ERC721Mintable
Functionality available for contracts that implement the
IERC721
and
IMintableERC721
interfaces.
Allows you to mint new NFTs on the contract.
By default, the NFT metadata is uploaded and pinned to IPFS before minting.
You can override this default behavior by providing a string
that points to valid metadata object instead of an object.
mint
Mint a new NFT to the connected wallet.
// Custom metadata of the NFT, note that you can fully customize this metadata with other properties.
const metadata = {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
};
const txResult = await contract.erc721.mint(metadata);
Configuration
mintTo
The same as mint
, but allows you to specify the address of the wallet that will receive the NFT rather than using
the connected wallet address.
// 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",
};
const txResult = await contract.erc721.mintTo(walletAddress, metadata);
Configuration
mintBatch
Mint multiple NFTs in a single transaction to the connected wallet.
const txResult = await contract.erc721.mintBatch([
{
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
},
{
name: "Cool NFT #2",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
},
]);
Configuration
mintBatchTo
The same as mintBatch
, but allows you to specify the address
of the wallet that will receive the NFTs rather than using the connected wallet address.
const txResult = contract.erc721.mintBatchTo("{{wallet_address}}", [
{
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
},
{
name: "Cool NFT #2",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
},
]);
Configuration
nextTokenIdToMint
Returns the token ID of the next NFT that will be minted.
const nextTokenId = await contract.erc721.nextTokenIdToMint();
Configuration
getMintTransaction
Construct a mint transaction without executing it. This is useful for estimating the gas cost of a mint transaction, overriding transaction options and having fine grained control over the transaction execution.
const txResult = await contract.erc721.getMintTransaction(
"{{wallet_address}}", // Wallet address to mint to
{
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
},
);