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 Testnet Faucet.
Example Code
- Rust
- Typescript (Node.js)
- Python
- Instantiate a
Wallet, get Alice'sAccountwhich was created in the first guide. - Sync the account with the node to get the latest transactions and the account's
balance by calling
the
Account.sync()function.
- Instantiate a
Wallet, Get Alice'sAccountwhich was created in the first guide. - Sync the account with the node to get the latest transactions and the account's
balanceby calling theAccount.sync()function.
- Instantiate a
Wallet, Get Alice'sAccountwhich was created in the first guide. Syncthe account with the node to get the latest transactions and the account'sbalanceby calling theAccount.sync()function.
Full Example Code
- Rust
- Typescript (Node.js)
- Python
sdk/examples/how_tos/accounts_and_addresses/check_balance.rs
loading...
bindings/nodejs/examples/how_tos/accounts_and_addresses/check-balance.ts
loading...
bindings/python/examples/how_tos/accounts_and_addresses/check_balance.py
loading...
Expected Output
- Rust
- Typescript (Node.js)
- Python
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: {},
}
Balance {
baseCoin: {total: '1398000000', available: '1398000000', votingPower: '0'
},
requiredStorageDeposit: {
alias: '0',
basic: '213000',
foundry: '0',
nft: '0'
},
nativeTokens: [],
nfts: [],
aliases: [],
foundries: [],
potentiallyLockedOutputs: {}
}
Balance {
"baseCoin": {
"total": "1398000000",
"available": "1398000000"
},
"requiredStorageDeposit": {
"alias": "0",
"basic": "213000",
"foundry": "0",
"nft": "0"
},
"nativeTokens": [],
"nfts": [],
"aliases": [],
"foundries": [],
"potentiallyLockedOutputs": {}
}