Get Methods

getContractURI

Get the contract URI of the airdrop contract.

PropertyTypeDescription
Promisestringthe contract URI

Example

const contractURI = await airdropSdk.getContractURI()
// example contractURI: www.google.com

 

getFee

Get the fee of the airdrop contract. Each time when a user calls the registerTree method, they need to pay some fee to the contract.

Parameter

No parameter is needed for this method

Response

PropertyTypeDescription
PromiseBigNumberthe fee amount

Example

const fee = await airdropSdk.getFee()
// example fee: {"type":"BigNumber","hex": "0x1"}

getFeeReceiver

Get the address of the contract fee receiver who receives the contract fee when the user calls registerTree method.

Parameter

No parameter is needed for this method

Response

PropertyTypeDescription
Promisestringthe wallet address of contract fee receiver

Example

const feeReceiver = await airdropSdk.getFeeReceiver()
// example feeReceiver: 0x0CEE2872EA9E72b7eb5BE52cA34223264450AE9c

getFeeToken

Get the address of the token that the user needs to pay as the contract fee when calling the registerTree method. The token could be a zero address which represents the native token or any other ERC20 token address.

Parameter

No parameter is needed for this method

Response

PropertyTypeDescription
Promisestringthe address of the fee token of the contract

Example

const feeToken = await airdropSdk.getFeeToken()
// example feeToken: 0xEa3cdB2112886AD7361812363E4cf014A6B67277

getAdjustableFee

Get a boolean value which represents whether the fee token or the fee receiver could be set again.

Parameter

No parameter is needed for this method

Response

PropertyTypeDescription
Promisebooleanwhether the contract fee is adjustable

Example

const adjustableFee = await airdropSdk.getAdjustableFee()
// example adjustableFee: true

getAirdrop

Get the airdrop information given the ID of a registered airdrop.

Parameter

ArgumentTypeDescription
idstringthe id of the airdrop

Response

Response:

PropertyTypeDescription
PromiseAirdropthe info of airdrop

Airdrop:

FieldTypeDescription
tokenAddressstringthe address of the crypto token stored in this airdrop
ownerstringthe wallet address of the owner of the airdrop
rootstringthe root value of this airdrop
supplyBigNumberthe supply amount of the airdrop
startTimeBigNumberthe unix timestamp of the airdrop start time
endTimeBigNumberthe unix timestamp of the airdrop end time

Example

const id = 1
const airdrop = await airdropSdk.getAirdrop(id)
// example: 
// ["0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", " 0x0000000000000000000000000000000000000000000000000000000000000000", {"type":"BigNumber","hex":"0x0"}, {"type":"BigNumber","hex":"0x0"}, {"type":"BigNumber","hex":"0x0"}]

getAirdropIds

Get an array of a user's registered airdrop IDs in this contract given the user's wallet address.

Parameter

ArgumentTypeDescription
ownerAddressstringwallet address of the user

Response

PropertyTypeDescription
Promise<BigNumber[]>BigNumber[]the airdrop Id owned by the user wallet

Example

const owner = <WALLET_ADDRESS>
const ids = await airdropSdk.getAirdropIds(owner)
// example ids: 
// [["0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", " 0x0000000000000000000000000000000000000000000000000000000000000000", {"type":"BigNumber","hex":"0x0"}, {"type":"BigNumber","hex":"0x0"}, {"type":"BigNumber","hex":"0x0"}]]
Note: You may need to adjust the code to match your specific markdown rendering system or tool, as not all markdown renderers are the same.