viem 0.0.0 → 0.0.1-alpha.1

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.
@@ -0,0 +1,987 @@
1
+ import { A as Address, k as Hash, Q as Quantity, s as RpcTransactionRequest, m as RpcBlockNumber, d as BlockTag, l as RpcBlockIdentifier, H as Hex, P as RpcEstimateGasParameters, n as RpcFeeHistory, R as RpcBlock, p as RpcLog, q as RpcTransaction, r as RpcTransactionReceipt, u as RpcUncle } from './rpc-655c0ba4.js';
2
+
3
+ declare class RpcError extends Error {
4
+ code: number;
5
+ details: string;
6
+ constructor(code: number, message: string);
7
+ }
8
+ type ProviderConnectInfo = {
9
+ chainId: string;
10
+ };
11
+ type ProviderMessage = {
12
+ type: string;
13
+ data: unknown;
14
+ };
15
+ type Events = {
16
+ on(event: 'connect', listener: (connectInfo: ProviderConnectInfo) => void): void;
17
+ on(event: 'disconnect', listener: (error: RpcError) => void): void;
18
+ on(event: 'chainChanged', listener: (chainId: string) => void): void;
19
+ on(event: 'accountsChanged', listener: (accounts: string[]) => void): void;
20
+ on(event: 'message', listener: (message: ProviderMessage) => void): void;
21
+ removeListener(event: 'connect', listener: (connectInfo: ProviderConnectInfo) => void): void;
22
+ removeListener(event: 'disconnect', listener: (error: RpcError) => void): void;
23
+ removeListener(event: 'chainChanged', listener: (chainId: string) => void): void;
24
+ removeListener(event: 'accountsChanged', listener: (accounts: Address[]) => void): void;
25
+ removeListener(event: 'message', listener: (message: ProviderMessage) => void): void;
26
+ };
27
+ type Chain = {
28
+ /** A 0x-prefixed hexadecimal string */
29
+ chainId: string;
30
+ /** The chain name. */
31
+ chainName: string;
32
+ /** Native currency for the chain. */
33
+ nativeCurrency?: {
34
+ name: string;
35
+ symbol: string;
36
+ decimals: number;
37
+ };
38
+ rpcUrls: string[];
39
+ blockExplorerUrls?: string[];
40
+ iconUrls?: string[];
41
+ };
42
+ type NetworkSync = {
43
+ /** The current block number */
44
+ currentBlock: Quantity;
45
+ /** Number of latest block on the network */
46
+ highestBlock: Quantity;
47
+ /** Block number at which syncing started */
48
+ startingBlock: Quantity;
49
+ };
50
+ type WalletPermissionCaveat = {
51
+ type: string;
52
+ value: any;
53
+ };
54
+ type WalletPermission = {
55
+ caveats: WalletPermissionCaveat[];
56
+ date: number;
57
+ id: string;
58
+ invoker: `http://${string}` | `https://${string}`;
59
+ parentCapability: 'eth_accounts' | string;
60
+ };
61
+ type WatchAssetParams = {
62
+ /** Token type. */
63
+ type: 'ERC20';
64
+ options: {
65
+ /** The address of the token contract */
66
+ address: string;
67
+ /** A ticker symbol or shorthand, up to 11 characters */
68
+ symbol: string;
69
+ /** The number of token decimals */
70
+ decimals: number;
71
+ /** A string url of the token logo */
72
+ image: string;
73
+ };
74
+ };
75
+ type PublicRequests = {
76
+ request(args: {
77
+ /**
78
+ * @description Returns the version of the current client
79
+ * @link https://eips.ethereum.org/EIPS/eip-1474
80
+ * @example
81
+ * provider.request({ method: 'web3_clientVersion' })
82
+ * // => 'MetaMask/v1.0.0'
83
+ */
84
+ method: 'web3_clientVersion';
85
+ params?: never;
86
+ }): Promise<string>;
87
+ request(args: {
88
+ /**
89
+ * @description Hashes data using the Keccak-256 algorithm
90
+ * @link https://eips.ethereum.org/EIPS/eip-1474
91
+ * @example
92
+ * provider.request({ method: 'web3_sha3', params: ['0x68656c6c6f20776f726c64'] })
93
+ * // => '0xc94770007dda54cF92009BFF0dE90c06F603a09f'
94
+ */
95
+ method: 'web3_sha3';
96
+ params: [data: Hash];
97
+ }): Promise<string>;
98
+ request(args: {
99
+ /**
100
+ * @description Determines if this client is listening for new network connections
101
+ * @link https://eips.ethereum.org/EIPS/eip-1474
102
+ * @example
103
+ * provider.request({ method: 'net_listening' })
104
+ * // => true
105
+ */
106
+ method: 'net_listening';
107
+ params?: never;
108
+ }): Promise<boolean>;
109
+ request(args: {
110
+ /**
111
+ * @description Returns the number of peers currently connected to this client
112
+ * @link https://eips.ethereum.org/EIPS/eip-1474
113
+ * @example
114
+ * provider.request({ method: 'net_peerCount' })
115
+ * // => '0x1'
116
+ */
117
+ method: 'net_peerCount';
118
+ params?: never;
119
+ }): Promise<Quantity>;
120
+ request(args: {
121
+ /**
122
+ * @description Returns the chain ID associated with the current network
123
+ * @link https://eips.ethereum.org/EIPS/eip-1474
124
+ * @example
125
+ * provider.request({ method: 'net_version' })
126
+ * // => '1'
127
+ */
128
+ method: 'net_version';
129
+ params?: never;
130
+ }): Promise<Quantity>;
131
+ request(args: {
132
+ /**
133
+ * @description Returns the number of the most recent block seen by this client
134
+ * @link https://eips.ethereum.org/EIPS/eip-1474
135
+ * @example
136
+ * provider.request({ method: 'eth_blockNumber' })
137
+ * // => '0x1b4'
138
+ * */
139
+ method: 'eth_blockNumber';
140
+ params?: never;
141
+ }): Promise<Quantity>;
142
+ request(args: {
143
+ /**
144
+ * @description Executes a new message call immediately without submitting a transaction to the network
145
+ * @link https://eips.ethereum.org/EIPS/eip-1474
146
+ * @example
147
+ * provider.request({ method: 'eth_call', params: [{ to: '0x...', data: '0x...' }] })
148
+ * // => '0x...'
149
+ */
150
+ method: 'eth_call';
151
+ params: [
152
+ request: RpcTransactionRequest,
153
+ block: RpcBlockNumber | BlockTag | RpcBlockIdentifier
154
+ ];
155
+ }): Promise<Hex>;
156
+ request(args: {
157
+ /**
158
+ * @description Returns the chain ID associated with the current network
159
+ * @example
160
+ * provider.request({ method: 'eth_chainId' })
161
+ * // => '1'
162
+ */
163
+ method: 'eth_chainId';
164
+ params?: never;
165
+ }): Promise<Quantity>;
166
+ request(args: {
167
+ method: 'eth_coinbase';
168
+ params?: never;
169
+ }): Promise<Address>;
170
+ request(args: {
171
+ /**
172
+ * @description Estimates the gas necessary to complete a transaction without submitting it to the network
173
+ * @link https://eips.ethereum.org/EIPS/eip-1474
174
+ * @example
175
+ * provider.request({
176
+ * method: 'eth_estimateGas',
177
+ * params: [{ from: '0x...', to: '0x...', value: '0x...' }]
178
+ * })
179
+ * // => '0x5208'
180
+ * */
181
+ method: 'eth_estimateGas';
182
+ params: [parameters: RpcEstimateGasParameters, block: RpcBlockNumber | BlockTag];
183
+ }): Promise<Quantity>;
184
+ request(args: {
185
+ /**
186
+ * @description Returns a collection of historical gas information
187
+ * @link https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md
188
+ * @example
189
+ * provider.request({
190
+ * method: 'eth_feeHistory',
191
+ * params: ['4', 'latest', ['25', '75']]
192
+ * })
193
+ * // => {
194
+ * // oldestBlock: '0x1',
195
+ * // baseFeePerGas: ['0x1', '0x2', '0x3', '0x4'],
196
+ * // gasUsedRatio: ['0x1', '0x2', '0x3', '0x4'],
197
+ * // reward: [['0x1', '0x2'], ['0x3', '0x4'], ['0x5', '0x6'], ['0x7', '0x8']]
198
+ * // }
199
+ * */
200
+ method: 'eth_feeHistory';
201
+ params: [
202
+ /** Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available. */
203
+ blockCount: Quantity,
204
+ /** Highest number block of the requested range. */
205
+ newestBlock: RpcBlockNumber | BlockTag,
206
+ /** A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used. */
207
+ rewardPercentiles: number[] | undefined
208
+ ];
209
+ }): Promise<RpcFeeHistory>;
210
+ request(args: {
211
+ /**
212
+ * @description Returns the current price of gas expressed in wei
213
+ * @link https://eips.ethereum.org/EIPS/eip-1474
214
+ * @example
215
+ * provider.request({ method: 'eth_gasPrice' })
216
+ * // => '0x09184e72a000'
217
+ * */
218
+ method: 'eth_gasPrice';
219
+ params?: never;
220
+ }): Promise<Quantity>;
221
+ request(args: {
222
+ /**
223
+ * @description Returns the balance of an address in wei
224
+ * @link https://eips.ethereum.org/EIPS/eip-1474
225
+ * @example
226
+ * provider.request({ method: 'eth_getBalance', params: ['0x...', 'latest'] })
227
+ * // => '0x12a05...'
228
+ * */
229
+ method: 'eth_getBalance';
230
+ params: [address: Address, block: RpcBlockNumber | BlockTag | RpcBlockIdentifier];
231
+ }): Promise<Quantity>;
232
+ request(args: {
233
+ /**
234
+ * @description Returns information about a block specified by hash
235
+ * @link https://eips.ethereum.org/EIPS/eip-1474
236
+ * @example
237
+ * provider.request({ method: 'eth_getBlockByHash', params: ['0x...', true] })
238
+ * // => {
239
+ * // number: '0x1b4',
240
+ * // hash: '0x...',
241
+ * // parentHash: '0x...',
242
+ * // ...
243
+ * // }
244
+ * */
245
+ method: 'eth_getBlockByHash';
246
+ params: [
247
+ /** hash of a block */
248
+ hash: Hash,
249
+ /** true will pull full transaction objects, false will pull transaction hashes */
250
+ includeTransactionObjects: boolean
251
+ ];
252
+ }): Promise<RpcBlock | null>;
253
+ request(args: {
254
+ /**
255
+ * @description Returns information about a block specified by number
256
+ * @link https://eips.ethereum.org/EIPS/eip-1474
257
+ * @example
258
+ * provider.request({ method: 'eth_getBlockByNumber', params: ['0x1b4', true] })
259
+ * // => {
260
+ * // number: '0x1b4',
261
+ * // hash: '0x...',
262
+ * // parentHash: '0x...',
263
+ * // ...
264
+ * // }
265
+ * */
266
+ method: 'eth_getBlockByNumber';
267
+ params: [
268
+ /** block number, or one of "latest", "safe", "finalized", "earliest" or "pending" */
269
+ block: RpcBlockNumber | BlockTag,
270
+ /** true will pull full transaction objects, false will pull transaction hashes */
271
+ includeTransactionObjects: boolean
272
+ ];
273
+ }): Promise<RpcBlock | null>;
274
+ request(args: {
275
+ /**
276
+ * @description Returns the number of transactions in a block specified by block hash
277
+ * @link https://eips.ethereum.org/EIPS/eip-1474
278
+ * @example
279
+ * provider.request({ method: 'eth_getBlockTransactionCountByHash', params: ['0x...'] })
280
+ * // => '0x1'
281
+ * */
282
+ method: 'eth_getBlockTransactionCountByHash';
283
+ params: [hash: Hash];
284
+ }): Promise<Quantity>;
285
+ request(args: {
286
+ /**
287
+ * @description Returns the number of transactions in a block specified by block number
288
+ * @link https://eips.ethereum.org/EIPS/eip-1474
289
+ * @example
290
+ * provider.request({ method: 'eth_getBlockTransactionCountByNumber', params: ['0x1b4'] })
291
+ * // => '0x1'
292
+ * */
293
+ method: 'eth_getBlockTransactionCountByNumber';
294
+ params: [block: RpcBlockNumber | BlockTag];
295
+ }): Promise<Quantity>;
296
+ request(args: {
297
+ /**
298
+ * @description Returns the contract code stored at a given address
299
+ * @link https://eips.ethereum.org/EIPS/eip-1474
300
+ * @example
301
+ * provider.request({ method: 'eth_getCode', params: ['0x...', 'latest'] })
302
+ * // => '0x...'
303
+ * */
304
+ method: 'eth_getCode';
305
+ params: [address: Address, block: RpcBlockNumber | BlockTag | RpcBlockIdentifier];
306
+ }): Promise<Hex>;
307
+ request(args: {
308
+ /**
309
+ * @description Returns a list of all logs based on filter ID since the last log retrieval
310
+ * @link https://eips.ethereum.org/EIPS/eip-1474
311
+ * @example
312
+ * provider.request({ method: 'eth_getFilterChanges', params: ['0x...'] })
313
+ * // => [{ ... }, { ... }]
314
+ * */
315
+ method: 'eth_getFilterChanges';
316
+ params: [filterId: Quantity];
317
+ }): Promise<RpcLog[] | Hex[]>;
318
+ request(args: {
319
+ /**
320
+ * @description Returns a list of all logs based on filter ID
321
+ * @link https://eips.ethereum.org/EIPS/eip-1474
322
+ * @example
323
+ * provider.request({ method: 'eth_getFilterLogs', params: ['0x...'] })
324
+ * // => [{ ... }, { ... }]
325
+ * */
326
+ method: 'eth_getFilterLogs';
327
+ params: [filterId: Quantity];
328
+ }): Promise<RpcLog[]>;
329
+ request(args: {
330
+ /**
331
+ * @description Returns a list of all logs based on a filter object
332
+ * @link https://eips.ethereum.org/EIPS/eip-1474
333
+ * @example
334
+ * provider.request({ method: 'eth_getLogs', params: [{ ... }] })
335
+ * // => [{ ... }, { ... }]
336
+ * */
337
+ method: 'eth_getLogs';
338
+ params: [
339
+ filter: {
340
+ address?: Address | Address[];
341
+ topics?: Hex[];
342
+ } & ({
343
+ fromBlock?: RpcBlockNumber | BlockTag;
344
+ toBlock?: RpcBlockNumber | BlockTag;
345
+ } | {
346
+ blockHash?: Hash;
347
+ })
348
+ ];
349
+ }): Promise<RpcLog>;
350
+ request(args: {
351
+ /**
352
+ * @description Returns the value from a storage position at an address
353
+ * @link https://eips.ethereum.org/EIPS/eip-1474
354
+ * @example
355
+ * provider.request({ method: 'eth_getStorageAt', params: ['0x...', '0x...', 'latest'] })
356
+ * // => '0x...'
357
+ * */
358
+ method: 'eth_getStorageAt';
359
+ params: [
360
+ address: Address,
361
+ index: Quantity,
362
+ block: RpcBlockNumber | BlockTag | RpcBlockIdentifier
363
+ ];
364
+ }): Promise<RpcLog>;
365
+ request(args: {
366
+ /**
367
+ * @description Returns information about a transaction specified by block hash and transaction index
368
+ * @link https://eips.ethereum.org/EIPS/eip-1474
369
+ * @example
370
+ * provider.request({ method: 'eth_getTransactionByBlockHashAndIndex', params: ['0x...', '0x...'] })
371
+ * // => { ... }
372
+ * */
373
+ method: 'eth_getTransactionByBlockHashAndIndex';
374
+ params: [hash: Hash, index: Quantity];
375
+ }): Promise<RpcTransaction | null>;
376
+ request(args: {
377
+ /**
378
+ * @description Returns information about a transaction specified by block number and transaction index
379
+ * @link https://eips.ethereum.org/EIPS/eip-1474
380
+ * @example
381
+ * provider.request({ method: 'eth_getTransactionByBlockNumberAndIndex', params: ['0x...', '0x...'] })
382
+ * // => { ... }
383
+ * */
384
+ method: 'eth_getTransactionByBlockNumberAndIndex';
385
+ params: [block: RpcBlockNumber | BlockTag, index: Quantity];
386
+ }): Promise<RpcTransaction | null>;
387
+ request(args: {
388
+ /**
389
+ * @description Returns information about a transaction specified by hash
390
+ * @link https://eips.ethereum.org/EIPS/eip-1474
391
+ * @example
392
+ * provider.request({ method: 'eth_getTransactionByHash', params: ['0x...'] })
393
+ * // => { ... }
394
+ * */
395
+ method: 'eth_getTransactionByHash';
396
+ params: [hash: Hash];
397
+ }): Promise<RpcTransaction | null>;
398
+ request(args: {
399
+ /**
400
+ * @description Returns the number of transactions sent from an address
401
+ * @link https://eips.ethereum.org/EIPS/eip-1474
402
+ * @example
403
+ * provider.request({ method: 'eth_getTransactionCount', params: ['0x...', 'latest'] })
404
+ * // => '0x1'
405
+ * */
406
+ method: 'eth_getTransactionCount';
407
+ params: [address: Address, block: RpcBlockNumber | BlockTag | RpcBlockIdentifier];
408
+ }): Promise<Quantity | null>;
409
+ request(args: {
410
+ /**
411
+ * @description Returns the receipt of a transaction specified by hash
412
+ * @link https://eips.ethereum.org/EIPS/eip-1474
413
+ * @example
414
+ * provider.request({ method: 'eth_getTransactionReceipt', params: ['0x...'] })
415
+ * // => { ... }
416
+ * */
417
+ method: 'eth_getTransactionReceipt';
418
+ params: [hash: Hash];
419
+ }): Promise<RpcTransactionReceipt | null>;
420
+ request(args: {
421
+ /**
422
+ * @description Returns information about an uncle specified by block hash and uncle index position
423
+ * @link https://eips.ethereum.org/EIPS/eip-1474
424
+ * @example
425
+ * provider.request({ method: 'eth_getUncleByBlockHashAndIndex', params: ['0x...', '0x...'] })
426
+ * // => { ... }
427
+ * */
428
+ method: 'eth_getUncleByBlockHashAndIndex';
429
+ params: [hash: Hash, index: Quantity];
430
+ }): Promise<RpcUncle | null>;
431
+ request(args: {
432
+ /**
433
+ * @description Returns information about an uncle specified by block number and uncle index position
434
+ * @link https://eips.ethereum.org/EIPS/eip-1474
435
+ * @example
436
+ * provider.request({ method: 'eth_getUncleByBlockNumberAndIndex', params: ['0x...', '0x...'] })
437
+ * // => { ... }
438
+ * */
439
+ method: 'eth_getUncleByBlockNumberAndIndex';
440
+ params: [block: RpcBlockNumber | BlockTag, index: Quantity];
441
+ }): Promise<RpcUncle | null>;
442
+ request(args: {
443
+ /**
444
+ * @description Returns the number of uncles in a block specified by block hash
445
+ * @link https://eips.ethereum.org/EIPS/eip-1474
446
+ * @example
447
+ * provider.request({ method: 'eth_getUncleCountByBlockHash', params: ['0x...'] })
448
+ * // => '0x1'
449
+ * */
450
+ method: 'eth_getUncleCountByBlockHash';
451
+ params: [hash: Hash];
452
+ }): Promise<Quantity>;
453
+ request(args: {
454
+ /**
455
+ * @description Returns the number of uncles in a block specified by block number
456
+ * @link https://eips.ethereum.org/EIPS/eip-1474
457
+ * @example
458
+ * provider.request({ method: 'eth_getUncleCountByBlockNumber', params: ['0x...'] })
459
+ * // => '0x1'
460
+ * */
461
+ method: 'eth_getUncleCountByBlockNumber';
462
+ params: [block: RpcBlockNumber | BlockTag];
463
+ }): Promise<Quantity>;
464
+ request(args: {
465
+ /**
466
+ * @description Creates a filter to listen for new blocks that can be used with `eth_getFilterChanges`
467
+ * @link https://eips.ethereum.org/EIPS/eip-1474
468
+ * @example
469
+ * provider.request({ method: 'eth_newBlockFilter' })
470
+ * // => '0x1'
471
+ * */
472
+ method: 'eth_newBlockFilter';
473
+ params?: never;
474
+ }): Promise<Quantity>;
475
+ request(args: {
476
+ /**
477
+ * @description Creates a filter to listen for specific state changes that can then be used with `eth_getFilterChanges`
478
+ * @link https://eips.ethereum.org/EIPS/eip-1474
479
+ * @example
480
+ * provider.request({ method: 'eth_newFilter', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
481
+ * // => '0x1'
482
+ * */
483
+ method: 'eth_newFilter';
484
+ params: [
485
+ filter: {
486
+ fromBlock?: RpcBlockNumber | BlockTag;
487
+ toBlock?: RpcBlockNumber | BlockTag;
488
+ address?: Address | Address[];
489
+ topics?: (Hex | Hex[] | null)[];
490
+ }
491
+ ];
492
+ }): Promise<Quantity>;
493
+ request(args: {
494
+ /**
495
+ * @description Creates a filter to listen for new pending transactions that can be used with `eth_getFilterChanges`
496
+ * @link https://eips.ethereum.org/EIPS/eip-1474
497
+ * @example
498
+ * provider.request({ method: 'eth_newPendingTransactionFilter' })
499
+ * // => '0x1'
500
+ * */
501
+ method: 'eth_newPendingTransactionFilter';
502
+ params?: never;
503
+ }): Promise<Quantity>;
504
+ request(args: {
505
+ /**
506
+ * @description Returns the current Ethereum protocol version
507
+ * @link https://eips.ethereum.org/EIPS/eip-1474
508
+ * @example
509
+ * provider.request({ method: 'eth_protocolVersion' })
510
+ * // => '54'
511
+ * */
512
+ method: 'eth_protocolVersion';
513
+ params?: never;
514
+ }): Promise<string>;
515
+ request(args: {
516
+ /**
517
+ * @description Sends and already-signed transaction to the network
518
+ * @link https://eips.ethereum.org/EIPS/eip-1474
519
+ * @example
520
+ * provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] })
521
+ * // => '0x...'
522
+ * */
523
+ method: 'eth_sendRawTransaction';
524
+ params: [signedTransaction: Hex];
525
+ }): Promise<Hex>;
526
+ request(args: {
527
+ /**
528
+ * @description Destroys a filter based on filter ID
529
+ * @link https://eips.ethereum.org/EIPS/eip-1474
530
+ * @example
531
+ * provider.request({ method: 'eth_uninstallFilter', params: ['0x1'] })
532
+ * // => true
533
+ * */
534
+ method: 'eth_uninstallFilter';
535
+ params: [
536
+ /** ID of the filter to destroy */
537
+ filterId: Quantity
538
+ ];
539
+ }): Promise<boolean>;
540
+ };
541
+ type TestRequests<Name extends string> = {
542
+ request(args: {
543
+ /**
544
+ * @description Add information about compiled contracts
545
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_addcompilationresult
546
+ */
547
+ method: `${Name}_addCompilationResult`;
548
+ params: any[];
549
+ }): Promise<any>;
550
+ request(args: {
551
+ /**
552
+ * @description Remove a transaction from the mempool
553
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_droptransaction
554
+ */
555
+ method: `${Name}_dropTransaction`;
556
+ params: [hash: Hash];
557
+ }): Promise<void>;
558
+ request(args: {
559
+ /**
560
+ * @description Turn on call traces for transactions that are returned to the user when they execute a transaction (instead of just txhash/receipt).
561
+ */
562
+ method: `${Name}_enableTraces`;
563
+ params?: never;
564
+ }): Promise<void>;
565
+ request(args: {
566
+ /**
567
+ * @description Impersonate an account or contract address.
568
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_impersonateaccount
569
+ */
570
+ method: `${Name}_impersonateAccount`;
571
+ params: [address: Address];
572
+ }): Promise<void>;
573
+ request(args: {
574
+ /**
575
+ * @description Returns true if automatic mining is enabled, and false otherwise. See [Mining Modes](https://hardhat.org/hardhat-network/explanation/mining-modes) to learn more.
576
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_getautomine
577
+ */
578
+ method: `${Name}_getAutomine`;
579
+ }): Promise<boolean>;
580
+ request(args: {
581
+ /**
582
+ * @description Advance the block number of the network by a certain number of blocks
583
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_mine
584
+ */
585
+ method: `${Name}_mine`;
586
+ params: [
587
+ /** Number of blocks to mine. */
588
+ count: Hex,
589
+ /** Interval between each block in seconds. */
590
+ interval: Hex | undefined
591
+ ];
592
+ }): Promise<void>;
593
+ request(args: {
594
+ /**
595
+ * @description Resets the fork.
596
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_reset
597
+ */
598
+ method: `${Name}_reset`;
599
+ params: any[];
600
+ }): Promise<void>;
601
+ request(args: {
602
+ /**
603
+ * @description Modifies the balance of an account.
604
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setbalance
605
+ */
606
+ method: `${Name}_setBalance`;
607
+ params: [
608
+ /** The address of the target account. */
609
+ address: Address,
610
+ /** Amount to send in wei. */
611
+ value: Quantity
612
+ ];
613
+ }): Promise<void>;
614
+ request(args: {
615
+ /**
616
+ * @description Modifies the bytecode stored at an account's address.
617
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcode
618
+ */
619
+ method: `${Name}_setCode`;
620
+ params: [
621
+ /** The address of the contract. */
622
+ address: Address,
623
+ /** Data bytecode. */
624
+ data: string
625
+ ];
626
+ }): Promise<void>;
627
+ request(args: {
628
+ /**
629
+ * @description Sets the coinbase address to be used in new blocks.
630
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcoinbase
631
+ */
632
+ method: `${Name}_setCoinbase`;
633
+ params: [
634
+ /** The address to set as the coinbase address. */
635
+ address: Address
636
+ ];
637
+ }): Promise<void>;
638
+ request(args: {
639
+ /**
640
+ * @description Enable or disable logging on the test node network.
641
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcoinbase
642
+ */
643
+ method: `${Name}_setLoggingEnabled`;
644
+ params: [enabled: boolean];
645
+ }): Promise<void>;
646
+ request(args: {
647
+ /**
648
+ * @description Change the minimum gas price accepted by the network (in wei).
649
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setmingasprice
650
+ */
651
+ method: `${Name}_setMinGasPrice`;
652
+ params: [gasPrice: Quantity];
653
+ }): Promise<void>;
654
+ request(args: {
655
+ /**
656
+ * @description Sets the base fee of the next block.
657
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setnextblockbasefeepergas
658
+ */
659
+ method: `${Name}_setNextBlockBaseFeePerGas`;
660
+ params: [baseFeePerGas: Quantity];
661
+ }): Promise<void>;
662
+ request(args: {
663
+ /**
664
+ * @description Modifies an account's nonce by overwriting it.
665
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setnonce
666
+ */
667
+ method: `${Name}_setNonce`;
668
+ params: [
669
+ /** The account address. */
670
+ address: Address,
671
+ /** The new nonce. */
672
+ nonce: Quantity
673
+ ];
674
+ }): Promise<void>;
675
+ request(args: {
676
+ /**
677
+ * @description Sets the backend RPC URL.
678
+ */
679
+ method: `${Name}_setRpcUrl`;
680
+ params: [url: string];
681
+ }): Promise<void>;
682
+ request(args: {
683
+ /**
684
+ * @description Writes a single position of an account's storage.
685
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setstorageat
686
+ */
687
+ method: `${Name}_setStorageAt`;
688
+ params: [
689
+ /** The account address. */
690
+ address: Address,
691
+ /** The storage position index. */
692
+ index: Quantity,
693
+ /** The storage value. */
694
+ value: Quantity
695
+ ];
696
+ }): Promise<void>;
697
+ request(args: {
698
+ /**
699
+ * @description Use this method to stop impersonating an account after having previously used impersonateAccount.
700
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_stopimpersonatingaccount
701
+ */
702
+ method: `${Name}_stopImpersonatingAccount`;
703
+ params: [
704
+ /** The address to stop impersonating. */
705
+ address: Address
706
+ ];
707
+ }): Promise<void>;
708
+ request(args: {
709
+ /**
710
+ * @description Jump forward in time by the given amount of time, in seconds.
711
+ * @link https://github.com/trufflesuite/ganache/blob/ef1858d5d6f27e4baeb75cccd57fb3dc77a45ae8/src/chains/ethereum/ethereum/RPC-METHODS.md#evm_increasetime
712
+ */
713
+ method: 'evm_increaseTime';
714
+ params: [seconds: Quantity];
715
+ }): Promise<Quantity>;
716
+ request(args: {
717
+ /**
718
+ * @description Enables or disables, based on the single boolean argument, the automatic mining of new blocks with each new transaction submitted to the network.
719
+ * @link https://hardhat.org/hardhat-network/docs/reference#evm_setautomine
720
+ */
721
+ method: 'evm_setAutomine';
722
+ params: [boolean];
723
+ }): Promise<void>;
724
+ request(args: {
725
+ /**
726
+ * @description Sets the block's gas limit.
727
+ * @link https://hardhat.org/hardhat-network/docs/reference#evm_setblockgaslimit
728
+ */
729
+ method: 'evm_setBlockGasLimit';
730
+ params: [gasLimit: Quantity];
731
+ }): Promise<void>;
732
+ request(args: {
733
+ /**
734
+ * @description Similar to `evm_increaseTime` but sets a block timestamp `interval`.
735
+ * The timestamp of the next block will be computed as `lastBlock_timestamp` + `interval`
736
+ */
737
+ method: `${Name}_setBlockTimestampInterval`;
738
+ params: [seconds: number];
739
+ }): Promise<void>;
740
+ request(args: {
741
+ /**
742
+ * @description Removes `setBlockTimestampInterval` if it exists
743
+ */
744
+ method: `${Name}_removeBlockTimestampInterval`;
745
+ }): Promise<void>;
746
+ request(args: {
747
+ /**
748
+ * @description Enables (with a numeric argument greater than 0) or disables (with a numeric argument equal to 0), the automatic mining of blocks at a regular interval of milliseconds, each of which will include all pending transactions.
749
+ * @link https://hardhat.org/hardhat-network/docs/reference#evm_setintervalmining
750
+ */
751
+ method: 'evm_setIntervalMining';
752
+ params: [number];
753
+ }): Promise<void>;
754
+ request(args: {
755
+ /**
756
+ * @description Set the timestamp of the next block.
757
+ * @link https://hardhat.org/hardhat-network/docs/reference#evm_setnextblocktimestamp
758
+ */
759
+ method: 'evm_setNextBlockTimestamp';
760
+ params: [Quantity];
761
+ }): Promise<void>;
762
+ request(args: {
763
+ /**
764
+ * @description Snapshot the state of the blockchain at the current block. Takes no parameters. Returns the id of the snapshot that was created.
765
+ * @link https://hardhat.org/hardhat-network/docs/reference#evm_snapshot
766
+ */
767
+ method: 'evm_snapshot';
768
+ params?: never;
769
+ }): Promise<Quantity>;
770
+ request(args: {
771
+ /**
772
+ * @description Revert the state of the blockchain to a previous snapshot. Takes a single parameter, which is the snapshot id to revert to.
773
+ */
774
+ method: 'evm_revert';
775
+ params?: [id: Quantity];
776
+ }): Promise<void>;
777
+ request(args: {
778
+ /**
779
+ * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-content
780
+ */
781
+ method: 'txpool_content';
782
+ params?: never;
783
+ }): Promise<{
784
+ pending: Record<Address, Record<string, RpcTransaction>>;
785
+ queued: Record<Address, Record<string, RpcTransaction>>;
786
+ }>;
787
+ request(args: {
788
+ /**
789
+ * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-inspect
790
+ */
791
+ method: 'txpool_inspect';
792
+ params?: never;
793
+ }): Promise<{
794
+ pending: Record<Address, Record<string, string>>;
795
+ queued: Record<Address, Record<string, string>>;
796
+ }>;
797
+ request(args: {
798
+ /**
799
+ * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-inspect
800
+ */
801
+ method: 'txpool_status';
802
+ params?: never;
803
+ }): Promise<{
804
+ pending: Quantity;
805
+ queued: Quantity;
806
+ }>;
807
+ request(args: {
808
+ /**
809
+ * @description Creates, signs, and sends a new transaction to the network regardless of the signature.
810
+ * @link https://eips.ethereum.org/EIPS/eip-1474
811
+ * @example
812
+ * provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
813
+ * // => '0x...'
814
+ * */
815
+ method: 'eth_sendUnsignedTransaction';
816
+ params: [request: RpcTransactionRequest];
817
+ }): Promise<Hash>;
818
+ };
819
+ type SignableRequests = {
820
+ request(args: {
821
+ /**
822
+ * @description Creates, signs, and sends a new transaction to the network
823
+ * @link https://eips.ethereum.org/EIPS/eip-1474
824
+ * @example
825
+ * provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
826
+ * // => '0x...'
827
+ * */
828
+ method: 'eth_sendTransaction';
829
+ params: [request: RpcTransactionRequest];
830
+ }): Promise<Hash>;
831
+ request(args: {
832
+ /**
833
+ * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
834
+ * @link https://eips.ethereum.org/EIPS/eip-1474
835
+ * @example
836
+ * provider.request({ method: 'eth_sign', params: ['0x...', '0x...'] })
837
+ * // => '0x...'
838
+ * */
839
+ method: 'eth_sign';
840
+ params: [
841
+ /** Address to use for signing */
842
+ address: Address,
843
+ /** Data to sign */
844
+ data: Hex
845
+ ];
846
+ }): Promise<Hex>;
847
+ request(args: {
848
+ /**
849
+ * @description Signs a transaction that can be submitted to the network at a later time using with `eth_sendRawTransaction`
850
+ * @link https://eips.ethereum.org/EIPS/eip-1474
851
+ * @example
852
+ * provider.request({ method: 'eth_signTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
853
+ * // => '0x...'
854
+ * */
855
+ method: 'eth_signTransaction';
856
+ params: [request: RpcTransactionRequest];
857
+ }): Promise<Hex>;
858
+ request(args: {
859
+ /**
860
+ * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
861
+ * @link https://eips.ethereum.org/EIPS/eip-1474
862
+ * @example
863
+ * provider.request({ method: 'eth_signTypedData', params: [{ from: '0x...', data: [{ type: 'string', name: 'message', value: 'hello world' }] }] })
864
+ * // => '0x...'
865
+ * */
866
+ method: 'eth_signTypedData';
867
+ params: [
868
+ /** Address to use for signing */
869
+ address: Address,
870
+ /** Message to sign containing type information, a domain separator, and data */
871
+ message: Hex
872
+ ];
873
+ }): Promise<Hex>;
874
+ request(args: {
875
+ /**
876
+ * @description Returns information about the status of this client’s network synchronization
877
+ * @link https://eips.ethereum.org/EIPS/eip-1474
878
+ * @example
879
+ * provider.request({ method: 'eth_syncing' })
880
+ * // => { startingBlock: '0x...', currentBlock: '0x...', highestBlock: '0x...' }
881
+ * */
882
+ method: 'eth_syncing';
883
+ params?: never;
884
+ }): Promise<NetworkSync | false>;
885
+ request(args: {
886
+ /**
887
+ * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
888
+ * @link https://eips.ethereum.org/EIPS/eip-1474
889
+ * @example
890
+ * provider.request({ method: 'personal_sign', params: ['0x...', '0x...'] })
891
+ * // => '0x...'
892
+ * */
893
+ method: 'personal_sign';
894
+ params: [
895
+ /** Data to sign */
896
+ data: Hex,
897
+ /** Address to use for signing */
898
+ address: Address
899
+ ];
900
+ }): Promise<Hex>;
901
+ };
902
+ type WalletRequests = {
903
+ request(args: {
904
+ /**
905
+ * @description Returns a list of addresses owned by this client
906
+ * @link https://eips.ethereum.org/EIPS/eip-1474
907
+ * @example
908
+ * provider.request({ method: 'eth_accounts' })
909
+ * // => ['0x0fB69...']
910
+ * */
911
+ method: 'eth_accounts';
912
+ params?: never;
913
+ }): Promise<Address[]>;
914
+ request(args: {
915
+ /**
916
+ * @description Requests that the user provides an Ethereum address to be identified by. Typically causes a browser extension popup to appear.
917
+ * @link https://eips.ethereum.org/EIPS/eip-1102
918
+ * @example
919
+ * provider.request({ method: 'eth_requestAccounts' }] })
920
+ * // => ['0x...', '0x...']
921
+ * */
922
+ method: 'eth_requestAccounts';
923
+ params?: never;
924
+ }): Promise<Address[]>;
925
+ request(args: {
926
+ /**
927
+ * @description Requests the given permissions from the user.
928
+ * @link https://eips.ethereum.org/EIPS/eip-2255
929
+ * @example
930
+ * provider.request({ method: 'wallet_requestPermissions', params: [{ eth_accounts: {} }] })
931
+ * // => { ... }
932
+ * */
933
+ method: 'wallet_requestPermissions';
934
+ params: [permissions: {
935
+ eth_accounts: Record<string, any>;
936
+ }];
937
+ }): Promise<WalletPermission[]>;
938
+ request(args: {
939
+ /**
940
+ * @description Gets the wallets current permissions.
941
+ * @link https://eips.ethereum.org/EIPS/eip-2255
942
+ * @example
943
+ * provider.request({ method: 'wallet_getPermissions' })
944
+ * // => { ... }
945
+ * */
946
+ method: 'wallet_getPermissions';
947
+ params?: never;
948
+ }): Promise<WalletPermission[]>;
949
+ request(args: {
950
+ /**
951
+ * @description Add an Ethereum chain to the wallet.
952
+ * @link https://eips.ethereum.org/EIPS/eip-3085
953
+ * @example
954
+ * provider.request({ method: 'wallet_addEthereumChain', params: [{ chainId: 1, rpcUrl: 'https://mainnet.infura.io/v3/...' }] })
955
+ * // => { ... }
956
+ */
957
+ method: 'wallet_addEthereumChain';
958
+ params: [chain: Chain];
959
+ }): Promise<null>;
960
+ request(args: {
961
+ /**
962
+ * @description Switch the wallet to the given Ethereum chain.
963
+ * @link https://eips.ethereum.org/EIPS/eip-3326
964
+ * @example
965
+ * provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0xf00' }] })
966
+ * // => { ... }
967
+ * */
968
+ method: 'wallet_switchEthereumChain';
969
+ params: [chain: {
970
+ chainId: string;
971
+ }];
972
+ }): Promise<null>;
973
+ /**
974
+ * @description Requests that the user tracks the token in their wallet. Returns a boolean indicating if the token was successfully added.
975
+ * @link https://eips.ethereum.org/EIPS/eip-747
976
+ * @example
977
+ * provider.request({ method: 'wallet_watchAsset' }] })
978
+ * // => true
979
+ * */
980
+ request(args: {
981
+ method: 'wallet_watchAsset';
982
+ params: [WatchAssetParams];
983
+ }): Promise<boolean>;
984
+ };
985
+ type Requests = PublicRequests & SignableRequests & WalletRequests;
986
+
987
+ export { Events as E, PublicRequests as P, Requests as R, SignableRequests as S, TestRequests as T, WalletPermission as W, WatchAssetParams as a, WalletRequests as b };