Skip to main content

ERC1155 - Mint NFTs

You can utilize these features of the SDK if your contract implements the ERC1155Mintable interface.

Mint an NFT with a limited supply

Provide a metadata object to mint a specified quantity of a new 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 toAddress = "{{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 metadataWithSupply = {
metadata,
supply: 1000, // The number of this NFT you want to mint
}

const tx = await contract.erc1155.mint(toAddress, metadataWithSupply);
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

Mint Additional Supply of an NFT

Make additional copies of an NFT that already exists.

const tokenId = 0;
const additionalSupply = 1000;
await contract.erc1155.mintAdditionalSupply(tokenId, additionalSupply);

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

View in React SDK Documentation