essential-eth 0.10.3 → 0.10.4-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/dist/index.cjs +2024 -0
  2. package/dist/index.d.cts +330 -0
  3. package/dist/index.d.ts +330 -0
  4. package/dist/index.js +1952 -0
  5. package/package.json +13 -14
  6. package/dist/cjs/classes/Contract.d.ts +0 -81
  7. package/dist/cjs/classes/Contract.js +0 -139
  8. package/dist/cjs/classes/test/Contract/crv-abi.d.ts +0 -2
  9. package/dist/cjs/classes/test/Contract/crv-abi.js +0 -413
  10. package/dist/cjs/classes/test/Contract/ens-abi.d.ts +0 -2
  11. package/dist/cjs/classes/test/Contract/ens-abi.js +0 -453
  12. package/dist/cjs/classes/test/Contract/fei-abi.d.ts +0 -2
  13. package/dist/cjs/classes/test/Contract/fei-abi.js +0 -526
  14. package/dist/cjs/classes/test/Contract/foo-abi.d.ts +0 -2
  15. package/dist/cjs/classes/test/Contract/foo-abi.js +0 -42
  16. package/dist/cjs/classes/test/Contract/jokerrace-abi.d.ts +0 -2
  17. package/dist/cjs/classes/test/Contract/jokerrace-abi.js +0 -22
  18. package/dist/cjs/classes/test/Contract/uniswap-abi.d.ts +0 -2
  19. package/dist/cjs/classes/test/Contract/uniswap-abi.js +0 -121
  20. package/dist/cjs/classes/utils/clean-block.d.ts +0 -120
  21. package/dist/cjs/classes/utils/clean-block.js +0 -160
  22. package/dist/cjs/classes/utils/clean-log.d.ts +0 -9
  23. package/dist/cjs/classes/utils/clean-log.js +0 -39
  24. package/dist/cjs/classes/utils/clean-transaction-receipt.d.ts +0 -14
  25. package/dist/cjs/classes/utils/clean-transaction-receipt.js +0 -53
  26. package/dist/cjs/classes/utils/clean-transaction.d.ts +0 -14
  27. package/dist/cjs/classes/utils/clean-transaction.js +0 -54
  28. package/dist/cjs/classes/utils/encode-decode-transaction.d.ts +0 -16
  29. package/dist/cjs/classes/utils/encode-decode-transaction.js +0 -185
  30. package/dist/cjs/classes/utils/fetchers.d.ts +0 -53
  31. package/dist/cjs/classes/utils/fetchers.js +0 -85
  32. package/dist/cjs/classes/utils/hex-to-decimal.d.ts +0 -18
  33. package/dist/cjs/classes/utils/hex-to-decimal.js +0 -24
  34. package/dist/cjs/classes/utils/prepare-transaction.d.ts +0 -6
  35. package/dist/cjs/classes/utils/prepare-transaction.js +0 -47
  36. package/dist/cjs/index.d.ts +0 -24
  37. package/dist/cjs/index.js +0 -58
  38. package/dist/cjs/index.umd.js +0 -2
  39. package/dist/cjs/index.umd.js.map +0 -1
  40. package/dist/cjs/logger/logger.d.ts +0 -11
  41. package/dist/cjs/logger/logger.js +0 -37
  42. package/dist/cjs/logger/package-version.d.ts +0 -1
  43. package/dist/cjs/logger/package-version.js +0 -5
  44. package/dist/cjs/package.json +0 -1
  45. package/dist/cjs/providers/AlchemyProvider.d.ts +0 -4
  46. package/dist/cjs/providers/AlchemyProvider.js +0 -11
  47. package/dist/cjs/providers/BaseProvider.d.ts +0 -374
  48. package/dist/cjs/providers/BaseProvider.js +0 -514
  49. package/dist/cjs/providers/FallthroughProvider.d.ts +0 -24
  50. package/dist/cjs/providers/FallthroughProvider.js +0 -74
  51. package/dist/cjs/providers/JsonRpcProvider.d.ts +0 -33
  52. package/dist/cjs/providers/JsonRpcProvider.js +0 -46
  53. package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.d.ts +0 -14
  54. package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.js +0 -152
  55. package/dist/cjs/providers/test/mock-of.d.ts +0 -8
  56. package/dist/cjs/providers/test/mock-of.js +0 -12
  57. package/dist/cjs/providers/test/rpc-urls.d.ts +0 -12
  58. package/dist/cjs/providers/test/rpc-urls.js +0 -27
  59. package/dist/cjs/providers/utils/chains-info.d.ts +0 -24
  60. package/dist/cjs/providers/utils/chains-info.js +0 -71
  61. package/dist/cjs/shared/tiny-big/helpers.d.ts +0 -17
  62. package/dist/cjs/shared/tiny-big/helpers.js +0 -97
  63. package/dist/cjs/shared/tiny-big/tiny-big.d.ts +0 -58
  64. package/dist/cjs/shared/tiny-big/tiny-big.js +0 -101
  65. package/dist/cjs/shared/validate-type.d.ts +0 -3
  66. package/dist/cjs/shared/validate-type.js +0 -9
  67. package/dist/cjs/types/Block.types.d.ts +0 -41
  68. package/dist/cjs/types/Block.types.js +0 -2
  69. package/dist/cjs/types/Contract.types.d.ts +0 -24
  70. package/dist/cjs/types/Contract.types.js +0 -2
  71. package/dist/cjs/types/FeeData.types.d.ts +0 -7
  72. package/dist/cjs/types/FeeData.types.js +0 -2
  73. package/dist/cjs/types/Filter.types.d.ts +0 -16
  74. package/dist/cjs/types/Filter.types.js +0 -2
  75. package/dist/cjs/types/Network.types.d.ts +0 -8
  76. package/dist/cjs/types/Network.types.js +0 -2
  77. package/dist/cjs/types/Transaction.types.d.ts +0 -123
  78. package/dist/cjs/types/Transaction.types.js +0 -2
  79. package/dist/cjs/utils/bytes.d.ts +0 -289
  80. package/dist/cjs/utils/bytes.js +0 -711
  81. package/dist/cjs/utils/compute-address.d.ts +0 -17
  82. package/dist/cjs/utils/compute-address.js +0 -34
  83. package/dist/cjs/utils/compute-public-key.d.ts +0 -18
  84. package/dist/cjs/utils/compute-public-key.js +0 -26
  85. package/dist/cjs/utils/ether-to-gwei.d.ts +0 -27
  86. package/dist/cjs/utils/ether-to-gwei.js +0 -35
  87. package/dist/cjs/utils/ether-to-wei.d.ts +0 -27
  88. package/dist/cjs/utils/ether-to-wei.js +0 -35
  89. package/dist/cjs/utils/gwei-to-ether.d.ts +0 -27
  90. package/dist/cjs/utils/gwei-to-ether.js +0 -35
  91. package/dist/cjs/utils/hash-message.d.ts +0 -14
  92. package/dist/cjs/utils/hash-message.js +0 -30
  93. package/dist/cjs/utils/is-address.d.ts +0 -24
  94. package/dist/cjs/utils/is-address.js +0 -39
  95. package/dist/cjs/utils/keccak256.d.ts +0 -16
  96. package/dist/cjs/utils/keccak256.js +0 -31
  97. package/dist/cjs/utils/solidity-keccak256.d.ts +0 -39
  98. package/dist/cjs/utils/solidity-keccak256.js +0 -138
  99. package/dist/cjs/utils/split-signature.d.ts +0 -24
  100. package/dist/cjs/utils/split-signature.js +0 -163
  101. package/dist/cjs/utils/to-checksum-address.d.ts +0 -17
  102. package/dist/cjs/utils/to-checksum-address.js +0 -46
  103. package/dist/cjs/utils/to-utf8-bytes.d.ts +0 -15
  104. package/dist/cjs/utils/to-utf8-bytes.js +0 -21
  105. package/dist/cjs/utils/wei-to-ether.d.ts +0 -27
  106. package/dist/cjs/utils/wei-to-ether.js +0 -45
  107. package/dist/esm/classes/Contract.d.ts +0 -11
  108. package/dist/esm/classes/Contract.js +0 -58
  109. package/dist/esm/classes/test/Contract/crv-abi.d.ts +0 -2
  110. package/dist/esm/classes/test/Contract/crv-abi.js +0 -395
  111. package/dist/esm/classes/test/Contract/ens-abi.d.ts +0 -2
  112. package/dist/esm/classes/test/Contract/ens-abi.js +0 -435
  113. package/dist/esm/classes/test/Contract/fei-abi.d.ts +0 -2
  114. package/dist/esm/classes/test/Contract/fei-abi.js +0 -521
  115. package/dist/esm/classes/test/Contract/foo-abi.d.ts +0 -2
  116. package/dist/esm/classes/test/Contract/foo-abi.js +0 -33
  117. package/dist/esm/classes/test/Contract/jokerrace-abi.d.ts +0 -2
  118. package/dist/esm/classes/test/Contract/jokerrace-abi.js +0 -18
  119. package/dist/esm/classes/test/Contract/uniswap-abi.d.ts +0 -2
  120. package/dist/esm/classes/test/Contract/uniswap-abi.js +0 -116
  121. package/dist/esm/classes/utils/clean-block.d.ts +0 -2
  122. package/dist/esm/classes/utils/clean-block.js +0 -35
  123. package/dist/esm/classes/utils/clean-log.d.ts +0 -2
  124. package/dist/esm/classes/utils/clean-log.js +0 -28
  125. package/dist/esm/classes/utils/clean-transaction-receipt.d.ts +0 -2
  126. package/dist/esm/classes/utils/clean-transaction-receipt.js +0 -37
  127. package/dist/esm/classes/utils/clean-transaction.d.ts +0 -2
  128. package/dist/esm/classes/utils/clean-transaction.js +0 -36
  129. package/dist/esm/classes/utils/encode-decode-transaction.d.ts +0 -4
  130. package/dist/esm/classes/utils/encode-decode-transaction.js +0 -143
  131. package/dist/esm/classes/utils/fetchers.d.ts +0 -15
  132. package/dist/esm/classes/utils/fetchers.js +0 -37
  133. package/dist/esm/classes/utils/hex-to-decimal.d.ts +0 -1
  134. package/dist/esm/classes/utils/hex-to-decimal.js +0 -3
  135. package/dist/esm/classes/utils/prepare-transaction.d.ts +0 -2
  136. package/dist/esm/classes/utils/prepare-transaction.js +0 -36
  137. package/dist/esm/index.d.ts +0 -24
  138. package/dist/esm/index.js +0 -19
  139. package/dist/esm/logger/logger.d.ts +0 -11
  140. package/dist/esm/logger/logger.js +0 -34
  141. package/dist/esm/logger/package-version.d.ts +0 -1
  142. package/dist/esm/logger/package-version.js +0 -1
  143. package/dist/esm/providers/AlchemyProvider.d.ts +0 -4
  144. package/dist/esm/providers/AlchemyProvider.js +0 -7
  145. package/dist/esm/providers/BaseProvider.d.ts +0 -26
  146. package/dist/esm/providers/BaseProvider.js +0 -137
  147. package/dist/esm/providers/FallthroughProvider.d.ts +0 -11
  148. package/dist/esm/providers/FallthroughProvider.js +0 -50
  149. package/dist/esm/providers/JsonRpcProvider.d.ts +0 -7
  150. package/dist/esm/providers/JsonRpcProvider.js +0 -15
  151. package/dist/esm/providers/test/json-rpc-provider/get-logs/mocks.d.ts +0 -14
  152. package/dist/esm/providers/test/json-rpc-provider/get-logs/mocks.js +0 -142
  153. package/dist/esm/providers/test/mock-of.d.ts +0 -1
  154. package/dist/esm/providers/test/mock-of.js +0 -1
  155. package/dist/esm/providers/test/rpc-urls.d.ts +0 -12
  156. package/dist/esm/providers/test/rpc-urls.js +0 -21
  157. package/dist/esm/providers/utils/chains-info.d.ts +0 -24
  158. package/dist/esm/providers/utils/chains-info.js +0 -67
  159. package/dist/esm/shared/tiny-big/helpers.d.ts +0 -1
  160. package/dist/esm/shared/tiny-big/helpers.js +0 -58
  161. package/dist/esm/shared/tiny-big/tiny-big.d.ts +0 -10
  162. package/dist/esm/shared/tiny-big/tiny-big.js +0 -45
  163. package/dist/esm/shared/validate-type.d.ts +0 -3
  164. package/dist/esm/shared/validate-type.js +0 -5
  165. package/dist/esm/types/Block.types.d.ts +0 -40
  166. package/dist/esm/types/Block.types.js +0 -1
  167. package/dist/esm/types/Contract.types.d.ts +0 -24
  168. package/dist/esm/types/Contract.types.js +0 -1
  169. package/dist/esm/types/FeeData.types.d.ts +0 -7
  170. package/dist/esm/types/FeeData.types.js +0 -1
  171. package/dist/esm/types/Filter.types.d.ts +0 -12
  172. package/dist/esm/types/Filter.types.js +0 -1
  173. package/dist/esm/types/Network.types.d.ts +0 -5
  174. package/dist/esm/types/Network.types.js +0 -1
  175. package/dist/esm/types/Transaction.types.d.ts +0 -113
  176. package/dist/esm/types/Transaction.types.js +0 -1
  177. package/dist/esm/utils/bytes.d.ts +0 -40
  178. package/dist/esm/utils/bytes.js +0 -245
  179. package/dist/esm/utils/compute-address.d.ts +0 -1
  180. package/dist/esm/utils/compute-address.js +0 -12
  181. package/dist/esm/utils/compute-public-key.d.ts +0 -2
  182. package/dist/esm/utils/compute-public-key.js +0 -6
  183. package/dist/esm/utils/ether-to-gwei.d.ts +0 -3
  184. package/dist/esm/utils/ether-to-gwei.js +0 -7
  185. package/dist/esm/utils/ether-to-wei.d.ts +0 -3
  186. package/dist/esm/utils/ether-to-wei.js +0 -7
  187. package/dist/esm/utils/gwei-to-ether.d.ts +0 -3
  188. package/dist/esm/utils/gwei-to-ether.js +0 -7
  189. package/dist/esm/utils/hash-message.d.ts +0 -2
  190. package/dist/esm/utils/hash-message.js +0 -14
  191. package/dist/esm/utils/is-address.d.ts +0 -1
  192. package/dist/esm/utils/is-address.js +0 -12
  193. package/dist/esm/utils/keccak256.d.ts +0 -2
  194. package/dist/esm/utils/keccak256.js +0 -13
  195. package/dist/esm/utils/solidity-keccak256.d.ts +0 -2
  196. package/dist/esm/utils/solidity-keccak256.js +0 -85
  197. package/dist/esm/utils/split-signature.d.ts +0 -2
  198. package/dist/esm/utils/split-signature.js +0 -126
  199. package/dist/esm/utils/to-checksum-address.d.ts +0 -1
  200. package/dist/esm/utils/to-checksum-address.js +0 -25
  201. package/dist/esm/utils/to-utf8-bytes.d.ts +0 -1
  202. package/dist/esm/utils/to-utf8-bytes.js +0 -3
  203. package/dist/esm/utils/wei-to-ether.d.ts +0 -3
  204. package/dist/esm/utils/wei-to-ether.js +0 -16
