Skip to content

Commit 2dd52bc

Browse files
committed
Address second cursor bot review pass
- revolut: percent-encode the pagination cursor so an opaque next_cursor containing + or / does not break paging after the first page (Medium). - nexchange: treat a zero contract address (0x000...0) as the chain's native asset instead of minting a tokenId for the gas asset, which would mis-route its rates and volume (Medium, matches Banxa/Moonpay).
1 parent 7cd6768 commit 2dd52bc

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/partners/nexchange.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,16 @@ export function resolveNexchangeAsset(
267267
const evmChainId = EVM_CHAIN_IDS[chainPluginId]
268268
const contractAddress = meta.contract_address
269269

270-
// No contract_address means a native chain asset.
271-
if (contractAddress == null || contractAddress === '') {
270+
// A missing/empty contract_address, or a zero address (0x000…0), denotes the
271+
// chain's native/gas asset, not a token. The zero-address case matters
272+
// because createTokenId would otherwise mint a non-null tokenId for the gas
273+
// asset and mis-route its rates/volume (Banxa and Moonpay special-case this
274+
// the same way).
275+
if (
276+
contractAddress == null ||
277+
contractAddress === '' ||
278+
/^0x0+$/i.test(contractAddress)
279+
) {
272280
return {
273281
currencyCode: normalizedCode,
274282
chainPluginId,

src/partners/revolut.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ export async function queryRevolut(
9595
const to = new Date(endTime).toISOString()
9696

9797
let url = `https://api.revolut.com/partner/v1/transactions?from=${from}&to=${to}&limit=${QUERY_LIMIT}`
98-
if (cursor != null) url += `&cursor=${cursor}`
98+
// Opaque cursors can contain + or /, which must be percent-encoded or
99+
// pagination breaks after the first page (an unencoded + becomes a
100+
// space), silently dropping later orders in the window.
101+
if (cursor != null) url += `&cursor=${encodeURIComponent(cursor)}`
99102

100103
log(`Querying Revolut from:${from} to:${to}`)
101104

0 commit comments

Comments
 (0)