Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 1.17 KB

AccountBalanceQuery.md

File metadata and controls

58 lines (39 loc) · 1.17 KB

class AccountBalanceQuery extends Query < Hbar >

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.

** Java **

var balances = new AccountBalanceQuery()
    .setAccountId(operatorId)
    .execute(client);

** JavaScript **

const balances = await new AccountBalanceQuery()
    .setAccountId("3") // balance of node 3
    .execute(client);

** Go **

balances, err := hedera.NewAccountBalanceQuery().
    SetAccountID(client.GetOperatorAccountID()).
    Execute(client)
if err != nil {
    println(err.Error())
}

Constructor

constructor()

Properties

accountId: AccountId

The account ID for which information is requested


contractId: ContractId

The contract ID for which information is requested