Get the balance of a cryptocurrency account. This returns only the balance, so it is a smaller reply than CryptoGetInfo, which returns the balance plus additional information.
Tip
AccountBalanceQuery
is a completely free query and does not even require
setOperator
to be called on the client.
var balances = new AccountBalanceQuery()
.setAccountId(operatorId)
.execute(client);
const balances = await new AccountBalanceQuery()
.setAccountId("3") // balance of node 3
.execute(client);
balances, err := hedera.NewAccountBalanceQuery().
SetAccountID(client.GetOperatorAccountID()).
Execute(client)
if err != nil {
println(err.Error())
}
accountId
: AccountId
The account ID for which information is requested
contractId
: ContractId
The contract ID for which information is requested