Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e40dcd5
Fix hang due to undefined apiKey
paullinator Jul 18, 2025
c0091ec
Require couchUris
paullinator Aug 13, 2025
69d3c1f
Fix moonpay
paullinator Aug 13, 2025
35424a3
Use v2 rates api
paullinator Oct 26, 2025
196c1b2
Add index for orderId
paullinator Oct 26, 2025
486e8be
Rename yarn scripts to use '.'
paullinator Nov 10, 2025
ac0d516
Properly exit destroyPartition
paullinator Nov 10, 2025
f756b6b
Add chainId, pluginId, and tokenId fields to StandardTx
paullinator Nov 10, 2025
30376ee
Update lifi to provide chainId, pluginId, and tokenId
paullinator Nov 10, 2025
7a26fb0
Use ratex v3 if transactions has full pluginId/tokenId values
paullinator Nov 20, 2025
1932ac3
Fix banxa by adding ACH payment type
paullinator Nov 20, 2025
727de29
future! paul/v3RatesAndFixes
paullinator Dec 19, 2025
efc0c87
Refactor to use common processTx
paullinator Dec 6, 2025
035a9ff
Include all moonpay txs
paullinator Dec 6, 2025
5aea3a8
Add EdgeAsset info for moonpay
paullinator Dec 7, 2025
405a15c
Add EdgeAsset info for thorchain/maya
paullinator Dec 7, 2025
dc4b881
Add EdgeAsset info for changenow
paullinator Dec 7, 2025
5d9c707
Add EdgeAsset info for sideshift
paullinator Dec 9, 2025
e024ee5
Add EdgeAsset info for banxa
paullinator Dec 11, 2025
bd73fde
Add EdgeAsset info for godex
paullinator Dec 12, 2025
1f23973
Add EdgeAsset info for changehero
paullinator Dec 12, 2025
34be25d
Improve v3 rates logging
paullinator Dec 12, 2025
111da07
Check pluginId/tokenId for updating transactions
paullinator Dec 12, 2025
1fd2553
Fix ratesEngine bug
paullinator Dec 12, 2025
bb53298
Add EdgeAsset info for letsexchange
paullinator Dec 12, 2025
6e9e800
Add indices for pluginId/tokenId fields
paullinator Dec 12, 2025
81b8d9c
Add EdgeAsset info for exolix
paullinator Dec 13, 2025
1b5bee6
Add disablePartnerQuery feature
paullinator Dec 13, 2025
057fbda
Use scoped logging
paullinator Dec 14, 2025
f6b8146
Fix rates server bookmarking
paullinator Dec 15, 2025
522bf0c
Optimize rates engine
paullinator Dec 15, 2025
ddfaa68
For a partner to run with soloPartnerId even if disabled in couch
paullinator Dec 18, 2025
2281e89
Use semaphores for queryEngine
paullinator Dec 25, 2025
913a852
Add EdgeAsset info for bitrefill
paullinator Dec 27, 2025
2f72472
Add rango query plugin
paullinator Dec 28, 2025
764365b
Add max new transactions for letsexchange
paullinator Dec 24, 2025
3c59068
fixup! Add EdgeAsset info for moonpay
samholmes Jan 7, 2026
c81d6fb
Fix issue with testData.json
samholmes Jan 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## Unreleased

- changed: Add index for orderId
- changed: Add EVM chainId, pluginId, and tokenId fields to StandardTx
- changed: Update Lifi to provide chainId, pluginId, and tokenId
- changed: Use rates V3 for transactions with pluginId/tokenId
- fixed: Moonpay by adding Revolut payment type
- fixed: Use v2 rates API

## 0.2.0

