Skip to main content

useTokenBalance

Callable

  • useTokenBalance(contract: null | Contract, address?: string, autoUpdateInterval?: number): BigNumber

  • Gets the current token balance for a specified address, or the currently-connected wallet. This should be used on ERC20 or ERC721 contracts that implement the balanceOf(address) function. This hook will suspend while it loads.


    Parameters

    • contract: null | Contract

      The smart contract for the token. Should be an ERC20 or ERC721 contract.

    • optionaladdress: string

      The address. Defaults to the address of the connected wallet.

    • optionalautoUpdateInterval: number

      The interval in milliseconds to automatically update the balance.

    Returns BigNumber