Exchange bot API¶
Module: gex.bot()
Exchange¶
Exchange eth to gex¶
Method: depositEth(value)
Type: transaction
Params:
- value: eth value (in wei) that you want to change to gex tokens.
Returns:
- Promise: Javascript promise object.
Usage:
let ethVal = 10; let weiVal = gex.w3.web3.utils.toWei(ethVal); let promiseRes = gex.bot().depositEth(weiVal);
Exchange gex to eth¶
Method: depositGex(value)
Type: transaction
Params:
- value: gex tokens amount that you want to change to eth.
Returns:
- Promise: Javascript promise object.
Usage:
let gexTokensToChange = 100; let weiGexVal = gex.w3.web3.utils.toWei(gexTokensToChange); let promiseRes = gex.bot().depositGex(weiGexVal);
Return eth from bot balance¶
Method: returnEth()
Type: transaction
Returns:
- Promise: Javascript promise object.
Usage:
let promiseRes = gex.bot().returnEth();
Return gex from bot balance¶
Method: returnGex()
Type: transaction
Returns:
- Promise: Javascript promise object.
Usage:
let promiseRes = gex.bot().returnGex();
Info¶
Get info for account¶
Method: getInfoForAccount(account)
Type: call
Params:
- account: Ethereum account address in format '0x000..... (optional)
If you don't send account param, accounts[0] from your web3 provider will be taken
Returns:
- Promise that resolves in Object:
{
active: bool,
amountEth: string,
amountGex: string,
loanEth: 'string,
loanGex: string,
sendEth: string,
sendGex: string
}
Usage:
let account = '0x0000...'; let accountInfo = await gex.bot().getInfoForAccount(account); // or let defaultAccountInfo = await gex.bot().getInfoForAccount();
Events¶
Message¶
Message event is used for most call results.
Structure:
event Message(
string inf,
address sender,
uint88 value
)