Skip to content

Commit 87447b7

Browse files
authored
Merge pull request #205 from EdgeApp/paul/v3RatesAndFixes
Paul/v3 rates and fixes
2 parents ee764ce + 56378b8 commit 87447b7

44 files changed

Lines changed: 843 additions & 120 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
## Unreleased
44

5+
- changed: Add index for orderId
6+
- changed: Add EVM chainId, pluginId, and tokenId fields to StandardTx
7+
- changed: Update Lifi to provide chainId, pluginId, and tokenId
8+
- changed: Use rates V3 for transactions with pluginId/tokenId
9+
- fixed: Moonpay by adding Revolut payment type
10+
- fixed: Use v2 rates API
11+
12+
## 0.2.0
13+
514
- added: Add Lifi reporting
615
- added: Added `/v1/getTxInfo` route.
716
- added: Paybis support

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
"prepare": "./scripts/prepare.sh && npm-run-all clean configure -p build.* && npm run setup",
2121
"setup": "node -r sucrase/register src/initDbs.ts",
2222
"start": "node -r sucrase/register src/indexQuery.ts",
23-
"start:cache": "node -r sucrase/register src/indexCache.ts",
24-
"start:rates": "node -r sucrase/register src/indexRates.ts",
25-
"start:api": "node -r sucrase/register src/indexApi.ts",
26-
"start:destroyPartition": "node -r sucrase/register src/bin/destroyPartition.ts",
23+
"start.cache": "node -r sucrase/register src/indexCache.ts",
24+
"start.rates": "node -r sucrase/register src/indexRates.ts",
25+
"start.api": "node -r sucrase/register src/indexApi.ts",
26+
"start.destroyPartition": "node -r sucrase/register src/bin/destroyPartition.ts",
2727
"stats": "node -r sucrase/register src/bin/partitionStats.ts",
2828
"test": "mocha -r sucrase/register 'test/**/*.test.ts'",
2929
"demo": "parcel serve src/demo/index.html",

src/bin/destroyPartition.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ async function main(partitionName: string): Promise<void> {
5656
datelog(`Successfully Deleted: progress cache ${progress._id}`)
5757
} catch (e) {
5858
datelog(e)
59+
process.exit(1)
5960
}
61+
process.exit(0)
6062
}
6163

6264
main(process.argv[2]).catch(e => datelog(e))

src/config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export const asConfig = asObject({
1818
timeoutOverrideMins: asOptional(asNumber, 1200),
1919
cacheLookbackMonths: asOptional(asNumber, 24),
2020
couchMainCluster: asOptional(asString, 'wusa'),
21-
couchUris: asOptional(asCouchCredentials)
21+
couchUris: asOptional(asCouchCredentials, {
22+
wusa: 'http://username:password@localhost:5984'
23+
})
2224
})
2325

2426
export const config = makeConfig(asConfig, 'config.json')

src/demo/demo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class App extends Component<
6060

