Skip to main content

Method Signature

align.blockchain.transactions.sendToken(
  wallet: Wallet,
  token: Token,
  to: string,
  amount: string,
  network: Network
): Promise<Transaction>

Parameters

wallet
Wallet
required
The sender’s wallet
token
Token
required
Token identifier: "usdc", "usdt", "dai", etc.
to
string
required
Recipient address
amount
string
required
Amount in human-readable format (e.g., "100.0")
network
string
required
Network where the token exists

Examples

import Align from "@tolbel/align";

const align = new Align({
  apiKey: process.env.ALIGN_API_KEY!,
  environment: "sandbox",
});

const wallet = await align.blockchain.wallets.createFromPrivateKey(
  process.env.PRIVATE_KEY!
);

// Send 100 USDC on Polygon
const tx = await align.blockchain.transactions.sendToken(
  wallet,
  "usdc",
  "0xRecipientAddress...",
  "100.0",
  "polygon"
);

console.log(`TX Hash: ${tx.hash}`);

// Wait for confirmation
const receipt = await align.blockchain.transactions.waitForConfirmation(
  tx.hash,
  "polygon"
);
console.log(`USDC sent! Block: ${receipt.blockNumber}`);

Supported Tokens

TokenNetworks
usdcAll
usdtAll
daiethereum, polygon
ERC-20 transfers require native tokens for gas. Ensure your wallet has both the tokens and gas.