Skip to main content

Check Balance

You can retrieve the balance for any account you created by calling the Account.getBalance() 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.

Online Faucet

You can request test funds from the Shimmer Testnet Faucet.

Example Code

  1. Instantiate a Wallet, get Alice's Account which was created in the first guide.
  2. Sync the account with the node to get the latest transactions and the account's balance by calling the Account.sync() function.
sdk/examples/how_tos/accounts_and_addresses/check_balance.rs
loading...

Full Example Code

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: {},
}