ERC1155Mintable
Functionality available for contracts that implement the
IERC1155
and
IMintableERC1155
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.
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 tx = await contract.erc1155.mint({
metadata: metadata,
supply: 1000, // The number of this NFT you want to mint
});
Configuration
mintTo
The same as mint
, but allows you to specify the address of the wallet rather than using the connected wallet.
// 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 #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 metadataWithSupply = {
metadata,
supply: 1000, // The number of this NFT you want to mint
};
const txResult = await contract.erc1155.mintTo(toAddress, metadataWithSupply);
Configuration
mintAdditionalSupply
Mint additional quantity of an NFT that already exists on the contract.
const tokenId = 0;
const additionalSupply = 1000;
const txResult = await contract.erc1155.mintAdditionalSupply(
tokenId,
additionalSupply,
);
Configuration
mintAdditionalSupplyTo
The same as mintAdditionalSupply
, but allows you to specify the address of the wallet rather than using the connected wallet.
const toAddress = "{{wallet_address}}";
const tokenId = 0;
const additionalSupply = 1000;
const txResult = await contract.erc1155.mintAdditionalSupplyTo(
toAddress,
tokenId,
additionalSupply,
);
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.erc1155.getMintTransaction(
"{{wallet_address}}", // Wallet address to mint to
{
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
},
supply: 1000, // The number of this NFT you want to mint
},
);
Configuration
nextTokenIdToMint
Get the next token ID that will be minted on the contract.
const nextTokenId = await contract.erc1155.nextTokenIdToMint();