useTokenSupply

Hook for fetching the total supply of an ERC20 token.

This takes into account the increase and decrease in supply when tokens are minted and burned.

Example

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

Parameters

Returns

Hook's data object includes the total supply of the token in the value property as a BigNumber object.