Skip to main content

ERC721 - Mint NFTs

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

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.

// Address of the wallet you want to mint the NFT to
const walletAddress = "{{wallet_address}}";

// Custom metadata of the NFT, note that you can fully customize this metadata with other properties.
const metadata = {
name: "Cool NFT",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
};

const tx = await contract.erc721.mintTo(walletAddress, metadata);
const receipt = tx.receipt; // the transaction receipt
const tokenId = tx.id; // the id of the NFT minted
const nft = await tx.data(); // (optional) fetch details of minted NFT

This snippet is for v3 of the SDK. Learn how to upgrade.

View in React SDK Documentation