Skip to main content

Collections — 1 of 1 mint

A solidity extension, React hooks and REST APIs to mint 1-of-1 NFTs with completely different metadata (name, image, attributes) for every single token in your collection.

Relevant use-cases:

  • Minting unique digital art pieces, each with its own individual media and metadata attached.
  • Minting unique NFTs based on some user action directly from your backend.

Dashboard

For collections that have this extension, you will be able to mint NFTs directly from the dashboard.

It is recommended to mint 1-of-1 NFTs from your backend as you would have full flexibility to construct the metadata and mint on any important event in your system.

You can go to Minting tab when visiting your collection in the dashboard.

React Hooks

Require Extension

All hooks defined below require the ERC721OneOfOneMintExtension.sol Solidity extension, which is already included in some of the ready-made presets.

useOneOfOneMinter

Mint one or more 1-of-1 NFTs using owner wallet or a wallet that has "MINTER_ROLE".

Minter Role

You can assign the MINTER_ROLE to any address via Flair's collection dashboard, under "Roles" section of your collection management panel.

import { useOneOfOneMinter } from "flair-sdk";

const App = () => {
const {
data,
error,
isLoading,
writeAndWait: mintOneOfOne,
} = useOneOfOneMinter({
contractAddress: "0x6f90661e8e6133c64d8ec7859da8a8137ab67f01",
toAddress: "0xd56fbe3294ea4d73cca99ff8751ce7bd9b688cd5",
mintCount: 1,
tokenURIs: ["ipfs://xxxxxxxxxxxxx"],

// Optional access type, depending on which wallet is minting. Defaults to "ByOwner" wallet.
access: 'ByOwner' // or 'ByRole'
});

return (
<>
<button onClick={() => mintOneOfOne()}>Mint a 1-of-1</button>
</>
);
};

REST APIs

Flair provides a scalable and trustless relayer API to mint 1-of-1 NFTs from your backend services to any wallet.

You can check examples / mint-nft-by-role-meta-transactions simple Node.js + Express example, that uses Flair SDKs and API to mint 1-of-1 NFTs.

Using the SDK you don't need to directly code API calls, but if you are interested in exploring API Specs you can visit the API Swagger docs.

Solidity extensions

ERC721OneOfOneMintExtension.sol

This extensions provides capability to mint 1-of-1 NFTs by owner of the collection, or any address you give the "MINTER_ROLE" to.

Features:

  • Mint 1 or more one of one NFTs by providing unique metadata URLs for each token.
  • Getting token URI for each minted token.
  • Uses ERC721PerTokenMetadataExtension (and OpenZeppelin's ERC721URIStorage) under the hood.

View the source code.