Balance
The balance
method allows you to retrieve the balance of an account for a specific token. It returns an Asset instance with a value equal to the account balance for the queried token.
Usage
The balance
method is available on any Account instance. Here is a basic example of how to use it:
const balance = await testAccount.balance()
// Returns the balance of the system token for the account.
To retrieve the balance for a secondary token:
const balance = await testAccount.balance("eosio.token", "USDT")
// Returns the balance of the 'USDT' token for the account.
Options
contract
: The contract of the token balance that is being retrieved. Defaults to the system token contract.symbol
: The symbol of the token balance that is being retrieved. Defaults to the system token symbol.
Return Value
The balance
method returns an instance of the Asset class.