Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 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
0ade0d0
fixup! Require couchUris
paullinator Jan 26, 2026
cf1f99a
Fix moonpay
paullinator Aug 13, 2025
d34cf0d
Use v2 rates api
paullinator Oct 26, 2025
8422f1c
Add index for orderId
paullinator Oct 26, 2025
5befdec
Rename yarn scripts to use '.'
paullinator Nov 10, 2025
2ae6594
Properly exit destroyPartition
paullinator Nov 10, 2025
dc2a912
Add chainId, pluginId, and tokenId fields to StandardTx
paullinator Nov 10, 2025
a1fd398
Update lifi to provide chainId, pluginId, and tokenId
paullinator Nov 10, 2025
3b85371
fixup! Update lifi to provide chainId, pluginId, and tokenId
paullinator Jan 26, 2026
4438280
fixup! Update lifi to provide chainId, pluginId, and tokenId
paullinator Jan 26, 2026
a996d9e
fixup! fixup! Update lifi to provide chainId, pluginId, and tokenId
paullinator Feb 27, 2026
a6aa1b3
fixup! fixup! fixup! Update lifi to provide chainId, pluginId, and to…
paullinator Feb 27, 2026
f2105a4
Use ratex v3 if transactions has full pluginId/tokenId values
paullinator Nov 20, 2025
4f95ce1
fixup! Use ratex v3 if transactions has full pluginId/tokenId values
paullinator Jan 26, 2026
7239a9b
fixup! fixup! Use ratex v3 if transactions has full pluginId/tokenId …
paullinator Feb 27, 2026
53ac34d
fixup! Use ratex v3 if transactions has full pluginId/tokenId values
paullinator Jan 26, 2026
e388dab
fixup! fixup! Use ratex v3 if transactions has full pluginId/tokenId …
paullinator Feb 27, 2026
08f671c
Fix banxa by adding ACH payment type
paullinator Nov 20, 2025
f7d8800
Fix promiseTimeout to cleanup setTimeout
paullinator Jan 26, 2026
2eb5444
Add HyperEVM EVM chain ID mapping
cursoragent Feb 27, 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",
Comment on lines +23 to +26
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional

I'd argue to keep the colon over the dot as a separator just because colon has become the de facto standard. Not worth being different from the rest of codebases here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But they are such a pain to type.

"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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why this was hanging is because of we don't cleanup the setTimeout in promiseTimeout util. This should be fixed as a separate commit.

}

main(process.argv[2]).catch(e => datelog(e))
4 changes: 3 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export const asConfig = asObject({
timeoutOverrideMins: asOptional(asNumber, 1200),
cacheLookbackMonths: asOptional(asNumber, 24),
couchMainCluster: asOptional(asString, 'wusa'),
couchUris: asOptional(asCouchCredentials)
couchUris: asOptional(asCouchCredentials, {
wusa: 'http://username:password@localhost:5984'
})
})

export const config = makeConfig(asConfig, 'config.json')
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
Loading
Loading