useBalanceForAddress

This hook is similar to the useBalance hook, but it for fetching the native token balance of any given wallet address.

This hook only fetches the native token balance of the given wallet address. If you want to get the ERC20 balance from a given wallet, use useTokenBalance

Example

const { data, isLoading } = useBalanceForAddress(walletAddress);
function useBalanceForAddress(
walletAddress: string,
): UseQueryResult<
{
decimals: number;
displayValue: string;
name: string;
symbol: string;
value: BigNumber;
},
unknown
>;

Parameters

The address of the wallet that you want to get the native balance

Type

let walletAddress: string;

Returns

let returnType: UseQueryResult<
{
decimals: number;
displayValue: string;
name: string;
symbol: string;
value: BigNumber;
},
unknown
>;

The hook's data property contains the native token's balance in the value property as a BigNumber object.