UNPKG

@iexec/iexec-oracle-factory-wrapper

Version:
65 lines (64 loc) 2.67 kB
import { Eip1193Provider, AbstractSigner, BrowserProvider } from 'ethers'; import { IExec } from 'iexec'; import { AddressOrENS, OracleValue, OracleFactoryOptions, ParamSet, Web3SignerProvider, DataType, ParamSetCID, OracleID, RawParams, CreateOracleMessage, UpdateOracleMessage } from '../types/index.js'; import { Observable } from '../utils/reactive.js'; /** * IExecOracleFactory, used to interact with oracle creation, update, and read operations. */ declare class IExecOracleFactory { private oracleContract; private oracleApp; private oracleAppWhitelist; private workerpool; private ipfsNode; private ipfsGateway; private iexec; private ethersProviderPromise; /** * Creates an instance of IExecOracleFactory. * @param ethProvider The Ethereum provider used to interact with the blockchain. * @param options Optional configuration options OracleFactory. */ constructor(ethProvider: Eip1193Provider | Web3SignerProvider | AbstractSigner | BrowserProvider, options?: OracleFactoryOptions); /** * Creates a new oracle with the provided parameters. * @param rawParams {@link RawParams} for creating the oracle. * @returns Observable {@link CreateOracleMessage} result of the creation operation. */ createOracle: (rawParams: RawParams) => Observable<CreateOracleMessage>; /** * Updates an existing oracle with new parameters or a new CID. * @param paramSetOrCid Parameters or CID of the oracle to update. * @param options Update options. * @returns Observable result of the update operation. */ updateOracle: (paramSetOrCid: ParamSet | ParamSetCID, options?: { /** * workerpool to use for the update */ workerpool?: AddressOrENS; /** * Chain ID of target blockchains for cross-chain update. */ targetBlockchains?: number[]; /** * whether to use a voucher for payment (default: false) */ useVoucher?: boolean; }) => Observable<UpdateOracleMessage>; /** * Reads an oracle with the provided ID CID or Oracle ID. * @param paramSetOrCidOrOracleId Parameters, CID or Oracle ID to read. * @param options Options for reading the oracle. * @returns Promise resolving to the oracle data. */ readOracle: (paramSetOrCidOrOracleId: ParamSet | ParamSetCID | OracleID, options?: { dataType?: DataType; }) => Promise<OracleValue>; /** * Gets the current instance of the IExec interface. * @returns Current instance of IExec. */ getIExec: () => IExec; } export { IExecOracleFactory };