Skip to main content

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.

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.

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.