Skip to main content

Method Signature

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

Parameters

wallet
Wallet
required
The sender’s wallet object (with private key)
token
string
required
Token contract address or identifier (usdc, usdt)
to
string
required
Recipient wallet address
amount
string
required
Amount to send (e.g., "100.00" for 100 USDC)
network
string
required
Network: ethereum, polygon, base, arbitrum

Returns

hash
string
Transaction hash
status
string
Transaction status

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 50 USDC on Polygon
const tx = await align.blockchain.wallets.sendToken(
  wallet,
  "usdc",
  "0xRecipientAddress...",
  "50.00",
  "polygon"
);

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

// Wait for confirmation
const receipt = await align.blockchain.transactions.waitForConfirmation(
  tx.hash,
  "polygon"
);
console.log(`Sent 50 USDC in block ${receipt.blockNumber}`);

Using Contract Address

// Custom token by contract address
const DAI_POLYGON = "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063";

const tx = await align.blockchain.wallets.sendToken(
  wallet,
  DAI_POLYGON,
  recipient,
  "100.00",
  "polygon"
);
Token transfers require native tokens for gas fees. Ensure the wallet has both the tokens to send AND native tokens for gas.