Check Balances
Query SOL, SPL token, and paymaster token balances with the Solana gasless wallet.
This guide explains how to check native SOL, SPL token, batch SPL token, and paymaster token balances.
Native SOL Balance
Use getBalance() to read the native SOL balance in lamports:
const balance = await account.getBalance()
console.log('SOL balance:', balance, 'lamports')SPL Token Balance
Use getTokenBalance(tokenAddress) to read one SPL token balance:
const tokenBalance = await account.getTokenBalance('TokenMint111111111111111111111111111111111')
console.log('Token balance:', tokenBalance)Balances are returned in the token's base units.
Batch SPL Token Balances
Use getTokenBalances(tokenAddresses) to read multiple SPL balances:
const balances = await account.getTokenBalances([
'TokenMint111111111111111111111111111111111',
'OtherMint1111111111111111111111111111111111'
])
console.log(balances)Missing associated token accounts return 0n.
Paymaster Token Balance
Use getPaymasterTokenBalance() to read the balance of the configured paymaster fee token:
const feeTokenBalance = await account.getPaymasterTokenBalance()
console.log('Paymaster token balance:', feeTokenBalance)The method reads paymasterToken.address from the account configuration and delegates to getTokenBalance().
Read-Only Balances
Read-only accounts support the same balance methods:
const readOnlyAccount = await account.toReadOnlyAccount()
console.log(await readOnlyAccount.getBalance())
console.log(await readOnlyAccount.getPaymasterTokenBalance())Next Steps
With balances in place, learn how to send transactions.