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.
- React
- Javascript
- Python
- Go
- Unity
// 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// 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 Javascript SDK DocumentationThis feature is missing a code snippet or might not be supported yet.
Check the Python SDK documentation for more information.
Reach out on Discord for further assistance!
View Python SDK DocumentationThis feature is missing a code snippet or might not be supported yet.
Check the Go SDK documentation for more information.
Reach out on Discord for further assistance!
View Go SDK Documentation// Address of the wallet you want to mint the NFT to
var walletAddress = "{{wallet_address}}";
// Custom metadata of the NFT, note that you can fully customize this metadata with other properties.
var metadata = new NFTMetadata() {
name = "Cool NFT",
description = "This is a cool NFT",
image = "<image-url-here>"
};
var tx = await contract.ERC721.MintTo(walletAddress, metadata);