Mint an NFT
Now that we have a deployed contract, we can mint an NFT.
This document assumes you have followed the deploy a contract instructions and have a contract address for minting NFTs.

Load the contract

Use the loadContract method to assign the contract to a variable.
Add the deployed contract address.
const existing = await sdk.loadContract({
template: TEMPLATES.ERC721Mintable,
contractAddress: "<CONTRACT_ADDRESS>",
console.log(`Contract address is: ${existing.contractAddress}`);

Mint an NFT

Create a new meta data file containing information about the NFT.
"name": "ConsenSys NFT Number 1",
"description": "The first NFT of all of them.",
"image": ""
Include the tokenURI in the mint method.
Like contractURI, the tokenURI must resolve to a public, hosted, well-formed json file.
We added the json file to Infura IPFS as before.
Call the mint method.
const mint1 = await{
publicAddress: process.env.WALLET_PUBLIC_ADDRESS,
tokenURI: '',
const minted = await mint1.wait();
console.log(`Status: ${minted.status}\n NFT minted on ${minted.blockHash} with ${minted.confirmations} confirmation!`);
Example output:
Contract address is: 0x0300F3F929B558e84107B67e3FbBe9e897daDB5a
Status: 1
NFT minted on 0x3df8bf019a2d38f71173a1c7d94ab1f70ffa13a411b311e9054c55fd3e35c00a with 1 confirmation!

Get contract data

After deploying and minting, the contract metadata is available.
const contractMetadata = await sdk.getContractMetadata({
contractAddress: "<CONTRACT_ADDRESS>"
console.log('contract metadata: \n', contractMetadata);
Example output:
contract metadata:
{ symbol: 'CONS', name: 'NFT contract', tokenType: 'ERC721' }
Copy link
On this page
Load the contract
Mint an NFT
Get contract data