Skip to main content

useTotalCount

Hook to get the total count of unique NFTs minted on a smart contract.

Available to use on smart contracts that implement the ERC721 or ERC1155 standard.

When used for ERC1155 contracts, the total count is the number of unique token IDs minted, not the total supply of all tokens in circulation.

import { useTotalCount } from "@thirdweb-dev/react";

const { data, isLoading, error } = useTotalCount(contract);

Usage

Provide your NFT contract from the useContract hook as the first argument.

import { useTotalCount, useContract } from "@thirdweb-dev/react";

// Your smart contract address
const contractAddress = "{{contract_address}}";

function App() {
const { contract } = useContract(contractAddress);
const { data: totalCount, isLoading, error } = useTotalCount(contract);
}