Claim / Claim Conditions
Functionality available for contracts that implement the
IDropSinglePhase
or
IDropSinglePhase_V1
interfaces.
Enables wallets to claim (mint) tokens from the contract under specific conditions.
claim
Claim a specified number of tokens to the connected wallet.
const txResult = await contract.erc20.claim("{{amount}}");
Configuration
claimTo
The same as claim
, but allows specifying the recipient address rather than using the connected wallet.
const txResult = await contract.erc20.claimTo("{{recipient}}", "{{amount}}");
Configuration
canClaim
Check if tokens are currently available for claiming, optionally specifying if a specific wallet address can claim.
const canClaim = await contract.erc20.claimConditions.canClaim("{{quantity}}");
Configuration
getActive
Retrieve the currently active claim phase, if any.
const activePhase = await contract.erc20.claimConditions.getActive();
Configuration
getAll
Get all the claim phases configured on the drop contract.
const claimPhases = await contract.erc20.claimConditions.getAll();
Configuration
getClaimIneligibilityReasons
Get an array of reasons why a specific wallet address is not eligible to claim tokens, if any.
const reasons = await contract.erc20.getClaimIneligibilityReasons(
"{{quantity}}", // Quantity of tokens to claim
"{{wallet_address}}", // Wallet address to check
);
Configuration
getClaimTransaction
Construct a claim transaction without executing it. This is useful for estimating the gas cost of a claim transaction, overriding transaction options and having fine grained control over the transaction execution.
const claimTransaction =
await contract.erc20.claimConditions.getClaimTransaction(
"{{wallet_address}}",
"{{quantity}}",
);
Configuration
getClaimerProofs
Returns allowlist information and merkle proofs for a given wallet address.
const claimerProofs = await contract.erc20.claimConditions.getClaimerProofs(
"{{wallet_address}}",
);
Configuration
set
Overwrite the claim phases on the drop contract.
const txResult = await contract.erc20.claimConditions.set([
{
metadata: {
name: "Phase 1", // The name of the phase
},
currencyAddress: "0x...", // The address of the currency you want users to pay in
price: 1, // The price of the token in the currency specified above
maxClaimablePerWallet: 1, // The maximum number of tokens a wallet can claim
maxClaimableSupply: 100, // The total number of tokens that can be claimed in this phase
startTime: new Date(), // When the phase starts (i.e. when users can start claiming tokens)
waitInSeconds: 60 * 60 * 24 * 7, // The period of time users must wait between repeat claims
snapshot: [
{
address: "0x...", // The address of the wallet
currencyAddress: "0x...", // Override the currency address this wallet pays in
maxClaimable: 5, // Override the maximum number of tokens this wallet can claim
price: 0.5, // Override the price this wallet pays
},
],
merkleRootHash: "0x...", // The merkle root hash of the snapshot
},
]);
Configuration
update
Update a single claim phase on the drop contract, by providing the index of that phase and the new phase configuration.
The index
is the position of the phase in the list of phases you have made, starting from zero.
e.g. if you have two phases, the first phase has an index of 0
and the second phase has an index of 1
.
const txResult = await contract.erc20.claimConditions.update(
0, // The index of the phase to update
{
metadata: {
name: "Phase 1", // The name of the phase
},
currencyAddress: "0x...", // The address of the currency you want users to pay in
price: 1, // The price of the token in the currency specified above
maxClaimablePerWallet: 1, // The maximum number of tokens a wallet can claim
maxClaimableSupply: 100, // The total number of tokens that can be claimed in this phase
startTime: new Date(), // When the phase starts (i.e. when users can start claiming tokens)
waitInSeconds: 60 * 60 * 24 * 7, // The period of time users must wait between repeat claims
snapshot: [
{
address: "0x...", // The address of the wallet
currencyAddress: "0x...", // Override the currency address this wallet pays in
maxClaimable: 5, // Override the maximum number of tokens this wallet can claim
price: 0.5, // Override the price this wallet pays
},
],
merkleRootHash: "0x...", // The merkle root hash of the snapshot
},
);