Erc20SignatureMintable
Enables generating ERC20 Tokens with rules and an associated signature, which can then be minted by anyone securely
class Erc20SignatureMintable implements DetectableFeature {}
function constructor( contractWrapper: ContractWrapper<TokenERC20>, TokenERC20, "metadata" | "transfer" | "minter" | "admin" >,
TokenERC20, "metadata" | "transfer" | "minter" | "admin">;
Generate a signature that can be used to mint a certain amount of tokens
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.
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 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 = await contract.erc20.signature.generate(payload);// now anyone can use these to mint the NFT using `contract.erc20.signature.mint(signedPayload)`
function generate(mintRequest: { currencyAddress?: string; mintEndTime?: number | Date; mintStartTime?: number | Date; price?: string | number; primarySaleRecipient?: string; quantity: string | number; to: string; uid?: string;
The signed payload and the corresponding signature
Generate a batch of signatures that can be used to mint many token signatures.
See Erc20SignatureMintable.generate
function generateBatch( payloadsToSign: Array<{ currencyAddress?: string; mintEndTime?: number | Date; mintStartTime?: number | Date; price?: string | number; primarySaleRecipient?: string; quantity: string | number; to: string; uid?: string; }>,
An array of payloads and signatures
Verify that a payload is correctly signed
Preparable
You can also prepare the transaction without executing it by calling mint.prepare()
with same arguments.Learn more
function mintBatch(): Promise<TResult>;
Preparable
You can also prepare the transaction without executing it by calling mintBatch.prepare()
with same arguments.Learn more
let featureName: "ERC20SignatureMintable";