viem 0.0.1-alpha.3 → 0.0.1-alpha.31

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 (101) hide show
  1. package/chains/package.json +1 -1
  2. package/contract/package.json +4 -0
  3. package/dist/chain-00b37e4e.d.ts +543 -0
  4. package/dist/chain-38182d92.d.ts +5 -0
  5. package/dist/chains.d.ts +1305 -74
  6. package/dist/chains.js +125 -130
  7. package/dist/chains.js.map +1 -0
  8. package/dist/chains.mjs +129 -0
  9. package/dist/chains.mjs.map +1 -0
  10. package/dist/chunk-5STAX3WF.js +265 -0
  11. package/dist/chunk-5STAX3WF.js.map +1 -0
  12. package/dist/chunk-6ZFIUYGC.mjs +3436 -0
  13. package/dist/chunk-6ZFIUYGC.mjs.map +1 -0
  14. package/dist/chunk-APXHGB76.mjs +197 -0
  15. package/dist/chunk-APXHGB76.mjs.map +1 -0
  16. package/dist/chunk-C54QK7K3.mjs +210 -0
  17. package/dist/chunk-C54QK7K3.mjs.map +1 -0
  18. package/dist/{chunk-YZEQFYZ3.js → chunk-IBWRBL2I.mjs} +725 -556
  19. package/dist/chunk-IBWRBL2I.mjs.map +1 -0
  20. package/dist/chunk-J7QHQ26Y.js +3436 -0
  21. package/dist/chunk-J7QHQ26Y.js.map +1 -0
  22. package/dist/chunk-MYFKW55L.js +210 -0
  23. package/dist/chunk-MYFKW55L.js.map +1 -0
  24. package/dist/chunk-NCPBWOQA.js +1216 -0
  25. package/dist/chunk-NCPBWOQA.js.map +1 -0
  26. package/dist/chunk-QBB3DFIB.mjs +265 -0
  27. package/dist/chunk-QBB3DFIB.mjs.map +1 -0
  28. package/dist/chunk-UUULPQHV.js +197 -0
  29. package/dist/chunk-UUULPQHV.js.map +1 -0
  30. package/dist/contract.d.ts +11 -0
  31. package/dist/contract.js +57 -0
  32. package/dist/contract.js.map +1 -0
  33. package/dist/contract.mjs +57 -0
  34. package/dist/contract.mjs.map +1 -0
  35. package/dist/createClient-5258d590.d.ts +70 -0
  36. package/dist/createPublicClient-99be385b.d.ts +650 -0
  37. package/dist/{eip1193-8b4d90ce.d.ts → eip1193-fcdeee04.d.ts} +13 -10
  38. package/dist/ens.d.ts +22 -0
  39. package/dist/ens.js +22 -0
  40. package/dist/ens.js.map +1 -0
  41. package/dist/ens.mjs +22 -0
  42. package/dist/ens.mjs.map +1 -0
  43. package/dist/formatAbiItem-50cb39d8.d.ts +14 -0
  44. package/dist/getAbiItem-6d4f64d2.d.ts +97 -0
  45. package/dist/index.d.ts +251 -67
  46. package/dist/index.js +769 -344
  47. package/dist/index.js.map +1 -0
  48. package/dist/index.mjs +769 -0
  49. package/dist/index.mjs.map +1 -0
  50. package/dist/namehash-88f4639d.d.ts +22 -0
  51. package/dist/parseGwei-8af7a0a6.d.ts +509 -0
  52. package/dist/public.d.ts +29 -0
  53. package/dist/public.js +60 -0
  54. package/dist/public.js.map +1 -0
  55. package/dist/public.mjs +60 -0
  56. package/dist/public.mjs.map +1 -0
  57. package/dist/test-79ec416c.d.ts +213 -0
  58. package/dist/test.d.ts +20 -0
  59. package/dist/test.js +62 -0
  60. package/dist/test.js.map +1 -0
  61. package/dist/test.mjs +62 -0
  62. package/dist/test.mjs.map +1 -0
  63. package/dist/utils/index.d.ts +52 -7
  64. package/dist/utils/index.js +187 -126
  65. package/dist/utils/index.js.map +1 -0
  66. package/dist/utils/index.mjs +187 -0
  67. package/dist/utils/index.mjs.map +1 -0
  68. package/dist/wallet-cf5c8351.d.ts +115 -0
  69. package/dist/wallet.d.ts +7 -0
  70. package/dist/wallet.js +24 -0
  71. package/dist/wallet.js.map +1 -0
  72. package/dist/wallet.mjs +24 -0
  73. package/dist/wallet.mjs.map +1 -0
  74. package/dist/window.d.ts +5 -2
  75. package/dist/window.js +1 -0
  76. package/dist/window.js.map +1 -0
  77. package/dist/window.mjs +1 -0
  78. package/dist/window.mjs.map +1 -0
  79. package/ens/package.json +4 -0
  80. package/package.json +46 -73
  81. package/public/package.json +4 -0
  82. package/test/package.json +4 -0
  83. package/utils/package.json +1 -1
  84. package/wallet/package.json +4 -0
  85. package/window/package.json +1 -1
  86. package/actions/package.json +0 -4
  87. package/clients/package.json +0 -4
  88. package/dist/actions/index.d.ts +0 -7
  89. package/dist/actions/index.js +0 -124
  90. package/dist/chunk-SRDTRROA.js +0 -1214
  91. package/dist/chunk-TLEMV4T3.js +0 -258
  92. package/dist/chunk-WZITKXV3.js +0 -996
  93. package/dist/clients/index.d.ts +0 -7
  94. package/dist/clients/index.js +0 -23
  95. package/dist/createWalletClient-15ad1601.d.ts +0 -130
  96. package/dist/parseGwei-0f85e8ca.d.ts +0 -248
  97. package/dist/rpc-15b85963.d.ts +0 -292
  98. package/dist/rpc-26932bae.d.ts +0 -61
  99. package/dist/transactionRequest-f538ea86.d.ts +0 -44
  100. package/dist/watchAsset-0c9d01e2.d.ts +0 -522
  101. package/dist/webSocket-b55b0951.d.ts +0 -83
