Skip to content

Getting Started ​

GitHub package.json version

Overview ​

Prerequisites ​

Before getting started, ensure that you have the following installed on your system:

- Node.js version 18 or higher

- NPM (Node.js package manager)

Start a new project ​

In this section, we will show you how to set up and call the different methods of the SDK in JS app.

You can reach the following open-source GitHub project, clone it and start from there.

You can find the project here.

Installation ​

sh
npm install @iexec/iexec-oracle-factory-wrapper
sh
yarn add @iexec/iexec-oracle-factory-wrapper
sh
pnpm add @iexec/iexec-oracle-factory-wrapper
sh
bun add @iexec/iexec-oracle-factory-wrapper

This package is an ESM package. Your project needs to use ESM too.Read more.

When deployed with WebPack, the Web3Mail tool requires WebPack version 5 or greater. You can refer to our sample WebPack project for more information.

Instantiate SDK ​

Import and initialize the Oracle Factory SDK in your application.

js
import { IExecOracleFactory } from '@iexec/iexec-oracle-factory-wrapper';

const web3Provider = window.ethereum;
// instantiate
const factory = new IExecOracleFactory(web3Provider);
js
import { IExecOracleFactory, utils } from '@iexec/iexec-oracle-factory-wrapper';

const { PRIVATE_KEY } = process.env;
// get web3 provider from a private key
const signer = utils.getSignerFromPrivateKey(
  'https://bellecour.iex.ec',
  'your-private-key'
);
const factory = new IExecOracleFactory(signer);

Instantiate only IExecOracleReader ​

Import and initialize the IExecOracleReader from the Oracle Factory SDK in your application.

js
import { IExecOracleReader } from '@iexec/iexec-oracle-factory-wrapper';

// instantiate
const mainnetBlockchainReader = new IExecOracleReader('mainnet');
js
import { IExecOracleReader } from '@iexec/iexec-oracle-factory-wrapper';

// instantiate
const mainnetBlockchainReader = new IExecOracleReader('mainnet');

TIP

You can initialize the IExecOracleReader with the blockchain name or the chain id or even your custom blockchain endpoint.

Supported blockchains:

blockchain namechainID
mainnet1
bellecour134
polygon137
mumbai80001

Sandbox ​

⚑  Code Sandbox

Corresponding GitHub repository:

πŸ”Ž Β GitHub repository sandbox