Queries token transactions with filters and cursor-based pagination for the SparkWallet.
Method Signature
async queryTokenTransactionsWithFilters({
sparkAddresses,
issuerPublicKeys,
tokenIdentifiers,
outputIds,
pageSize,
cursor,
direction,
}: {
sparkAddresses?: string[];
issuerPublicKeys?: string[];
tokenIdentifiers?: string[];
outputIds?: string[];
pageSize?: number;
cursor?: string;
direction?: "NEXT" | "PREVIOUS";
}): Promise<QueryTokenTransactionsResponse>
Parameters
Request constraints are combined using an AND relation by the underlying API.
Array of Spark addresses to filter by
Array of issuer public keys to filter by
Array of Bech32m token identifiers to filter by
Array of output IDs to filter by
Page size (defaults to 50)
Cursor returned from a previous response (pageResponse.nextCursor or pageResponse.prevCursor)
Pagination direction (defaults to "NEXT")
Returns
response
QueryTokenTransactionsResponse
required
Token transactions response object
response.tokenTransactionsWithStatus
TokenTransactionWithStatus[]
required
Matching token transactions for the requested page
Pagination metadata including nextCursor / prevCursor
Example
const firstPage = await wallet.queryTokenTransactionsWithFilters({
tokenIdentifiers: ["btkn1..."],
pageSize: 25,
direction: "NEXT",
});
const nextCursor = firstPage.pageResponse?.nextCursor;
if (nextCursor) {
const secondPage = await wallet.queryTokenTransactionsWithFilters({
tokenIdentifiers: ["btkn1..."],
pageSize: 25,
cursor: nextCursor,
direction: "NEXT",
});
console.log(secondPage.tokenTransactionsWithStatus.length);
}