Transfer coins

Transfers any coin from the current wallet to a specified recipient.

This function supports both native Aptos coins and custom coin types deployed on the Aptos blockchain.

This function abstracts the complexity of Aptos transaction building and submission, allowing you to transfer any fungible token with a single call.

transferCoin(recipient: string, amount: bigint | number, coinType?: MoveStructId): Promise<string>

Returns:

A Promise<string> resolving to the transaction hash of the transfer operation.

Transfer APT coin to a wallet

const RECIPIENT_ADDRESS = "..."; // Wallet address of the recipient
const AMOUNT = 1; // 1 APT

const transactionHash = await wallet.transferCoin(RECIPIENT_ADDRESS, AMOUNT);
console.log(`Transaction sent with hash: ${transactionHash}`); 

Transfer any coin to a wallet

const USDT_COIN_TYPE = "0x43417434fd869edee76cca2a4d2301e528a1551b1d719b75c350c3c97d15b8b9::coins::USDT";
const RECIPIENT_ADDRESS = "..."; // Wallet address of the recipient
const AMOUNT = 1; // 1 USDT

const transactionHash = await wallet.transferCoin(
    RECIPIENT_ADDRESS, 
    AMOUNT, 
    USDT_COIN_TYPE
);
console.log(`Transaction sent with hash: ${transactionHash}`);    

Last updated