useBalance() function
This feature is currently in beta and may change based on feedback that we receive.
A hook to get the native or (optional) ERC20 token balance of the connected wallet.
Signature:
export declare function useBalance(
tokenAddress?: ContractAddress,
): import("@tanstack/react-query").UseQueryResult<
| {
symbol: string;
value: import("ethers").BigNumber;
name: string;
decimals: number;
displayValue: string;
}
| undefined,
unknown
>;
Parameters
Parameter | Type | Description |
---|---|---|
tokenAddress | ContractAddress | (Optional) the address of the token contract, if empty will use the chain's native token |
Returns:
import("@tanstack/react-query").UseQueryResult<{ symbol: string; value: import("ethers").BigNumber; name: string; decimals: number; displayValue: string; } | undefined, unknown>
the balance of the connected wallet (native or ERC20)