useTokenBalance

Hook for fetching the balance a wallet has for a specific ERC20 token.

This hook is for custom ERC20 tokens. For native tokens such as Ether, use useBalance or useBalanceForAddress

Available to use on contracts that implement the ERC20 interface.

Example

import { useTokenBalance, useContract } from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress, "token");
const { data, isLoading, error } = useTokenBalance(
contract,
walletAddress,
);
}

Parameters

Returns

Hook's data object includes the token balance for given wallet address