useTotalCirculatingSupply

Hook for fetching the total number of NFTs in circulation for a given smart contract.

This takes into account the increase in supply due to minting and the decrease in supply due to burning.

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

Example

import {
useTotalCirculatingSupply,
useContract,
} from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
const { data, isLoading, error } =
useTotalCirculatingSupply(contract);
}
function useTotalCirculatingSupply(
contract: RequiredParam<NFTContract>,
tokenId?: RequiredParam<BigNumberish>,
): UseQueryResult<BigNumber, unknown>;

Parameters

Instance of a NFTContract

Type

let contract: RequiredParam<NFTContract>;

Required for ERC1155, the tokenId to look up. This will return the total quantity of the given token ID in circulation.

import {
useTotalCirculatingSupply,
useContract,
} from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
const { data, isLoading, error } = useTotalCirculatingSupply(
contract,
"{{token_id}}",
);
}

Type

let tokenId: RequiredParam<BigNumberish>;

Returns

let returnType: UseQueryResult<BigNumber, unknown>;

A BigNumber representing the total circulating supply.