6161
async componentDidMount(): Promise<void> {
6262
Object.assign(document.body.style, body)
63-
if (this.state.apiKey !== '') {
63+
if (this.state.apiKey != null && this.state.apiKey.length > 2) {
6464
await this.getAppId()
6565
}
6666
}

src/initDbs.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function fieldsToDesignDocs(
3939

4040
const transactionIndexes: DesignDocumentMap = {
4141
...fieldsToDesignDocs(['isoDate']),
42+
...fieldsToDesignDocs(['orderId']),
4243
...fieldsToDesignDocs(['status']),
4344
...fieldsToDesignDocs(['status', 'depositCurrency', 'isoDate']),
4445
...fieldsToDesignDocs([
@@ -125,20 +126,14 @@ const options: SetupDatabaseOptions = {
125126
}
126127

127128
export async function initDbs(): Promise<void> {
128-
if (config.couchUris != null) {
129-
const pool = connectCouch(config.couchMainCluster, config.couchUris)
130-
await setupDatabase(pool, couchSettingsSetup, options)
131-
await Promise.all(
132-
databases.map(async setup => await setupDatabase(pool, setup, options))
133-
)
134-
} else {
135-
await Promise.all(
136-
databases.map(
137-
async setup =>
138-
await setupDatabase(config.couchDbFullpath, setup, options)
139-
)
140-
)
129+
if (config.couchUris == null) {
130+
throw new Error('couchUris is not set')
141131
}
132+
const pool = connectCouch(config.couchMainCluster, config.couchUris)
133+
await setupDatabase(pool, couchSettingsSetup, options)
134+
await Promise.all(
135+
databases.map(async setup => await setupDatabase(pool, setup, options))
136+
)
142137
console.log('Done')
143138
process.exit(0)
144139
}

src/partners/banxa.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,19 @@ export function processBanxaTx(rawTx: unknown): StandardTx {
276276
depositTxid: undefined,
277277
depositAddress: undefined,
278278
depositCurrency: inputCurrency,
279+
depositChainPluginId: undefined,
280+
depositEvmChainId: undefined,
281+
depositTokenId: undefined,
279282
depositAmount: inputAmount,
280283
direction,
281284
exchangeType: 'fiat',
282285
paymentType,
283286
payoutTxid: undefined,
284287
payoutAddress,
285288
payoutCurrency: outputCurrency,
289+
payoutChainPluginId: undefined,
290+
payoutEvmChainId: undefined,
291+
payoutTokenId: undefined,
286292
payoutAmount: outputAmount,
287293
timestamp,
288294
isoDate,
@@ -332,6 +338,8 @@ function getFiatPaymentType(tx: BanxaTx): FiatPaymentType {
332338
return 'googlepay'
333339
case 'iDEAL Transfer':
334340
return 'ideal'
341+
case 'ZeroHash ACH Sell':
342+
return 'ach'
335343
default:
336344
throw new Error(`Unknown payment method: ${tx.payment_type} for ${tx.id}`)
337345
}

src/partners/bitaccess.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,19 @@ export function processBitaccessTx(rawTx: unknown): StandardTx {
145145
depositTxid,
146146
depositAddress: tx.deposit_address,
147147
depositCurrency: tx.deposit_currency.toUpperCase(),
148+
depositChainPluginId: undefined,
149+
depositEvmChainId: undefined,
150+
depositTokenId: undefined,
148151
depositAmount: tx.deposit_amount,
149152
direction: tx.trade_type,
150153
exchangeType: 'fiat',
151154
paymentType: 'cash',
152155
payoutTxid,
153156
payoutAddress: tx.withdrawal_address,
154157
payoutCurrency: tx.withdrawal_currency.toUpperCase(),
158+
payoutChainPluginId: undefined,
159+
payoutEvmChainId: undefined,
160+
payoutTokenId: undefined,
155161
payoutAmount: tx.withdrawal_amount,
156162
timestamp,
157163
isoDate: tx.updated_at,

src/partners/bitrefill.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,19 @@ export function processBitrefillTx(rawTx: unknown): StandardTx {
151151
depositTxid: undefined,
152152
depositAddress: undefined,
153153
depositCurrency: inputCurrency,
154+
depositChainPluginId: undefined,
155+
depositEvmChainId: undefined,
156+
depositTokenId: undefined,
154157
depositAmount,
155158
direction: 'sell',
156159
exchangeType: 'fiat',
157160
paymentType: 'giftcard',
158161
payoutTxid: undefined,
159162
payoutAddress: undefined,
160163
payoutCurrency: tx.currency,
164+
payoutChainPluginId: undefined,
165+
payoutEvmChainId: undefined,
166+
payoutTokenId: undefined,
161167
payoutAmount: parseInt(tx.value),
162168
timestamp,
163169
isoDate: new Date(tx.invoiceTime).toISOString(),

src/partners/bitsofgold.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,19 @@ export function processBitsOfGoldTx(rawTx: unknown): StandardTx {
127127
depositTxid: undefined,
128128
depositAddress: undefined,
129129
depositCurrency,
130+
depositChainPluginId: undefined,
131+
depositEvmChainId: undefined,
132+
depositTokenId: undefined,
130133
depositAmount,
131134
direction,
132135
exchangeType: 'fiat',
133136
paymentType: data.fiat_type === 'ILS' ? 'israelibank' : 'sepa',
134137
payoutTxid: undefined,
135138
payoutAddress: undefined,
136139
payoutCurrency,
140+
payoutChainPluginId: undefined,
141+
payoutEvmChainId: undefined,
142+
payoutTokenId: undefined,
137143
payoutAmount,
138144
timestamp: timestamp / 1000,
139145
isoDate: date.toISOString(),

0 commit comments

Comments
 (0)