viem 0.0.1-alpha.23 → 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 (66) 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-TXHOG6KU.mjs → chunk-3ARWEJ3G.mjs} +2 -2
  7. package/dist/{chunk-TXHOG6KU.mjs.map → chunk-3ARWEJ3G.mjs.map} +0 -0
  8. package/dist/{chunk-SSPRUPGN.js → chunk-4D5XG6XB.js} +2 -2
  9. package/dist/{chunk-SSPRUPGN.js.map → chunk-4D5XG6XB.js.map} +0 -0
  10. package/dist/{chunk-EGVXCZNJ.mjs → chunk-6QTEW2BE.mjs} +2 -2
  11. package/dist/{chunk-EGVXCZNJ.mjs.map → chunk-6QTEW2BE.mjs.map} +0 -0
  12. package/dist/{chunk-ZKYGWITF.js → chunk-A2HXAZXC.js} +199 -73
  13. package/dist/chunk-A2HXAZXC.js.map +1 -0
  14. package/dist/{chunk-GX2KDAM3.mjs → chunk-KRPS5CIB.mjs} +2 -2
  15. package/dist/{chunk-GX2KDAM3.mjs.map → chunk-KRPS5CIB.mjs.map} +0 -0
  16. package/dist/{chunk-XBUH66KN.mjs → chunk-LQVMDX5I.mjs} +2 -2
  17. package/dist/{chunk-XBUH66KN.mjs.map → chunk-LQVMDX5I.mjs.map} +0 -0
  18. package/dist/{chunk-NW6724MI.js → chunk-N3IOPT3R.js} +14 -14
  19. package/dist/{chunk-NW6724MI.js.map → chunk-N3IOPT3R.js.map} +0 -0
  20. package/dist/{chunk-RJLUZTJS.mjs → chunk-YQUC52RL.mjs} +129 -3
  21. package/dist/chunk-YQUC52RL.mjs.map +1 -0
  22. package/dist/{chunk-BV5NTHUX.js → chunk-ZSTVHQ6J.js} +13 -13
  23. package/dist/{chunk-BV5NTHUX.js.map → chunk-ZSTVHQ6J.js.map} +0 -0
  24. package/dist/{chunk-7Y5QVLX7.js → chunk-ZYSXBTBB.js} +13 -13
  25. package/dist/{chunk-7Y5QVLX7.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-4c3a37b3.d.ts → contract-70f4ddbe.d.ts} +1 -1
  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 +62 -20
  38. package/dist/index.js +10 -6
  39. package/dist/index.mjs +9 -5
  40. package/dist/{parseGwei-3411cf2d.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-57df1a13.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/actions/index.test.ts +2 -0
  62. package/src/actions/index.ts +6 -0
  63. package/src/index.test.ts +2 -0
  64. package/src/index.ts +6 -0
  65. package/dist/chunk-RJLUZTJS.mjs.map +0 -1
  66. package/dist/chunk-ZKYGWITF.js.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 _chunk7Y5QVLX7js = require('./chunk-7Y5QVLX7.js');
3
+ var _chunkZYSXBTBBjs = require('./chunk-ZYSXBTBB.js');
4
4
 
5
5
 
6
6
 
@@ -29,7 +29,7 @@ var _chunk7Y5QVLX7js = require('./chunk-7Y5QVLX7.js');
29
29
 
30
30
 
31
31
 
32
- var _chunkSSPRUPGNjs = require('./chunk-SSPRUPGN.js');
32
+ var _chunk4D5XG6XBjs = require('./chunk-4D5XG6XB.js');
33
33
 
34
34
  // src/actions/public/call.ts
35
35
  async function call(client, {
@@ -49,10 +49,10 @@ async function call(client, {
49
49
  ...rest
50
50
  }) {
51
51
  if (maxFeePerGas !== void 0 && maxPriorityFeePerGas !== void 0 && maxFeePerGas < maxPriorityFeePerGas)
52
- throw new (0, _chunkSSPRUPGNjs.InvalidGasArgumentsError)();
53
- const blockNumberHex = blockNumber ? _chunkSSPRUPGNjs.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;
54
54
  const formatter = _optionalChain([chain, 'optionalAccess', _ => _.formatters, 'optionalAccess', _2 => _2.transactionRequest]);
55
- const request_ = _chunkSSPRUPGNjs.format.call(void 0,
55
+ const request_ = _chunk4D5XG6XBjs.format.call(void 0,
56
56
  {
57
57
  from,
58
58
  accessList,
@@ -64,10 +64,10 @@ async function call(client, {
64
64
  nonce,
65
65
  to,
66
66
  value,
67
- ..._chunkSSPRUPGNjs.extract.call(void 0, rest, { formatter })
67
+ ..._chunk4D5XG6XBjs.extract.call(void 0, rest, { formatter })
68
68
  },
69
69
  {
70
- formatter: formatter || _chunkSSPRUPGNjs.formatTransactionRequest
70
+ formatter: formatter || _chunk4D5XG6XBjs.formatTransactionRequest
71
71
  }
72
72
  );
73
73
  const response = await client.request({
@@ -87,7 +87,7 @@ async function simulateContract(client, {
87
87
  functionName,
88
88
  ...callRequest
89
89
  }) {
90
- const calldata = _chunkSSPRUPGNjs.encodeFunctionData.call(void 0, {
90
+ const calldata = _chunk4D5XG6XBjs.encodeFunctionData.call(void 0, {
91
91
  abi,
92
92
  args,
93
93
  functionName
@@ -98,7 +98,7 @@ async function simulateContract(client, {
98
98
  to: address,
99
99
  ...callRequest
100
100
  });
101
- const result = _chunkSSPRUPGNjs.decodeFunctionResult.call(void 0, {
101
+ const result = _chunk4D5XG6XBjs.decodeFunctionResult.call(void 0, {
102
102
  abi,
103
103
  args,
104
104
  functionName,
@@ -115,7 +115,7 @@ async function simulateContract(client, {
115
115
  }
116
116
  };
117
117
  } catch (err) {
118
- throw _chunkSSPRUPGNjs.getContractError.call(void 0, err, {
118
+ throw _chunk4D5XG6XBjs.getContractError.call(void 0, err, {
119
119
  abi,
120
120
  address,
121
121
  args,
@@ -159,8 +159,8 @@ async function createEventFilter(client, {
159
159
  params: [
160
160
  {
161
161
  address,
162
- fromBlock: typeof fromBlock === "bigint" ? _chunkSSPRUPGNjs.numberToHex.call(void 0, fromBlock) : fromBlock,
163
- toBlock: typeof toBlock === "bigint" ? _chunkSSPRUPGNjs.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,
164
164
  ...topics.length ? { topics } : {}
165
165
  }
166
166
  ]
@@ -171,7 +171,7 @@ function buildFilterTopics({
171
171
  event,
172
172
  args: _args
173
173
  }) {
174
- const signature = _chunkSSPRUPGNjs.getEventSignature.call(void 0, event);
174
+ const signature = _chunk4D5XG6XBjs.getEventSignature.call(void 0, event);
175
175
  return [signature];
176
176
  }
177
177
 
@@ -184,7 +184,7 @@ async function createContractEventFilter(client, {
184
184
  fromBlock,
185
185
  toBlock
186
186
  }) {
187
- const topics = eventName ? _chunkSSPRUPGNjs.encodeEventTopics.call(void 0, {
187
+ const topics = eventName ? _chunk4D5XG6XBjs.encodeEventTopics.call(void 0, {
188
188
  abi,
189
189
  args,
190
190
  eventName
@@ -194,8 +194,8 @@ async function createContractEventFilter(client, {
194
194
  params: [
195
195
  {
196
196
  address,
197
- fromBlock: typeof fromBlock === "bigint" ? _chunkSSPRUPGNjs.numberToHex.call(void 0, fromBlock) : fromBlock,
198
- toBlock: typeof toBlock === "bigint" ? _chunkSSPRUPGNjs.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,
199
199
  topics
200
200
  }
201
201
  ]
@@ -205,12 +205,12 @@ async function createContractEventFilter(client, {
205
205
 
206
206
  // src/actions/public/deployContract.ts
207
207
  function deployContract(walletClient, { abi, args, bytecode, ...request }) {
208
- const calldata = _chunkSSPRUPGNjs.encodeDeployData.call(void 0, {
208
+ const calldata = _chunk4D5XG6XBjs.encodeDeployData.call(void 0, {
209
209
  abi,
210
210
  args,
211
211
  bytecode
212
212
  });
213
- return _chunk7Y5QVLX7js.sendTransaction.call(void 0, walletClient, {
213
+ return _chunkZYSXBTBBjs.sendTransaction.call(void 0, walletClient, {
214
214
  ...request,
215
215
  data: calldata
216
216
  });
@@ -229,16 +229,16 @@ async function estimateGas(client, {
229
229
  to,
230
230
  value
231
231
  }) {
232
- const blockNumberHex = blockNumber ? _chunkSSPRUPGNjs.numberToHex.call(void 0, blockNumber) : void 0;
232
+ const blockNumberHex = blockNumber ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
233
233
  const parameters = {
234
234
  data,
235
235
  from,
236
- gas: gas ? _chunkSSPRUPGNjs.numberToHex.call(void 0, gas) : void 0,
237
- gasPrice: gasPrice ? _chunkSSPRUPGNjs.numberToHex.call(void 0, gasPrice) : void 0,
238
- maxFeePerGas: maxFeePerGas ? _chunkSSPRUPGNjs.numberToHex.call(void 0, maxFeePerGas) : void 0,
239
- maxPriorityFeePerGas: maxPriorityFeePerGas ? _chunkSSPRUPGNjs.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,
240
240
  to,
241
- value: value ? _chunkSSPRUPGNjs.numberToHex.call(void 0, value) : void 0
241
+ value: value ? _chunk4D5XG6XBjs.numberToHex.call(void 0, value) : void 0
242
242
  };
243
243
  const balance = await client.request({
244
244
  method: "eth_estimateGas",
@@ -249,7 +249,7 @@ async function estimateGas(client, {
249
249
 
250
250
  // src/actions/public/getBalance.ts
251
251
  async function getBalance(client, { address, blockNumber, blockTag = "latest" }) {
252
- const blockNumberHex = blockNumber ? _chunkSSPRUPGNjs.numberToHex.call(void 0, blockNumber) : void 0;
252
+ const blockNumberHex = blockNumber ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
253
253
  const balance = await client.request({
254
254
  method: "eth_getBalance",
255
255
  params: [address, blockNumberHex || blockTag]
@@ -264,7 +264,7 @@ async function getBlock(client, {
264
264
  blockTag = "latest",
265
265
  includeTransactions = false
266
266
  } = {}) {
267
- const blockNumberHex = blockNumber !== void 0 ? _chunkSSPRUPGNjs.numberToHex.call(void 0, blockNumber) : void 0;
267
+ const blockNumberHex = blockNumber !== void 0 ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
268
268
  let block = null;
269
269
  if (blockHash) {
270
270
  block = await client.request({
@@ -278,19 +278,19 @@ async function getBlock(client, {
278
278
  });
279
279
  }
280
280
  if (!block)
281
- throw new (0, _chunkSSPRUPGNjs.BlockNotFoundError)({ blockHash, blockNumber });
282
- return _chunkSSPRUPGNjs.format.call(void 0, block, {
283
- formatter: _optionalChain([client, 'access', _3 => _3.chain, 'optionalAccess', _4 => _4.formatters, 'optionalAccess', _5 => _5.block]) || _chunkSSPRUPGNjs.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
284
284
  });
285
285
  }
286
286
 
287
287
  // src/actions/public/getBlockNumber.ts
288
288
  var cacheKey = (id) => `blockNumber.${id}`;
289
289
  function getBlockNumberCache(id) {
290
- return _chunkSSPRUPGNjs.getCache.call(void 0, cacheKey(id));
290
+ return _chunk4D5XG6XBjs.getCache.call(void 0, cacheKey(id));
291
291
  }
292
292
  async function getBlockNumber(client, { maxAge = client.pollingInterval } = {}) {
293
- const blockNumberHex = await _chunkSSPRUPGNjs.withCache.call(void 0,
293
+ const blockNumberHex = await _chunk4D5XG6XBjs.withCache.call(void 0,
294
294
  () => client.request({
295
295
  method: "eth_blockNumber"
296
296
  }),
@@ -305,7 +305,7 @@ async function getBlockTransactionCount(client, {
305
305
  blockNumber,
306
306
  blockTag = "latest"
307
307
  } = {}) {
308
- const blockNumberHex = blockNumber !== void 0 ? _chunkSSPRUPGNjs.numberToHex.call(void 0, blockNumber) : void 0;
308
+ const blockNumberHex = blockNumber !== void 0 ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
309
309
  let count = null;
310
310
  if (blockHash) {
311
311
  count = await client.request({
@@ -318,12 +318,12 @@ async function getBlockTransactionCount(client, {
318
318
  params: [blockNumberHex || blockTag]
319
319
  });
320
320
  }
321
- return _chunkSSPRUPGNjs.hexToNumber.call(void 0, count);
321
+ return _chunk4D5XG6XBjs.hexToNumber.call(void 0, count);
322
322
  }
323
323
 
324
324
  // src/actions/public/getBytecode.ts
325
325
  async function getBytecode(client, { address, blockNumber, blockTag = "latest" }) {
326
- const blockNumberHex = blockNumber !== void 0 ? _chunkSSPRUPGNjs.numberToHex.call(void 0, blockNumber) : void 0;
326
+ const blockNumberHex = blockNumber !== void 0 ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
327
327
  const hex = await client.request({
328
328
  method: "eth_getCode",
329
329
  params: [address, blockNumberHex || blockTag]
@@ -336,7 +336,7 @@ async function getBytecode(client, { address, blockNumber, blockTag = "latest" }
336
336
  // src/actions/public/getChainId.ts
337
337
  async function getChainId(client) {
338
338
  const chainIdHex = await client.request({ method: "eth_chainId" });
339
- return _chunkSSPRUPGNjs.hexToNumber.call(void 0, chainIdHex);
339
+ return _chunk4D5XG6XBjs.hexToNumber.call(void 0, chainIdHex);
340
340
  }
341
341
 
342
342
  // src/actions/public/getFeeHistory.ts
@@ -346,16 +346,16 @@ async function getFeeHistory(client, {
346
346
  blockTag = "latest",
347
347
  rewardPercentiles
348
348
  }) {
349
- const blockNumberHex = blockNumber ? _chunkSSPRUPGNjs.numberToHex.call(void 0, blockNumber) : void 0;
349
+ const blockNumberHex = blockNumber ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
350
350
  const feeHistory = await client.request({
351
351
  method: "eth_feeHistory",
352
352
  params: [
353
- _chunkSSPRUPGNjs.numberToHex.call(void 0, blockCount),
353
+ _chunk4D5XG6XBjs.numberToHex.call(void 0, blockCount),
354
354
  blockNumberHex || blockTag,
355
355
  rewardPercentiles
356
356
  ]
357
357
  });
358
- return _chunkSSPRUPGNjs.formatFeeHistory.call(void 0, feeHistory);
358
+ return _chunk4D5XG6XBjs.formatFeeHistory.call(void 0, feeHistory);
359
359
  }
360
360
 
361
361
  // src/actions/public/getFilterChanges.ts
@@ -365,7 +365,7 @@ async function getFilterChanges(client, { filter }) {
365
365
  params: [filter.id]
366
366
  });
367
367
  return logs.map(
368
- (log) => typeof log === "string" ? log : _chunkSSPRUPGNjs.formatLog.call(void 0, log)
368
+ (log) => typeof log === "string" ? log : _chunk4D5XG6XBjs.formatLog.call(void 0, log)
369
369
  );
370
370
  }
371
371
 
@@ -375,7 +375,7 @@ async function getFilterLogs(client, { filter }) {
375
375
  method: "eth_getFilterLogs",
376
376
  params: [filter.id]
377
377
  });
378
- return logs.map(_chunkSSPRUPGNjs.formatLog);
378
+ return logs.map(_chunk4D5XG6XBjs.formatLog);
379
379
  }
380
380
 
381
381
  // src/actions/public/getGasPrice.ts
@@ -412,18 +412,18 @@ async function getLogs(client, {
412
412
  {
413
413
  address,
414
414
  topics,
415
- fromBlock: typeof fromBlock === "bigint" ? _chunkSSPRUPGNjs.numberToHex.call(void 0, fromBlock) : fromBlock,
416
- toBlock: typeof toBlock === "bigint" ? _chunkSSPRUPGNjs.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
417
417
  }
418
418
  ]
419
419
  });
420
420
  }
421
- return logs.map(_chunkSSPRUPGNjs.formatLog);
421
+ return logs.map(_chunk4D5XG6XBjs.formatLog);
422
422
  }
423
423
 
424
424
  // src/actions/public/getStorageAt.ts
425
425
  async function getStorageAt(client, { address, blockNumber, blockTag = "latest", slot }) {
426
- const blockNumberHex = blockNumber !== void 0 ? _chunkSSPRUPGNjs.numberToHex.call(void 0, blockNumber) : void 0;
426
+ const blockNumberHex = blockNumber !== void 0 ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
427
427
  const data = await client.request({
428
428
  method: "eth_getStorageAt",
429
429
  params: [address, slot, blockNumberHex || blockTag]
@@ -439,7 +439,7 @@ async function getTransaction(client, {
439
439
  hash,
440
440
  index
441
441
  }) {
442
- const blockNumberHex = blockNumber !== void 0 ? _chunkSSPRUPGNjs.numberToHex.call(void 0, blockNumber) : void 0;
442
+ const blockNumberHex = blockNumber !== void 0 ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : void 0;
443
443
  let transaction = null;
444
444
  if (hash) {
445
445
  transaction = await client.request({
@@ -449,24 +449,24 @@ async function getTransaction(client, {
449
449
  } else if (blockHash) {
450
450
  transaction = await client.request({
451
451
  method: "eth_getTransactionByBlockHashAndIndex",
452
- params: [blockHash, _chunkSSPRUPGNjs.numberToHex.call(void 0, index)]
452
+ params: [blockHash, _chunk4D5XG6XBjs.numberToHex.call(void 0, index)]
453
453
  });
454
454
  } else if (blockNumberHex || blockTag) {
455
455
  transaction = await client.request({
456
456
  method: "eth_getTransactionByBlockNumberAndIndex",
457
- params: [blockNumberHex || blockTag, _chunkSSPRUPGNjs.numberToHex.call(void 0, index)]
457
+ params: [blockNumberHex || blockTag, _chunk4D5XG6XBjs.numberToHex.call(void 0, index)]
458
458
  });
459
459
  }
460
460
  if (!transaction)
461
- throw new (0, _chunkSSPRUPGNjs.TransactionNotFoundError)({
461
+ throw new (0, _chunk4D5XG6XBjs.TransactionNotFoundError)({
462
462
  blockHash,
463
463
  blockNumber,
464
464
  blockTag,
465
465
  hash,
466
466
  index
467
467
  });
468
- return _chunkSSPRUPGNjs.format.call(void 0, transaction, {
469
- formatter: _optionalChain([client, 'access', _6 => _6.chain, 'optionalAccess', _7 => _7.formatters, 'optionalAccess', _8 => _8.transaction]) || _chunkSSPRUPGNjs.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
470
470
  });
471
471
  }
472
472
 
@@ -486,9 +486,9 @@ async function getTransactionConfirmations(client, { hash, transactionReceipt })
486
486
  async function getTransactionCount(client, { address, blockTag = "latest", blockNumber }) {
487
487
  const count = await client.request({
488
488
  method: "eth_getTransactionCount",
489
- params: [address, blockNumber ? _chunkSSPRUPGNjs.numberToHex.call(void 0, blockNumber) : blockTag]
489
+ params: [address, blockNumber ? _chunk4D5XG6XBjs.numberToHex.call(void 0, blockNumber) : blockTag]
490
490
  });
491
- return _chunkSSPRUPGNjs.hexToNumber.call(void 0, count);
491
+ return _chunk4D5XG6XBjs.hexToNumber.call(void 0, count);
492
492
  }
493
493
 
494
494
  // src/actions/public/getTransactionReceipt.ts
@@ -498,9 +498,9 @@ async function getTransactionReceipt(client, { hash }) {
498
498
  params: [hash]
499
499
  });
500
500
  if (!receipt)
501
- throw new (0, _chunkSSPRUPGNjs.TransactionReceiptNotFoundError)({ hash });
502
- return _chunkSSPRUPGNjs.format.call(void 0, receipt, {
503
- formatter: _optionalChain([client, 'access', _11 => _11.chain, 'optionalAccess', _12 => _12.formatters, 'optionalAccess', _13 => _13.transactionReceipt]) || _chunkSSPRUPGNjs.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
504
504
  });
505
505
  }
506
506
 
@@ -512,7 +512,7 @@ async function readContract(client, {
512
512
  functionName,
513
513
  ...callRequest
514
514
  }) {
515
- const calldata = _chunkSSPRUPGNjs.encodeFunctionData.call(void 0, {
515
+ const calldata = _chunk4D5XG6XBjs.encodeFunctionData.call(void 0, {
516
516
  abi,
517
517
  args,
518
518
  functionName
@@ -523,14 +523,14 @@ async function readContract(client, {
523
523
  to: address,
524
524
  ...callRequest
525
525
  });
526
- return _chunkSSPRUPGNjs.decodeFunctionResult.call(void 0, {
526
+ return _chunk4D5XG6XBjs.decodeFunctionResult.call(void 0, {
527
527
  abi,
528
528
  args,
529
529
  functionName,
530
530
  data: data || "0x"
531
531
  });
532
532
  } catch (err) {
533
- throw _chunkSSPRUPGNjs.getContractError.call(void 0, err, {
533
+ throw _chunk4D5XG6XBjs.getContractError.call(void 0, err, {
534
534
  abi,
535
535
  address,
536
536
  args,
@@ -551,7 +551,7 @@ async function multicall(client, args) {
551
551
  } = args;
552
552
  const calls = contracts.map(({ abi, address, args: args2, functionName }) => {
553
553
  try {
554
- const callData = _chunkSSPRUPGNjs.encodeFunctionData.call(void 0, {
554
+ const callData = _chunk4D5XG6XBjs.encodeFunctionData.call(void 0, {
555
555
  abi,
556
556
  args: args2,
557
557
  functionName
@@ -562,7 +562,7 @@ async function multicall(client, args) {
562
562
  target: address
563
563
  };
564
564
  } catch (err) {
565
- const error = _chunkSSPRUPGNjs.getContractError.call(void 0, err, {
565
+ const error = _chunk4D5XG6XBjs.getContractError.call(void 0, err, {
566
566
  abi,
567
567
  address,
568
568
  args: args2,
@@ -579,7 +579,7 @@ async function multicall(client, args) {
579
579
  }
580
580
  });
581
581
  const results = await readContract(client, {
582
- abi: _chunkSSPRUPGNjs.multicall3Abi,
582
+ abi: _chunk4D5XG6XBjs.multicall3Abi,
583
583
  address: multicallAddress,
584
584
  args: [calls],
585
585
  blockNumber,
@@ -591,17 +591,17 @@ async function multicall(client, args) {
591
591
  const { abi, address, functionName, args: args2 } = contracts[i];
592
592
  try {
593
593
  if (callData === "0x")
594
- throw new (0, _chunkSSPRUPGNjs.AbiDecodingZeroDataError)();
594
+ throw new (0, _chunk4D5XG6XBjs.AbiDecodingZeroDataError)();
595
595
  if (!success)
596
- throw new (0, _chunkSSPRUPGNjs.RawContractError)({ data: returnData });
597
- const result = _chunkSSPRUPGNjs.decodeFunctionResult.call(void 0, {
596
+ throw new (0, _chunk4D5XG6XBjs.RawContractError)({ data: returnData });
597
+ const result = _chunk4D5XG6XBjs.decodeFunctionResult.call(void 0, {
598
598
  abi,
599
599
  data: returnData,
600
600
  functionName
601
601
  });
602
602
  return { result, status: "success" };
603
603
  } catch (err) {
604
- const error = _chunkSSPRUPGNjs.getContractError.call(void 0, err, {
604
+ const error = _chunk4D5XG6XBjs.getContractError.call(void 0, err, {
605
605
  abi,
606
606
  address,
607
607
  args: args2,
@@ -674,12 +674,12 @@ function poll(fn, { emitOnBegin, initialWaitTime, interval }) {
674
674
  if (emitOnBegin)
675
675
  data = await fn({ unpoll: unwatch });
676
676
  const initialWait = await _asyncNullishCoalesce(await _optionalChain([initialWaitTime, 'optionalCall', _17 => _17(data)]), async () => ( interval));
677
- await _chunkSSPRUPGNjs.wait.call(void 0, initialWait);
677
+ await _chunk4D5XG6XBjs.wait.call(void 0, initialWait);
678
678
  const poll2 = async () => {
679
679
  if (!active)
680
680
  return;
681
681
  await fn({ unpoll: unwatch });
682
- await _chunkSSPRUPGNjs.wait.call(void 0, interval);
682
+ await _chunk4D5XG6XBjs.wait.call(void 0, interval);
683
683
  poll2();
684
684
  };
685
685
  poll2();
@@ -792,6 +792,130 @@ function watchBlocks(client, {
792
792
  );
793
793
  }
794
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
+
795
919
  // src/actions/public/watchPendingTransactions.ts
796
920
  function watchPendingTransactions(client, {
797
921
  batch = true,
@@ -827,7 +951,7 @@ function watchPendingTransactions(client, {
827
951
  else
828
952
  hashes.forEach((hash) => emit.onTransactions([hash]));
829
953
  } catch (err) {
830
- _optionalChain([emit, 'access', _24 => _24.onError, 'optionalCall', _25 => _25(err)]);
954
+ _optionalChain([emit, 'access', _28 => _28.onError, 'optionalCall', _29 => _29(err)]);
831
955
  }
832
956
  },
833
957
  {
@@ -862,7 +986,7 @@ async function waitForTransactionReceipt(client, {
862
986
  return new Promise((resolve, reject) => {
863
987
  if (timeout)
864
988
  setTimeout(
865
- () => reject(new (0, _chunkSSPRUPGNjs.WaitForTransactionReceiptTimeoutError)({ hash })),
989
+ () => reject(new (0, _chunk4D5XG6XBjs.WaitForTransactionReceiptTimeoutError)({ hash })),
866
990
  timeout
867
991
  );
868
992
  const unobserve = observe(
@@ -892,7 +1016,7 @@ async function waitForTransactionReceipt(client, {
892
1016
  return;
893
1017
  done(() => emit.resolve(receipt));
894
1018
  } catch (err) {
895
- if (transaction && (err instanceof _chunkSSPRUPGNjs.TransactionNotFoundError || err instanceof _chunkSSPRUPGNjs.TransactionReceiptNotFoundError)) {
1019
+ if (transaction && (err instanceof _chunk4D5XG6XBjs.TransactionNotFoundError || err instanceof _chunk4D5XG6XBjs.TransactionReceiptNotFoundError)) {
896
1020
  replacedTransaction = transaction;
897
1021
  const block = await getBlock(client, {
898
1022
  blockNumber,
@@ -915,7 +1039,7 @@ async function waitForTransactionReceipt(client, {
915
1039
  reason = "cancelled";
916
1040
  }
917
1041
  done(() => {
918
- _optionalChain([emit, 'access', _26 => _26.onReplaced, 'optionalCall', _27 => _27({
1042
+ _optionalChain([emit, 'access', _30 => _30.onReplaced, 'optionalCall', _31 => _31({
919
1043
  reason,
920
1044
  replacedTransaction,
921
1045
  transaction: replacementTransaction,
@@ -968,5 +1092,7 @@ async function waitForTransactionReceipt(client, {
968
1092
 
969
1093
 
970
1094
 
971
- 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.watchPendingTransactions = watchPendingTransactions;
972
- //# sourceMappingURL=chunk-ZKYGWITF.js.map
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