ERC20 - Signature-Based Minting
You can utilize these features of the SDK on your contract if it implements SignatureMintERC20.
Generate a signature
Generate a signature that can be utilized to mint tokens by another wallet.
The signature specifies any information about the tokens such as the price and currency.
The generation of signatures requires the wallet to have the MINTER
role on the contract by default.
- React
- Javascript
- Python
- Go
- Unity
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)`
This snippet is for v3 of the SDK. Learn how to upgrade.
View in React SDK Documentationconst 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)`
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 quantity = "1";
var payload = new ERC20MintPayload(connectedAddress, quantity);
var signature = await contract.ERC20.signature.Generate(payload);
Use a signature to mint tokens
Mint a certain amount of tokens from a previously generated signature.
- React
- Javascript
- Python
- Go
- Unity
// see how to craft a payload to sign in the `generate()` documentation
const signedPayload = contract.erc20.signature.generate(payload);
// Use the signed payload to mint the tokens
const tx = contract.erc20.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.erc20.signature.generate(payload);
// Use the signed payload to mint the tokens
const tx = contract.erc20.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 above to pass into the Mint method.
var nft = await contract.ERC20.signature.Mint(signature);