Optionalprops: { accountId?: string | AccountId } = {}OptionalrequestTimeout: numbertotal timeout for the whole
operation in milliseconds, every retry included; defaults to the
retry policy's totalDeadline, which in turn defaults to
client.requestTimeout
with Status.InvalidAccountId if the mirror node knows no such account
Set the account whose balance to read. Contract IDs are accepted too, since the mirror node balances endpoint resolves them.
Mirror-node REST replacement for the deprecated
AccountBalanceQuery.Reads the HBAR balance from
GET /api/v1/balances?account.id={id}through the client's shared HTTP transport. Pure HTTP: no query payment, no node rotation, no gRPC, so this class deliberately does not extendQuery. Retry, backoff and timeouts follow the client'sMirrorNodeHttpRetryPolicy(seeClient.setMirrorNodeHttpConfig).setAccountIdaccepts everything the mirror node resolves:shard.realm.num, an EVM address, a public key alias, or a contract ID. AnAccountIdcarrying analiasKeyor anevmAddressis sent in the form the mirror node understands (base32 alias / bare EVM address) rather thanAccountId.toString().Only the HBAR balance is returned (see MirrorNodeAccountBalance).
An account the mirror node does not know returns an empty result rather than a 404; the SDK maps that to a MirrorNodeStatusError carrying Status.InvalidAccountId, the status
AccountBalanceQueryreported. An account that exists holding nothing returns"balance": 0, so a real zero is never mistaken for a missing account.Eventual consistency: the mirror node trails the network by a few seconds, and the lag covers the account's existence as well as its balance. A just-created account transiently fails with
INVALID_ACCOUNT_ID, so retry rather than treat the first failure as final.A deleted account reads as a zero balance: the balances endpoint does not expose the deleted flag, so unlike
AccountBalanceQuerythis query cannot reportACCOUNT_DELETED. Use/accounts/{id}if that matters.