Skip to main content

GetBalance

Fetch the native or ERC20 token balance of the connected wallet.

Usage

Use this method to fetch the balance of a wallet.

You can use the native currency address to fetch the balance of the native currency, or a specific ERC20 token contract address to fetch the ERC20 balance.

var data = await sdk.wallet.GetBalance();

Configuration

currencyAddress (optional)

The address of the token smart contract that you want to get the balance for.

If no address is provided, the balance of the native currency will be used.

var data = await sdk.wallet.GetBalance("{{currency_contract_address}}");

Return Value

Returns a CurrencyValue struct containing the following properties:

{
string name;
string symbol;
string decimals;
string value;
string displayValue;
}