1 | import { TransactionReceipt } from "./types";
|
2 |
|
3 | type PromiEventType = "transactionHash" | "receipt" | "confirmation" | "error";
|
4 |
|
5 | export default interface PromiEvent<T> extends Promise<T> {
|
6 | once(
|
7 | type: "transactionHash",
|
8 | handler: (receipt: string) => void
|
9 | ): PromiEvent<T>;
|
10 | once(
|
11 | type: "receipt",
|
12 | handler: (receipt: TransactionReceipt) => void
|
13 | ): PromiEvent<T>;
|
14 | once(
|
15 | type: "confirmation",
|
16 | handler: (confNumber: number, receipt: TransactionReceipt) => void
|
17 | ): PromiEvent<T>;
|
18 | once(type: "error", handler: (error: Error) => void): PromiEvent<T>;
|
19 | once(
|
20 | type: PromiEventType,
|
21 | handler: (error: Error | TransactionReceipt | string) => void
|
22 | ): PromiEvent<T>;
|
23 | on(
|
24 | type: "transactionHash",
|
25 | handler: (receipt: string) => void
|
26 | ): PromiEvent<T>;
|
27 | on(
|
28 | type: "receipt",
|
29 | handler: (receipt: TransactionReceipt) => void
|
30 | ): PromiEvent<T>;
|
31 | on(
|
32 | type: "confirmation",
|
33 | handler: (confNumber: number, receipt: TransactionReceipt) => void
|
34 | ): PromiEvent<T>;
|
35 | on(type: "error", handler: (error: Error) => void): PromiEvent<T>;
|
36 | on(
|
37 | type: "error" | "confirmation" | "receipt" | "transactionHash",
|
38 | handler: (error: Error | TransactionReceipt | string) => void
|
39 | ): PromiEvent<T>;
|
40 | }
|