useWalletBalance
Fetch the balance of a wallet for a specific token.
import { useWalletBalance } from "thirdweb/react"; const { data, isLoading, isError } = useWalletBalance({ chain, address, client, tokenAddress,});
function useWalletBalance( options: { address: undefined | string; chain: | undefined | { readonly blockExplorers?: Array<{ apiUrl?: string; name: string; url: string; }>; readonly experimental?: { increaseZeroByteCount?: boolean }; readonly faucets?: Array<string>; readonly icon?: Icon; readonly id: number; readonly name?: string; readonly nativeCurrency?: { decimals?: number; name?: string; symbol?: string; }; readonly rpc: string; readonly testnet?: true; }; tokenAddress?: string; }, queryOptions?: UseWalletBalanceQueryOptions,): UseQueryResult<GetWalletBalanceResult>;
GetWalletBalanceOptions - The options for fetching the wallet balance.
let options: { address: undefined | string; chain: | undefined | { readonly blockExplorers?: Array<{ apiUrl?: string; name: string; url: string; }>; readonly experimental?: { increaseZeroByteCount?: boolean }; readonly faucets?: Array<string>; readonly icon?: Icon; readonly id: number; readonly name?: string; readonly nativeCurrency?: { decimals?: number; name?: string; symbol?: string; }; readonly rpc: string; readonly testnet?: true; }; tokenAddress?: string;};