export type * from '../common/types.js'; export type * from './IExecConfig.js'; import IExecContractsClient from '../common/utils/IExecContractsClient.js'; import { AbstractProvider, AbstractSigner, BrowserProvider } from 'ethers'; export interface Eip1193Provider { request(request: { method: string; params?: Array | Record; }): Promise; } export interface IExecConfigArgs { /** * A web3 Eth provider, a network name, a chain id or an ethers provider * * read-only provider examples: * - `"arbitrum-sepolia-testnet"` or `421614` or `"421614"` for arbitrum sepolia testnet provider * - `"arbitrum-mainnet"` or `42161` or `"42161"` for arbitrum mainnet provider * - `"http://localhost:8545"` for local chain * - `new ethers.JsonRpcProvider("https://")` ethers provider connected to your RPC provider * * signer provider examples: * - `window.ethereum` for browser injected wallet provider * - `utils.getSignerFromPrivateKey('arbitrum-sepolia-testnet', PRIVATE_KEY)` signer connected to arbitrum sepolia testnet using a private key * - `new ethers.Wallet(PRIVATE_KEY, new ethers.JsonRpcProvider("https://"))` ethers wallet connected to a specific network */ ethProvider: | Eip1193Provider | AbstractProvider | AbstractSigner | BrowserProvider | string | number; } export interface IExecConfigOptions { /** * override the IExec contract address to target a custom instance */ hubAddress?: string; /** * override the SMS URL to target a custom instance */ smsURL?: string; /** * override the IPFS gateway URL to target a custom instance */ ipfsGatewayURL?: string; /** * override the IPFS node URL to target a custom instance */ ipfsNodeURL?: string; /** * override the IExec market URL to target a custom instance */ iexecGatewayURL?: string; /** * @experimental * override the compass URL to target a custom instance */ compassURL?: string; /** * override the PoCo subgraph URL to target a custom instance */ pocoSubgraphURL?: string; /** * number of block to wait for transactions confirmation (default 1) */ confirms?: number; /** * if true allows using a provider connected to an experimental networks (default false) * * ⚠️ experimental networks are networks on which the iExec's stack is partially deployed, experimental networks can be subject to instabilities or discontinuity. Access is provided without warranties. */ allowExperimentalNetworks?: boolean; } /** * configuration for IExecModule * * example: * ```js * // create the configuration * const config = new IExecConfig({ ethProvider: window.ethereum }); * * // instantiate iExec SDK * const iexec = IExec.fromConfig(config); * * // or instantiate IExecModules sharing the same configuration * const account = IExecAccountModule.fromConfig(config); * const wallet = IExecWalletModule.fromConfig(config); * ``` */ export default class IExecConfig { /** * Create an IExecConfig instance consumable by IExecModules * * example: * * - using injected provider client side * * ```js * const config = new IExecConfig({ ethProvider: window.ethereum }); * ``` * * - using a private key server side * * ```js * import { getSignerFromPrivateKey } from 'iexec/utils'; * const config = new IExecConfig({ ethProvider: getSignerFromPrivateKey('arbitrum-sepolia-testnet', privateKey) }); * ``` */ constructor(args: IExecConfigArgs, options?: IExecConfigOptions); /** * resolve the current chainId */ resolveChainId(): Promise; /** * resolve the current IExecContractsClient */ resolveContractsClient(): Promise; /** * resolve the current SMS URL */ resolveSmsURL(): Promise; /** * resolve the current IExec market URL */ resolveIexecGatewayURL(): Promise; /** * @experimental * resolve the current Compass URL */ resolveCompassURL(): Promise; /** * resolve the current IPFS gateway URL */ resolveIpfsGatewayURL(): Promise; /** * resolve the current IPFS node URL */ resolveIpfsNodeURL(): Promise; /** * resolve the current PoCo subgraph URL */ resolvePocoSubgraphURL(): Promise; }