import { Contract, ContractReceipt, ContractTransaction } from '@ethersproject/contracts'; import EventEmitter from 'eventemitter3'; import { InternalEvents, StreamrClientEventEmitter, StreamrClientEvents } from '../events'; import { LoggerFactory } from './LoggerFactory'; export interface ContractEvent { onMethodExecute: (methodName: string) => void; onTransactionSubmit: (methodName: string, tx: ContractTransaction) => void; onTransactionConfirm: (methodName: string, tx: ContractTransaction, receipt: ContractReceipt) => void; } export type ObservableContract = T & { eventEmitter: EventEmitter; }; export declare function waitForTx(txToSubmit: Promise): Promise; /** * Adds error handling, logging and limits concurrency. * * You can use the decorated contract normally, e.g.: * const tx = await contract.createFoobar(123) * return await tx.wait() * or * await contract.getFoobar(456) */ export declare const createDecoratedContract: (contract: Contract, contractName: string, loggerFactory: LoggerFactory, maxConcurrentCalls: number) => ObservableContract; export declare const queryAllReadonlyContracts: (call: (contract: C) => Promise, contracts: C[]) => Promise; export declare const initContractEventGateway: (opts: { sourceName: TSourceName; targetName: TTargetName; sourceEmitter: { on: (name: TSourceName, listener: (...args: TSourcePayloads) => void) => void; off: (name: TSourceName, listener: (...args: TSourcePayloads) => void) => void; }; targetEmitter: StreamrClientEventEmitter; transformation: (...args: TSourcePayloads) => Parameters<(StreamrClientEvents & InternalEvents)[TTargetName]>[0]; loggerFactory: LoggerFactory; }) => void;