Wallet balances

Fetches the balance of any coin of the wallet.

getCoinBalance(coinType?: string): Promise<number>

Get APT balance of the wallet

const aptBalance = await wallet.getCoinBalance();
console.log(`APT balance: ${aptBalance} APT`); 
// Example: APT balance: 2 APT

Get balances of other assets

const USDT_COIN_TYPE = "0x43417434fd869edee76cca2a4d2301e528a1551b1d719b75c350c3c97d15b8b9::coins::USDT";
const usdtBalance = await wallet.getCoinBalance(USDT_COIN_TYPE);
console.log(`USDT balance: ${usdtBalance} USDT`); 
// Example: USDT balance: 1 USDT

Last updated