balance
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.
// Get the native currency balance e.g. Ether on Ethereum
const balance = await sdk.wallet.balance();
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.
const erc20Balance = await sdk.wallet.balance("{{token_contract_address}}");
Return Value
Returns a CurrencyValue
object containing the following properties:
{
symbol: string;
value: BigNumber;
name: string;
decimals: number;
displayValue: string;
}