iexec-server-js-client
JS client lib to interact with iExec server REST API
Ressources
- The iExec server API doc: https://serverapi.iex.ec
- The iExec SDK
- The iExec main documentation: https://docs.iex.ec
Examples
Below are examples showcasing the use of the library in the most common worklow:
1. Create iExec client
iExec server URL:
- tesnet (ropsten / rinkeby / kovan):
https://testxw.iex.ec:443
- mainnet:
https://mainxw.iex.ec:443
const createIEXECClient = ;const iexec = ;
2. Auth
Authenticate before hitting iExec API:
iexec;
If you already have your JWT token, no need to do full auth (avoid wallet signing):
iexec;
3. Submit a work
Call the dapp smart contract "iexecSubmit" method to submit a work (for reference only, not part of this repo library):
const oracleJSON = ;const work = '{"cmdline":"10"}' const oracleContract = web3eth ;const callbackPrice = await oracleContract; const dappContract = web3eth ; // this is the work submitconst txHash = await dappContract;
4. Wait for work result
After submitting a work through Ethereum, use the transaction hash (txHash) to wait for the work result:
iexec ; // let user open this URL in the browser to download the work result