@@ -0,0 +1,330 @@
1
+ import Big from 'big.js';
2
+
3
+ declare class TinyBig extends Big {
4
+ constructor(value: string | number | TinyBig | Big);
5
+ toHexString(): string;
6
+ toNumber(): number;
7
+ toString(): string;
8
+ private padAndChop;
9
+ toTwos(bitCount: number): Big;
10
+ }
11
+ declare function tinyBig(value: string | number | TinyBig | Big): TinyBig;
12
+
13
+ type Bytes = ArrayLike<number>;
14
+ type BytesLike = Bytes | string;
15
+ type BytesLikeWithNumber = BytesLike | number;
16
+ interface DataOptions {
17
+ allowMissingPrefix?: boolean;
18
+ hexPad?: 'left' | 'right' | null;
19
+ }
20
+ interface Hexable {
21
+ toHexString(): string;
22
+ }
23
+ type SignatureLike = {
24
+ r: string;
25
+ s?: string;
26
+ _vs?: string;
27
+ recoveryParam?: number;
28
+ v?: number;
29
+ } | BytesLike;
30
+ interface Signature {
31
+ r: string;
32
+ s: string;
33
+ _vs: string;
34
+ recoveryParam: number;
35
+ v: number;
36
+ yParityAndS: string;
37
+ compact: string;
38
+ }
39
+ declare function isBytesLike(value: any): value is BytesLike;
40
+ declare function isBytes(value: any): value is Bytes;
41
+ declare function arrayify(value: BytesLike | Hexable | number, options?: DataOptions): Uint8Array;
42
+ declare function concat(arrayOfBytesLike: ReadonlyArray<BytesLikeWithNumber>): Uint8Array;
43
+ declare function stripZeros(value: BytesLike): Uint8Array;
44
+ declare function zeroPad(value: BytesLike, length: number): Uint8Array;
45
+ declare function isHexString(value: any, length?: number): boolean;
46
+ declare function hexlify(value: BytesLike | Hexable | number | bigint, options?: DataOptions): string;
47
+ declare function hexDataLength(data: BytesLike): number | null;
48
+ declare function hexDataSlice(data: BytesLikeWithNumber, offset: number, endOffset?: number): string;
49
+ declare function hexConcat(items: ReadonlyArray<BytesLike>): string;
50
+ declare function hexValue(value: BytesLike | Hexable | number | bigint): string;
51
+ declare function hexStripZeros(value: BytesLike): string;
52
+ declare function hexZeroPad(value: BytesLikeWithNumber, length: number): string;
53
+
54
+ type Modify$1<T, R> = Omit<T, keyof R> & R;
55
+ interface RPCTransaction extends RPCBlockTransaction {
56
+ maxFeePerGas: string;
57
+ maxPriorityFeePerGas: string;
58
+ }
59
+ type TransactionResponse = Modify$1<RPCTransaction, {
60
+ blockNumber: number;
61
+ chainId: number;
62
+ gas: TinyBig;
63
+ gasLimit: TinyBig;
64
+ gasPrice: TinyBig;
65
+ nonce: TinyBig;
66
+ transactionIndex: number;
67
+ type: number;
68
+ v: number;
69
+ value: TinyBig;
70
+ } & {
71
+ maxFeePerGas: TinyBig;
72
+ maxPriorityFeePerGas: TinyBig;
73
+ confirmations: number;
74
+ }>;
75
+ type TransactionReceipt = Modify$1<RPCTransactionReceipt, {
76
+ blockNumber: number;
77
+ cumulativeGasUsed: TinyBig;
78
+ effectiveGasPrice: TinyBig;
79
+ gasUsed: TinyBig;
80
+ logs: Array<Log>;
81
+ status: number;
82
+ transactionIndex: number;
83
+ type: number;
84
+ } & {
85
+ byzantium: boolean;
86
+ confirmations: number;
87
+ }>;
88
+ interface RPCTransactionRequest {
89
+ from?: string;
90
+ to: string;
91
+ gas?: string;
92
+ gasPrice?: string;
93
+ value?: string;
94
+ data?: BytesLike;
95
+ nonce?: string;
96
+ maxPriorityFeePerGas?: string;
97
+ maxFeePerGas?: string;
98
+ }
99
+ interface TransactionRequest {
100
+ to?: string;
101
+ from?: string;
102
+ nonce?: TinyBig | string | Big | number;
103
+ gas?: TinyBig | number | Big | string;
104
+ gasPrice?: TinyBig | Big | string | number;
105
+ data?: BytesLike;
106
+ value?: TinyBig | string | Big | number;
107
+ chainId?: number;
108
+ type?: number;
109
+ maxPriorityFeePerGas?: TinyBig | string | Big | number;
110
+ maxFeePerGas?: TinyBig | string | Big | number;
111
+ }
112
+ type Log = Modify$1<RPCLog, {
113
+ blockNumber: number;
114
+ logIndex: number;
115
+ transactionIndex: number;
116
+ }>;
117
+ type BlockTransactionResponse = Omit<TransactionResponse, 'maxFeePerGas' | 'maxPriorityFeePerGas'>;
118
+ interface RPCBlockTransaction {
119
+ blockHash: string;
120
+ blockNumber: string;
121
+ chainId: string;
122
+ from: string;
123
+ gas: string;
124
+ gasPrice: string;
125
+ hash: string;
126
+ input: string;
127
+ nonce: string;
128
+ r: string;
129
+ s: string;
130
+ to: string;
131
+ transactionIndex: string;
132
+ type: string;
133
+ v: string;
134
+ value: string;
135
+ }
136
+ interface RPCTransactionReceipt {
137
+ blockHash: string;
138
+ blockNumber: string;
139
+ contractAddress: string;
140
+ cumulativeGasUsed: string;
141
+ effectiveGasPrice: string;
142
+ from: string;
143
+ gasUsed: string;
144
+ logs: Array<RPCLog>;
145
+ logsBloom: string;
146
+ status: string;
147
+ to: string;
148
+ transactionHash: string;
149
+ transactionIndex: string;
150
+ type: string;
151
+ }
152
+ interface RPCLog {
153
+ address: string;
154
+ blockHash: string;
155
+ blockNumber: string;
156
+ data: string;
157
+ logIndex: string;
158
+ removed?: boolean;
159
+ topics: Array<string>;
160
+ transactionHash: string;
161
+ transactionIndex: string;
162
+ }
163
+
164
+ type Modify<T, R> = Omit<T, keyof R> & R;
165
+ type BlockResponse = Modify<RPCBlock, {
166
+ baseFeePerGas: TinyBig;
167
+ difficulty: TinyBig;
168
+ gasLimit: TinyBig;
169
+ gasUsed: TinyBig;
170
+ nonce: TinyBig;
171
+ number: number;
172
+ size: TinyBig;
173
+ timestamp: TinyBig;
174
+ totalDifficulty: TinyBig;
175
+ transactions: Array<string | BlockTransactionResponse>;
176
+ }>;
177
+ interface RPCBlock {
178
+ baseFeePerGas: string;
179
+ difficulty: string;
180
+ extraData: string;
181
+ gasLimit: string;
182
+ gasUsed: string;
183
+ hash: string;
184
+ logsBloom: string;
185
+ miner: string;
186
+ mixHash: string;
187
+ nonce: string;
188
+ number: string;
189
+ parentHash: string;
190
+ receiptsRoot: string;
191
+ sha3Uncles: string;
192
+ size: string;
193
+ stateRoot: string;
194
+ timestamp: string;
195
+ totalDifficulty: string;
196
+ transactions: Array<string | RPCTransaction>;
197
+ transactionsRoot: string;
198
+ uncles: Array<string>;
199
+ }
200
+ type BlockTag = 'latest' | 'earliest' | 'pending' | number | string;
201
+
202
+ interface FeeData {
203
+ gasPrice: TinyBig;
204
+ lastBaseFeePerGas: TinyBig | null;
205
+ maxFeePerGas: TinyBig | null;
206
+ maxPriorityFeePerGas: TinyBig | null;
207
+ }
208
+
209
+ interface EventFilter {
210
+ address?: string;
211
+ topics?: Array<string | Array<string> | null>;
212
+ }
213
+ interface Filter extends EventFilter {
214
+ fromBlock?: BlockTag;
215
+ toBlock?: BlockTag;
216
+ }
217
+ interface FilterByBlockHash extends EventFilter {
218
+ blockHash?: string;
219
+ }
220
+
221
+ interface Network {
222
+ chainId: number;
223
+ ensAddress: string | null;
224
+ name: string;
225
+ }
226
+
227
+ declare abstract class BaseProvider {
228
+ abstract selectRpcUrl(): string;
229
+ abstract post(body: Record<string, unknown>): Promise<any>;
230
+ readonly _rpcUrls: string[];
231
+ protected _post: (body: Record<string, unknown>) => Promise<any>;
232
+ constructor(rpcUrls: string[]);
233
+ getNetwork(): Promise<Network>;
234
+ getBlockNumber(): Promise<number>;
235
+ getTransaction(transactionHash: string): Promise<TransactionResponse>;
236
+ getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
237
+ getTransactionCount(address: string, blockTag?: BlockTag): Promise<number>;
238
+ getBlock(timeFrame?: BlockTag, returnTransactionObjects?: boolean): Promise<BlockResponse>;
239
+ getGasPrice(): Promise<TinyBig>;
240
+ getBalance(address: string, blockTag?: BlockTag): Promise<TinyBig>;
241
+ getCode(address: string, blockTag?: BlockTag): Promise<string>;
242
+ estimateGas(transaction: TransactionRequest): Promise<TinyBig>;
243
+ getFeeData(): Promise<FeeData>;
244
+ getLogs(filter: Filter | FilterByBlockHash): Promise<Array<Log>>;
245
+ call(transaction: TransactionRequest, blockTag?: BlockTag): Promise<string>;
246
+ }
247
+
248
+ declare class JsonRpcProvider extends BaseProvider {
249
+ selectRpcUrl(): string;
250
+ post(body: Record<string, unknown>): Promise<any>;
251
+ constructor(rpcUrl?: string);
252
+ }
253
+ declare function jsonRpcProvider(rpcUrl?: string): JsonRpcProvider;
254
+
255
+ type ContractTypes = 'bool' | 'bytes1' | 'bytes2' | 'bytes3' | 'bytes4' | 'bytes5' | 'bytes6' | 'bytes7' | 'bytes8' | 'bytes9' | 'bytes10' | 'bytes11' | 'bytes12' | 'bytes13' | 'bytes14' | 'bytes15' | 'bytes16' | 'bytes17' | 'bytes18' | 'bytes19' | 'bytes20' | 'bytes21' | 'bytes22' | 'bytes23' | 'bytes24' | 'bytes25' | 'bytes26' | 'bytes27' | 'bytes28' | 'bytes29' | 'bytes30' | 'bytes31' | 'bytes32' | 'bytes32[]' | 'address' | 'address payable' | 'address[4]' | 'address[100]' | 'uint256' | 'uint256[100]' | 'uint8' | 'uint32' | string;
256
+ type ContractInterface = JSONABI;
257
+ interface JSONABIArgument {
258
+ anonymous?: false;
259
+ inputs: {
260
+ internalType?: ContractTypes | string;
261
+ name: string;
262
+ type: ContractTypes;
263
+ indexed?: boolean;
264
+ }[];
265
+ name?: string;
266
+ outputs?: {
267
+ internalType?: ContractTypes | string;
268
+ name: string;
269
+ type: ContractTypes;
270
+ }[];
271
+ stateMutability?: 'view' | 'nonpayable' | string;
272
+ type: 'function' | 'event' | 'constructor' | 'error' | 'fallback';
273
+ gas?: number;
274
+ constant?: boolean;
275
+ payable?: boolean;
276
+ }
277
+ type JSONABI = JSONABIArgument[];
278
+
279
+ declare class BaseContract {
280
+ private readonly _address;
281
+ private readonly _provider;
282
+ constructor(addressOrName: string, contractInterface: ContractInterface, signerOrProvider: JsonRpcProvider);
283
+ }
284
+ declare class Contract extends BaseContract {
285
+ readonly [key: string]: any;
286
+ }
287
+
288
+ declare class AlchemyProvider extends JsonRpcProvider {
289
+ constructor(apiKey: string, network?: string);
290
+ }
291
+
292
+ interface ConstructorOptions {
293
+ timeoutDuration?: number;
294
+ }
295
+ declare class FallthroughProvider extends BaseProvider {
296
+ private rpcUrlCounter;
297
+ private readonly timeoutDuration;
298
+ selectRpcUrl(): string;
299
+ constructor(rpcUrls: string[], options?: ConstructorOptions);
300
+ post: (body: Record<string, unknown>) => Promise<any>;
301
+ }
302
+
303
+ declare function computeAddress(key: string): string;
304
+
305
+ declare function computePublicKey(privKey: BytesLike): string;
306
+
307
+ declare function etherToGwei(etherQuantity: string | number | TinyBig | Big): TinyBig;
308
+
309
+ declare function etherToWei(etherQuantity: string | number | TinyBig | Big): TinyBig;
310
+
311
+ declare function gweiToEther(gweiQuantity: string | number | TinyBig | Big): TinyBig;
312
+
313
+ declare function hashMessage(message: Bytes | string): string;
314
+
315
+ declare function isAddress(address: string): boolean;
316
+
317
+ declare function keccak256(data: BytesLike): string;
318
+
319
+ declare function pack(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
320
+ declare function solidityKeccak256(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
321
+
322
+ declare function splitSignature(signature: SignatureLike): Signature;
323
+
324
+ declare function toChecksumAddress(address: string): string;
325
+
326
+ declare function toUtf8Bytes(data: string): Uint8Array;
327
+
328
+ declare function weiToEther(weiQuantity: string | number | TinyBig | Big): TinyBig;
329
+
330
+ export { AlchemyProvider, BaseContract, type BlockResponse, type BlockTag, type BlockTransactionResponse, type Bytes, type BytesLike, type BytesLikeWithNumber, type ConstructorOptions, Contract, type ContractTypes, type DataOptions, FallthroughProvider, type Filter, type FilterByBlockHash, type Hexable, type JSONABI, type JSONABIArgument, JsonRpcProvider, type Log, type Network, type RPCBlock, type RPCLog, type RPCTransaction, type RPCTransactionReceipt, type RPCTransactionRequest, type Signature, type SignatureLike, TinyBig, type TransactionReceipt, type TransactionRequest, type TransactionResponse, arrayify, computeAddress, computePublicKey, concat, etherToGwei, etherToWei, gweiToEther, hashMessage, hexConcat, hexDataLength, hexDataSlice, hexStripZeros, hexValue, hexZeroPad, hexlify, isAddress, isBytes, isBytesLike, isHexString, jsonRpcProvider, keccak256, pack, solidityKeccak256, splitSignature, stripZeros, tinyBig, toChecksumAddress, toUtf8Bytes, weiToEther, zeroPad };
@@ -0,0 +1,330 @@
1
+ import Big from 'big.js';
2
+
3
+ declare class TinyBig extends Big {
4
+ constructor(value: string | number | TinyBig | Big);
5
+ toHexString(): string;
6
+ toNumber(): number;
7
+ toString(): string;
8
+ private padAndChop;
9
+ toTwos(bitCount: number): Big;
10
+ }
11
+ declare function tinyBig(value: string | number | TinyBig | Big): TinyBig;
12
+
13
+ type Bytes = ArrayLike<number>;
14
+ type BytesLike = Bytes | string;
15
+ type BytesLikeWithNumber = BytesLike | number;
16
+ interface DataOptions {
17
+ allowMissingPrefix?: boolean;
18
+ hexPad?: 'left' | 'right' | null;
19
+ }
20
+ interface Hexable {
21
+ toHexString(): string;
22
+ }
23
+ type SignatureLike = {
24
+ r: string;
25
+ s?: string;
26
+ _vs?: string;
27
+ recoveryParam?: number;
28
+ v?: number;
29
+ } | BytesLike;
30
+ interface Signature {
31
+ r: string;
32
+ s: string;
33
+ _vs: string;
34
+ recoveryParam: number;
35
+ v: number;
36
+ yParityAndS: string;
37
+ compact: string;
38
+ }
39
+ declare function isBytesLike(value: any): value is BytesLike;
40
+ declare function isBytes(value: any): value is Bytes;
41
+ declare function arrayify(value: BytesLike | Hexable | number, options?: DataOptions): Uint8Array;
42
+ declare function concat(arrayOfBytesLike: ReadonlyArray<BytesLikeWithNumber>): Uint8Array;
43
+ declare function stripZeros(value: BytesLike): Uint8Array;
44
+ declare function zeroPad(value: BytesLike, length: number): Uint8Array;
45
+ declare function isHexString(value: any, length?: number): boolean;
46
+ declare function hexlify(value: BytesLike | Hexable | number | bigint, options?: DataOptions): string;
47
+ declare function hexDataLength(data: BytesLike): number | null;
48
+ declare function hexDataSlice(data: BytesLikeWithNumber, offset: number, endOffset?: number): string;
49
+ declare function hexConcat(items: ReadonlyArray<BytesLike>): string;
50
+ declare function hexValue(value: BytesLike | Hexable | number | bigint): string;
51
+ declare function hexStripZeros(value: BytesLike): string;
52
+ declare function hexZeroPad(value: BytesLikeWithNumber, length: number): string;
53
+
54
+ type Modify$1<T, R> = Omit<T, keyof R> & R;
55
+ interface RPCTransaction extends RPCBlockTransaction {
56
+ maxFeePerGas: string;
57
+ maxPriorityFeePerGas: string;
58
+ }
59
+ type TransactionResponse = Modify$1<RPCTransaction, {
60
+ blockNumber: number;
61
+ chainId: number;
62
+ gas: TinyBig;
63
+ gasLimit: TinyBig;
64
+ gasPrice: TinyBig;
65
+ nonce: TinyBig;
66
+ transactionIndex: number;
67
+ type: number;
68
+ v: number;
69
+ value: TinyBig;
70
+ } & {
71
+ maxFeePerGas: TinyBig;
72
+ maxPriorityFeePerGas: TinyBig;
73
+ confirmations: number;
74
+ }>;
75
+ type TransactionReceipt = Modify$1<RPCTransactionReceipt, {
76
+ blockNumber: number;
77
+ cumulativeGasUsed: TinyBig;
78
+ effectiveGasPrice: TinyBig;
79
+ gasUsed: TinyBig;
80
+ logs: Array<Log>;
81
+ status: number;
82
+ transactionIndex: number;
83
+ type: number;
84
+ } & {
85
+ byzantium: boolean;
86
+ confirmations: number;
87
+ }>;
88
+ interface RPCTransactionRequest {
89
+ from?: string;
90
+ to: string;
91
+ gas?: string;
92
+ gasPrice?: string;
93
+ value?: string;
94
+ data?: BytesLike;
95
+ nonce?: string;
96
+ maxPriorityFeePerGas?: string;
97
+ maxFeePerGas?: string;
98
+ }
99
+ interface TransactionRequest {
100
+ to?: string;
101
+ from?: string;
102
+ nonce?: TinyBig | string | Big | number;
103
+ gas?: TinyBig | number | Big | string;
104
+ gasPrice?: TinyBig | Big | string | number;
105
+ data?: BytesLike;
106
+ value?: TinyBig | string | Big | number;
107
+ chainId?: number;
108
+ type?: number;
109
+ maxPriorityFeePerGas?: TinyBig | string | Big | number;
110
+ maxFeePerGas?: TinyBig | string | Big | number;
111
+ }
112
+ type Log = Modify$1<RPCLog, {
113
+ blockNumber: number;
114
+ logIndex: number;
115
+ transactionIndex: number;
116
+ }>;
117
+ type BlockTransactionResponse = Omit<TransactionResponse, 'maxFeePerGas' | 'maxPriorityFeePerGas'>;
118
+ interface RPCBlockTransaction {
119
+ blockHash: string;
120
+ blockNumber: string;
121
+ chainId: string;
122
+ from: string;
123
+ gas: string;
124
+ gasPrice: string;
125
+ hash: string;
126
+ input: string;
127
+ nonce: string;
128
+ r: string;
129
+ s: string;
130
+ to: string;
131
+ transactionIndex: string;
132
+ type: string;
133
+ v: string;
134
+ value: string;
135
+ }
136
+ interface RPCTransactionReceipt {
137
+ blockHash: string;
138
+ blockNumber: string;
139
+ contractAddress: string;
140
+ cumulativeGasUsed: string;
141
+ effectiveGasPrice: string;
142
+ from: string;
143
+ gasUsed: string;
144
+ logs: Array<RPCLog>;
145
+ logsBloom: string;
146
+ status: string;
147
+ to: string;
148
+ transactionHash: string;
149
+ transactionIndex: string;
150
+ type: string;
151
+ }
152
+ interface RPCLog {
153
+ address: string;
154
+ blockHash: string;
155
+ blockNumber: string;
156
+ data: string;
157
+ logIndex: string;
158
+ removed?: boolean;
159
+ topics: Array<string>;
160
+ transactionHash: string;
161
+ transactionIndex: string;
162
+ }
163
+
164
+ type Modify<T, R> = Omit<T, keyof R> & R;
165
+ type BlockResponse = Modify<RPCBlock, {
166
+ baseFeePerGas: TinyBig;
167
+ difficulty: TinyBig;
168
+ gasLimit: TinyBig;
169
+ gasUsed: TinyBig;
170
+ nonce: TinyBig;
171
+ number: number;
172
+ size: TinyBig;
173
+ timestamp: TinyBig;
174
+ totalDifficulty: TinyBig;
175
+ transactions: Array<string | BlockTransactionResponse>;
176
+ }>;
177
+ interface RPCBlock {
178
+ baseFeePerGas: string;
179
+ difficulty: string;
180
+ extraData: string;
181
+ gasLimit: string;
182
+ gasUsed: string;
183
+ hash: string;
184
+ logsBloom: string;
185
+ miner: string;
186
+ mixHash: string;
187
+ nonce: string;
188
+ number: string;
189
+ parentHash: string;
190
+ receiptsRoot: string;
191
+ sha3Uncles: string;
192
+ size: string;
193
+ stateRoot: string;
194
+ timestamp: string;
195
+ totalDifficulty: string;
196
+ transactions: Array<string | RPCTransaction>;
197
+ transactionsRoot: string;
198
+ uncles: Array<string>;
199
+ }
200
+ type BlockTag = 'latest' | 'earliest' | 'pending' | number | string;
201
+
202
+ interface FeeData {
203
+ gasPrice: TinyBig;
204
+ lastBaseFeePerGas: TinyBig | null;
205
+ maxFeePerGas: TinyBig | null;
206
+ maxPriorityFeePerGas: TinyBig | null;
207
+ }
208
+
209
+ interface EventFilter {
210
+ address?: string;
211
+ topics?: Array<string | Array<string> | null>;
212
+ }
213
+ interface Filter extends EventFilter {
214
+ fromBlock?: BlockTag;
215
+ toBlock?: BlockTag;
216
+ }
217
+ interface FilterByBlockHash extends EventFilter {
218
+ blockHash?: string;
219
+ }
220
+
221
+ interface Network {
222
+ chainId: number;
223
+ ensAddress: string | null;
224
+ name: string;
225
+ }
226
+
227
+ declare abstract class BaseProvider {
228
+ abstract selectRpcUrl(): string;
229
+ abstract post(body: Record<string, unknown>): Promise<any>;
230
+ readonly _rpcUrls: string[];
231
+ protected _post: (body: Record<string, unknown>) => Promise<any>;
232
+ constructor(rpcUrls: string[]);
233
+ getNetwork(): Promise<Network>;
234
+ getBlockNumber(): Promise<number>;
235
+ getTransaction(transactionHash: string): Promise<TransactionResponse>;
236
+ getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
237
+ getTransactionCount(address: string, blockTag?: BlockTag): Promise<number>;
238
+ getBlock(timeFrame?: BlockTag, returnTransactionObjects?: boolean): Promise<BlockResponse>;
239
+ getGasPrice(): Promise<TinyBig>;
240
+ getBalance(address: string, blockTag?: BlockTag): Promise<TinyBig>;
241
+ getCode(address: string, blockTag?: BlockTag): Promise<string>;
242
+ estimateGas(transaction: TransactionRequest): Promise<TinyBig>;
243
+ getFeeData(): Promise<FeeData>;
244
+ getLogs(filter: Filter | FilterByBlockHash): Promise<Array<Log>>;
245
+ call(transaction: TransactionRequest, blockTag?: BlockTag): Promise<string>;
246
+ }
247
+
248
+ declare class JsonRpcProvider extends BaseProvider {
249
+ selectRpcUrl(): string;
250
+ post(body: Record<string, unknown>): Promise<any>;
251
+ constructor(rpcUrl?: string);
252
+ }
253
+ declare function jsonRpcProvider(rpcUrl?: string): JsonRpcProvider;
254
+
255
+ type ContractTypes = 'bool' | 'bytes1' | 'bytes2' | 'bytes3' | 'bytes4' | 'bytes5' | 'bytes6' | 'bytes7' | 'bytes8' | 'bytes9' | 'bytes10' | 'bytes11' | 'bytes12' | 'bytes13' | 'bytes14' | 'bytes15' | 'bytes16' | 'bytes17' | 'bytes18' | 'bytes19' | 'bytes20' | 'bytes21' | 'bytes22' | 'bytes23' | 'bytes24' | 'bytes25' | 'bytes26' | 'bytes27' | 'bytes28' | 'bytes29' | 'bytes30' | 'bytes31' | 'bytes32' | 'bytes32[]' | 'address' | 'address payable' | 'address[4]' | 'address[100]' | 'uint256' | 'uint256[100]' | 'uint8' | 'uint32' | string;
256
+ type ContractInterface = JSONABI;
257
+ interface JSONABIArgument {
258
+ anonymous?: false;
259
+ inputs: {
260
+ internalType?: ContractTypes | string;
261
+ name: string;
262
+ type: ContractTypes;
263
+ indexed?: boolean;
264
+ }[];
265
+ name?: string;
266
+ outputs?: {
267
+ internalType?: ContractTypes | string;
268
+ name: string;
269
+ type: ContractTypes;
270
+ }[];
271
+ stateMutability?: 'view' | 'nonpayable' | string;
272
+ type: 'function' | 'event' | 'constructor' | 'error' | 'fallback';
273
+ gas?: number;
274
+ constant?: boolean;
275
+ payable?: boolean;
276
+ }
277
+ type JSONABI = JSONABIArgument[];
278
+
279
+ declare class BaseContract {
280
+ private readonly _address;
281
+ private readonly _provider;
282
+ constructor(addressOrName: string, contractInterface: ContractInterface, signerOrProvider: JsonRpcProvider);
283
+ }
284
+ declare class Contract extends BaseContract {
285
+ readonly [key: string]: any;
286
+ }
287
+
288
+ declare class AlchemyProvider extends JsonRpcProvider {
289
+ constructor(apiKey: string, network?: string);
290
+ }
291
+
292
+ interface ConstructorOptions {
293
+ timeoutDuration?: number;
294
+ }
295
+ declare class FallthroughProvider extends BaseProvider {
296
+ private rpcUrlCounter;
297
+ private readonly timeoutDuration;
298
+ selectRpcUrl(): string;
299
+ constructor(rpcUrls: string[], options?: ConstructorOptions);
300
+ post: (body: Record<string, unknown>) => Promise<any>;
301
+ }
302
+
303
+ declare function computeAddress(key: string): string;
304
+
305
+ declare function computePublicKey(privKey: BytesLike): string;
306
+
307
+ declare function etherToGwei(etherQuantity: string | number | TinyBig | Big): TinyBig;
308
+
309
+ declare function etherToWei(etherQuantity: string | number | TinyBig | Big): TinyBig;
310
+
311
+ declare function gweiToEther(gweiQuantity: string | number | TinyBig | Big): TinyBig;
312
+
313
+ declare function hashMessage(message: Bytes | string): string;
314
+
315
+ declare function isAddress(address: string): boolean;
316
+
317
+ declare function keccak256(data: BytesLike): string;
318
+
319
+ declare function pack(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
320
+ declare function solidityKeccak256(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
321
+
322
+ declare function splitSignature(signature: SignatureLike): Signature;
323
+
324
+ declare function toChecksumAddress(address: string): string;
325
+
326
+ declare function toUtf8Bytes(data: string): Uint8Array;
327
+
328
+ declare function weiToEther(weiQuantity: string | number | TinyBig | Big): TinyBig;
329
+
330
+ export { AlchemyProvider, BaseContract, type BlockResponse, type BlockTag, type BlockTransactionResponse, type Bytes, type BytesLike, type BytesLikeWithNumber, type ConstructorOptions, Contract, type ContractTypes, type DataOptions, FallthroughProvider, type Filter, type FilterByBlockHash, type Hexable, type JSONABI, type JSONABIArgument, JsonRpcProvider, type Log, type Network, type RPCBlock, type RPCLog, type RPCTransaction, type RPCTransactionReceipt, type RPCTransactionRequest, type Signature, type SignatureLike, TinyBig, type TransactionReceipt, type TransactionRequest, type TransactionResponse, arrayify, computeAddress, computePublicKey, concat, etherToGwei, etherToWei, gweiToEther, hashMessage, hexConcat, hexDataLength, hexDataSlice, hexStripZeros, hexValue, hexZeroPad, hexlify, isAddress, isBytes, isBytesLike, isHexString, jsonRpcProvider, keccak256, pack, solidityKeccak256, splitSignature, stripZeros, tinyBig, toChecksumAddress, toUtf8Bytes, weiToEther, zeroPad };