Skip to main content
Send tokens to any Spark address. Transfers are instant, free, and recipients receive them automatically.
Transfer Tokens

Send Tokens

const [tokenIdentifier] = await wallet.getIssuerTokenIdentifiers();
if (!tokenIdentifier) throw new Error("No token identifiers found for this issuer");

await wallet.transferTokens({
  tokenIdentifier,
  tokenAmount: 100_000000n, // 100 tokens (6 decimals)
  receiverSparkAddress: "spark1abc..."
});

Batch Transfer

Send to multiple recipients in a single transaction:
await wallet.batchTransferTokens([
  { tokenIdentifier, tokenAmount: 1000_000000n, receiverSparkAddress: "spark1alice..." },
  { tokenIdentifier, tokenAmount: 500_000000n, receiverSparkAddress: "spark1bob..." },
  { tokenIdentifier, tokenAmount: 250_000000n, receiverSparkAddress: "spark1carol..." }
]);
Batch transfers are atomic. All succeed or none do. Each item in the array must include its own tokenIdentifier.

Token Amounts

All amounts are in base units. If your token has 6 decimals:
HumanBase Units
11,000,000
100100,000,000
0.5500,000
function toBaseUnits(amount: string, decimals: number): bigint {
  const [whole, fraction = ""] = amount.split(".");
  const fractionPadded = (fraction + "0".repeat(decimals)).slice(0, decimals);
  return BigInt(whole || "0") * 10n ** BigInt(decimals) + BigInt(fractionPadded || "0");
}

await wallet.transferTokens({
  tokenIdentifier,
  tokenAmount: toBaseUnits("50.5", 6),
  receiverSparkAddress: "spark1..."
});

Receiving Tokens

Recipients don’t need to do anything. Tokens appear instantly:
const { tokenBalances } = await wallet.getBalance();

tokenBalances.forEach((data, key) => {
  console.log(data.tokenMetadata.tokenName, ":", data.ownedBalance);
});