Method Signature
align.blockchain.transactions.sendToken(
wallet: Wallet,
token: Token,
to: string,
amount: string,
network: Network
): Promise<Transaction>
Parameters
Token identifier: "usdc", "usdt", "dai", etc.
Amount in human-readable format (e.g., "100.0")
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}`);
const tx = await align.blockchain.transactions.sendToken(
wallet,
"usdc",
recipient,
"50.0",
"polygon"
);
console.log("TX Hash:", tx.hash);
Supported Tokens
| Token | Networks |
|---|
usdc | All |
usdt | All |
dai | ethereum, polygon |
ERC-20 transfers require native tokens for gas. Ensure your wallet has both
the tokens and gas.