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.

const Component = () => {
const { contract } = useContract("{{contract_address}}");
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: "{{wallet_address}}" })}
>
Mint!
</button>
);
};

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 Component = () => {
const { contract } = useContract("{{contract_address}}");
const {
mutate: mintNftSupply,
isLoading,
error,
} = useMintNFTSupply(contract);

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

return (
<button
disabled={isLoading}
onClick={() => mintNftSupply({ tokenId: 0, additionalSupply: 100, to: "{{wallet_address}}"})}
>
Mint Additional Supply!
</button>
);
};

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

View in React SDK Documentation