UNPKG

@atomiqlabs/chain-evm

Version:

EVM specific base implementation

43 lines (42 loc) 2.21 kB
import { BaseContract } from "ethers"; import { EVMEvents } from "../../chain/modules/EVMEvents"; import { EVMContractBase } from "../EVMContractBase"; import { EVMChainInterface } from "../../chain/EVMChainInterface"; import { TypedEventLog } from "../../typechain/common"; export declare class EVMContractEvents<T extends BaseContract> extends EVMEvents { readonly contract: EVMContractBase<T>; readonly baseContract: T; constructor(chainInterface: EVMChainInterface<any>, contract: EVMContractBase<T>); private toTypedEvents; private toFilter; /** * Returns the events occuring in a range of EVM blocks as identified by the contract and keys, * returns pending events if no startHeight & endHeight is passed * * @param events * @param keys * @param startBlockHeight * @param endBlockHeight */ getContractBlockEvents<TEventName extends keyof T["filters"]>(events: TEventName[], keys: string[], startBlockHeight?: number, endBlockHeight?: number): Promise<TypedEventLog<T["filters"][TEventName]>[]>; /** * Runs a search backwards in time, processing the events for a specific topic public key * * @param events * @param keys * @param processor called for every event, should return a value if the correct event was found, or null * if the search should continue * @param abortSignal */ findInContractEvents<TResult, TEventName extends keyof T["filters"]>(events: TEventName[], keys: string[], processor: (event: TypedEventLog<T["filters"][TEventName]>) => Promise<TResult>, abortSignal?: AbortSignal): Promise<TResult>; /** * Runs a search forwards in time, processing the events for a specific topic * * @param events * @param keys * @param processor called for every event, should return a value if the correct event was found, or null * if the search should continue * @param abortSignal */ findInContractEventsForward<TResult, TEventName extends keyof T["filters"]>(events: TEventName[], keys: string[], processor: (event: TypedEventLog<T["filters"][TEventName]>) => Promise<TResult>, abortSignal?: AbortSignal): Promise<TResult>; }