zilswap-sdk / Exports / zilo / Zilo
Zilo class to represent an instance of a ZilSwap Initial Launch Offering.
Usage:
const zilswap = new Zilswap(Network.TestNet)
await zilswap.initialize()
const zilo = await zilswap.registerZilo(ZILO_ADDRESS, ziloStateObserver)
const ziloState = zilo.getZiloState()
if (ziloState.state === ILOState.Active) {
const amount = new BigNumber(1).shiftedBy(ZIL_DECIMALS).toString(10)
const tx = await zilo.contribute(amount)
console.log("distribute TX sent", tx.hash)
} else {
console.log("ZILO not yet active")
}
• new Zilo(zilswap
, address
)
Name | Type |
---|---|
zilswap |
Zilswap |
address |
string |
▸ claim(): Promise
<null
| ObservedTx>
Execute claim function if user contributed
Promise
<null
| ObservedTx>
▸ complete(): Promise
<null
| ObservedTx>
Promise
<null
| ObservedTx>
▸ contribute(amountToContributeStr
): Promise
<null
| ObservedTx>
Contribute to the ILO, may need to increase token allowance before proceeding
Name | Type | Description |
---|---|---|
amountToContributeStr |
string |
is the exact amount of ZIL to be contribute as a unitless string (without decimals). |
Promise
<null
| ObservedTx>
▸ getZiloState(): ZiloAppState
▸ initialize(observer?
): Promise
<void>
Name | Type |
---|---|
observer? |
OnStateUpdate |
Promise
<void>
▸ updateBlockHeight(height?
): Promise
<void>
Name | Type |
---|---|
height? |
number |
Promise
<void>
▸ updateObserver(observer?
): void
Name | Type |
---|---|
observer? |
OnStateUpdate |
void
▸ updateZiloState(): Promise
<void>
Promise
<void>