- added: Add Lifi reporting
- added: Added `/v1/getTxInfo` route.
- added: Paybis support
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"prepare": "./scripts/prepare.sh && npm-run-all clean configure -p build.* && npm run setup",
"setup": "node -r sucrase/register src/initDbs.ts",
"start": "node -r sucrase/register src/indexQuery.ts",
"start:cache": "node -r sucrase/register src/indexCache.ts",
"start:rates": "node -r sucrase/register src/indexRates.ts",
"start:api": "node -r sucrase/register src/indexApi.ts",
"start:destroyPartition": "node -r sucrase/register src/bin/destroyPartition.ts",
"start.cache": "node -r sucrase/register src/indexCache.ts",
"start.rates": "node -r sucrase/register src/indexRates.ts",
"start.api": "node -r sucrase/register src/indexApi.ts",
"start.destroyPartition": "node -r sucrase/register src/bin/destroyPartition.ts",
"stats": "node -r sucrase/register src/bin/partitionStats.ts",
"test": "mocha -r sucrase/register 'test/**/*.test.ts'",
"demo": "parcel serve src/demo/index.html",
Expand Down
2 changes: 2 additions & 0 deletions src/bin/destroyPartition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ async function main(partitionName: string): Promise<void> {
datelog(`Successfully Deleted: progress cache ${progress._id}`)
} catch (e) {
datelog(e)
process.exit(1)
}
process.exit(0)
}

main(process.argv[2]).catch(e => datelog(e))
2 changes: 1 addition & 1 deletion src/demo/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class App extends Component<

