Skip to main content

Erc1155SignatureMintable.generateFromTokenId() method

Generate a signature that can be used to mint additionaly supply to an existing NFT.

Example

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 = contract.signature.generate(payload);
// now anyone can use these to mint the NFT using `contract.signature.mint(signedPayload)`

Signature:

generateFromTokenId(payloadToSign: PayloadToSign1155WithTokenId): Promise<SignedPayload1155>;

Parameters

ParameterTypeDescription
payloadToSignPayloadToSign1155WithTokenIdthe payload to sign

Returns:

Promise<SignedPayload1155>

the signed payload and the corresponding signature

Remarks

Takes in a payload with the token ID of an existing NFT, and signs it with your private key. The generated signature can then be used to mint additional supply to the NFT using the exact payload and signature generated.