viem 0.0.1-alpha.22 → 0.0.1-alpha.24

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 (80) hide show
  1. package/dist/{chain-4b39613a.d.ts → chain-afa13f5a.d.ts} +1 -1
  2. package/dist/{chain-aa4898d0.d.ts → chain-e33d019b.d.ts} +1 -1
  3. package/dist/chains.d.ts +3 -3
  4. package/dist/chains.js +46 -46
  5. package/dist/chains.mjs +1 -1
  6. package/dist/{chunk-QN2NCTEN.mjs → chunk-3ARWEJ3G.mjs} +2 -2
  7. package/dist/{chunk-QN2NCTEN.mjs.map → chunk-3ARWEJ3G.mjs.map} +0 -0
  8. package/dist/{chunk-V5U5S7PQ.js → chunk-4D5XG6XB.js} +5 -3
  9. package/dist/{chunk-V5U5S7PQ.js.map → chunk-4D5XG6XB.js.map} +0 -0
  10. package/dist/{chunk-JMFNAGCD.mjs → chunk-6QTEW2BE.mjs} +2 -2
  11. package/dist/{chunk-JMFNAGCD.mjs.map → chunk-6QTEW2BE.mjs.map} +0 -0
  12. package/dist/{chunk-MVD4Y3AE.js → chunk-A2HXAZXC.js} +271 -66
  13. package/dist/chunk-A2HXAZXC.js.map +1 -0
  14. package/dist/{chunk-OZIBQJYR.mjs → chunk-KRPS5CIB.mjs} +2 -2
  15. package/dist/{chunk-OZIBQJYR.mjs.map → chunk-KRPS5CIB.mjs.map} +0 -0
  16. package/dist/{chunk-WWJ5YPTJ.mjs → chunk-LQVMDX5I.mjs} +4 -2
  17. package/dist/{chunk-WWJ5YPTJ.mjs.map → chunk-LQVMDX5I.mjs.map} +0 -0
  18. package/dist/{chunk-QA3IE5DU.js → chunk-N3IOPT3R.js} +14 -14
  19. package/dist/{chunk-QA3IE5DU.js.map → chunk-N3IOPT3R.js.map} +0 -0
  20. package/dist/{chunk-ZXXEENRD.mjs → chunk-YQUC52RL.mjs} +208 -3
  21. package/dist/chunk-YQUC52RL.mjs.map +1 -0
  22. package/dist/{chunk-PMPJGAHY.js → chunk-ZSTVHQ6J.js} +13 -13
  23. package/dist/{chunk-PMPJGAHY.js.map → chunk-ZSTVHQ6J.js.map} +0 -0
  24. package/dist/{chunk-S77NLWHO.js → chunk-ZYSXBTBB.js} +13 -13
  25. package/dist/{chunk-S77NLWHO.js.map → chunk-ZYSXBTBB.js.map} +0 -0
  26. package/dist/clients/index.d.ts +7 -7
  27. package/dist/clients/index.js +3 -3
  28. package/dist/clients/index.mjs +2 -2
  29. package/dist/{contract-74f34ac9.d.ts → contract-70f4ddbe.d.ts} +2 -2
  30. package/dist/{createClient-55a04188.d.ts → createClient-60e3ab98.d.ts} +2 -2
  31. package/dist/{createPublicClient-3b27b282.d.ts → createPublicClient-d3d12dc3.d.ts} +3 -3
  32. package/dist/{createTestClient-93f9eac6.d.ts → createTestClient-5f4532c4.d.ts} +3 -3
  33. package/dist/{createWalletClient-c10df94d.d.ts → createWalletClient-9ec3df4f.d.ts} +3 -3
  34. package/dist/{eip1193-4c24765a.d.ts → eip1193-9317a312.d.ts} +1 -1
  35. package/dist/ens.js +2 -2
  36. package/dist/ens.mjs +1 -1
  37. package/dist/index.d.ts +111 -20
  38. package/dist/index.js +12 -6
  39. package/dist/index.mjs +11 -5
  40. package/dist/{parseGwei-b323fb0a.d.ts → parseGwei-492ab7dd.d.ts} +2 -2
  41. package/dist/public.d.ts +9 -9
  42. package/dist/public.js +4 -4
  43. package/dist/public.mjs +3 -3
  44. package/dist/{sendTransaction-f17a2389.d.ts → sendTransaction-54a0d509.d.ts} +3 -3
  45. package/dist/{stopImpersonatingAccount-afb26486.d.ts → stopImpersonatingAccount-c1a4b7e5.d.ts} +2 -2
  46. package/dist/test.d.ts +5 -5
  47. package/dist/test.js +3 -3
  48. package/dist/test.mjs +2 -2
  49. package/dist/{transactionRequest-93e9f001.d.ts → transactionRequest-bdf57f7d.d.ts} +1 -1
  50. package/dist/utils/index.d.ts +8 -8
  51. package/dist/utils/index.js +2 -2
  52. package/dist/utils/index.mjs +1 -1
  53. package/dist/wallet.d.ts +7 -7
  54. package/dist/wallet.js +3 -3
  55. package/dist/wallet.mjs +2 -2
  56. package/dist/{watchAsset-efd3dd05.d.ts → watchAsset-d59d6e35.d.ts} +3 -3
  57. package/dist/{watchPendingTransactions-a8688b26.d.ts → watchPendingTransactions-ea21b31d.d.ts} +6 -6
  58. package/dist/{webSocket-d2e7bd0e.d.ts → webSocket-775b4037.d.ts} +2 -2
  59. package/dist/window.d.ts +2 -2
  60. package/package.json +1 -1
  61. package/src/_test/constants.ts +4 -3
  62. package/src/_test/index.ts +1 -1
  63. package/src/actions/index.test.ts +3 -0
  64. package/src/actions/index.ts +8 -0
  65. package/src/actions/public/getFilterChanges.test.ts +9 -9
  66. package/src/actions/public/getFilterLogs.test.ts +7 -7
  67. package/src/actions/public/getLogs.test.ts +7 -7
  68. package/src/actions/public/index.test.ts +1 -0
  69. package/src/actions/public/index.ts +3 -0
  70. package/src/actions/public/multicall.test.ts +20 -20
  71. package/src/actions/public/readContract.test.ts +2 -2
  72. package/src/actions/public/watchContractEvent.test.ts +32 -32
  73. package/src/actions/public/watchEvent.test.ts +11 -11
  74. package/src/actions/test/impersonateAccount.test.ts +4 -6
  75. package/src/actions/test/sendUnsignedTransaction.test.ts +2 -2
  76. package/src/actions/test/stopImpersonatingAccount.test.ts +5 -7
  77. package/src/index.test.ts +3 -0
  78. package/src/index.ts +8 -0
  79. package/dist/chunk-MVD4Y3AE.js.map +0 -1
  80. package/dist/chunk-ZXXEENRD.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkS77NLWHOjs = require('./chunk-S77NLWHO.js');