async componentDidMount(): Promise<void> {
Object.assign(document.body.style, body)
if (this.state.apiKey !== '') {
if (this.state.apiKey != null && this.state.apiKey.length > 2) {
await this.getAppId()
}
}
Expand Down
21 changes: 8 additions & 13 deletions src/initDbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function fieldsToDesignDocs(

const transactionIndexes: DesignDocumentMap = {
...fieldsToDesignDocs(['isoDate']),
...fieldsToDesignDocs(['orderId']),
...fieldsToDesignDocs(['status']),
...fieldsToDesignDocs(['status', 'depositCurrency', 'isoDate']),
...fieldsToDesignDocs([
Expand Down Expand Up @@ -125,20 +126,14 @@ const options: SetupDatabaseOptions = {
}

export async function initDbs(): Promise<void> {
if (config.couchUris != null) {
const pool = connectCouch(config.couchMainCluster, config.couchUris)
await setupDatabase(pool, couchSettingsSetup, options)
await Promise.all(
databases.map(async setup => await setupDatabase(pool, setup, options))
)
} else {
await Promise.all(
databases.map(
async setup =>
await setupDatabase(config.couchDbFullpath, setup, options)
)
)
if (config.couchUris == null) {
throw new Error('couchUris is not set')
}
const pool = connectCouch(config.couchMainCluster, config.couchUris)
await setupDatabase(pool, couchSettingsSetup, options)
await Promise.all(
databases.map(async setup => await setupDatabase(pool, setup, options))
)
console.log('Done')
process.exit(0)
}
Expand Down
8 changes: 8 additions & 0 deletions src/partners/banxa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,19 @@ export function processBanxaTx(rawTx: unknown): StandardTx {
depositTxid: undefined,
depositAddress: undefined,
depositCurrency: inputCurrency,
depositChainPluginId: undefined,
depositEvmChainId: undefined,
depositTokenId: undefined,
depositAmount: inputAmount,
direction,
exchangeType: 'fiat',
paymentType,
payoutTxid: undefined,
payoutAddress,
payoutCurrency: outputCurrency,
payoutChainPluginId: undefined,
payoutEvmChainId: undefined,
payoutTokenId: undefined,
payoutAmount: outputAmount,
timestamp,
isoDate,
Expand Down Expand Up @@ -332,6 +338,8 @@ function getFiatPaymentType(tx: BanxaTx): FiatPaymentType {
return 'googlepay'
case 'iDEAL Transfer':
return 'ideal'
case 'ZeroHash ACH Sell':
return 'ach'
default:
throw new Error(`Unknown payment method: ${tx.payment_type} for ${tx.id}`)
}
Expand Down
6 changes: 6 additions & 0 deletions src/partners/bitaccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,19 @@ export function processBitaccessTx(rawTx: unknown): StandardTx {
depositTxid,
depositAddress: tx.deposit_address,
depositCurrency: tx.deposit_currency.toUpperCase(),
depositChainPluginId: undefined,
depositEvmChainId: undefined,
depositTokenId: undefined,
depositAmount: tx.deposit_amount,
direction: tx.trade_type,
exchangeType: 'fiat',
paymentType: 'cash',
payoutTxid,
payoutAddress: tx.withdrawal_address,
payoutCurrency: tx.withdrawal_currency.toUpperCase(),
payoutChainPluginId: undefined,
payoutEvmChainId: undefined,
payoutTokenId: undefined,
payoutAmount: tx.withdrawal_amount,
timestamp,
isoDate: tx.updated_at,
Expand Down
6 changes: 6 additions & 0 deletions src/partners/bitrefill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,19 @@ export function processBitrefillTx(rawTx: unknown): StandardTx {
depositTxid: undefined,
depositAddress: undefined,
depositCurrency: inputCurrency,
depositChainPluginId: undefined,
depositEvmChainId: undefined,
depositTokenId: undefined,
depositAmount,
direction: 'sell',
exchangeType: 'fiat',
paymentType: 'giftcard',
payoutTxid: undefined,
payoutAddress: undefined,
payoutCurrency: tx.currency,
payoutChainPluginId: undefined,
payoutEvmChainId: undefined,
payoutTokenId: undefined,
payoutAmount: parseInt(tx.value),
timestamp,
isoDate: new Date(tx.invoiceTime).toISOString(),
Expand Down
6 changes: 6 additions & 0 deletions src/partners/bitsofgold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,19 @@ export function processBitsOfGoldTx(rawTx: unknown): StandardTx {
depositTxid: undefined,
depositAddress: undefined,
depositCurrency,
depositChainPluginId: undefined,
depositEvmChainId: undefined,
depositTokenId: undefined,
depositAmount,
direction,
exchangeType: 'fiat',
paymentType: data.fiat_type === 'ILS' ? 'israelibank' : 'sepa',
payoutTxid: undefined,
payoutAddress: undefined,
payoutCurrency,
payoutChainPluginId: undefined,
payoutEvmChainId: undefined,
payoutTokenId: undefined,
payoutAmount,
timestamp: timestamp / 1000,
isoDate: date.toISOString(),
Expand Down
6 changes: 6 additions & 0 deletions src/partners/bity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,19 @@ export function processBityTx(rawTx: unknown): StandardTx {
depositTxid: undefined,
depositAddress: undefined,
depositCurrency: tx.input.currency.toUpperCase(),
depositChainPluginId: undefined,
depositEvmChainId: undefined,
depositTokenId: undefined,
depositAmount: safeParseFloat(tx.input.amount),
direction,
exchangeType: 'fiat',
paymentType: 'sepa',
payoutTxid: undefined,
payoutAddress: undefined,
payoutCurrency: tx.output.currency.toUpperCase(),
payoutChainPluginId: undefined,
payoutEvmChainId: undefined,
payoutTokenId: undefined,
payoutAmount: safeParseFloat(tx.output.amount),
timestamp: Date.parse(tx.timestamp_created.concat('Z')) / 1000,
isoDate: new Date(tx.timestamp_created.concat('Z')).toISOString(),
Expand Down
6 changes: 6 additions & 0 deletions src/partners/changehero.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,19 @@ export function processChangeHeroTx(rawTx: unknown): StandardTx {
depositTxid: tx.payinHash,
depositAddress: tx.payinAddress,
depositCurrency: tx.currencyFrom.toUpperCase(),
depositChainPluginId: undefined,
depositEvmChainId: undefined,
depositTokenId: undefined,
depositAmount: safeParseFloat(tx.amountFrom),
direction: null,
exchangeType: 'swap',
paymentType: null,
payoutTxid: tx.payoutHash,
payoutAddress: tx.payoutAddress,
payoutCurrency: tx.currencyTo.toUpperCase(),
payoutChainPluginId: undefined,
payoutEvmChainId: undefined,
payoutTokenId: undefined,
payoutAmount: safeParseFloat(tx.amountTo),
timestamp: tx.createdAt,
isoDate: smartIsoDateFromTimestamp(tx.createdAt).isoDate,
Expand Down
6 changes: 6 additions & 0 deletions src/partners/changelly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,19 @@ export function processChangellyTx(rawTx: unknown): StandardTx {
depositTxid: tx.payinHash,
depositAddress: tx.payinAddress,
depositCurrency: tx.currencyFrom.toUpperCase(),
depositChainPluginId: undefined,
depositEvmChainId: undefined,
depositTokenId: undefined,
depositAmount: safeParseFloat(tx.amountFrom),
direction: null,
exchangeType: 'swap',
paymentType: null,
payoutTxid: tx.payoutHash,
payoutAddress: tx.payoutAddress,
payoutCurrency: tx.currencyTo.toUpperCase(),
payoutChainPluginId: undefined,
payoutEvmChainId: undefined,
payoutTokenId: undefined,
payoutAmount: safeParseFloat(tx.amountTo),
timestamp: tx.createdAt,
isoDate: new Date(tx.createdAt * 1000).toISOString(),
Expand Down
6 changes: 6 additions & 0 deletions src/partners/changenow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,19 @@ export function processChangeNowTx(rawTx: unknown): StandardTx {
depositTxid: tx.payin.hash,
depositAddress: tx.payin.address,
depositCurrency: tx.payin.currency.toUpperCase(),
depositChainPluginId: undefined,
depositEvmChainId: undefined,
depositTokenId: undefined,
depositAmount: tx.payin.amount ?? tx.payin.expectedAmount ?? 0,
direction: null,
exchangeType: 'swap',
paymentType: null,
payoutTxid: tx.payout.hash,
payoutAddress: tx.payout.address,
payoutCurrency: tx.payout.currency.toUpperCase(),
payoutChainPluginId: undefined,
payoutEvmChainId: undefined,
payoutTokenId: undefined,
payoutAmount: tx.payout.amount ?? tx.payout.expectedAmount ?? 0,
timestamp,
isoDate: date.toISOString(),
Expand Down
6 changes: 6 additions & 0 deletions src/partners/coinswitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,19 @@ export function processCoinSwitchTx(rawTx: unknown): StandardTx {
depositTxid,
depositAddress: tx.exchangeAddress.address,
depositCurrency: tx.depositCoin.toUpperCase(),
depositChainPluginId: undefined,
depositEvmChainId: undefined,
depositTokenId: undefined,
depositAmount: tx.depositCoinAmount,
direction: null,
exchangeType: 'swap',
paymentType: null,
payoutTxid,
payoutAddress: tx.destinationAddress.address,
payoutCurrency: tx.destinationCoin.toUpperCase(),
payoutChainPluginId: undefined,
payoutEvmChainId: undefined,
payoutTokenId: undefined,
payoutAmount: tx.destinationCoinAmount,
timestamp: tx.createdAt / 1000,
isoDate: new Date(tx.createdAt).toISOString(),
Expand Down
6 changes: 6 additions & 0 deletions src/partners/exolix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,19 @@ export function processExolixTx(rawTx: unknown): StandardTx {
depositTxid: tx.hashIn?.hash ?? '',
depositAddress: tx.depositAddress,
depositCurrency: tx.coinFrom.coinCode,
depositChainPluginId: undefined,
depositEvmChainId: undefined,
depositTokenId: undefined,
depositAmount: tx.amount,
direction: null,
exchangeType: 'swap',
paymentType: null,
payoutTxid: tx.hashOut?.hash ?? '',
payoutAddress: tx.withdrawalAddress,
payoutCurrency: tx.coinTo.coinCode,
payoutChainPluginId: undefined,
payoutEvmChainId: undefined,
payoutTokenId: undefined,
payoutAmount: tx.amountTo,
timestamp,
isoDate,
Expand Down
6 changes: 6 additions & 0 deletions src/partners/faast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,19 @@ export function processFaastTx(rawTx: unknown): StandardTx {
depositTxid: undefined,
depositAddress: tx.deposit_address,
depositCurrency: tx.deposit_currency.toUpperCase(),
depositChainPluginId: undefined,
depositEvmChainId: undefined,
depositTokenId: undefined,
depositAmount: tx.amount_deposited,
direction: null,
exchangeType: 'swap',
paymentType: null,
payoutTxid: tx.transaction_id,
payoutAddress: tx.withdrawal_address,
payoutCurrency: tx.withdrawal_currency.toUpperCase(),
payoutChainPluginId: undefined,
payoutEvmChainId: undefined,
payoutTokenId: undefined,
payoutAmount: tx.amount_withdrawn,
timestamp,
isoDate: tx.created_at,
Expand Down
6 changes: 6 additions & 0 deletions src/partners/foxExchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,19 @@ export function processFoxExchangeTx(rawTx: unknown): StandardTx {
depositTxid: undefined,
depositAddress: tx.exchangeAddress.address,
depositCurrency: tx.depositCoin.toUpperCase(),
depositChainPluginId: undefined,
depositEvmChainId: undefined,
depositTokenId: undefined,
depositAmount: tx.depositCoinAmount,
direction: null,
exchangeType: 'swap',
paymentType: null,
payoutTxid: tx.outputTransactionHash,
payoutAddress: tx.destinationAddress.address,
payoutCurrency: tx.destinationCoin.toUpperCase(),
payoutChainPluginId: undefined,
payoutEvmChainId: undefined,
payoutTokenId: undefined,
payoutAmount: tx.destinationCoinAmount,
timestamp: tx.createdAt / 1000,
isoDate: new Date(tx.createdAt).toISOString(),
Expand Down
6 changes: 6 additions & 0 deletions src/partners/godex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,19 @@ export function processGodexTx(rawTx: unknown): StandardTx {
depositTxid: tx.hash_in,
depositAddress: tx.deposit,
depositCurrency: tx.coin_from.toUpperCase(),
depositChainPluginId: undefined,
depositEvmChainId: undefined,
depositTokenId: undefined,
depositAmount: safeParseFloat(tx.deposit_amount),
direction: null,
exchangeType: 'swap',
paymentType: null,
payoutTxid: undefined,
payoutAddress: tx.withdrawal,
payoutCurrency: tx.coin_to.toUpperCase(),
payoutChainPluginId: undefined,
payoutEvmChainId: undefined,
payoutTokenId: undefined,
payoutAmount: safeParseFloat(tx.withdrawal_amount),
timestamp,
isoDate,
Expand Down
6 changes: 6 additions & 0 deletions src/partners/ioniagiftcard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,19 @@ export function processIoniaGiftCardsTx(rawTx: unknown): StandardTx {
depositTxid: undefined,
depositAddress: undefined,
depositCurrency: 'USD',
depositChainPluginId: undefined,
depositEvmChainId: undefined,
depositTokenId: undefined,
depositAmount: tx.USDPaidByCustomer,
direction: 'sell',
exchangeType: 'fiat',
paymentType: 'giftcard',
payoutTxid: undefined,
payoutAddress: undefined,
payoutCurrency: 'USD',
payoutChainPluginId: undefined,
payoutEvmChainId: undefined,
payoutTokenId: undefined,
payoutAmount: tx.GiftCardFaceValue,
timestamp,
isoDate,
Expand Down
6 changes: 6 additions & 0 deletions src/partners/ioniavisarewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,19 @@ export function processIoniaVisaRewardsTx(rawTx: unknown): StandardTx {
depositTxid: undefined,
depositAddress: undefined,
depositCurrency: 'USD',
depositChainPluginId: undefined,
depositEvmChainId: undefined,
depositTokenId: undefined,
depositAmount: tx.USDPaidByCustomer,
direction: 'sell',
exchangeType: 'fiat',
paymentType: null,
payoutTxid: undefined,
payoutAddress: undefined,
payoutCurrency: 'USD',
payoutChainPluginId: undefined,
payoutEvmChainId: undefined,
payoutTokenId: undefined,
payoutAmount: tx.GiftCardFaceValue,
timestamp,
isoDate,
Expand Down
Loading