From 05c08c1e76c38a0b98b1c7621827a410c8e00170 Mon Sep 17 00:00:00 2001 From: Samy RABAH-MONTAROU Date: Mon, 13 Jan 2025 20:34:22 +0100 Subject: [PATCH] listoperations return value --- .../src/common-logic/history/listOperations.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/coin-modules/coin-module-boilerplate/src/common-logic/history/listOperations.ts b/libs/coin-modules/coin-module-boilerplate/src/common-logic/history/listOperations.ts index 0ddd7bbf4a6..5cfd7b3ef98 100644 --- a/libs/coin-modules/coin-module-boilerplate/src/common-logic/history/listOperations.ts +++ b/libs/coin-modules/coin-module-boilerplate/src/common-logic/history/listOperations.ts @@ -5,15 +5,17 @@ import { getTransactions } from "../../network/indexer"; * Returns list of operations associated to an account. * @param address Account address * @param pagination Pagination options - * @returns + * @returns Operations found and the next "id" or "index" to use for pagination (i.e. `start` property).\ + * If `0` is returns, no pagination needed. + * This "id" or "index" value, thus it has functional meaning, is different for each blockchain. */ export async function listOperations( address: string, { limit, start }: Pagination, -): Promise { +): Promise<[Operation[], number]> { const transactions = await getTransactions(address, { from: start || 0, size: limit }); - return transactions.map(convertToCoreOperation(address)); + return [transactions.map(convertToCoreOperation(address)), transactions.length]; } const convertToCoreOperation = (address: string) => (operation: any) => {