Skip to main content

useNFTBalance() function

This feature is currently in beta and may change based on feedback that we receive.

Use this to get a the total balance of a NFTContract and wallet address.

Example

const { contract } = useContract(<ContractAddress>);
const { data: ownerBalance, isLoading, error } = useNFTBalance(contract, <OwnerWalletAddress>);

Signature:

export declare function useNFTBalance(
contract: RequiredParam<NFTContract>,
ownerWalletAddress: RequiredParam<WalletAddress>,
tokenId: RequiredParam<BigNumberish>,
): import("@tanstack/react-query").UseQueryResult<BigNumber, unknown>;

Parameters

ParameterTypeDescription
contractRequiredParam<NFTContract>an instance of a NFTContract
ownerWalletAddressRequiredParam<WalletAddress>the wallet adress to check the balance of
tokenIdRequiredParam<BigNumberish>

Returns:

import("@tanstack/react-query").UseQueryResult<BigNumber, unknown>

a response object that includes the total balance of the owner