Skip to content

Commit

Permalink
listoperations return value
Browse files Browse the repository at this point in the history
  • Loading branch information
Wozacosta committed Jan 14, 2025
1 parent 60c7c24 commit 05c08c1
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Operation[]> {
): 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) => {
Expand Down

0 comments on commit 05c08c1

Please sign in to comment.