Getting Started β
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)
Installation β
sh
npm install @iexec/web3mail
sh
yarn add @iexec/web3mail
sh
pnpm add @iexec/web3mail
sh
bun add @iexec/web3mail
This package is an ESM package. Your project needs to use ESM too. Β Read more
If you use it with Webpack, some polyfills will be needed. You can find a working project here.
Instantiate with a Web3 provider β
ts
import { IExecWeb3mail } from '@iexec/web3mail';
const web3Provider = window.ethereum;
// instantiate
const web3mail = new IExecWeb3mail(web3Provider);
ts
import { IExecWeb3mail, getWeb3Provider } from '@iexec/web3mail';
// get web3 provider from a private key
const web3Provider = getWeb3Provider('YOUR_PRIVATE_KEY');
// instantiate
const web3mail = new IExecWeb3mail(web3Provider);
Instantiate without a Web3 provider β
For projects that only require read functions, you can instantiate the SDK without a Web3 provider.
ts
import { IExecWeb3mail } from '@iexec/web3mail';
// instantiate
const web3mail = new IExecWeb3mail();
ts
import { IExecWeb3mail, getWeb3Provider } from '@iexec/web3mail';
// instantiate
const web3mail = new IExecWeb3mail();
Sandbox β
β‘ Β Code SandboxCorresponding GitHub repository:
π Β GitHub repository sandbox