Get Methods

getTokenAddress

Get the token address that is on sale on this presale contract.

Note: No parameter is needed for this method

Response

PropertyTypeDescription
Promisestringthe token address

Example

const tokenAddress = await presaleSdk.getTokenAddress()
// Example result:
// 0xe802376580c10fe23f027e1e19ed9d54d4c9311e

getPaymentReceiver

Get the address of the user who receivers the presale fees.

Note: No parameter is required by this method.

Response

PropertyTypeDescription
Promisestringthe wallet address of payment receiver

Example

const paymentReceiver = await presaleSdk.getPaymentReceiver()
// Example result:
// 0x0CEE2872EA9E72b7eb5BE52cA34223264450AE9c

getWhitelistEnabled

Get the boolean value of whitelistEnabled field of the contract. If this is enabled, then only the address on the whitelist of the contract could buy the presale token.

Note: No parameter is needed for this method

Response

PropertyTypeDescription
PromiseBooleanwhether the whitelist of the contract is enabled

Example

const whitelistEnabled = await presaleSdk.getWhitelistEnabled()
// Example result:
// true

getStartTime

Get the start time Unix timestamp (in seconds) of the presale contract.

Note: No parameter is needed for this method

Response

PropertyTypeDescription
PromiseBigNumberUnix timestamp of the start time of the contract

Example

const startTime = await presaleSdk.getStartTime()
// Example result:
// 1674492515

 

getEndTime

Get the end time Unix timestamp (in seconds) of the presale contract.

Parameter

No parameter is needed for this method

Response

PropertyTypeDescription
PromiseBigNumberUnix timestamp of the start time of the contract

Example

const endTime = await presaleSdk.getEndTime()
// Example Result:
// 1679941650

getEndTime

Get the end time Unix timestamp (in seconds) of the presale contract.

Parameter

No parameter is needed for this method

Response

PropertyTypeDescription
PromiseBigNumberUnix timestamp of the start time of the contract

Example

const endTime = await presaleSdk.getEndTime()
// Example Result:
// 1679941650

getWithdrawTime

Get the withdraw time Unix timestamp (in seconds) of the presale contract. A user could only withdraw the presale token they bought if it is past the withdraw time.

Parameter

No parameter is needed for this method

Response

PropertyTypeDescription
PromiseBigNumberUnix timestamp of the withdraw time of the contract

Example

const withdrawTime = await presaleSdk.getWithdrawTime()
// Example result: 
// 1679941655

getTotalSupply

Get the total supply of the presale token.

Parameter

No parameter is needed for this method

Response

PropertyTypeDescription
PromiseBigNumberthe total supply of the presale contract

Example

const totalSupply = await presaleSdk.getTotalSupply()
// example result:
// {"type":"BigNumber","hex":"0x174876e800"}

getCurrentSupply

Get the current supply of the presale token.

Note: No parameter is needed for this method

Response

PropertyTypeDescription
PromiseBigNumberthe current supply of the presale contract

Example

const currentSupply = await presaleSdk.getCurrentSupply()
// example result:
// {"type":"BigNumber","hex":"0x174876e800"}

getMaxAmountPerBuyer

Get the maximum amount of the presale token a user can purchase.

Note: No parameter is needed for this method

Response

PropertyTypeDescription
PromiseBigNumberthe maximum amount of presale token allowed to purchase

Example

const maxAmountPerBuyer = await presaleSdk.getMaxAmountPerBuyer()
// Example result:
// {"type":"BigNumber","hex":"0x174876e800"}

getMinAmountPerBuyer

Get the minimum amount of the presale token a user can purchase.

Note: No parameter is needed for this method

Response

PropertyTypeDescription
PromiseBigNumberthe minimum amount of presale token

Example

const minAmountPerBuyer = await presaleSdk.getMinAmountPerBuyer()
// Example result:
// {"type":"BigNumber","hex":"0x174876e800"}

getPaymentMethods

Get all supported ERC20 token addresses that could be used to purchase the presale token.

Note: No parameter is needed for this method

Response

PropertyTypeDescription
Promise<string[]>string[]list of supported payment token addresses

Example

const paymentMethods = await presaleSdk.getPaymentMethods()
// example result:
// 0xEa3cdB2112886AD7361812363E4cf014A6B67277

getPaymentMethodRate

Get the exchange rate of a supported ERC20 token.

Parameter

ParameterTypeDescription
paymentMethodstringThe address of the payment token.

Response

PropertyTypeDescription
Promise<TokenRate[]>TokenRate[]the exchange rate of the corresponding payment token

TokenRate

FieldTypeDescription
presaleTokenBigNumberamount of presale token that could be get from the exchange
paymentTokenBigNumberamount of payment token that needs to be spent in the exchange

Example

const rate = await presaleSdk.getPaymentMethodRate(paymentMethod)
// example Result:
// [[{"type":"BigNumber","hex":"0x1"}, {"type":"BigNumber","hex":"0x1"}]]

getWhitelistStatus

Get the boolean value which indicates whether the current user is on the whitelist of the contract. If the whitelistEnabled is false, then the whitelistStatus of any user is always true.

Parameter

ArgumentTypeDescription
walletAddressstringwallet address of the user

Response:

PropertyTypeDescription
Promisebooleanwhether the given wallet address is on the white list of the presale contract if whitelist is enabled for this contract

Example

const whitelistStatus = await presaleSdk.getWhitelistStatus(walletAddress)
// example: true

getPurchasedAmount

Get the amount of presale token a user has purchased.

Parameter

ParameterTypeDescription
walletAddressstringthe wallet address of the user

Response

PropertyTypeDescription
PromiseBigNumberthe purchased amount of presale token

Example

const purchasedAmount = await presaleSdk.getPurchasedAmount(walletAddress)
// example purchasedAmount: {"type":"BigNumber","hex":"0x1"}

getClaimableAmount

Get the amount of presale token a user could withdraw.

Parameter

ParameterTypeDescription
walletAddressstringthe wallet address of the user

Response

PropertyTypeDescription
PromiseBigNumberthe claimable amount of presale token

Example

const claimableAmount = await presaleSdk.getClaimableAmount(walletAddress)
// example claimableAmount: {"type":"BigNumber","hex":"0x1"}

getRemainingAllocation

Get the remaining amount of tokens that an address is allowed to buy.

Parameter

ArgumentTypeDescription
walletAddressstringthe wallet address of the user

Response

PropertyTypeDescription
PromiseBigNumberthe amount of the presale token the user is allowed to buy

Example

const remainingAllocation = await presaleSdk.getRemainingAllocation(walletAddress)
// example remainingAllocation: {"type":"BigNumber","hex":"0x1"}