Retrieves token transactions from the network with flexible filtering options for the IssuerSparkWallet.
Method Signature
async function queryTokenTransactions({
sparkAddresses,
ownerPublicKeys,
issuerPublicKeys,
tokenTransactionHashes,
tokenIdentifiers,
outputIds,
order,
pageSize,
offset,
}: {
sparkAddresses?: string[];
ownerPublicKeys?: string[]; // deprecated, use sparkAddresses
issuerPublicKeys?: string[];
tokenTransactionHashes?: string[];
tokenIdentifiers?: string[];
outputIds?: string[];
order?: "asc" | "desc";
pageSize?: number;
offset?: number;
}): Promise<QueryTokenTransactionsResponse>;
Parameters
Filter Constraint: You can only specify one filter type per query. The parameters are mutually exclusive - use sparkAddresses OR ownerPublicKeys OR issuerPublicKeys OR tokenTransactionHashes OR tokenIdentifiers OR outputIds, but not multiple types together.
Array of Spark addresses to filter by (recommended)
Array of owner public keys to filter by (deprecated, use sparkAddresses)
Array of issuer public keys to filter by
Array of token transaction hashes to filter by
Array of Bech32m token identifiers to filter by
Array of output IDs to filter by
Sort order: "asc" or "desc" (defaults to "desc")
Number of results per page (defaults to 50)
Pagination offset (defaults to 0)
Returns
response
QueryTokenTransactionsResponse
required
Token transactions response object
Example
// Query all token transactions
const transactions = await issuerWallet.queryTokenTransactions({});
// Query transactions for specific tokens with pagination
const tokenTransactions = await issuerWallet.queryTokenTransactions({
tokenIdentifiers: ["btkn1..."],
order: "desc",
pageSize: 20,
offset: 0
});
// Query transactions for specific Spark addresses
const addressTransactions = await issuerWallet.queryTokenTransactions({
sparkAddresses: ["spark1..."]
});
// Query all transactions for your token
const allTransactions = await issuerWallet.queryTokenTransactions({
issuerPublicKeys: [await issuerWallet.getIdentityPublicKey()]
});
Getting the sender address: Token transaction outputs only show the recipient. To get the sender’s address for an incoming transfer, query the previous transaction using the prevTokenTransactionHash from the input’s OutputToSpend.