Skip to main content

ERC1155SignatureMintable

Functionality available for contracts that implement the IERC1155 and ISignatureMintERC1155 interfaces.

Allows you to utilize signature-based minting of NFTs.

Generate​

Generate a signature that a wallet address can use to mint the specified number of NFTs.

This is typically an admin operation, where the owner of the contract generates a signature that allows another wallet to mint tokens.

NFTMetadata meta = new NFTMetadata()
{
name = "Unity NFT",
description = "Minted From Unity",
image = "ipfs://QmbpciV7R5SSPb6aT9kEBAxoYoXBUsStJkMpxzymV4ZcVc",
};

var receiverAddress = "{{wallet_address}}";
var payload = new ERC1155MintPayload(receiverAddress, meta, 1000);
var signedPayload = await contract.ERC1155.signature.Generate(payload);
Configuration

The information you provide to the generate method outlines what the signature can be used for.

The quantity, to, and metadata fields are required, while the rest are optional.

receiverAddress​

The wallet address that can use this signature to mint tokens.

This is to prevent another wallet from intercepting the signature and using it to mint tokens for themselves.

Must be a string.

metadata​

The metadata of the NFT to mint.

Must be an NFTMetadata struct containing metadata that conforms to the metadata standards.

The metadata is uploaded and pinned to IPFS before the NFT(s) are minted.

quantity​

The number of tokens this signature can be used to mint.

Must be an int.

GenerateFromTokenId​

Generate a signature that can be used to mint additional supply of an existing NFT in the contract.

This is the same as generate but it allows you to specify the tokenId of the NFT you want to mint additional supply for, rather than providing the metadata of a new NFT.

NFTMetadata meta = new NFTMetadata()
{
name = "Unity NFT",
description = "Minted From Unity",
image = "ipfs://QmbpciV7R5SSPb6aT9kEBAxoYoXBUsStJkMpxzymV4ZcVc",
};

var receiverAddress = "{{wallet_address}}";
var payload = new ERC1155MintAdditionalPayload(receiverAddress, "{{token_id}}", 1);
var signedPayload = await contract.ERC1155.signature.GenerateFromTokenId(payload);
Configuration

receiverAddress​

The wallet address that can use this signature to mint tokens.

This is to prevent another wallet from intercepting the signature and using it to mint tokens for themselves.

Must be a string.

tokenId​

The tokenId of the NFT you want to mint additional supply for.

Must be a string.

quantity​

The number of tokens this signature can be used to mint.

Must be an int.

Mint​

Mint tokens from a previously generated signature (see generate).

NFTMetadata meta = new NFTMetadata()
{
name = "Unity NFT",
description = "Minted From Unity",
image = "ipfs://QmbpciV7R5SSPb6aT9kEBAxoYoXBUsStJkMpxzymV4ZcVc",
};
var receiverAddress = "{{wallet_address}}";
var payload = new ERC1155MintAdditionalPayload(receiverAddress, "{{token_id}}", 1);
var signedPayload = await contract.ERC1155.signature.GenerateFromTokenId(payload);

var data = await contract.ERC1155.signature.Mint(signedPayload);
Configuration

signedPayload​

The payload created by the generate function.

The typical pattern is the admin generates a signature, and the user uses it to mint the tokens, under the conditions specified in the signature.

Verify​

Verify that a payload is correctly signed.

This allows you to provide a payload, and prove that it was valid and was generated by a wallet with permission to generate signatures.

If a payload is not valid, the mint/mintBatch functions will fail, but you can use this function to verify that the payload is valid before attempting to mint the tokens if you want to show a more user-friendly error message.

NFTMetadata meta = new NFTMetadata()
{
name = "Unity NFT",
description = "Minted From Unity",
image = "ipfs://QmbpciV7R5SSPb6aT9kEBAxoYoXBUsStJkMpxzymV4ZcVc",
};
var receiverAddress = "{{wallet_address}}";
var payload = new ERC1155MintAdditionalPayload(receiverAddress, "{{token_id}}", 1);
var signedPayload = await contract.ERC1155.signature.GenerateFromTokenId(payload);

var data = await contract.ERC1155.signature.Verify(signedPayload);
Configuration

signedPayload​

The payload to verify.

Return Value​

Returns true if the payload is valid, false otherwise.

bool