useNFTBalance
Hook to get the quantity a user owns of a specific ERC1155 NFT.
Available to use on smart contracts that implement the ERC1155 standard.
import { useNFTBalance } from "@thirdweb-dev/react";
const { data, isLoading, error } = useNFTBalance(
contract,
"{{wallet_address}}",
"{{token_id}}",
);
Usage
Provide your smart contract instance, the wallet address to check, and the token ID to check.
import { useNFTBalance, useContract } from "@thirdweb-dev/react";
// Your smart contract address
const contractAddress = "{{contract_address}}";
function App() {
const { contract } = useContract(contractAddress);
const { isLoading, data, error } = useNFTBalance(
contract,
"{{wallet_address}}",
"{{token_id}}",
);
}