WDK logoWDK documentation

Check Balances

Query native, ERC-20, and paymaster token balances.

This guide explains how to check native token balances, ERC-20 token balances, multiple token balances, paymaster token balances, and read-only account balances.

Native Token Balance

You can retrieve the native token balance (e.g., ETH) using account.getBalance():

Get Native Balance
const balance = await account.getBalance()
console.log('Native balance:', balance, 'wei')

ERC-20 Token Balance

You can check the balance of a specific ERC-20 token using account.getTokenBalance():

Get ERC-20 Balance
const tokenBalance = await account.getTokenBalance('0xdAC17F958D2ee523a2206206994597C13D831ec7') // USDt
console.log('USDt balance:', tokenBalance)

Multiple Token Balances

You can check balances for multiple ERC-20 tokens in a single call using account.getTokenBalances():

Get Multiple Token Balances
const tokenBalances = await account.getTokenBalances([
  '0xdAC17F958D2ee523a2206206994597C13D831ec7', // USDt
  '0x68749665FF8D2d112Fa859AA293F07A622782F38'  // XAUt
])
console.log('Multi-token balances:', tokenBalances)

Paymaster Token Balance

You can check the paymaster token balance used for paying gas fees using account.getPaymasterTokenBalance():

Get Paymaster Token Balance
const paymasterBalance = await account.getPaymasterTokenBalance()
console.log('Paymaster token balance:', paymasterBalance)

The paymaster token balance is held by the Safe account. Fund the Safe with enough of the configured token to repay the paymaster before initiating token-paid operations.

Read-Only Account Balances

Create the read-only account with the known-Safe workflow, then use getBalance() to query that Safe's native balance:

Read-Only Balance
const balance = await readOnlyAccount.getBalance()
console.log('Read-only Safe balance:', balance, 'wei')

The same account supports the token and allowance queries listed in the API reference. Balance reads do not require the Safe to be deployed. Reading the configured paymaster token balance requires a paymasterToken configuration.

If you have the owner EOA address instead, use the read-only constructor. Passing a Safe address to that constructor predicts a different account; use the factory to read the supplied Safe directly.

Next Steps

With balance checks in place, learn how to send gasless transactions.

On this page