ERC1155 - Signature-Based Minting
Use signature-based minting of NFTs in your smart contract.
You can utilize these features of the SDK on your contract if it implements SignatureMintERC1155.
Generate a signature
Generate a signature that can be utilized to mint an NFT by another wallet.
The signature specifies any information about the NFT such as the metadata and price.
The generation of signatures requires the wallet to have the MINTER
role on the contract by default.
- React
- Javascript
- Python
- Go
- Unity
const nftMetadata = {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
};
const startTime = new Date();
const endTime = new Date(Date.now() + 60 * 60 * 24 * 1000);
const payload = {
metadata: nftMetadata, // The NFT to mint
to: {{wallet_address}}, // Who will receive the NFT
quantity: 2, // the quantity of NFTs to mint
price: 0.5, // the price per NFT
currencyAddress: NATIVE_TOKEN_ADDRESS, // the currency to pay with
mintStartTime: startTime, // can mint anytime from now
mintEndTime: endTime, // to 24h from now
royaltyRecipient: "0x...", // custom royalty recipient for this NFT
royaltyBps: 100, // custom royalty fees for this NFT (in bps)
primarySaleRecipient: "0x...", // custom sale recipient for this NFT
};
const signedPayload = await contract.erc1155.signature.generate(payload);
// now anyone can use these to mint the NFT using `contract.erc1155.signature.mint(signedPayload)`
This snippet is for v3 of the SDK. Learn how to upgrade.
View in React SDK Documentationconst nftMetadata = {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
};
const startTime = new Date();
const endTime = new Date(Date.now() + 60 * 60 * 24 * 1000);
const payload = {
metadata: nftMetadata, // The NFT to mint
to: {{wallet_address}}, // Who will receive the NFT
quantity: 2, // the quantity of NFTs to mint
price: 0.5, // the price per NFT
currencyAddress: NATIVE_TOKEN_ADDRESS, // the currency to pay with
mintStartTime: startTime, // can mint anytime from now
mintEndTime: endTime, // to 24h from now
royaltyRecipient: "0x...", // custom royalty recipient for this NFT
royaltyBps: 100, // custom royalty fees for this NFT (in bps)
primarySaleRecipient: "0x...", // custom sale recipient for this NFT
};
const signedPayload = await contract.erc1155.signature.generate(payload);
// now anyone can use these to mint the NFT using `contract.erc1155.signature.mint(signedPayload)`
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 Documentationvar meta =
new NFTMetadata()
{
name = "Unity NFT",
description = "Minted From Unity (signature)",
image = "ipfs://QmbpciV7R5SSPb6aT9kEBAxoYoXBUsStJkMpxzymV4ZcVc"
};
string connectedAddress = await sdk.wallet.GetAddress();
var payload = new ERC1155MintPayload(connectedAddress, meta);
var signature = await contract.ERC1155.signature.Generate(payload);
Generate From Token ID
- React
- Javascript
- Python
- Go
- Unity
const nftMetadata = {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
};
const startTime = new Date();
const endTime = new Date(Date.now() + 60 * 60 * 24 * 1000);
const payload = {
tokenId: 0, // Instead of metadata, we specificy the token ID of the NFT to mint supply to
to: {{wallet_address}}, // Who will receive the NFT (or AddressZero for anyone)
quantity: 2, // the quantity of NFTs to mint
price: 0.5, // the price per NFT
currencyAddress: NATIVE_TOKEN_ADDRESS, // the currency to pay with
mintStartTime: startTime, // can mint anytime from now
mintEndTime: endTime, // to 24h from now
royaltyRecipient: "0x...", // custom royalty recipient for this NFT
royaltyBps: 100, // custom royalty fees for this NFT (in bps)
primarySaleRecipient: "0x...", // custom sale recipient for this NFT
};
const signedPayload = await contract.erc1155.signature.generateFromTokenId(payload);
// now anyone can use these to mint the NFT using `contract.erc1155.signature.mint(signedPayload)`
This snippet is for v3 of the SDK. Learn how to upgrade.
View in React SDK Documentationconst nftMetadata = {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
};
const startTime = new Date();
const endTime = new Date(Date.now() + 60 * 60 * 24 * 1000);
const payload = {
tokenId: 0, // Instead of metadata, we specificy the token ID of the NFT to mint supply to
to: {{wallet_address}}, // Who will receive the NFT (or AddressZero for anyone)
quantity: 2, // the quantity of NFTs to mint
price: 0.5, // the price per NFT
currencyAddress: NATIVE_TOKEN_ADDRESS, // the currency to pay with
mintStartTime: startTime, // can mint anytime from now
mintEndTime: endTime, // to 24h from now
royaltyRecipient: "0x...", // custom royalty recipient for this NFT
royaltyBps: 100, // custom royalty fees for this NFT (in bps)
primarySaleRecipient: "0x...", // custom sale recipient for this NFT
};
const signedPayload = await contract.erc1155.signature.generateFromTokenId(payload);
// now anyone can use these to mint the NFT using `contract.erc1155.signature.mint(signedPayload)`
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 Documentationstring connectedAddress = await sdk.wallet.GetAddress();
string tokenId = "0";
var payload =
new ERC1155MintAdditionalPayload(connectedAddress, tokenId);
payload.quantity = 3;
var signature =
await contract.ERC1155.signature.GenerateFromTokenId(payload);
Use a signature to mint an NFT
Use a signature to mint NFTs.
- React
- Javascript
- Python
- Go
- Unity
// see how to craft a payload to sign in the `generate()` documentation
const signedPayload = contract.erc1155.signature.generate(payload);
// now anyone can mint the NFT
const tx = contract.erc1155.signature.mint(signedPayload);
This snippet is for v3 of the SDK. Learn how to upgrade.
View in React SDK Documentation// see how to craft a payload to sign in the `generate()` documentation
const signedPayload = contract.erc1155.signature.generate(payload);
// now anyone can mint the NFT
const tx = contract.erc1155.signature.mint(signedPayload);
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// Use the signature you generated in the Mint method:
var nft = await contract.ERC1155.signature.Mint(signature);