try_native_balance
Returns an address's native-token balance as exact Wei at an explicit block, as native_balance does. A balance read cannot revert, so a failed read raises here too.
Example
Live RPC
{"id":"sample_2r8bnw","title":"Sample"}
API reference
try_native_balance(CLIENT, ADDRESS, BIGINT) #
As native_balance at an explicit block height; an RPC error raises.
Inputs
| Name | Type | Use |
|---|---|---|
client | CLIENT Readable EVM state represented by a live, pinned, or execution CLIENT. | required positional |
address | ADDRESS Account or contract address whose native balance should be read. | required positional |
block_number | BIGINT Optional historical block height; NULL gives NULL without an RPC call. | required positional |
Returns
| Name | Type |
|---|---|
balance | UINT256 |
Native balance in Wei. Returns a UINT256 raw Wei balance; NULL only for a NULL input.