diff --git a/libs/coin-modules/coin-xrp/src/api/index.ts b/libs/coin-modules/coin-xrp/src/api/index.ts index a00568ce2fcc..4664d56c0b79 100644 --- a/libs/coin-modules/coin-xrp/src/api/index.ts +++ b/libs/coin-modules/coin-xrp/src/api/index.ts @@ -45,7 +45,7 @@ async function operations( address: string, { limit, start }: Pagination, ): Promise<[Operation[], number]> { - const [ops, index] = await listOperations(address, { limit, mostRecentIndex: start }); + const [ops, index] = await listOperations(address, { limit, startAt: start ?? 0 }); return [ ops.map(op => { const { simpleType, blockHash, blockTime, ...rest } = op; diff --git a/libs/coin-modules/coin-xrp/src/logic/listOperations.ts b/libs/coin-modules/coin-xrp/src/logic/listOperations.ts index 2ff666b6bd96..79b8537ca73b 100644 --- a/libs/coin-modules/coin-xrp/src/logic/listOperations.ts +++ b/libs/coin-modules/coin-xrp/src/logic/listOperations.ts @@ -39,7 +39,7 @@ export async function listOperations( options = { ...options, // if there is no ops, it might be after a clear and we prefer to pull from the oldest possible history - ledger_index_min: Math.max(startAt ?? 0, minLedgerVersion), + ledger_index_min: Math.max(startAt, minLedgerVersion), }; } @@ -47,7 +47,6 @@ export async function listOperations( return [ transactions - .filter(op => op.tx_json.TransactionType === "Payment") .map(convertToCoreOperation(address)), transactions.slice(-1)[0].tx_json.ledger_index - 1, // Returns the next index to start from for pagination ]; diff --git a/libs/coin-modules/coin-xrp/src/network/index.ts b/libs/coin-modules/coin-xrp/src/network/index.ts index a00fe481bb2e..3184d1205c1c 100644 --- a/libs/coin-modules/coin-xrp/src/network/index.ts +++ b/libs/coin-modules/coin-xrp/src/network/index.ts @@ -68,13 +68,13 @@ export const getServerInfos = async (): Promise => { export const getTransactions = async ( address: string, - options: { ledger_index_min?: number; ledger_index_max?: number; limit?: number} | undefined, + options: { ledger_index_min?: number; ledger_index_max?: number; limit?: number } | undefined, ): Promise => { const result = await rpcCall("account_tx", { account: address, - ledger_index: "validated", ...options, api_version: 2, + tx_type: "Payment", }); return result.transactions; @@ -110,7 +110,7 @@ async function rpcCall( }); if (isResponseStatus(result) && result.status !== "success") { - throw new Error(`couldn't fetch ${method} with params ${params}`); + throw new Error(`couldn't fetch ${method} with params ${JSON.stringify(params)}`); } return result;