Check Balances
Query native TON, Jetton, and paymaster token balances.
This guide explains how to check native TON balances, Jetton token balances, paymaster token balances, and read-only account balances.
Native TON Balance
You can retrieve the native TON balance using account.getBalance():
const balance = await account.getBalance()
console.log('Native TON balance:', balance, 'nanotons')Jetton Token Balance
You can check the balance of a specific Jetton token using account.getTokenBalance():
const jettonAddress = 'EQ...' // Jetton contract address
const jettonBalance = await account.getTokenBalance(jettonAddress)
console.log('Jetton token balance:', jettonBalance)Paymaster Token Balance
You can check the balance of the configured paymaster token using account.getPaymasterTokenBalance():
const paymasterBalance = await account.getPaymasterTokenBalance()
console.log('Paymaster Jetton balance:', paymasterBalance)The account pays gasless fees from its balance of the configured paymaster Jetton. If that is also the Jetton being transferred, the same balance must cover both the transfer amount and the final fee.
Read-Only Account Balances
You can check balances for any public key without a seed phrase using WalletAccountReadOnlyTonGasless:
import { WalletAccountReadOnlyTonGasless } from '@tetherto/wdk-wallet-ton-gasless'
const readOnlyAccount = new WalletAccountReadOnlyTonGasless(publicKey, {
tonClient: {
url: 'https://toncenter.com/api/v2/jsonRPC',
secretKey: 'your-api-key' // Optional
},
tonApiClient: {
url: 'https://tonapi.io',
secretKey: 'your-ton-api-key' // Optional
},
paymasterToken: {
address: 'EQ...' // Paymaster Jetton contract address
}
})You can retrieve balances from a read-only account using readOnlyAccount.getBalance() and readOnlyAccount.getPaymasterTokenBalance():
const balance = await readOnlyAccount.getBalance()
console.log('Native TON balance:', balance)
const paymasterBalance = await readOnlyAccount.getPaymasterTokenBalance()
console.log('Paymaster token balance:', paymasterBalance)Next Steps
With balance checks in place, learn how to transfer Jetton tokens gaslessly.