Erc20SignatureMintable.generate() method
Generate a signature that can be used to mint a certain amount of tokens
Example
const startTime = new Date();
const endTime = new Date(Date.now() + 60 * 60 * 24 * 1000);
const payload = {
quantity: 4.2, // The quantity of tokens to be minted
to: {{wallet_address}}, // Who will receive the tokens (or AddressZero for anyone)
price: 0.5, // the price to pay for minting those tokens
currencyAddress: NATIVE_TOKEN_ADDRESS, // the currency to pay with
mintStartTime: startTime, // can mint anytime from now
mintEndTime: endTime, // to 24h from now,
primarySaleRecipient: "0x...", // custom sale recipient for this token mint
};
const signedPayload = contract.signature.generate(payload);
// now anyone can use these to mint the NFT using `contract.signature.mint(signedPayload)`
Signature:
generate(mintRequest: PayloadToSign20): Promise<SignedPayload20>;
Parameters
Parameter | Type | Description |
---|---|---|
mintRequest | PayloadToSign20 | the payload to sign |
Returns:
Promise<SignedPayload20>
the signed payload and the corresponding signature
Remarks
Takes in a quantity of tokens, some conditions for how it can be minted and signs it with your private key. The generated signature can then be used to mint those tokens using the exact payload and signature generated.