Skip to main content
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.
sparkAddresses
string[]
Array of Spark addresses to filter by
issuerPublicKeys
string[]
Array of issuer public keys to filter by
tokenIdentifiers
string[]
Array of Bech32m token identifiers to filter by
outputIds
string[]
Array of output IDs to filter by
pageSize
number
Page size (defaults to 50)
cursor
string
Cursor returned from a previous response (pageResponse.nextCursor or pageResponse.prevCursor)
direction
"NEXT" | "PREVIOUS"
Pagination direction (defaults to "NEXT")

Returns

response
QueryTokenTransactionsResponse
required
Token transactions response object
response.tokenTransactionsWithStatus
TokenTransactionWithStatus[]
required
Matching token transactions for the requested page
response.pageResponse
PageResponse
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);
}