Collections — Supply
Dashboard
When creating collection via Dashboard, or React hooks you will be able to specify max supply when deploying your contract.
React Hooks
useTotalSupply
Current total number of minted tokens in this collection.
- Requires: Solidity extension ERC721AutoIdMinterExtension.sol, which is already included in Flair's ready-made presets.
import { useTotalSupply } from "flair-sdk";
const App = () => {
const { data, error, isLoading } = useTotalSupply({
contractAddress: "0x123412341234123412341234123412341234",
enabled: true, // (optional) whether to fetch on initial render
});
return <div>Current total supply: {data}</div>;
};
useMaxSupply
Maximum number of tokens that can ever be minted on the collection.
- Requires: Solidity extension ERC721AutoIdMinterExtension.sol, which is already included in Flair's ready-made presets.
import { useMaxSupply } from "flair-sdk";
const App = () => {
const { data, error, isLoading } = useMaxSupply({
contractAddress: "0x123412341234123412341234123412341234",
enabled: true, // (optional) whether to fetch on initial render
});
return <div>Max supply: {data}</div>;
};
Solidity Extensions
ERC721AutoIdMinterExtension.sol
This extensions sets a maximum supply for your ERC721 collection, and tracks mints using an auto-incremented ID starting from 1.
View source code.