Private
_chainBurn tokens
Rest
...args: [amount: string | number]Burn tokens held by the connected wallet
// The amount of this token you want to burn
const amount = 1.2;
await contract.erc20.burn(amount);
ERC20Burnable
Rest
...args: [amount: string | number]Burn tokens from a specific wallet
Rest
...args: [holder: string, amount: string | number]Burn tokens held by the specified wallet
// Address of the wallet sending the tokens
const holderAddress = "{{wallet_address}}";
// The amount of this token you want to burn
const amount = 1.2;
await contract.erc20.burnFrom(holderAddress, amount);
ERC20Burnable
Rest
...args: [holder: string, amount: string | number]Private
burnableClaim tokens
Rest
...args: [amount: string | number, options?: ClaimOptions]Let the specified wallet claim Tokens.
const address = "{{wallet_address}}"; // address of the wallet you want to claim the NFTs
const quantity = 42.69; // how many tokens you want to claim
const tx = await contract.erc20.claim(address, quantity);
const receipt = tx.receipt; // the transaction receipt
ERC20ClaimPhasesV2 | ERC20ClaimPhasesV1 | ERC20ClaimConditionsV2 | ERC20ClaimConditionsV1
Rest
...args: [amount: string | number, options?: ClaimOptions]Claim tokens to a specific wallet
Rest
...args: [destinationAddress: string, amount: string | number, options?: ClaimOptions]Let the specified wallet claim Tokens.
const address = "{{wallet_address}}"; // address of the wallet you want to claim the NFTs
const quantity = 42.69; // how many tokens you want to claim
const tx = await contract.erc20.claim(address, quantity);
const receipt = tx.receipt; // the transaction receipt
ERC20ClaimPhasesV2 | ERC20ClaimPhasesV1 | ERC20ClaimConditionsV2 | ERC20ClaimConditionsV1
Rest
...args: [destinationAddress: string, amount: string | number, options?: ClaimOptions]Protected
contractPrivate
droppableMint tokens
Rest
...args: [amount: string | number]Mint tokens to the connected wallet.
const amount = "1.5"; // The amount of this token you want to mint
await contract.erc20.mint(amount);
ERC20Mintable
Rest
...args: [amount: string | number]Mint tokens to many wallets
Rest
...args: [args: { Mint tokens to many wallets in one transaction.
// Data of the tokens you want to mint
const data = [
{
toAddress: "{{wallet_address}}", // Address to mint tokens to
amount: 0.2, // How many tokens to mint to specified address
},
{
toAddress: "0x...",
amount: 1.4,
}
]
await contract.mintBatchTo(data);
ERC20BatchMintable
Rest
...args: [args: { Mint tokens to a specific wallet
Rest
...args: [receiver: string, amount: string | number]Mint tokens to a specified address.
const toAddress = "{{wallet_address}}"; // Address of the wallet you want to mint the tokens to
const amount = "1.5"; // The amount of this token you want to mint
await contract.erc20.mintTo(toAddress, amount);
ERC20Mintable
Rest
...args: [receiver: string, amount: string | number]Private
mintableMint tokens
Set token allowance
Rest
...args: [spender: string, amount: string | number]Allows the specified spender
wallet to transfer the given amount
of tokens to another wallet
// Address of the wallet to allow transfers from
const spenderAddress = "0x...";
// The number of tokens to give as allowance
const amount = 100
await contract.erc20.setAllowance(spenderAddress, amount);
ERC20
Rest
...args: [spender: string, amount: string | number]Private
signatureProtected
storageTransfer tokens
Rest
...args: [to: string, amount: string | number]Transfer tokens from the connected wallet to another wallet.
// Address of the wallet you want to send the tokens to
const toAddress = "0x...";
// The amount of tokens you want to send
const amount = 0.1;
await contract.erc20.transfer(toAddress, amount);
ERC20
Rest
...args: [to: string, amount: string | number]Transfer tokens to many wallets
Rest
...args: [args: { Mint tokens from the connected wallet to many wallets
// Data of the tokens you want to mint
const data = [
{
toAddress: "{{wallet_address}}", // Address to mint tokens to
amount: 100, // How many tokens to mint to specified address
},
{
toAddress: "0x...",
amount: 100,
}
]
await contract.erc20.transferBatch(data);
Rest
...args: [args: { Transfer tokens from a specific address
Rest
...args: [from: string, to: string, amount: string | number]Transfer tokens from one wallet to another
// Address of the wallet sending the tokens
const fromAddress = "{{wallet_address}}";
// Address of the wallet you want to send the tokens to
const toAddress = "0x...";
// The number of tokens you want to send
const amount = 1.2
// Note that the connected wallet must have approval to transfer the tokens of the fromAddress
await contract.erc20.transferFrom(fromAddress, toAddress, amount);
ERC20
Rest
...args: [from: string, to: string, amount: string | number]Configure claim conditions
Define who can claim NFTs in the collection, when and how many.
const presaleStartTime = new Date();
const publicSaleStartTime = new Date(Date.now() + 60 * 60 * 24 * 1000);
const claimConditions = [
{
startTime: presaleStartTime, // start the presale now
maxClaimableSupply: 2, // limit how many mints for this presale
price: 0.01, // presale price
snapshot: ['0x...', '0x...'], // limit minting to only certain addresses
},
{
startTime: publicSaleStartTime, // 24h after presale, start public sale
price: 0.08, // public sale price
}
]);
await contract.erc20.claimConditions.set(claimConditions);
ERC20ClaimPhasesV2 | ERC20ClaimPhasesV1 | ERC20ClaimConditionsV2 | ERC20ClaimConditionsV1
Mint with signature
Generate dynamic tokens with your own signature, and let others mint them using that signature.
// see how to craft a payload to sign in the `contract.erc20.signature.generate()` documentation
const signedPayload = contract.erc20.signature().generate(payload);
// now the payload can be used to mint tokens
const tx = contract.erc20.signature.mint(signedPayload);
ERC20SignatureMintable
Get token allowance
The allowance of one wallet over anothers funds.
Get the allowance of a 'spender' wallet over the connected wallet's funds - the allowance of a different address for a token is the amount of tokens that the spender
wallet is allowed to spend on behalf of the connected wallet.
// Address of the wallet to check token allowance
const spenderAddress = "0x...";
const allowance = await contract.erc20.allowance(spenderAddress);
ERC20
Get token allowance of a specific wallet
The allowance of one wallet over anothers funds.
Get the allowance of one wallet over another wallet's funds - the allowance of a different address for a token is the amount of tokens that the wallet is allowed to spend on behalf of the specified wallet.
// Address of the wallet who owns the funds
const owner = "{{wallet_address}}";
// Address of the wallet to check token allowance
const spender = "0x...";
const allowance = await contract.erc20.allowanceOf(owner, spender);
ERC20
Get token balance for the currently connected wallet
The balance of a specific wallet.
Get a wallets token balance.
const balance = await contract.erc20.balance();
ERC20
Get token balance for a specific wallet
The balance of a specific wallet.
Get a wallets token balance.
const walletAddress = "{{wallet_address}}";
const balance = await contract.erc20.balanceOf(walletAddress);
ERC20
Private
detectPrivate
detectPrivate
detectPrivate
detectConstruct a mint transaction without executing it
Address you want to send the token to
The amount of tokens you want to mint
This is useful for estimating the gas cost of a mint transaction, overriding transaction options and having fine grained control over the transaction execution.
Use contract.erc20.mint.prepare(...args)
instead
ERC20Mintable
Get the total supply for this token
Get how much supply has been minted
const balance = await contract.erc20.totalSupply();
ERC20
Generated using TypeDoc
Standard ERC20 Token functions
Remarks
Basic functionality for a ERC20 contract that handles all unit transformation for you.
Example