Skip to main content
Methods for managing and interacting with tokens on the Spark network.

transferTokens(params)

Transfers tokens to another user.
async transferTokens({
  tokenIdentifier,
  tokenAmount,
  receiverSparkAddress,
  selectedOutputs,
}: {
  tokenIdentifier: string;
  tokenAmount: bigint;
  receiverSparkAddress: string;
  selectedOutputs?: OutputWithPreviousTransactionData[];
}): Promise<string>
Parameters:
  • params: Object containing:
    • tokenIdentifier: The Bech32m token identifier (eg: btkn1…) of the token to transfer
    • tokenAmount: The amount of tokens to transfer
    • receiverSparkAddress: The recipient’s Spark Address
    • selectedOutputs: (Optional) Specific outputs to use for the transfer
Returns:
  • Promise<string>: The transaction ID of the token transfer

getTokenInfo()

Gets information about tokens owned by the wallet.
async getTokenInfo(): Promise<TokenInfo[]>
Returns:
  • Promise<TokenInfo[]>: Array of token information objects

queryTokenTransactions()

Retrieves token transaction from the network. Can optionally filter by ownerPublicKeys, issuerPublicKeys, tokenTransactionHashes, tokenIdentifiers, or outputIds.
Note: This is archived documentation. In current versions, you can only use one filter type per query - the parameters are mutually exclusive.
async queryTokenTransactions({
  ownerPublicKeys,
  issuerPublicKeys,
  tokenTransactionHashes,
  tokenIdentifiers,
  outputIds,
}: {
  ownerPublicKeys?: string[];
  issuerPublicKeys?: string[];
  tokenTransactionHashes?: string[];
  tokenIdentifiers?: string[];
  outputIds?: string[];
}): Promise<TokenTransactionWithStatus[]>
Parameters:
  • ownerPublicKeys: (Optional) Array of owner public keys to filter by
  • issuerPublicKeys: (Optional) Array of issuer public keys to filter by
  • tokenTransactionHashes: (Optional) Array of token transaction hashes to filter by
  • tokenIdentifiers: (Optional) Array of Bech32m token identifiers to filter by
  • outputIds: (Optional) Array of output IDs to filter by
Returns:
  • Promise<TokenTransactionWithStatus[]>: Array of token transactions with status

getTokenL1Address()

Gets the Layer 1 Bitcoin address for token operations.
async getTokenL1Address(): Promise<string>
Returns:
  • Promise<string>: The Layer 1 Bitcoin address