java.lang.Object
com.hedera.hashgraph.sdk.MirrorNodeAccountBalance
The HBAR balance of an account as reported by the mirror node REST API.
Returned by MirrorNodeAccountBalanceQuery. Token balances are not included.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
hbars
The HBAR balance of the account.
-
-
Constructor Details
-
MirrorNodeAccountBalance
MirrorNodeAccountBalance(Hbar hbars) Constructor.- Parameters:
hbars- the HBAR balance of the account
-
-
Method Details
-
fromJson
Create a balance from a mirror node REST JSON payload.The mirror node reports an account it does not know with an empty
balancesarray — not a 404. That case is signalled by returningnull; the caller decides how to report it. An account that exists but holds no HBAR is a populated entry with"balance": 0and is parsed normally, so a genuine zero is never mistaken for a missing account.- Parameters:
root- the JSON object returned byGET /api/v1/balances- Returns:
- the new balance, or
nullif the mirror node knows no such account - Throws:
IllegalStateException- if the payload is not a well-formed balances response
-
getHbars
Extract the HBAR balance.- Returns:
- the HBAR balance of the account
-
toString
-