Skip to main content
Transfers tokens to multiple recipients in a single transaction via the IssuerSparkWallet.

Method Signature

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

Parameters

receiverOutputs
{ tokenIdentifier: Bech32mTokenIdentifier; tokenAmount: bigint; receiverSparkAddress: string; }[]
required
Array of transfer outputs. Outputs may include multiple token identifiers:
  • tokenIdentifier: Bech32m token identifier (e.g., btkn1...)
  • tokenAmount: Amount of tokens to transfer (bigint)
  • receiverSparkAddress: Recipient’s Spark address
outputSelectionStrategy
"SMALL_FIRST" | "LARGE_FIRST"
Strategy for selecting outputs: "SMALL_FIRST" or "LARGE_FIRST" (default: "SMALL_FIRST")
selectedOutputs
OutputWithPreviousTransactionData[]
Specific outputs to use for transfer (overrides selection strategy)
executeBefore
Date
Optional deadline for the transaction. If the transaction is not executed before this time, it will not be processed.

Returns

txId
string
required
Transaction ID

Example

const txId = await issuerWallet.batchTransferTokens([
  { tokenIdentifier: "btkn1...", tokenAmount: 1000n, receiverSparkAddress: "spark1abc..." },
  { tokenIdentifier: "btkn1...", tokenAmount: 500n, receiverSparkAddress: "spark1def..." },
  { tokenIdentifier: "btkn1...", tokenAmount: 250n, receiverSparkAddress: "spark1ghi..." }
]);

console.log("Batch transfer completed:", txId);