@myria/airdrop-js
Version:
Airdrop in L1 with claim based approach
35 lines (34 loc) • 3.13 kB
TypeScript
/**
* Collection of wrapper functions which include single functions in core to simplify consumers's integration like plug (config in) and play
* @module Transaction/Wrapper
*/
import { ThirdwebContract } from 'thirdweb';
import { Account, ApproveWhitelistAndAllowanceResult, ExtraGasOptions, RetryOptions, SaveMerkleTreeResult } from '../type';
/**
* Wrapper function: Airdrop's owner approve whitelist to save on-chain include both setMerkleRoot and saveSnapshot
*
* @param {Account} account - The Account represent as sender @see {@link https://ethereum.org/en/glossary/#account|Account's Ethereum}.
* @param {string} merkleRoot - The generated merkleRoot from whitelist @see {@link generateMerkleTreeInfoERC20ForWhitelist|Generate merkleRoot}
* @param {string} snapshotUri - The generated snapshotUri from whitelist @see {@link generateMerkleTreeInfoERC20ForWhitelist|Generate snapshotUri}
* @param {ThirdwebContract} airdropContract - The airdrop Thirdweb contract.
* @param {Address} tokenAddress - The token address to claim.
* @param {RetryOptions} retryOptions - The configuration on retry
* @param {ExtraGasOptions} extraGasOptions - The extra gas options bidding for your transaction to be included in the next block.
* @returns {Promise<SaveMerkleTreeResult>} A promise that resolves to the confirmed transaction hashes accordingly.
*/
export declare function saveMerkleTreeByOwner(account: Account, merkleRoot: string, snapshotUri: string, airdropContract: ThirdwebContract, tokenAddress: string, retryOptions?: RetryOptions, extraGasOptions?: ExtraGasOptions): Promise<SaveMerkleTreeResult>;
/**
* Wrapper function: Owner approve the whitelist on behalf of Airdrop's contract owner and approve allowance on behalf of Token's contract owner.
*
* @param {Account} account - The Account represent as sender @see {@link https://ethereum.org/en/glossary/#account|Account's Ethereum}.
* @param {string} merkleRoot - The generated merkleRoot from whitelist @see {@link generateMerkleTreeInfoERC20ForWhitelist|Generate merkleRoot}
* @param {string} snapshotUri - The generated snapshotUri from whitelist @see {@link generateMerkleTreeInfoERC20ForWhitelist|Generate snapshotUri}
* @param {ThirdwebContract} airdropContract - The airdrop Thirdweb contract.
* @param {ThirdwebContract} tokenContract - The token Thirdweb contract to airdrop
* @param {number} totalAmount - The total airdrop amount in ether format.
* @param {RetryOptions} retryOptions - The configuration on retry
* @param {ExtraGasOptions} extraGasOptions - The extra gas options bidding for your transaction to be included in the next block.
* @returns {Promise<ApproveWhitelistAndAllowanceResult>} A promise that resolves to the confirmed transaction hashes accordingly.
* @throws An error if the totalAmount <= 0.
*/
export declare function approveWhitelistAndAllowance(account: Account, merkleRoot: string, snapshotUri: string, airdropContract: ThirdwebContract, tokenContract: ThirdwebContract, totalAmount: number, retryOptions?: RetryOptions, extraGasOptions?: ExtraGasOptions): Promise<ApproveWhitelistAndAllowanceResult>;