3
+ var _chunkZYSXBTBBjs = require('./chunk-ZYSXBTBB.js');
4
4
 
5
5
 
6
6
 
@@ -26,7 +26,10 @@ var _chunkS77NLWHOjs = require('./chunk-S77NLWHO.js');
26
26
 
27
27
 
28
28
 
29
- var _chunkV5U5S7PQjs = require('./chunk-V5U5S7PQ.js');
29
+
30
+
31
+
32
+ var _chunk4D5XG6XBjs = require('./chunk-4D5XG6XB.js');
30
33
 
31
34
  // src/actions/public/call.ts
32
35
  async function call(client, {
@@ -46,10 +49,10 @@ async function call(client, {
46
49
  ...rest
47
50
  }) {
48
51
  if (maxFeePerGas !== void 0 && maxPriorityFeePerGas !== void 0 && maxFeePerGas < maxPriorityFeePerGas)
49
- throw new (0, _chunkV5U5S7PQjs.InvalidGasArgumentsError)();
50
- const blockNumberHex = blockNumber ? _chunkV5U5S7PQjs.numberToHex.call(void 0, blockNumber) : void 0;
52
+ throw new (0, _chunk4D5XG6XBjs.InvalidGasArgumentsError)();
53
+ const blockNumberHex = blockNumber ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
51
54
  const formatter = _optionalChain([chain, 'optionalAccess', _ => _.formatters, 'optionalAccess', _2 => _2.transactionRequest]);
52
- const request_ = _chunkV5U5S7PQjs.format.call(void 0,
55
+ const request_ = _chunk4D5XG6XBjs.format.call(void 0,
53
56
  {
54
57
  from,
55
58
  accessList,
@@ -61,10 +64,10 @@ async function call(client, {
61
64
  nonce,
62
65
  to,
63
66
  value,
64
- ..._chunkV5U5S7PQjs.extract.call(void 0, rest, { formatter })
67
+ ..._chunk4D5XG6XBjs.extract.call(void 0, rest, { formatter })
65
68
  },
66
69
  {
67
- formatter: formatter || _chunkV5U5S7PQjs.formatTransactionRequest
70
+ formatter: formatter || _chunk4D5XG6XBjs.formatTransactionRequest
68
71
  }
69
72
  );
70
73
  const response = await client.request({
@@ -84,7 +87,7 @@ async function simulateContract(client, {
84
87
  functionName,
85
88
  ...callRequest
86
89
  }) {
87
- const calldata = _chunkV5U5S7PQjs.encodeFunctionData.call(void 0, {
90
+ const calldata = _chunk4D5XG6XBjs.encodeFunctionData.call(void 0, {
88
91
  abi,
89
92
  args,
90
93
  functionName
@@ -95,7 +98,7 @@ async function simulateContract(client, {
95
98
  to: address,
96
99
  ...callRequest
97
100
  });
98
- const result = _chunkV5U5S7PQjs.decodeFunctionResult.call(void 0, {
101
+ const result = _chunk4D5XG6XBjs.decodeFunctionResult.call(void 0, {
99
102
  abi,
100
103
  args,
101
104
  functionName,
@@ -112,7 +115,7 @@ async function simulateContract(client, {
112
115
  }
113
116
  };
114
117
  } catch (err) {
115
- throw _chunkV5U5S7PQjs.getContractError.call(void 0, err, {
118
+ throw _chunk4D5XG6XBjs.getContractError.call(void 0, err, {
116
119
  abi,
117
120
  address,
118
121
  args,
@@ -156,8 +159,8 @@ async function createEventFilter(client, {
156
159
  params: [
157
160
  {
158
161
  address,
159
- fromBlock: typeof fromBlock === "bigint" ? _chunkV5U5S7PQjs.numberToHex.call(void 0, fromBlock) : fromBlock,
160
- toBlock: typeof toBlock === "bigint" ? _chunkV5U5S7PQjs.numberToHex.call(void 0, toBlock) : toBlock,
162
+ fromBlock: typeof fromBlock === "bigint" ? _chunk4D5XG6XBjs.numberToHex.call(void 0, fromBlock) : fromBlock,
163
+ toBlock: typeof toBlock === "bigint" ? _chunk4D5XG6XBjs.numberToHex.call(void 0, toBlock) : toBlock,
161
164
  ...topics.length ? { topics } : {}
162
165
  }
163
166
  ]
@@ -168,7 +171,7 @@ function buildFilterTopics({
168
171
  event,
169
172
  args: _args
170
173
  }) {
171
- const signature = _chunkV5U5S7PQjs.getEventSignature.call(void 0, event);
174
+ const signature = _chunk4D5XG6XBjs.getEventSignature.call(void 0, event);
172
175
  return [signature];
173
176
  }
174
177
 
@@ -181,7 +184,7 @@ async function createContractEventFilter(client, {
181
184
  fromBlock,
182
185
  toBlock
183
186
  }) {
184
- const topics = eventName ? _chunkV5U5S7PQjs.encodeEventTopics.call(void 0, {
187
+ const topics = eventName ? _chunk4D5XG6XBjs.encodeEventTopics.call(void 0, {
185
188
  abi,
186
189
  args,
187
190
  eventName
@@ -191,8 +194,8 @@ async function createContractEventFilter(client, {
191
194
  params: [
192
195
  {
193
196
  address,
194
- fromBlock: typeof fromBlock === "bigint" ? _chunkV5U5S7PQjs.numberToHex.call(void 0, fromBlock) : fromBlock,
195
- toBlock: typeof toBlock === "bigint" ? _chunkV5U5S7PQjs.numberToHex.call(void 0, toBlock) : toBlock,
197
+ fromBlock: typeof fromBlock === "bigint" ? _chunk4D5XG6XBjs.numberToHex.call(void 0, fromBlock) : fromBlock,
198
+ toBlock: typeof toBlock === "bigint" ? _chunk4D5XG6XBjs.numberToHex.call(void 0, toBlock) : toBlock,
196
199
  topics
197
200
  }
198
201
  ]
@@ -202,12 +205,12 @@ async function createContractEventFilter(client, {
202
205
 
203
206
  // src/actions/public/deployContract.ts
204
207
  function deployContract(walletClient, { abi, args, bytecode, ...request }) {
205
- const calldata = _chunkV5U5S7PQjs.encodeDeployData.call(void 0, {
208
+ const calldata = _chunk4D5XG6XBjs.encodeDeployData.call(void 0, {
206
209
  abi,
207
210
  args,
208
211
  bytecode
209
212
  });
210
- return _chunkS77NLWHOjs.sendTransaction.call(void 0, walletClient, {
213
+ return _chunkZYSXBTBBjs.sendTransaction.call(void 0, walletClient, {
211
214
  ...request,
212
215
  data: calldata
213
216
  });
@@ -226,16 +229,16 @@ async function estimateGas(client, {
226
229
  to,
227
230
  value
228
231
  }) {
229
- const blockNumberHex = blockNumber ? _chunkV5U5S7PQjs.numberToHex.call(void 0, blockNumber) : void 0;
232
+ const blockNumberHex = blockNumber ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
230
233
  const parameters = {
231
234
  data,
232
235
  from,
233
- gas: gas ? _chunkV5U5S7PQjs.numberToHex.call(void 0, gas) : void 0,
234
- gasPrice: gasPrice ? _chunkV5U5S7PQjs.numberToHex.call(void 0, gasPrice) : void 0,
235
- maxFeePerGas: maxFeePerGas ? _chunkV5U5S7PQjs.numberToHex.call(void 0, maxFeePerGas) : void 0,
236
- maxPriorityFeePerGas: maxPriorityFeePerGas ? _chunkV5U5S7PQjs.numberToHex.call(void 0, maxPriorityFeePerGas) : void 0,
236
+ gas: gas ? _chunk4D5XG6XBjs.numberToHex.call(void 0, gas) : void 0,
237
+ gasPrice: gasPrice ? _chunk4D5XG6XBjs.numberToHex.call(void 0, gasPrice) : void 0,
238
+ maxFeePerGas: maxFeePerGas ? _chunk4D5XG6XBjs.numberToHex.call(void 0, maxFeePerGas) : void 0,
239
+ maxPriorityFeePerGas: maxPriorityFeePerGas ? _chunk4D5XG6XBjs.numberToHex.call(void 0, maxPriorityFeePerGas) : void 0,
237
240
  to,
238
- value: value ? _chunkV5U5S7PQjs.numberToHex.call(void 0, value) : void 0
241
+ value: value ? _chunk4D5XG6XBjs.numberToHex.call(void 0, value) : void 0
239
242
  };
240
243
  const balance = await client.request({
241
244
  method: "eth_estimateGas",
@@ -246,7 +249,7 @@ async function estimateGas(client, {
246
249
 
247
250
  // src/actions/public/getBalance.ts
248
251
  async function getBalance(client, { address, blockNumber, blockTag = "latest" }) {
249
- const blockNumberHex = blockNumber ? _chunkV5U5S7PQjs.numberToHex.call(void 0, blockNumber) : void 0;
252
+ const blockNumberHex = blockNumber ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
250
253
  const balance = await client.request({
251
254
  method: "eth_getBalance",
252
255
  params: [address, blockNumberHex || blockTag]
@@ -261,7 +264,7 @@ async function getBlock(client, {
261
264
  blockTag = "latest",
262
265
  includeTransactions = false
263
266
  } = {}) {
264
- const blockNumberHex = blockNumber !== void 0 ? _chunkV5U5S7PQjs.numberToHex.call(void 0, blockNumber) : void 0;
267
+ const blockNumberHex = blockNumber !== void 0 ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
265
268
  let block = null;
266
269
  if (blockHash) {
267
270
  block = await client.request({
@@ -275,19 +278,19 @@ async function getBlock(client, {
275
278
  });
276
279
  }
277
280
  if (!block)
278
- throw new (0, _chunkV5U5S7PQjs.BlockNotFoundError)({ blockHash, blockNumber });
279
- return _chunkV5U5S7PQjs.format.call(void 0, block, {
280
- formatter: _optionalChain([client, 'access', _3 => _3.chain, 'optionalAccess', _4 => _4.formatters, 'optionalAccess', _5 => _5.block]) || _chunkV5U5S7PQjs.formatBlock
281
+ throw new (0, _chunk4D5XG6XBjs.BlockNotFoundError)({ blockHash, blockNumber });
282
+ return _chunk4D5XG6XBjs.format.call(void 0, block, {
283
+ formatter: _optionalChain([client, 'access', _3 => _3.chain, 'optionalAccess', _4 => _4.formatters, 'optionalAccess', _5 => _5.block]) || _chunk4D5XG6XBjs.formatBlock
281
284
  });
282
285
  }
283
286
 
284
287
  // src/actions/public/getBlockNumber.ts
285
288
  var cacheKey = (id) => `blockNumber.${id}`;
286
289
  function getBlockNumberCache(id) {
287
- return _chunkV5U5S7PQjs.getCache.call(void 0, cacheKey(id));
290
+ return _chunk4D5XG6XBjs.getCache.call(void 0, cacheKey(id));
288
291
  }
289
292
  async function getBlockNumber(client, { maxAge = client.pollingInterval } = {}) {
290
- const blockNumberHex = await _chunkV5U5S7PQjs.withCache.call(void 0,
293
+ const blockNumberHex = await _chunk4D5XG6XBjs.withCache.call(void 0,
291
294
  () => client.request({
292
295
  method: "eth_blockNumber"
293
296
  }),
@@ -302,7 +305,7 @@ async function getBlockTransactionCount(client, {
302
305
  blockNumber,
303
306
  blockTag = "latest"
304
307
  } = {}) {
305
- const blockNumberHex = blockNumber !== void 0 ? _chunkV5U5S7PQjs.numberToHex.call(void 0, blockNumber) : void 0;
308
+ const blockNumberHex = blockNumber !== void 0 ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
306
309
  let count = null;
307
310
  if (blockHash) {
308
311
  count = await client.request({
@@ -315,12 +318,12 @@ async function getBlockTransactionCount(client, {
315
318
  params: [blockNumberHex || blockTag]
316
319
  });
317
320
  }
318
- return _chunkV5U5S7PQjs.hexToNumber.call(void 0, count);
321
+ return _chunk4D5XG6XBjs.hexToNumber.call(void 0, count);
319
322
  }
320
323
 
321
324
  // src/actions/public/getBytecode.ts
322
325
  async function getBytecode(client, { address, blockNumber, blockTag = "latest" }) {
323
- const blockNumberHex = blockNumber !== void 0 ? _chunkV5U5S7PQjs.numberToHex.call(void 0, blockNumber) : void 0;
326
+ const blockNumberHex = blockNumber !== void 0 ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
324
327
  const hex = await client.request({
325
328
  method: "eth_getCode",
326
329
  params: [address, blockNumberHex || blockTag]
@@ -333,7 +336,7 @@ async function getBytecode(client, { address, blockNumber, blockTag = "latest" }
333
336
  // src/actions/public/getChainId.ts
334
337
  async function getChainId(client) {
335
338
  const chainIdHex = await client.request({ method: "eth_chainId" });
336
- return _chunkV5U5S7PQjs.hexToNumber.call(void 0, chainIdHex);
339
+ return _chunk4D5XG6XBjs.hexToNumber.call(void 0, chainIdHex);
337
340
  }
338
341
 
339
342
  // src/actions/public/getFeeHistory.ts
@@ -343,16 +346,16 @@ async function getFeeHistory(client, {
343
346
  blockTag = "latest",
344
347
  rewardPercentiles
345
348
  }) {
346
- const blockNumberHex = blockNumber ? _chunkV5U5S7PQjs.numberToHex.call(void 0, blockNumber) : void 0;
349
+ const blockNumberHex = blockNumber ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
347
350
  const feeHistory = await client.request({
348
351
  method: "eth_feeHistory",
349
352
  params: [
350
- _chunkV5U5S7PQjs.numberToHex.call(void 0, blockCount),
353
+ _chunk4D5XG6XBjs.numberToHex.call(void 0, blockCount),
351
354
  blockNumberHex || blockTag,
352
355
  rewardPercentiles
353
356
  ]
354
357
  });
355
- return _chunkV5U5S7PQjs.formatFeeHistory.call(void 0, feeHistory);
358
+ return _chunk4D5XG6XBjs.formatFeeHistory.call(void 0, feeHistory);
356
359
  }
357
360
 
358
361
  // src/actions/public/getFilterChanges.ts
@@ -362,7 +365,7 @@ async function getFilterChanges(client, { filter }) {
362
365
  params: [filter.id]
363
366
  });
364
367
  return logs.map(
365
- (log) => typeof log === "string" ? log : _chunkV5U5S7PQjs.formatLog.call(void 0, log)
368
+ (log) => typeof log === "string" ? log : _chunk4D5XG6XBjs.formatLog.call(void 0, log)
366
369
  );
367
370
  }
368
371
 
@@ -372,7 +375,7 @@ async function getFilterLogs(client, { filter }) {
372
375
  method: "eth_getFilterLogs",
373
376
  params: [filter.id]
374
377
  });
375
- return logs.map(_chunkV5U5S7PQjs.formatLog);
378
+ return logs.map(_chunk4D5XG6XBjs.formatLog);
376
379
  }
377
380
 
378
381
  // src/actions/public/getGasPrice.ts
@@ -409,18 +412,18 @@ async function getLogs(client, {
409
412
  {
410
413
  address,
411
414
  topics,
412
- fromBlock: typeof fromBlock === "bigint" ? _chunkV5U5S7PQjs.numberToHex.call(void 0, fromBlock) : fromBlock,
413
- toBlock: typeof toBlock === "bigint" ? _chunkV5U5S7PQjs.numberToHex.call(void 0, toBlock) : toBlock
415
+ fromBlock: typeof fromBlock === "bigint" ? _chunk4D5XG6XBjs.numberToHex.call(void 0, fromBlock) : fromBlock,
416
+ toBlock: typeof toBlock === "bigint" ? _chunk4D5XG6XBjs.numberToHex.call(void 0, toBlock) : toBlock
414
417
  }
415
418
  ]
416
419
  });
417
420
  }
418
- return logs.map(_chunkV5U5S7PQjs.formatLog);
421
+ return logs.map(_chunk4D5XG6XBjs.formatLog);
419
422
  }
420
423
 
421
424
  // src/actions/public/getStorageAt.ts
422
425
  async function getStorageAt(client, { address, blockNumber, blockTag = "latest", slot }) {
423
- const blockNumberHex = blockNumber !== void 0 ? _chunkV5U5S7PQjs.numberToHex.call(void 0, blockNumber) : void 0;
426
+ const blockNumberHex = blockNumber !== void 0 ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
424
427
  const data = await client.request({
425
428
  method: "eth_getStorageAt",
426
429
  params: [address, slot, blockNumberHex || blockTag]
@@ -436,7 +439,7 @@ async function getTransaction(client, {
436
439
  hash,
437
440
  index
438
441
  }) {
439
- const blockNumberHex = blockNumber !== void 0 ? _chunkV5U5S7PQjs.numberToHex.call(void 0, blockNumber) : void 0;
442
+ const blockNumberHex = blockNumber !== void 0 ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
440
443
  let transaction = null;
441
444
  if (hash) {
442
445
  transaction = await client.request({
@@ -446,24 +449,24 @@ async function getTransaction(client, {
446
449
  } else if (blockHash) {
447
450
  transaction = await client.request({
448
451
  method: "eth_getTransactionByBlockHashAndIndex",
449
- params: [blockHash, _chunkV5U5S7PQjs.numberToHex.call(void 0, index)]
452
+ params: [blockHash, _chunk4D5XG6XBjs.numberToHex.call(void 0, index)]
450
453
  });
451
454
  } else if (blockNumberHex || blockTag) {
452
455
  transaction = await client.request({
453
456
  method: "eth_getTransactionByBlockNumberAndIndex",
454
- params: [blockNumberHex || blockTag, _chunkV5U5S7PQjs.numberToHex.call(void 0, index)]
457
+ params: [blockNumberHex || blockTag, _chunk4D5XG6XBjs.numberToHex.call(void 0, index)]
455
458
  });
456
459
  }
457
460
  if (!transaction)
458
- throw new (0, _chunkV5U5S7PQjs.TransactionNotFoundError)({
461
+ throw new (0, _chunk4D5XG6XBjs.TransactionNotFoundError)({
459
462
  blockHash,
460
463
  blockNumber,
461
464
  blockTag,
462
465
  hash,
463
466
  index
464
467
  });
465
- return _chunkV5U5S7PQjs.format.call(void 0, transaction, {
466
- formatter: _optionalChain([client, 'access', _6 => _6.chain, 'optionalAccess', _7 => _7.formatters, 'optionalAccess', _8 => _8.transaction]) || _chunkV5U5S7PQjs.formatTransaction
468
+ return _chunk4D5XG6XBjs.format.call(void 0, transaction, {
469
+ formatter: _optionalChain([client, 'access', _6 => _6.chain, 'optionalAccess', _7 => _7.formatters, 'optionalAccess', _8 => _8.transaction]) || _chunk4D5XG6XBjs.formatTransaction
467
470
  });
468
471
  }
469
472
 
@@ -483,9 +486,9 @@ async function getTransactionConfirmations(client, { hash, transactionReceipt })
483
486
  async function getTransactionCount(client, { address, blockTag = "latest", blockNumber }) {
484
487
  const count = await client.request({
485
488
  method: "eth_getTransactionCount",
486
- params: [address, blockNumber ? _chunkV5U5S7PQjs.numberToHex.call(void 0, blockNumber) : blockTag]
489
+ params: [address, blockNumber ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : blockTag]
487
490
  });
488
- return _chunkV5U5S7PQjs.hexToNumber.call(void 0, count);
491
+ return _chunk4D5XG6XBjs.hexToNumber.call(void 0, count);
489
492
  }
490
493
 
491
494
  // src/actions/public/getTransactionReceipt.ts
@@ -495,9 +498,9 @@ async function getTransactionReceipt(client, { hash }) {
495
498
  params: [hash]
496
499
  });
497
500
  if (!receipt)
498
- throw new (0, _chunkV5U5S7PQjs.TransactionReceiptNotFoundError)({ hash });
499
- return _chunkV5U5S7PQjs.format.call(void 0, receipt, {
500
- formatter: _optionalChain([client, 'access', _11 => _11.chain, 'optionalAccess', _12 => _12.formatters, 'optionalAccess', _13 => _13.transactionReceipt]) || _chunkV5U5S7PQjs.formatTransactionReceipt
501
+ throw new (0, _chunk4D5XG6XBjs.TransactionReceiptNotFoundError)({ hash });
502
+ return _chunk4D5XG6XBjs.format.call(void 0, receipt, {
503
+ formatter: _optionalChain([client, 'access', _11 => _11.chain, 'optionalAccess', _12 => _12.formatters, 'optionalAccess', _13 => _13.transactionReceipt]) || _chunk4D5XG6XBjs.formatTransactionReceipt
501
504
  });
502
505
  }
503
506
 
@@ -509,7 +512,7 @@ async function readContract(client, {
509
512
  functionName,
510
513
  ...callRequest
511
514
  }) {
512
- const calldata = _chunkV5U5S7PQjs.encodeFunctionData.call(void 0, {
515
+ const calldata = _chunk4D5XG6XBjs.encodeFunctionData.call(void 0, {
513
516
  abi,
514
517
  args,
515
518
  functionName
@@ -520,14 +523,14 @@ async function readContract(client, {
520
523
  to: address,
521
524
  ...callRequest
522
525
  });
523
- return _chunkV5U5S7PQjs.decodeFunctionResult.call(void 0, {
526
+ return _chunk4D5XG6XBjs.decodeFunctionResult.call(void 0, {
524
527
  abi,
525
528
  args,
526
529
  functionName,
527
530
  data: data || "0x"
528
531
  });
529
532
  } catch (err) {
530
- throw _chunkV5U5S7PQjs.getContractError.call(void 0, err, {
533
+ throw _chunk4D5XG6XBjs.getContractError.call(void 0, err, {
531
534
  abi,
532
535
  address,
533
536
  args,
@@ -537,6 +540,81 @@ async function readContract(client, {
537
540
  }
538
541
  }
539
542
 
543
+ // src/actions/public/multicall.ts
544
+ async function multicall(client, args) {
545
+ const {
546
+ allowFailure = true,
547
+ blockNumber,
548
+ blockTag,
549
+ contracts,
550
+ multicallAddress
551
+ } = args;
552
+ const calls = contracts.map(({ abi, address, args: args2, functionName }) => {
553
+ try {
554
+ const callData = _chunk4D5XG6XBjs.encodeFunctionData.call(void 0, {
555
+ abi,
556
+ args: args2,
557
+ functionName
558
+ });
559
+ return {
560
+ allowFailure: true,
561
+ callData,
562
+ target: address
563
+ };
564
+ } catch (err) {
565
+ const error = _chunk4D5XG6XBjs.getContractError.call(void 0, err, {
566
+ abi,
567
+ address,
568
+ args: args2,
569
+ docsPath: "/docs/contract/multicall",
570
+ functionName
571
+ });
572
+ if (!allowFailure)
573
+ throw error;
574
+ return {
575
+ allowFailure: true,
576
+ callData: "0x",
577
+ target: address
578
+ };
579
+ }
580
+ });
581
+ const results = await readContract(client, {
582
+ abi: _chunk4D5XG6XBjs.multicall3Abi,
583
+ address: multicallAddress,
584
+ args: [calls],
585
+ blockNumber,
586
+ blockTag,
587
+ functionName: "aggregate3"
588
+ });
589
+ return results.map(({ returnData, success }, i) => {
590
+ const { callData } = calls[i];
591
+ const { abi, address, functionName, args: args2 } = contracts[i];
592
+ try {
593
+ if (callData === "0x")
594
+ throw new (0, _chunk4D5XG6XBjs.AbiDecodingZeroDataError)();
595
+ if (!success)
596
+ throw new (0, _chunk4D5XG6XBjs.RawContractError)({ data: returnData });
597
+ const result = _chunk4D5XG6XBjs.decodeFunctionResult.call(void 0, {
598
+ abi,
599
+ data: returnData,
600
+ functionName
601
+ });
602
+ return { result, status: "success" };
603
+ } catch (err) {
604
+ const error = _chunk4D5XG6XBjs.getContractError.call(void 0, err, {
605
+ abi,
606
+ address,
607
+ args: args2,
608
+ docsPath: "/docs/contract/multicall",
609
+ functionName
610
+ });
611
+ if (!allowFailure)
612
+ throw error;
613
+ return { error, result: void 0, status: "failure" };
614
+ }
615
+ });
616
+ }
617
+
540
618
  // src/actions/public/uninstallFilter.ts
541
619
  async function uninstallFilter(client, { filter }) {
542
620
  return client.request({
@@ -596,12 +674,12 @@ function poll(fn, { emitOnBegin, initialWaitTime, interval }) {
596
674
  if (emitOnBegin)
597
675
  data = await fn({ unpoll: unwatch });
598
676
  const initialWait = await _asyncNullishCoalesce(await _optionalChain([initialWaitTime, 'optionalCall', _17 => _17(data)]), async () => ( interval));
599
- await _chunkV5U5S7PQjs.wait.call(void 0, initialWait);
677
+ await _chunk4D5XG6XBjs.wait.call(void 0, initialWait);
600
678
  const poll2 = async () => {
601
679
  if (!active)
602
680
  return;
603
681
  await fn({ unpoll: unwatch });
604
- await _chunkV5U5S7PQjs.wait.call(void 0, interval);
682
+ await _chunk4D5XG6XBjs.wait.call(void 0, interval);
605
683
  poll2();
606
684
  };
607
685
  poll2();
@@ -714,6 +792,130 @@ function watchBlocks(client, {
714
792
  );
715
793
  }
716
794
 
795
+ // src/actions/public/watchContractEvent.ts
796
+ function watchContractEvent(client, {
797
+ abi,
798
+ address,
799
+ args,
800
+ batch = true,
801
+ eventName,
802
+ onError,
803
+ onLogs,
804
+ pollingInterval = client.pollingInterval
805
+ }) {
806
+ const observerId = JSON.stringify([
807
+ "watchContractEvent",
808
+ address,
809
+ args,
810
+ batch,
811
+ client.uid,
812
+ eventName,
813
+ pollingInterval
814
+ ]);
815
+ return observe(observerId, { onLogs, onError }, (emit) => {
816
+ let filter;
817
+ const unwatch = poll(
818
+ async () => {
819
+ try {
820
+ if (!filter) {
821
+ try {
822
+ filter = await createContractEventFilter(client, {
823
+ abi,
824
+ address,
825
+ args,
826
+ eventName
827
+ });
828
+ return;
829
+ } catch (err) {
830
+ unwatch();
831
+ throw err;
832
+ }
833
+ }
834
+ const logs = await getFilterChanges(client, { filter });
835
+ if (logs.length === 0)
836
+ return;
837
+ if (batch)
838
+ emit.onLogs(logs);
839
+ else
840
+ logs.forEach((log) => emit.onLogs([log]));
841
+ } catch (err) {
842
+ _optionalChain([emit, 'access', _24 => _24.onError, 'optionalCall', _25 => _25(err)]);
843
+ }
844
+ },
845
+ {
846
+ emitOnBegin: true,
847
+ interval: pollingInterval
848
+ }
849
+ );
850
+ return async () => {
851
+ if (filter)
852
+ await uninstallFilter(client, { filter });
853
+ unwatch();
854
+ };
855
+ });
856
+ }
857
+
858
+ // src/actions/public/watchEvent.ts
859
+ function watchEvent(client, {
860
+ address,
861
+ args,
862
+ batch = true,
863
+ event,
864
+ onError,
865
+ onLogs,
866
+ pollingInterval = client.pollingInterval
867
+ }) {
868
+ const observerId = JSON.stringify([
869
+ "watchEvent",
870
+ address,
871
+ args,
872
+ batch,
873
+ client.uid,
874
+ event,
875
+ pollingInterval
876
+ ]);
877
+ return observe(observerId, { onLogs, onError }, (emit) => {
878
+ let filter;
879
+ const unwatch = poll(
880
+ async () => {
881
+ try {
882
+ if (!filter) {
883
+ try {
884
+ filter = await createEventFilter(client, {
885
+ address,
886
+ args,
887
+ event
888
+ });
889
+ return;
890
+ } catch (err) {
891
+ unwatch();
892
+ throw err;
893
+ }
894
+ }
895
+ const logs = await getFilterChanges(client, { filter });
896
+ if (logs.length === 0)
897
+ return;
898
+ if (batch)
899
+ emit.onLogs(logs);
900
+ else
901
+ logs.forEach((log) => emit.onLogs([log]));
902
+ } catch (err) {
903
+ _optionalChain([emit, 'access', _26 => _26.onError, 'optionalCall', _27 => _27(err)]);
904
+ }
905
+ },
906
+ {
907
+ emitOnBegin: true,
908
+ interval: pollingInterval
909
+ }
910
+ );
911
+ return async () => {
912
+ if (filter)
913
+ await uninstallFilter(client, { filter });
914
+ unwatch();
915
+ };
916
+ });
917
+ }
918
+
717
919
  // src/actions/public/watchPendingTransactions.ts
718
920
  function watchPendingTransactions(client, {
719
921
  batch = true,
@@ -749,7 +951,7 @@ function watchPendingTransactions(client, {
749
951
  else
750
952
  hashes.forEach((hash) => emit.onTransactions([hash]));
751
953
  } catch (err) {
752
- _optionalChain([emit, 'access', _24 => _24.onError, 'optionalCall', _25 => _25(err)]);
954
+ _optionalChain([emit, 'access', _28 => _28.onError, 'optionalCall', _29 => _29(err)]);
753
955
  }
754
956
  },
755
957
  {
@@ -784,7 +986,7 @@ async function waitForTransactionReceipt(client, {
784
986
  return new Promise((resolve, reject) => {
785
987
  if (timeout)
786
988
  setTimeout(
787
- () => reject(new (0, _chunkV5U5S7PQjs.WaitForTransactionReceiptTimeoutError)({ hash })),
989
+ () => reject(new (0, _chunk4D5XG6XBjs.WaitForTransactionReceiptTimeoutError)({ hash })),
788
990
  timeout
789
991
  );
790
992
  const unobserve = observe(
@@ -814,7 +1016,7 @@ async function waitForTransactionReceipt(client, {
814
1016
  return;
815
1017
  done(() => emit.resolve(receipt));
816
1018
  } catch (err) {
817
- if (transaction && (err instanceof _chunkV5U5S7PQjs.TransactionNotFoundError || err instanceof _chunkV5U5S7PQjs.TransactionReceiptNotFoundError)) {
1019
+ if (transaction && (err instanceof _chunk4D5XG6XBjs.TransactionNotFoundError || err instanceof _chunk4D5XG6XBjs.TransactionReceiptNotFoundError)) {
818
1020
  replacedTransaction = transaction;
819
1021
  const block = await getBlock(client, {
820
1022
  blockNumber,
@@ -837,7 +1039,7 @@ async function waitForTransactionReceipt(client, {
837
1039
  reason = "cancelled";
838
1040
  }
839
1041
  done(() => {
840
- _optionalChain([emit, 'access', _26 => _26.onReplaced, 'optionalCall', _27 => _27({
1042
+ _optionalChain([emit, 'access', _30 => _30.onReplaced, 'optionalCall', _31 => _31({
841
1043
  reason,
842
1044
  replacedTransaction,
843
1045
  transaction: replacementTransaction,
@@ -889,5 +1091,8 @@ async function waitForTransactionReceipt(client, {
889
1091
 
890
1092
 
891
1093
 
892
- exports.call = call; exports.simulateContract = simulateContract; exports.createPendingTransactionFilter = createPendingTransactionFilter; exports.createBlockFilter = createBlockFilter; exports.createEventFilter = createEventFilter; exports.createContractEventFilter = createContractEventFilter; exports.deployContract = deployContract; exports.estimateGas = estimateGas; exports.getBalance = getBalance; exports.getBlock = getBlock; exports.getBlockNumberCache = getBlockNumberCache; exports.getBlockNumber = getBlockNumber; exports.getBlockTransactionCount = getBlockTransactionCount; exports.getBytecode = getBytecode; exports.getChainId = getChainId; exports.getFeeHistory = getFeeHistory; exports.getFilterChanges = getFilterChanges; exports.getFilterLogs = getFilterLogs; exports.getGasPrice = getGasPrice; exports.getLogs = getLogs; exports.getStorageAt = getStorageAt; exports.getTransaction = getTransaction; exports.getTransactionConfirmations = getTransactionConfirmations; exports.getTransactionCount = getTransactionCount; exports.getTransactionReceipt = getTransactionReceipt; exports.readContract = readContract; exports.uninstallFilter = uninstallFilter; exports.waitForTransactionReceipt = waitForTransactionReceipt; exports.watchBlockNumber = watchBlockNumber; exports.watchBlocks = watchBlocks; exports.watchPendingTransactions = watchPendingTransactions;
893
- //# sourceMappingURL=chunk-MVD4Y3AE.js.map
1094
+
1095
+
1096
+
1097
+ exports.call = call; exports.simulateContract = simulateContract; exports.createPendingTransactionFilter = createPendingTransactionFilter; exports.createBlockFilter = createBlockFilter; exports.createEventFilter = createEventFilter; exports.createContractEventFilter = createContractEventFilter; exports.deployContract = deployContract; exports.estimateGas = estimateGas; exports.getBalance = getBalance; exports.getBlock = getBlock; exports.getBlockNumberCache = getBlockNumberCache; exports.getBlockNumber = getBlockNumber; exports.getBlockTransactionCount = getBlockTransactionCount; exports.getBytecode = getBytecode; exports.getChainId = getChainId; exports.getFeeHistory = getFeeHistory; exports.getFilterChanges = getFilterChanges; exports.getFilterLogs = getFilterLogs; exports.getGasPrice = getGasPrice; exports.getLogs = getLogs; exports.getStorageAt = getStorageAt; exports.getTransaction = getTransaction; exports.getTransactionConfirmations = getTransactionConfirmations; exports.getTransactionCount = getTransactionCount; exports.getTransactionReceipt = getTransactionReceipt; exports.readContract = readContract; exports.multicall = multicall; exports.uninstallFilter = uninstallFilter; exports.waitForTransactionReceipt = waitForTransactionReceipt; exports.watchBlockNumber = watchBlockNumber; exports.watchBlocks = watchBlocks; exports.watchContractEvent = watchContractEvent; exports.watchEvent = watchEvent; exports.watchPendingTransactions = watchPendingTransactions;
1098
+ //# sourceMappingURL=chunk-A2HXAZXC.js.map