Skip to main content

Check Balance

You can retrieve the balance for any account you created by calling the Account.balance() function. Bear in mind that you should always sync the account with the node to get the latest outputs. The sync function also returns the balance. So in some cases just calling that might be enough.

Online Faucet

You can request test funds from the Shimmer Testnet Faucet.

Code Example

The following example will:

  1. Create a wallet.
  2. Get Alice's account which was created in the first guide.
  3. Sync the account with the node to get the latest transactions.
  4. Request the account's balance.
sdk/examples/how_tos/accounts_and_addresses/check_balance.rs
loading...

Expected Output

Balance {
base_coin: BaseCoinBalance {
total: 1398000000,
available: 1398000000,
},
required_storage_deposit: RequiredStorageDeposit {
alias: 0,
basic: 213000,
foundry: 0,
nft: 0,
},
native_tokens: [],
nfts: [],
aliases: [],
foundries: [],
potentially_locked_outputs: {},
}