useTokenBalance() function
This feature is currently in beta and may change based on feedback that we receive.
Use this to get the balance of your contract for a given address.
Example
const { data: balance, isLoading, error } = useTokenBalance(<YourTokenContractInstance>);
Signature:
export declare function useTokenBalance(
contract: RequiredParam<Erc20>,
walletAddress: RequiredParam<WalletAddress>,
): import("@tanstack/react-query").UseQueryResult<
{
symbol: string;
value: import("ethers").BigNumber;
name: string;
decimals: number;
displayValue: string;
},
unknown
>;
Parameters
Parameter | Type | Description |
---|---|---|
contract | RequiredParam<Erc20> | an instance of a Token contract. |
walletAddress | RequiredParam<WalletAddress> |
Returns:
import("@tanstack/react-query").UseQueryResult<{ symbol: string; value: import("ethers").BigNumber; name: string; decimals: number; displayValue: string; }, unknown>
a response object that includes the balance of the address