@@ -1,6 +1,16 @@
1
1
  import {
2
- checksumAddress,
3
- encodeHex,
2
+ AbiDecodingZeroDataError,
3
+ BlockNotFoundError,
4
+ RawContractError,
5
+ TransactionNotFoundError,
6
+ TransactionReceiptNotFoundError,
7
+ WaitForTransactionReceiptTimeoutError,
8
+ assertRequest,
9
+ decodeEventLog,
10
+ decodeFunctionResult,
11
+ encodeEventTopics,
12
+ encodeFunctionData,
13
+ extract,
4
14
  format,
5
15
  formatBlock,
6
16
  formatFeeHistory,
@@ -8,67 +18,118 @@ import {
8
18
  formatTransaction,
9
19
  formatTransactionReceipt,
10
20
  formatTransactionRequest,
11
- getAddress,
12
- hexToNumber,
13
- numberToHex
14
- } from "./chunk-SRDTRROA.js";
15
- import {
16
- BaseError,
17
- BlockNotFoundError,
18
- InvalidGasArgumentsError,
19
- TransactionNotFoundError,
20
- TransactionReceiptNotFoundError,
21
- WaitForTransactionReceiptTimeoutError,
21
+ getAbiItem,
22
22
  getCache,
23
+ getCallError,
24
+ getContractError,
25
+ getEstimateGasError,
26
+ hexToNumber,
27
+ multicall3Abi,
28
+ numberToHex,
23
29
  wait,
24
30
  withCache
25
- } from "./chunk-WZITKXV3.js";
31
+ } from "./chunk-6ZFIUYGC.mjs";
26
32
 
27
33
  // src/actions/public/call.ts
