import { Err } from "./errors"; import { ITransactionFetcher } from "./interfaces"; import { TransactionEvent } from "./transactionEvents"; import { TransactionOnNetwork } from "./transactionOnNetwork"; import { TransactionStatus } from "./transactionStatus"; export declare type PredicateIsAwaitedStatus = (status: TransactionStatus) => boolean; /** * TransactionWatcher allows one to continuously watch (monitor), by means of polling, the status of a given transaction. */ export declare class TransactionWatcher { private static DefaultPollingInterval; private static DefaultTimeout; private static DefaultPatience; static NoopOnStatusReceived: (_: TransactionStatus) => void; protected readonly fetcher: ITransactionFetcher; protected readonly pollingIntervalMilliseconds: number; protected readonly timeoutMilliseconds: number; protected readonly patienceMilliseconds: number; /** * A transaction watcher (awaiter). * * @param fetcher The transaction fetcher * @param options The options * @param options.pollingIntervalMilliseconds The polling interval, in milliseconds * @param options.timeoutMilliseconds The timeout, in milliseconds * @param options.patienceMilliseconds The patience: an extra time (in milliseconds) to wait, after the transaction has reached its desired status. Currently there's a delay between the moment a transaction is marked as "completed" and the moment its outcome (contract results, events and logs) is available. */ constructor(fetcher: ITransactionFetcher, options?: { pollingIntervalMilliseconds?: number; timeoutMilliseconds?: number; patienceMilliseconds?: number; }); /** * Waits until the transaction reaches the "pending" status. * @param txHash The hex-encoded transaction hash */ awaitPending(txHash: string): Promise; /** * Waits until the transaction is completely processed. * @param txHash The transaction hash */ awaitCompleted(txHash: string): Promise; awaitAllEvents(txHash: string, events: string[]): Promise; awaitAnyEvent(txHash: string, events: string[]): Promise; awaitOnCondition(txHash: string, condition: (data: TransactionOnNetwork) => boolean): Promise; protected awaitConditionally(isSatisfied: (data: TData) => boolean, doFetch: () => Promise, createError: () => Err): Promise; protected getAllTransactionEvents(transaction: TransactionOnNetwork): TransactionEvent[]; }