Skip to main content

ERC721 - Mint NFTs

You can utilize these features of the SDK on your contract if it implements ERC721Mintable.

Mint a unique NFT

Provide a metadata object to mint a unique NFT.

This function automatically uploads and pins your metadata to IPFS.

If you already have your metadata uploaded to IPFS (or any URL that points to valid metadata), you can directly pass the URI as the second argument; rather than a metadata object.

const Component = () => {
const { contract } = useContract(<ContractAddress>);
const {
mutate: mintNft,
isLoading,
error,
} = useMintNFT(contract);

if (error) {
console.error("failed to mint nft", error);
}

return (
<button
disabled={isLoading}
onClick={() => mintNft({ name: "My awesome NFT!", to: "0x..." })}
>
Mint!
</button>
);
};
View in React SDK Documentation