28
- async function call(client, {
29
- blockNumber,
30
- blockTag = "latest",
31
- chain,
32
- from,
33
- accessList,
34
- data,
35
- gas,
36
- gasPrice,
37
- maxFeePerGas,
38
- maxPriorityFeePerGas,
39
- nonce,
40
- to,
41
- value,
42
- ...rest
34
+ async function call(client, args) {
35
+ const {
36
+ blockNumber,
37
+ blockTag = "latest",
38
+ from,
39
+ accessList,
40
+ data,
41
+ gas,
42
+ gasPrice,
43
+ maxFeePerGas,
44
+ maxPriorityFeePerGas,
45
+ nonce,
46
+ to,
47
+ value,
48
+ ...rest
49
+ } = args;
50
+ try {
51
+ assertRequest(args);
52
+ const blockNumberHex = blockNumber ? numberToHex(blockNumber) : void 0;
53
+ const formatter = client.chain?.formatters?.transactionRequest;
54
+ const request_ = format(
55
+ {
56
+ from,
57
+ accessList,
58
+ data,
59
+ gas,
60
+ gasPrice,
61
+ maxFeePerGas,
62
+ maxPriorityFeePerGas,
63
+ nonce,
64
+ to,
65
+ value,
66
+ // Pick out extra data that might exist on the chain's transaction request type.
67
+ ...extract(rest, { formatter })
68
+ },
69
+ {
70
+ formatter: formatter || formatTransactionRequest
71
+ }
72
+ );
73
+ const response = await client.request({
74
+ method: "eth_call",
75
+ params: [request_, blockNumberHex || blockTag]
76
+ });
77
+ if (response === "0x")
78
+ return { data: void 0 };
79
+ return { data: response };
80
+ } catch (err) {
81
+ throw getCallError(err, {
82
+ ...args,
83
+ chain: client.chain
84
+ });
85
+ }
86
+ }
87
+
88
+ // src/actions/public/simulateContract.ts
89
+ async function simulateContract(client, {
90
+ abi,
91
+ address,
92
+ args,
93
+ functionName,
94
+ ...callRequest
43
95
  }) {
44
- if (maxFeePerGas !== void 0 && maxPriorityFeePerGas !== void 0 && maxFeePerGas < maxPriorityFeePerGas)
45
- throw new InvalidGasArgumentsError();
46
- const blockNumberHex = blockNumber ? numberToHex(blockNumber) : void 0;
47
- const request_ = format(
48
- {
49
- from,
50
- accessList,
51
- data,
52
- gas,
53
- gasPrice,
54
- maxFeePerGas,
55
- maxPriorityFeePerGas,
56
- nonce,
57
- to,
58
- value,
59
- ...rest
60
- },
61
- {
62
- formatter: chain?.formatters?.transactionRequest || formatTransactionRequest
63
- }
64
- );
65
- const response = await client.request({
66
- method: "eth_call",
67
- params: [request_, blockNumberHex || blockTag]
96
+ const calldata = encodeFunctionData({
97
+ abi,
98
+ args,
99
+ functionName
68
100
  });
69
- if (response === "0x")
70
- return { data: void 0 };
71
- return { data: response };
101
+ try {
102
+ const { data } = await call(client, {
103
+ data: calldata,
104
+ to: address,
105
+ ...callRequest
106
+ });
107
+ const result = decodeFunctionResult({
108
+ abi,
109
+ args,
110
+ functionName,
111
+ data: data || "0x"
112
+ });
113
+ return {
114
+ result,
115
+ request: {
116
+ abi,
117
+ address,
118
+ args,
119
+ functionName,
120
+ ...callRequest
121
+ }
122
+ };
123
+ } catch (err) {
124
+ throw getContractError(err, {
125
+ abi,
126
+ address,
127
+ args,
128
+ docsPath: "/docs/contract/simulateContract",
129
+ functionName,
130
+ sender: callRequest.from
131
+ });
132
+ }
72
133
  }
73
134
 
74
135
  // src/actions/public/createPendingTransactionFilter.ts
@@ -87,35 +148,158 @@ async function createBlockFilter(client) {
87
148
  return { id, type: "block" };
88
149
  }
89
150
 
90
- // src/actions/public/estimateGas.ts
91
- async function estimateGas(client, {
92
- blockNumber,
93
- blockTag = "latest",
94
- data,
95
- from,
96
- gas,
97
- gasPrice,
98
- maxFeePerGas,
99
- maxPriorityFeePerGas,
100
- to,
101
- value
151
+ // src/actions/public/createEventFilter.ts
152
+ async function createEventFilter(client, {
153
+ address,
154
+ args,
155
+ event,
156
+ fromBlock,
157
+ toBlock
158
+ } = {}) {
159
+ let topics = [];
160
+ if (event)
161
+ topics = encodeEventTopics({
162
+ abi: [event],
163
+ eventName: event.name,
164
+ args
165
+ });
166
+ const id = await client.request({
167
+ method: "eth_newFilter",
168
+ params: [
169
+ {
170
+ address,
171
+ fromBlock: typeof fromBlock === "bigint" ? numberToHex(fromBlock) : fromBlock,
172
+ toBlock: typeof toBlock === "bigint" ? numberToHex(toBlock) : toBlock,
173
+ ...topics.length ? { topics } : {}
174
+ }
175
+ ]
176
+ });
177
+ return {
178
+ abi: event ? [event] : void 0,
179
+ args,
180
+ eventName: event ? event.name : void 0,
181
+ id,
182
+ type: "event"
183
+ };
184
+ }
185
+
186
+ // src/actions/public/createContractEventFilter.ts
187
+ async function createContractEventFilter(client, {
188
+ address,
189
+ abi,
190
+ args,
191
+ eventName,
192
+ fromBlock,
193
+ toBlock
102
194
  }) {
103
- const blockNumberHex = blockNumber ? numberToHex(blockNumber) : void 0;
104
- const parameters = {
195
+ const topics = eventName ? encodeEventTopics({
196
+ abi,
197
+ args,
198
+ eventName
199
+ }) : void 0;
200
+ const id = await client.request({
201
+ method: "eth_newFilter",
202
+ params: [
203
+ {
204
+ address,
205
+ fromBlock: typeof fromBlock === "bigint" ? numberToHex(fromBlock) : fromBlock,
206
+ toBlock: typeof toBlock === "bigint" ? numberToHex(toBlock) : toBlock,
207
+ topics
208
+ }
209
+ ]
210
+ });
211
+ return {
212
+ abi,
213
+ args,
214
+ eventName,
215
+ id,
216
+ type: "event"
217
+ };
218
+ }
219
+
220
+ // src/actions/public/estimateGas.ts
221
+ async function estimateGas(client, args) {
222
+ const {
223
+ accessList,
224
+ blockNumber,
225
+ blockTag = "latest",
105
226
  data,
106
227
  from,
107
- gas: gas ? numberToHex(gas) : void 0,
108
- gasPrice: gasPrice ? numberToHex(gasPrice) : void 0,
109
- maxFeePerGas: maxFeePerGas ? numberToHex(maxFeePerGas) : void 0,
110
- maxPriorityFeePerGas: maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : void 0,
228
+ gas,
229
+ gasPrice,
230
+ maxFeePerGas,
231
+ maxPriorityFeePerGas,
232
+ nonce,
111
233
  to,
112
- value: value ? numberToHex(value) : void 0
113
- };
114
- const balance = await client.request({
115
- method: "eth_estimateGas",
116
- params: [parameters, blockNumberHex || blockTag]
234
+ value,
235
+ ...rest
236
+ } = args;
237
+ try {
238
+ assertRequest(args);
239
+ const blockNumberHex = blockNumber ? numberToHex(blockNumber) : void 0;
240
+ const formatter = client.chain?.formatters?.transactionRequest;
241
+ const request_ = format(
242
+ {
243
+ from,
244
+ accessList,
245
+ data,
246
+ gas,
247
+ gasPrice,
248
+ maxFeePerGas,
249
+ maxPriorityFeePerGas,
250
+ nonce,
251
+ to,
252
+ value,
253
+ // Pick out extra data that might exist on the chain's transaction request type.
254
+ ...extract(rest, { formatter })
255
+ },
256
+ {
257
+ formatter: formatter || formatTransactionRequest
258
+ }
259
+ );
260
+ const balance = await client.request({
261
+ method: "eth_estimateGas",
262
+ params: [request_, blockNumberHex || blockTag]
263
+ });
264
+ return BigInt(balance);
265
+ } catch (err) {
266
+ throw getEstimateGasError(err, {
267
+ ...args,
268
+ chain: client.chain
269
+ });
270
+ }
271
+ }
272
+
273
+ // src/actions/public/estimateContractGas.ts
274
+ async function estimateContractGas(client, {
275
+ abi,
276
+ address,
277
+ args,
278
+ functionName,
279
+ ...request
280
+ }) {
281
+ const data = encodeFunctionData({
282
+ abi,
283
+ args,
284
+ functionName
117
285
  });
118
- return BigInt(balance);
286
+ try {
287
+ const gas = await estimateGas(client, {
288
+ data,
289
+ to: address,
290
+ ...request
291
+ });
292
+ return gas;
293
+ } catch (err) {
294
+ throw getContractError(err, {
295
+ abi,
296
+ address,
297
+ args,
298
+ docsPath: "/docs/contract/simulateContract",
299
+ functionName,
300
+ sender: request.from
301
+ });
302
+ }
119
303
  }
120
304
 
121
305
  // src/actions/public/getBalance.ts
@@ -192,6 +376,18 @@ async function getBlockTransactionCount(client, {
192
376
  return hexToNumber(count);
193
377
  }
194
378
 
379
+ // src/actions/public/getBytecode.ts
380
+ async function getBytecode(client, { address, blockNumber, blockTag = "latest" }) {
381
+ const blockNumberHex = blockNumber !== void 0 ? numberToHex(blockNumber) : void 0;
382
+ const hex = await client.request({
383
+ method: "eth_getCode",
384
+ params: [address, blockNumberHex || blockTag]
385
+ });
386
+ if (hex === "0x")
387
+ return void 0;
388
+ return hex;
389
+ }
390
+
195
391
  // src/actions/public/getChainId.ts
196
392
  async function getChainId(client) {
197
393
  const chainIdHex = await client.request({ method: "eth_chainId" });
@@ -223,9 +419,16 @@ async function getFilterChanges(client, { filter }) {
223
419
  method: "eth_getFilterChanges",
224
420
  params: [filter.id]
225
421
  });
226
- return logs.map(
227
- (log) => typeof log === "string" ? log : formatLog(log)
228
- );
422
+ return logs.map((log) => {
423
+ if (typeof log === "string")
424
+ return log;
425
+ const { eventName, args } = "abi" in filter && filter.abi ? decodeEventLog({
426
+ abi: filter.abi,
427
+ data: log.data,
428
+ topics: log.topics
429
+ }) : { eventName: void 0, args: void 0 };
430
+ return formatLog(log, { args, eventName });
431
+ });
229
432
  }
230
433
 
231
434
  // src/actions/public/getFilterLogs.ts
@@ -234,7 +437,14 @@ async function getFilterLogs(client, { filter }) {
234
437
  method: "eth_getFilterLogs",
235
438
  params: [filter.id]
236
439
  });
237
- return logs.map(formatLog);
440
+ return logs.map((log) => {
441
+ const { eventName, args } = "abi" in filter && filter.abi ? decodeEventLog({
442
+ abi: filter.abi,
443
+ data: log.data,
444
+ topics: log.topics
445
+ }) : { eventName: void 0, args: void 0 };
446
+ return formatLog(log, { args, eventName });
447
+ });
238
448
  }
239
449
 
240
450
  // src/actions/public/getGasPrice.ts
@@ -245,6 +455,61 @@ async function getGasPrice(client) {
245
455
  return BigInt(gasPrice);
246
456
  }
247
457
 
458
+ // src/actions/public/getLogs.ts
459
+ async function getLogs(client, {
460
+ address,
461
+ blockHash,
462
+ fromBlock,
463
+ toBlock,
464
+ event,
465
+ args
466
+ } = {}) {
467
+ let topics = [];
468
+ if (event)
469
+ topics = encodeEventTopics({
470
+ abi: [event],
471
+ eventName: event.name,
472
+ args
473
+ });
474
+ let logs;
475
+ if (blockHash) {
476
+ logs = await client.request({
477
+ method: "eth_getLogs",
478
+ params: [{ address, topics, blockHash }]
479
+ });
480
+ } else {
481
+ logs = await client.request({
482
+ method: "eth_getLogs",
483
+ params: [
484
+ {
485
+ address,
486
+ topics,
487
+ fromBlock: typeof fromBlock === "bigint" ? numberToHex(fromBlock) : fromBlock,
488
+ toBlock: typeof toBlock === "bigint" ? numberToHex(toBlock) : toBlock
489
+ }
490
+ ]
491
+ });
492
+ }
493
+ return logs.map((log) => {
494
+ const { eventName, args: args2 } = event ? decodeEventLog({
495
+ abi: [event],
496
+ data: log.data,
497
+ topics: log.topics
498
+ }) : { eventName: void 0, args: void 0 };
499
+ return formatLog(log, { args: args2, eventName });
500
+ });
501
+ }
502
+
503
+ // src/actions/public/getStorageAt.ts
504
+ async function getStorageAt(client, { address, blockNumber, blockTag = "latest", slot }) {
505
+ const blockNumberHex = blockNumber !== void 0 ? numberToHex(blockNumber) : void 0;
506
+ const data = await client.request({
507
+ method: "eth_getStorageAt",
508
+ params: [address, slot, blockNumberHex || blockTag]
509
+ });
510
+ return data;
511
+ }
512
+
248
513
  // src/actions/public/getTransaction.ts
249
514
  async function getTransaction(client, {
250
515
  blockHash,
@@ -302,7 +567,7 @@ async function getTransactionCount(client, { address, blockTag = "latest", block
302
567
  method: "eth_getTransactionCount",
303
568
  params: [address, blockNumber ? numberToHex(blockNumber) : blockTag]
304
569
  });
305
- return hexToNumber(count ?? "0x0");
570
+ return hexToNumber(count);
306
571
  }
307
572
 
308
573
  // src/actions/public/getTransactionReceipt.ts
@@ -318,6 +583,117 @@ async function getTransactionReceipt(client, { hash }) {
318
583
  });
319
584
  }
320
585
 
586
+ // src/actions/public/readContract.ts
587
+ async function readContract(client, {
588
+ abi,
589
+ address,
590
+ args,
591
+ functionName,
592
+ ...callRequest
593
+ }) {
594
+ const calldata = encodeFunctionData({
595
+ abi,
596
+ args,
597
+ functionName
598
+ });
599
+ try {
600
+ const { data } = await call(client, {
601
+ data: calldata,
602
+ to: address,
603
+ ...callRequest
604
+ });
605
+ return decodeFunctionResult({
606
+ abi,
607
+ args,
608
+ functionName,
609
+ data: data || "0x"
610
+ });
611
+ } catch (err) {
612
+ throw getContractError(err, {
613
+ abi,
614
+ address,
615
+ args,
616
+ docsPath: "/docs/contract/readContract",
617
+ functionName
618
+ });
619
+ }
620
+ }
621
+
622
+ // src/actions/public/multicall.ts
623
+ async function multicall(client, args) {
624
+ const {
625
+ allowFailure = true,
626
+ blockNumber,
627
+ blockTag,
628
+ contracts,
629
+ multicallAddress
630
+ } = args;
631
+ const calls = contracts.map(({ abi, address, args: args2, functionName }) => {
632
+ try {
633
+ const callData = encodeFunctionData({
634
+ abi,
635
+ args: args2,
636
+ functionName
637
+ });
638
+ return {
639
+ allowFailure: true,
640
+ callData,
641
+ target: address
642
+ };
643
+ } catch (err) {
644
+ const error = getContractError(err, {
645
+ abi,
646
+ address,
647
+ args: args2,
648
+ docsPath: "/docs/contract/multicall",
649
+ functionName
650
+ });
651
+ if (!allowFailure)
652
+ throw error;
653
+ return {
654
+ allowFailure: true,
655
+ callData: "0x",
656
+ target: address
657
+ };
658
+ }
659
+ });
660
+ const results = await readContract(client, {
661
+ abi: multicall3Abi,
662
+ address: multicallAddress,
663
+ args: [calls],
664
+ blockNumber,
665
+ blockTag,
666
+ functionName: "aggregate3"
667
+ });
668
+ return results.map(({ returnData, success }, i) => {
669
+ const { callData } = calls[i];
670
+ const { abi, address, functionName, args: args2 } = contracts[i];
671
+ try {
672
+ if (callData === "0x")
673
+ throw new AbiDecodingZeroDataError();
674
+ if (!success)
675
+ throw new RawContractError({ data: returnData });
676
+ const result = decodeFunctionResult({
677
+ abi,
678
+ data: returnData,
679
+ functionName
680
+ });
681
+ return { result, status: "success" };
682
+ } catch (err) {
683
+ const error = getContractError(err, {
684
+ abi,
685
+ address,
686
+ args: args2,
687
+ docsPath: "/docs/contract/multicall",
688
+ functionName
689
+ });
690
+ if (!allowFailure)
691
+ throw error;
692
+ return { error, result: void 0, status: "failure" };
693
+ }
694
+ });
695
+ }
696
+
321
697
  // src/actions/public/uninstallFilter.ts
322
698
  async function uninstallFilter(client, { filter }) {
323
699
  return client.request({
@@ -368,98 +744,6 @@ function observe(observerId, callbacks, fn) {
368
744
  return unwatch;
369
745
  }
370
746
 
371
- // src/actions/public/waitForTransactionReceipt.ts
372
- async function waitForTransactionReceipt(client, {
373
- confirmations = 1,
374
- hash,
375
- onReplaced,
376
- pollingInterval = client.pollingInterval,
377
- timeout
378
- }) {
379
- const observerId = JSON.stringify([
380
- "waitForTransactionReceipt",
381
- client.uid,
382
- hash
383
- ]);
384
- let transaction;
385
- let replacedTransaction;
386
- let receipt;
387
- return new Promise((resolve, reject) => {
388
- if (timeout)
389
- setTimeout(
390
- () => reject(new WaitForTransactionReceiptTimeoutError({ hash })),
391
- timeout
392
- );
393
- const unobserve = observe(
394
- observerId,
395
- { onReplaced, resolve, reject },
396
- (emit) => {
397
- const unwatch = watchBlockNumber(client, {
398
- emitMissed: true,
399
- emitOnBegin: true,
400
- pollingInterval,
401
- async onBlockNumber(blockNumber) {
402
- const done = async (fn) => {
403
- unwatch();
404
- fn();
405
- unobserve();
406
- };
407
- try {
408
- if (receipt) {
409
- if (blockNumber - receipt.blockNumber + 1n < confirmations)
410
- return;
411
- done(() => emit.resolve(receipt));
412
- return;
413
- }
414
- transaction = await getTransaction(client, { hash });
415
- receipt = await getTransactionReceipt(client, { hash });
416
- if (blockNumber - receipt.blockNumber + 1n < confirmations)
417
- return;
418
- done(() => emit.resolve(receipt));
419
- } catch (err) {
420
- if (transaction && (err instanceof TransactionNotFoundError || err instanceof TransactionReceiptNotFoundError)) {
421
- replacedTransaction = transaction;
422
- const block = await getBlock(client, {
423
- blockNumber,
424
- includeTransactions: true
425
- });
426
- const replacementTransaction = block.transactions.find(
427
- ({ from, nonce }) => from === replacedTransaction.from && nonce === replacedTransaction.nonce
428
- );
429
- if (!replacementTransaction)
430
- return;
431
- receipt = await getTransactionReceipt(client, {
432
- hash: replacementTransaction.hash
433
- });
434
- if (blockNumber - receipt.blockNumber + 1n < confirmations)
435
- return;
436
- let reason = "replaced";
437
- if (replacementTransaction.to === replacedTransaction.to && replacementTransaction.value === replacedTransaction.value) {
438
- reason = "repriced";
439
- } else if (replacementTransaction.from === replacementTransaction.to && replacementTransaction.value === 0n) {
440
- reason = "cancelled";
441
- }
442
- done(() => {
443
- emit.onReplaced?.({
444
- reason,
445
- replacedTransaction,
446
- transaction: replacementTransaction,
447
- transactionReceipt: receipt
448
- });
449
- emit.resolve(receipt);
450
- });
451
- } else {
452
- done(() => emit.reject(err));
453
- }
454
- }
455
- }
456
- });
457
- return unwatch;
458
- }
459
- );
460
- });
461
- }
462
-
463
747
  // src/utils/poll.ts
464
748
  function poll(fn, { emitOnBegin, initialWaitTime, interval }) {
465
749
  let active = true;
@@ -587,6 +871,169 @@ function watchBlocks(client, {
587
871
  );
588
872
  }
589
873
 
874
+ // src/actions/public/watchContractEvent.ts
875
+ function watchContractEvent(client, {
876
+ abi,
877
+ address,
878
+ args,
879
+ batch = true,
880
+ eventName,
881
+ onError,
882
+ onLogs,
883
+ pollingInterval = client.pollingInterval
884
+ }) {
885
+ const observerId = JSON.stringify([
886
+ "watchContractEvent",
887
+ address,
888
+ args,
889
+ batch,
890
+ client.uid,
891
+ eventName,
892
+ pollingInterval
893
+ ]);
894
+ return observe(observerId, { onLogs, onError }, (emit) => {
895
+ let currentBlockNumber;
896
+ let filter;
897
+ let initialized = false;
898
+ const unwatch = poll(
899
+ async () => {
900
+ if (!initialized) {
901
+ try {
902
+ filter = await createContractEventFilter(client, {
903
+ abi,
904
+ address,
905
+ args,
906
+ eventName
907
+ });
908
+ } catch {
909
+ }
910
+ initialized = true;
911
+ return;
912
+ }
913
+ try {
914
+ let logs;
915
+ if (filter) {
916
+ logs = await getFilterChanges(client, { filter });
917
+ } else {
918
+ const blockNumber = await getBlockNumber(client);
919
+ if (currentBlockNumber && currentBlockNumber !== blockNumber) {
920
+ logs = await getLogs(client, {
921
+ address,
922
+ args,
923
+ fromBlock: blockNumber,
924
+ toBlock: blockNumber,
925
+ event: getAbiItem({
926
+ abi,
927
+ name: eventName
928
+ })
929
+ });
930
+ } else {
931
+ logs = [];
932
+ }
933
+ currentBlockNumber = blockNumber;
934
+ }
935
+ if (logs.length === 0)
936
+ return;
937
+ if (batch)
938
+ emit.onLogs(logs);
939
+ else
940
+ logs.forEach((log) => emit.onLogs([log]));
941
+ } catch (err) {
942
+ emit.onError?.(err);
943
+ }
944
+ },
945
+ {
946
+ emitOnBegin: true,
947
+ interval: pollingInterval
948
+ }
949
+ );
950
+ return async () => {
951
+ if (filter)
952
+ await uninstallFilter(client, { filter });
953
+ unwatch();
954
+ };
955
+ });
956
+ }
957
+
958
+ // src/actions/public/watchEvent.ts
959
+ function watchEvent(client, {
960
+ address,
961
+ args,
962
+ batch = true,
963
+ event,
964
+ onError,
965
+ onLogs,
966
+ pollingInterval = client.pollingInterval
967
+ }) {
968
+ const observerId = JSON.stringify([
969
+ "watchEvent",
970
+ address,
971
+ args,
972
+ batch,
973
+ client.uid,
974
+ event,
975
+ pollingInterval
976
+ ]);
977
+ return observe(observerId, { onLogs, onError }, (emit) => {
978
+ let currentBlockNumber;
979
+ let filter;
980
+ let initialized = false;
981
+ const unwatch = poll(
982
+ async () => {
983
+ if (!initialized) {
984
+ try {
985
+ filter = await createEventFilter(client, {
986
+ address,
987
+ args,
988
+ event
989
+ });
990
+ } catch {
991
+ }
992
+ initialized = true;
993
+ return;
994
+ }
995
+ try {
996
+ let logs;
997
+ if (filter) {
998
+ logs = await getFilterChanges(client, { filter });
999
+ } else {
1000
+ const blockNumber = await getBlockNumber(client);
1001
+ if (currentBlockNumber && currentBlockNumber !== blockNumber) {
1002
+ logs = await getLogs(client, {
1003
+ address,
1004
+ args,
1005
+ fromBlock: blockNumber,
1006
+ toBlock: blockNumber,
1007
+ event
1008
+ });
1009
+ } else {
1010
+ logs = [];
1011
+ }
1012
+ currentBlockNumber = blockNumber;
1013
+ }
1014
+ if (logs.length === 0)
1015
+ return;
1016
+ if (batch)
1017
+ emit.onLogs(logs);
1018
+ else
1019
+ logs.forEach((log) => emit.onLogs([log]));
1020
+ } catch (err) {
1021
+ emit.onError?.(err);
1022
+ }
1023
+ },
1024
+ {
1025
+ emitOnBegin: true,
1026
+ interval: pollingInterval
1027
+ }
1028
+ );
1029
+ return async () => {
1030
+ if (filter)
1031
+ await uninstallFilter(client, { filter });
1032
+ unwatch();
1033
+ };
1034
+ });
1035
+ }
1036
+
590
1037
  // src/actions/public/watchPendingTransactions.ts
591
1038
  function watchPendingTransactions(client, {
592
1039
  batch = true,
@@ -615,6 +1062,8 @@ function watchPendingTransactions(client, {
615
1062
  }
616
1063
  }
617
1064
  const hashes = await getFilterChanges(client, { filter });
1065
+ if (hashes.length === 0)
1066
+ return;
618
1067
  if (batch)
619
1068
  emit.onTransactions(hashes);
620
1069
  else
@@ -636,412 +1085,132 @@ function watchPendingTransactions(client, {
636
1085
  });
637
1086
  }
638
1087
 
639
- // src/actions/test/dropTransaction.ts
640
- async function dropTransaction(client, { hash }) {
641
- return await client.request({
642
- method: `${client.mode}_dropTransaction`,
643
- params: [hash]
644
- });
645
- }
646
-
647
- // src/actions/test/getAutomine.ts
648
- async function getAutomine(client) {
649
- return await client.request({
650
- method: `${client.mode}_getAutomine`
651
- });
652
- }
653
-
654
- // src/actions/test/getTxpoolContent.ts
655
- async function getTxpoolContent(client) {
656
- return await client.request({
657
- method: "txpool_content"
658
- });
659
- }
660
-
661
- // src/actions/test/getTxpoolStatus.ts
662
- async function getTxpoolStatus(client) {
663
- const { pending, queued } = await client.request({
664
- method: "txpool_status"
665
- });
666
- return {
667
- pending: hexToNumber(pending),
668
- queued: hexToNumber(queued)
669
- };
670
- }
671
-
672
- // src/actions/test/impersonateAccount.ts
673
- async function impersonateAccount(client, { address }) {
674
- return await client.request({
675
- method: `${client.mode}_impersonateAccount`,
676
- params: [address]
677
- });
678
- }
679
-
680
- // src/actions/test/increaseTime.ts
681
- async function increaseTime(client, { seconds }) {
682
- return await client.request({
683
- method: "evm_increaseTime",
684
- params: [numberToHex(seconds)]
685
- });
686
- }
687
-
688
- // src/actions/test/inspectTxpool.ts
689
- async function inspectTxpool(client) {
690
- return await client.request({
691
- method: "txpool_inspect"
692
- });
693
- }
694
-
695
- // src/actions/test/mine.ts
696
- async function mine(client, { blocks, interval }) {
697
- return await client.request({
698
- method: `${client.mode}_mine`,
699
- params: [numberToHex(blocks), numberToHex(interval || 0)]
700
- });
701
- }
702
-
703
- // src/actions/test/removeBlockTimestampInterval.ts
704
- async function removeBlockTimestampInterval(client) {
705
- return await client.request({
706
- method: `${client.mode}_removeBlockTimestampInterval`
707
- });
708
- }
709
-
710
- // src/actions/test/reset.ts
711
- async function reset(client, { blockNumber, jsonRpcUrl } = {}) {
712
- return await client.request({
713
- method: `${client.mode}_reset`,
714
- params: [{ forking: { blockNumber: Number(blockNumber), jsonRpcUrl } }]
715
- });
716
- }
717
-
718
- // src/actions/test/revert.ts
719
- async function revert(client, { id }) {
720
- return await client.request({
721
- method: "evm_revert",
722
- params: [id]
723
- });
724
- }
725
-
726
- // src/actions/test/sendUnsignedTransaction.ts
727
- async function sendUnsignedTransaction(client, request) {
728
- const request_ = formatTransactionRequest(request);
729
- const hash = await client.request({
730
- method: "eth_sendUnsignedTransaction",
731
- params: [request_]
732
- });
733
- return hash;
734
- }
735
-
736
- // src/actions/test/setAutomine.ts
737
- async function setAutomine(client, enabled) {
738
- return await client.request({
739
- method: "evm_setAutomine",
740
- params: [enabled]
741
- });
742
- }
743
-
744
- // src/actions/test/setBalance.ts
745
- async function setBalance(client, { address, value }) {
746
- return await client.request({
747
- method: `${client.mode}_setBalance`,
748
- params: [address, numberToHex(value)]
749
- });
750
- }
751
-
752
- // src/actions/test/setBlockGasLimit.ts
753
- async function setBlockGasLimit(client, { gasLimit }) {
754
- return await client.request({
755
- method: "evm_setBlockGasLimit",
756
- params: [numberToHex(gasLimit)]
757
- });
758
- }
759
-
760
- // src/actions/test/setBlockTimestampInterval.ts
761
- async function setBlockTimestampInterval(client, { interval }) {
762
- return await client.request({
763
- method: `${client.mode}_setBlockTimestampInterval`,
764
- params: [interval]
765
- });
766
- }
767
-
768
- // src/actions/test/setCode.ts
769
- async function setCode(client, { address, bytecode }) {
770
- return await client.request({
771
- method: `${client.mode}_setCode`,
772
- params: [address, bytecode]
773
- });
774
- }
775
-
776
- // src/actions/test/setCoinbase.ts
777
- async function setCoinbase(client, { address }) {
778
- return await client.request({
779
- method: `${client.mode}_setCoinbase`,
780
- params: [address]
781
- });
782
- }
783
-
784
- // src/actions/test/setIntervalMining.ts
785
- async function setIntervalMining(client, { interval }) {
786
- return await client.request({
787
- method: "evm_setIntervalMining",
788
- params: [interval]
789
- });
790
- }
791
-
792
- // src/actions/test/setLoggingEnabled.ts
793
- async function setLoggingEnabled(client, enabled) {
794
- return await client.request({
795
- method: `${client.mode}_setLoggingEnabled`,
796
- params: [enabled]
797
- });
798
- }
799
-
800
- // src/actions/test/setMinGasPrice.ts
801
- async function setMinGasPrice(client, { gasPrice }) {
802
- return await client.request({
803
- method: `${client.mode}_setMinGasPrice`,
804
- params: [numberToHex(gasPrice)]
805
- });
806
- }
807
-
808
- // src/actions/test/setNextBlockBaseFeePerGas.ts
809
- async function setNextBlockBaseFeePerGas(client, { baseFeePerGas }) {
810
- return await client.request({
811
- method: `${client.mode}_setNextBlockBaseFeePerGas`,
812
- params: [numberToHex(baseFeePerGas)]
813
- });
814
- }
815
-
816
- // src/actions/test/setNextBlockTimestamp.ts
817
- async function setNextBlockTimestamp(client, { timestamp }) {
818
- return await client.request({
819
- method: "evm_setNextBlockTimestamp",
820
- params: [numberToHex(timestamp)]
821
- });
822
- }
823
-
824
- // src/actions/test/setNonce.ts
825
- async function setNonce(client, { address, nonce }) {
826
- return await client.request({
827
- method: `${client.mode}_setNonce`,
828
- params: [address, numberToHex(nonce)]
829
- });
830
- }
831
-
832
- // src/actions/test/setStorageAt.ts
833
- async function setStorageAt(client, { address, index, value }) {
834
- return await client.request({
835
- method: `${client.mode}_setStorageAt`,
836
- params: [
837
- address,
838
- typeof index === "number" ? numberToHex(index) : index,
839
- value
840
- ]
841
- });
842
- }
843
-
844
- // src/actions/test/snapshot.ts
845
- async function snapshot(client) {
846
- return await client.request({
847
- method: "evm_snapshot"
848
- });
849
- }
850
-
851
- // src/actions/test/stopImpersonatingAccount.ts
852
- async function stopImpersonatingAccount(client, { address }) {
853
- return await client.request({
854
- method: `${client.mode}_stopImpersonatingAccount`,
855
- params: [address]
856
- });
857
- }
858
-
859
- // src/actions/wallet/addChain.ts
860
- async function addChain(client, chain) {
861
- const { id, name, nativeCurrency, rpcUrls, blockExplorers } = chain;
862
- await client.request({
863
- method: "wallet_addEthereumChain",
864
- params: [
865
- {
866
- chainId: numberToHex(id),
867
- chainName: name,
868
- nativeCurrency,
869
- rpcUrls: rpcUrls.default.http,
870
- blockExplorerUrls: blockExplorers ? Object.values(blockExplorers).map(({ url }) => url) : void 0
871
- }
872
- ]
873
- });
874
- }
875
-
876
- // src/actions/wallet/getAccounts.ts
877
- async function getAccounts(client) {
878
- const addresses = await client.request({ method: "eth_accounts" });
879
- return addresses.map((address) => checksumAddress(address));
880
- }
881
-
882
- // src/actions/wallet/getPermissions.ts
883
- async function getPermissions(client) {
884
- const permissions = await client.request({ method: "wallet_getPermissions" });
885
- return permissions;
886
- }
887
-
888
- // src/actions/wallet/requestAccounts.ts
889
- async function requestAccounts(client) {
890
- const addresses = await client.request({ method: "eth_requestAccounts" });
891
- return addresses.map((address) => getAddress(address));
892
- }
893
-
894
- // src/actions/wallet/requestPermissions.ts
895
- async function requestPermissions(client, permissions) {
896
- return client.request({
897
- method: "wallet_requestPermissions",
898
- params: [permissions]
899
- });
900
- }
901
-
902
- // src/actions/wallet/sendTransaction.ts
903
- async function sendTransaction(client, {
904
- chain,
905
- from,
906
- accessList,
907
- data,
908
- gas,
909
- gasPrice,
910
- maxFeePerGas,
911
- maxPriorityFeePerGas,
912
- nonce,
913
- to,
914
- value,
915
- ...rest
1088
+ // src/actions/public/waitForTransactionReceipt.ts
1089
+ async function waitForTransactionReceipt(client, {
1090
+ confirmations = 1,
1091
+ hash,
1092
+ onReplaced,
1093
+ pollingInterval = client.pollingInterval,
1094
+ timeout
916
1095
  }) {
917
- if (maxFeePerGas !== void 0 && maxPriorityFeePerGas !== void 0 && maxFeePerGas < maxPriorityFeePerGas)
918
- throw new InvalidGasArgumentsError();
919
- const request_ = format(
920
- {
921
- from,
922
- accessList,
923
- data,
924
- gas,
925
- gasPrice,
926
- maxFeePerGas,
927
- maxPriorityFeePerGas,
928
- nonce,
929
- to,
930
- value,
931
- ...rest
932
- },
933
- {
934
- formatter: chain?.formatters?.transactionRequest || formatTransactionRequest
935
- }
936
- );
937
- const hash = await client.request({
938
- method: "eth_sendTransaction",
939
- params: [request_]
940
- });
941
- return hash;
942
- }
943
-
944
- // src/actions/wallet/signMessage.ts
945
- async function signMessage(client, { from, data: data_ }) {
946
- let data;
947
- if (typeof data_ === "string") {
948
- if (!data_.startsWith("0x"))
949
- throw new BaseError(
950
- `data ("${data_}") must be a hex value. Encode it first to a hex with the \`encodeHex\` util.`,
951
- {
952
- docsPath: "/TODO"
953
- }
1096
+ const observerId = JSON.stringify([
1097
+ "waitForTransactionReceipt",
1098
+ client.uid,
1099
+ hash
1100
+ ]);
1101
+ let transaction;
1102
+ let replacedTransaction;
1103
+ let receipt;
1104
+ return new Promise((resolve, reject) => {
1105
+ if (timeout)
1106
+ setTimeout(
1107
+ () => reject(new WaitForTransactionReceiptTimeoutError({ hash })),
1108
+ timeout
954
1109
  );
955
- data = data_;
956
- } else {
957
- data = encodeHex(data_);
958
- }
959
- const signed = await client.request({
960
- method: "personal_sign",
961
- params: [data, from]
962
- });
963
- return signed;
964
- }
965
-
966
- // src/actions/wallet/switchChain.ts
967
- async function switchChain(client, { id }) {
968
- await client.request({
969
- method: "wallet_switchEthereumChain",
970
- params: [
971
- {
972
- chainId: numberToHex(id)
1110
+ const unobserve = observe(
1111
+ observerId,
1112
+ { onReplaced, resolve, reject },
1113
+ (emit) => {
1114
+ const unwatch = watchBlockNumber(client, {
1115
+ emitMissed: true,
1116
+ emitOnBegin: true,
1117
+ pollingInterval,
1118
+ async onBlockNumber(blockNumber) {
1119
+ const done = async (fn) => {
1120
+ unwatch();
1121
+ fn();
1122
+ unobserve();
1123
+ };
1124
+ try {
1125
+ if (receipt) {
1126
+ if (blockNumber - receipt.blockNumber + 1n < confirmations)
1127
+ return;
1128
+ done(() => emit.resolve(receipt));
1129
+ return;
1130
+ }
1131
+ transaction = await getTransaction(client, { hash });
1132
+ receipt = await getTransactionReceipt(client, { hash });
1133
+ if (blockNumber - receipt.blockNumber + 1n < confirmations)
1134
+ return;
1135
+ done(() => emit.resolve(receipt));
1136
+ } catch (err) {
1137
+ if (transaction && (err instanceof TransactionNotFoundError || err instanceof TransactionReceiptNotFoundError)) {
1138
+ replacedTransaction = transaction;
1139
+ const block = await getBlock(client, {
1140
+ blockNumber,
1141
+ includeTransactions: true
1142
+ });
1143
+ const replacementTransaction = block.transactions.find(
1144
+ ({ from, nonce }) => from === replacedTransaction.from && nonce === replacedTransaction.nonce
1145
+ );
1146
+ if (!replacementTransaction)
1147
+ return;
1148
+ receipt = await getTransactionReceipt(client, {
1149
+ hash: replacementTransaction.hash
1150
+ });
1151
+ if (blockNumber - receipt.blockNumber + 1n < confirmations)
1152
+ return;
1153
+ let reason = "replaced";
1154
+ if (replacementTransaction.to === replacedTransaction.to && replacementTransaction.value === replacedTransaction.value) {
1155
+ reason = "repriced";
1156
+ } else if (replacementTransaction.from === replacementTransaction.to && replacementTransaction.value === 0n) {
1157
+ reason = "cancelled";
1158
+ }
1159
+ done(() => {
1160
+ emit.onReplaced?.({
1161
+ reason,
1162
+ replacedTransaction,
1163
+ transaction: replacementTransaction,
1164
+ transactionReceipt: receipt
1165
+ });
1166
+ emit.resolve(receipt);
1167
+ });
1168
+ } else {
1169
+ done(() => emit.reject(err));
1170
+ }
1171
+ }
1172
+ }
1173
+ });
1174
+ return unwatch;
973
1175
  }
974
- ]
975
- });
976
- }
977
-
978
- // src/actions/wallet/watchAsset.ts
979
- async function watchAsset(client, params) {
980
- const added = await client.request({
981
- method: "wallet_watchAsset",
982
- params: [params]
1176
+ );
983
1177
  });
984
- return added;
985
1178
  }
986
1179
 
987
1180
  export {
988
1181
  call,
1182
+ simulateContract,
989
1183
  createPendingTransactionFilter,
990
1184
  createBlockFilter,
1185
+ createEventFilter,
1186
+ createContractEventFilter,
991
1187
  estimateGas,
1188
+ estimateContractGas,
992
1189
  getBalance,
993
1190
  getBlock,
994
1191
  getBlockNumberCache,
995
1192
  getBlockNumber,
996
1193
  getBlockTransactionCount,
1194
+ getBytecode,
997
1195
  getChainId,
998
1196
  getFeeHistory,
999
1197
  getFilterChanges,
1000
1198
  getFilterLogs,
1001
1199
  getGasPrice,
1200
+ getLogs,
1201
+ getStorageAt,
1002
1202
  getTransaction,
1003
1203
  getTransactionConfirmations,
1004
1204
  getTransactionCount,
1005
1205
  getTransactionReceipt,
1206
+ readContract,
1207
+ multicall,
1006
1208
  uninstallFilter,
1007
1209
  waitForTransactionReceipt,
1008
1210
  watchBlockNumber,
1009
1211
  watchBlocks,
1010
- watchPendingTransactions,
1011
- dropTransaction,
1012
- getAutomine,
1013
- getTxpoolContent,
1014
- getTxpoolStatus,
1015
- impersonateAccount,
1016
- increaseTime,
1017
- inspectTxpool,
1018
- mine,
1019
- removeBlockTimestampInterval,
1020
- reset,
1021
- revert,
1022
- sendUnsignedTransaction,
1023
- setAutomine,
1024
- setBalance,
1025
- setBlockGasLimit,
1026
- setBlockTimestampInterval,
1027
- setCode,
1028
- setCoinbase,
1029
- setIntervalMining,
1030
- setLoggingEnabled,
1031
- setMinGasPrice,
1032
- setNextBlockBaseFeePerGas,
1033
- setNextBlockTimestamp,
1034
- setNonce,
1035
- setStorageAt,
1036
- snapshot,
1037
- stopImpersonatingAccount,
1038
- addChain,
1039
- getAccounts,
1040
- getPermissions,
1041
- requestAccounts,
1042
- requestPermissions,
1043
- sendTransaction,
1044
- signMessage,
1045
- switchChain,
1046
- watchAsset
1212
+ watchContractEvent,
1213
+ watchEvent,
1214
+ watchPendingTransactions
1047
1215
  };
1216
+ //# sourceMappingURL=chunk-IBWRBL2I.mjs.map