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
metadataWithSupply
An object containing a metadata
object and a supply
property.
The metadata object can either be a string that points to valid metadata that conforms to the metadata standards, or an object that conforms to the same standards.
If you provide an object, the metadata is uploaded and pinned to IPFS before the NFT(s) are minted.
// Below is an example of using a string rather than an object for metadata
const metadata = "https://example.com/metadata.json"; // Any URL or IPFS URI that points to metadata
const txResult = await contract.erc1155.mint({
metadata: metadata,
supply: 1000, // The number of this NFT you want to mint
});
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
to
The address of the wallet you want to mint the NFT to.
Must be a string
.
const metadataWithSupply = {
// ...
};
const txResult = await contract.erc1155.mintTo(
"{{wallet_address}}",
metadataWithSupply,
);
metadataWithSupply
Same as metadataWithSupply
in the mint
method.
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
tokenId
The ID of the NFT you want to mint additional supply for.
Must be a string
, number
, or BigNumber
.
const txResult = await contract.erc1155.mintAdditionalSupply(
"{{token_id}}",
"{{additional_supply}}",
);
additionalSupply
How much additional supply you want to mint.
Must be a string
, number
, or BigNumber
.
const txResult = await contract.erc1155.mintAdditionalSupply(
"{{token_id}}",
"{{additional_supply}}",
);
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
to
The address of the wallet you want to mint the NFT to.
Must be a string
.
const txResult = await contract.erc1155.mintAdditionalSupplyTo(
"{{wallet_address}}",
"{{token_id}}",
"{{additoinal_supply}}",
);
tokenId
The ID of the NFT you want to mint additional supply for.
Must be a string
, number
, or BigNumber
.
const txResult = await contract.erc1155.mintAdditionalSupplyTo(
"{{wallet_address}}",
"{{token_id}}",
"{{additoinal_supply}}",
);
additionalSupply
How much additional supply you want to mint.
Must be a string
, number
, or BigNumber
.
const txResult = await contract.erc1155.mintAdditionalSupplyTo(
"{{wallet_address}}",
"{{token_id}}",
"{{additoinal_supply}}",
);
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
to
The address of the wallet you want to mint the NFT to.
Must be a string
.
metadataWithSupply
See metadataWithSupply
in the mint
method.
Return Value
TransactionTask;
nextTokenIdToMint
Get the next token ID that will be minted on the contract.
const nextTokenId = await contract.erc1155.nextTokenIdToMint();
Configuration
Return Value
Returns a BigNumber
representing the next token ID that will be minted on the contract.
BigNumber;