Skip to main content
Transfers tokens to another Spark Address via the IssuerSparkWallet.

Method Signature

async function transferTokens({
  tokenIdentifier,
  tokenAmount,
  receiverSparkAddress,
  outputSelectionStrategy,
  selectedOutputs,
}: {
  tokenIdentifier: Bech32mTokenIdentifier;
  tokenAmount: bigint;
  receiverSparkAddress: string;
  outputSelectionStrategy?: "SMALL_FIRST" | "LARGE_FIRST";
  selectedOutputs?: OutputWithPreviousTransactionData[];
}): Promise<string>;

Parameters

tokenIdentifier
Bech32mTokenIdentifier
required
Bech32m token identifier (eg: btkn1…) of the token to transfer
tokenAmount
bigint
required
Amount of tokens to transfer
receiverSparkAddress
string
required
Recipient’s Spark Address
outputSelectionStrategy
string
Strategy for selecting outputs: "SMALL_FIRST" or "LARGE_FIRST" (defaults to "SMALL_FIRST")
selectedOutputs
OutputWithPreviousTransactionData[]
Specific outputs to use for transfer (overrides selection strategy)

Returns

txId
string
required
Transaction ID

Example

const txId = await issuerWallet.transferTokens({
  tokenIdentifier: "btkn1...",
  tokenAmount: 1000n,
  receiverSparkAddress: "spark1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx"
});

console.log("Tokens transferred:", txId);