/
index.d.ts
155 lines (155 loc) · 6.18 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
import { BytesLike } from "@ethersproject/bytes";
import { Network } from "@ethersproject/networks";
import { Deferrable, Description } from "@ethersproject/properties";
import { AccessListish, Transaction } from "@ethersproject/transactions";
import { OnceBlockable } from "@ethersproject/web";
export declare type TransactionRequest = {
to?: string;
from?: string;
nonce?: BigNumberish;
gasLimit?: BigNumberish;
gasPrice?: BigNumberish;
data?: BytesLike;
value?: BigNumberish;
chainId?: number;
type?: number;
accessList?: AccessListish;
maxPriorityFeePerGas?: BigNumberish;
maxFeePerGas?: BigNumberish;
customData?: Record<string, any>;
ccipReadEnabled?: boolean;
};
export interface TransactionResponse extends Transaction {
hash: string;
blockNumber?: number;
blockHash?: string;
timestamp?: number;
confirmations: number;
from: string;
raw?: string;
wait: (confirmations?: number) => Promise<TransactionReceipt>;
}
export declare type BlockTag = string | number;
export interface _Block {
hash: string;
parentHash: string;
number: number;
timestamp: number;
nonce: string;
difficulty: number;
_difficulty: BigNumber;
gasLimit: BigNumber;
gasUsed: BigNumber;
miner: string;
extraData: string;
baseFeePerGas?: null | BigNumber;
}
export interface Block extends _Block {
transactions: Array<string>;
}
export interface BlockWithTransactions extends _Block {
transactions: Array<TransactionResponse>;
}
export interface Log {
blockNumber: number;
blockHash: string;
transactionIndex: number;
removed: boolean;
address: string;
data: string;
topics: Array<string>;
transactionHash: string;
logIndex: number;
}
export interface TransactionReceipt {
to: string;
from: string;
contractAddress: string;
transactionIndex: number;
root?: string;
gasUsed: BigNumber;
logsBloom: string;
blockHash: string;
transactionHash: string;
logs: Array<Log>;
blockNumber: number;
confirmations: number;
cumulativeGasUsed: BigNumber;
effectiveGasPrice: BigNumber;
byzantium: boolean;
type: number;
status?: number;
}
export interface FeeData {
maxFeePerGas: null | BigNumber;
maxPriorityFeePerGas: null | BigNumber;
gasPrice: null | BigNumber;
}
export interface EventFilter {
address?: string;
topics?: Array<string | Array<string> | null>;
}
export interface Filter extends EventFilter {
fromBlock?: BlockTag;
toBlock?: BlockTag;
}
export interface FilterByBlockHash extends EventFilter {
blockHash?: string;
}
export declare abstract class ForkEvent extends Description {
readonly expiry: number;
readonly _isForkEvent?: boolean;
static isForkEvent(value: any): value is ForkEvent;
}
export declare class BlockForkEvent extends ForkEvent {
readonly blockHash: string;
readonly _isBlockForkEvent?: boolean;
constructor(blockHash: string, expiry?: number);
}
export declare class TransactionForkEvent extends ForkEvent {
readonly hash: string;
readonly _isTransactionOrderForkEvent?: boolean;
constructor(hash: string, expiry?: number);
}
export declare class TransactionOrderForkEvent extends ForkEvent {
readonly beforeHash: string;
readonly afterHash: string;
constructor(beforeHash: string, afterHash: string, expiry?: number);
}
export declare type EventType = string | Array<string | Array<string>> | EventFilter | ForkEvent;
export declare type Listener = (...args: Array<any>) => void;
export declare abstract class Provider implements OnceBlockable {
abstract getNetwork(): Promise<Network>;
abstract getBlockNumber(): Promise<number>;
abstract getGasPrice(): Promise<BigNumber>;
getFeeData(): Promise<FeeData>;
abstract getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;
abstract getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;
abstract getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
abstract getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
abstract sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
abstract call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
abstract estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
abstract getBlockWithTransactions(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<BlockWithTransactions>;
abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;
abstract getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
abstract getLogs(filter: Filter): Promise<Array<Log>>;
abstract resolveName(name: string | Promise<string>): Promise<null | string>;
abstract lookupAddress(address: string | Promise<string>): Promise<null | string>;
abstract on(eventName: EventType, listener: Listener): Provider;
abstract once(eventName: EventType, listener: Listener): Provider;
abstract emit(eventName: EventType, ...args: Array<any>): boolean;
abstract listenerCount(eventName?: EventType): number;
abstract listeners(eventName?: EventType): Array<Listener>;
abstract off(eventName: EventType, listener?: Listener): Provider;
abstract removeAllListeners(eventName?: EventType): Provider;
addListener(eventName: EventType, listener: Listener): Provider;
removeListener(eventName: EventType, listener: Listener): Provider;
abstract waitForTransaction(transactionHash: string, confirmations?: number, timeout?: number): Promise<TransactionReceipt>;
readonly _isProvider: boolean;
constructor();
static isProvider(value: any): value is Provider;
}
//# sourceMappingURL=index.d.ts.map