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

Method Signature

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

Parameters

receiverOutputs
array
required
Array of transfer outputs, each containing:
  • tokenIdentifier: Bech32m token identifier (all must be the same token)
  • tokenAmount: Amount of tokens to send
  • receiverSparkAddress: Recipient’s Spark address
outputSelectionStrategy
string
Strategy for selecting outputs: "SMALL_FIRST" or "LARGE_FIRST" (default: "SMALL_FIRST")
selectedOutputs
OutputWithPreviousTransactionData[]
Specific outputs to use (overrides selection strategy)

Returns

txId
string
required
The transaction ID of the batch token transfer

Example

const txId = await wallet.batchTransferTokens([
  {
    tokenIdentifier: "btkn1...",
    tokenAmount: 500n,
    receiverSparkAddress: "spark1abc..."
  },
  {
    tokenIdentifier: "btkn1...",
    tokenAmount: 300n,
    receiverSparkAddress: "spark1def..."
  }
]);
console.log("Batch transfer completed:", txId);