@dvmkit/dvm-cli 0.0.0 → 0.1.5

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 (50) hide show
  1. package/LICENSE +67 -0
  2. package/NOTICE +2 -0
  3. package/README.md +28 -3
  4. package/dist/_esm-MN4BUYV6.js +885 -0
  5. package/dist/_esm-NRGECLJ7.js +35 -0
  6. package/dist/accounts-2WZE4N5F.js +73 -0
  7. package/dist/actions-LR65XILR.js +244 -0
  8. package/dist/ccip-JXYJSXTW.js +18 -0
  9. package/dist/chains-LJ7XK6H3.js +1460 -0
  10. package/dist/chunk-2VVVWBQA.js +15436 -0
  11. package/dist/chunk-3SWX5BQP.js +66 -0
  12. package/dist/chunk-3W2M46WM.js +61142 -0
  13. package/dist/chunk-4JXFXP4Y.js +757 -0
  14. package/dist/chunk-4NWEJTAW.js +16616 -0
  15. package/dist/chunk-65EY7CT4.js +2691 -0
  16. package/dist/chunk-6CC6JGEU.js +1815 -0
  17. package/dist/chunk-6O27TEXD.js +1181 -0
  18. package/dist/chunk-7OK7MBT6.js +258 -0
  19. package/dist/chunk-BECPI5H5.js +30063 -0
  20. package/dist/chunk-CJTE5TS3.js +1298 -0
  21. package/dist/chunk-ECEM3ZAS.js +339 -0
  22. package/dist/chunk-ECK465AY.js +5614 -0
  23. package/dist/chunk-EGY4KDBW.js +5149 -0
  24. package/dist/chunk-EVQERRCP.js +21369 -0
  25. package/dist/chunk-EZHT2RLJ.js +1447 -0
  26. package/dist/chunk-F55NNH2F.js +6484 -0
  27. package/dist/chunk-G5C6E6PJ.js +9063 -0
  28. package/dist/chunk-GZWKCIYN.js +3319 -0
  29. package/dist/chunk-IYHTITNZ.js +45 -0
  30. package/dist/chunk-LH3QPVN6.js +9869 -0
  31. package/dist/chunk-MLDUKBU3.js +2426 -0
  32. package/dist/chunk-N3UJT2NJ.js +3 -0
  33. package/dist/chunk-OWJZYYMG.js +185 -0
  34. package/dist/chunk-RA24J4QM.js +3717 -0
  35. package/dist/chunk-ZJYO7OLO.js +514 -0
  36. package/dist/client-OWIOFBKS.js +54 -0
  37. package/dist/dist-2G3QBGID.js +47 -0
  38. package/dist/dvm.js +56008 -0
  39. package/dist/esm-RQLHAH2K.js +5183 -0
  40. package/dist/internal-QFQ7MJ5V.js +1228 -0
  41. package/dist/mine.wasm-DNBKYCTQ.js +12 -0
  42. package/dist/payout-reporter-3UB5WRCV-XTVZFIAO.js +17 -0
  43. package/dist/pocket-refill-PQ5ZVSBY.js +129 -0
  44. package/dist/revenue-reporter-JIKUPXOK-TYUBTF4P.js +11 -0
  45. package/dist/secp256k1-JLZEQ2H7.js +19 -0
  46. package/dist/tempo-lifecycle-SQL3KLEZ-AATA2SKI.js +28 -0
  47. package/dist/tempo-wallet-QOLEIPCV-SWCXRBDS.js +33 -0
  48. package/dist/x402-FTG2GRAQ-UGAUMUL6.js +80 -0
  49. package/package.json +63 -6
  50. package/skills/dvm/SKILL.md +71 -0
@@ -0,0 +1,1298 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __dvmCreateRequire } from "node:module";
3
+ const require = __dvmCreateRequire(import.meta.url);
4
+ import {
5
+ EnsInvalidChainIdError,
6
+ addChain,
7
+ approve,
8
+ approveSync,
9
+ createAccessList,
10
+ createBlockFilter,
11
+ createEventFilter,
12
+ createPendingTransactionFilter,
13
+ deployContract,
14
+ dropTransaction,
15
+ dumpState,
16
+ estimateContractGas,
17
+ getAddresses,
18
+ getAllowance,
19
+ getAutomine,
20
+ getBalance,
21
+ getBalance2,
22
+ getBlobBaseFee,
23
+ getBlockReceipts,
24
+ getBlockTransactionCount,
25
+ getCallsStatus,
26
+ getCapabilities,
27
+ getDelegation,
28
+ getEip712Domain,
29
+ getEnsAddress,
30
+ getEnsAvatar,
31
+ getEnsName,
32
+ getEnsResolver,
33
+ getEnsText,
34
+ getFeeHistory,
35
+ getFilterLogs,
36
+ getMetadata,
37
+ getPermissions,
38
+ getProof,
39
+ getRawTransaction,
40
+ getStorageAt,
41
+ getTotalSupply,
42
+ getTransactionConfirmations,
43
+ getTxpoolContent,
44
+ getTxpoolStatus,
45
+ impersonateAccount,
46
+ increaseTime,
47
+ inspectTxpool,
48
+ loadState,
49
+ mine,
50
+ multicall,
51
+ prepareAuthorization,
52
+ removeBlockTimestampInterval,
53
+ requestAddresses,
54
+ requestPermissions,
55
+ reset,
56
+ revert,
57
+ sendCalls,
58
+ sendCallsSync,
59
+ sendUnsignedTransaction,
60
+ setAutomine,
61
+ setBalance,
62
+ setBlockGasLimit,
63
+ setBlockTimestampInterval,
64
+ setCode,
65
+ setCoinbase,
66
+ setIntervalMining,
67
+ setLoggingEnabled,
68
+ setMinGasPrice,
69
+ setNextBlockBaseFeePerGas,
70
+ setNextBlockTimestamp,
71
+ setNonce,
72
+ setRpcUrl,
73
+ setStorageAt,
74
+ showCallsStatus,
75
+ signAuthorization,
76
+ signMessage,
77
+ signTransaction,
78
+ signTypedData,
79
+ simulateBlocks,
80
+ simulateCalls,
81
+ simulateContract,
82
+ snapshot,
83
+ stopImpersonatingAccount,
84
+ switchChain,
85
+ transfer,
86
+ transferSync,
87
+ verifyMessage,
88
+ verifyTypedData,
89
+ waitForCallsStatus,
90
+ watchAsset,
91
+ watchBlocks,
92
+ watchEvent,
93
+ watchPendingTransactions
94
+ } from "./chunk-GZWKCIYN.js";
95
+ import {
96
+ buildRequest,
97
+ createContractEventFilter,
98
+ estimateFeesPerGas,
99
+ estimateGas,
100
+ estimateMaxPriorityFeePerGas,
101
+ fillTransaction,
102
+ getAction,
103
+ getBlock,
104
+ getBlockNumber,
105
+ getChainId,
106
+ getCode,
107
+ getContractEvents,
108
+ getFilterChanges,
109
+ getGasPrice,
110
+ getHttpRpcClient,
111
+ getLogs,
112
+ getSocket,
113
+ getTransaction,
114
+ getTransactionReceipt,
115
+ getWebSocketRpcClient,
116
+ parseTransaction,
117
+ prepareTransactionRequest,
118
+ readContract,
119
+ recoverAddress,
120
+ sendRawTransaction,
121
+ sendRawTransactionSync,
122
+ sendTransaction,
123
+ sendTransactionSync,
124
+ uninstallFilter,
125
+ verifyHash2 as verifyHash,
126
+ wait,
127
+ waitForTransactionReceipt,
128
+ watchBlockNumber,
129
+ watchContractEvent,
130
+ writeContract,
131
+ writeContractSync
132
+ } from "./chunk-LH3QPVN6.js";
133
+ import {
134
+ commitmentToVersionedHash,
135
+ getTransactionCount,
136
+ hashMessage,
137
+ serializeTransaction
138
+ } from "./chunk-6O27TEXD.js";
139
+ import {
140
+ secp256k1
141
+ } from "./chunk-65EY7CT4.js";
142
+ import {
143
+ RpcRequestError,
144
+ TransactionRejectedRpcError,
145
+ UserRejectedRequestError,
146
+ WalletConnectSessionSettlementError,
147
+ call,
148
+ createBatchScheduler,
149
+ decodeAbiParameters,
150
+ isAddressEqual
151
+ } from "./chunk-F55NNH2F.js";
152
+ import {
153
+ AbiConstructorNotFoundError,
154
+ AbiConstructorParamsNotFoundError,
155
+ BaseError,
156
+ ExecutionRevertedError,
157
+ bytesToHex,
158
+ createCursor,
159
+ hexToBigInt,
160
+ hexToBytes,
161
+ isAddress,
162
+ keccak256,
163
+ numberToHex,
164
+ parseAccount
165
+ } from "./chunk-MLDUKBU3.js";
166
+
167
+ // node_modules/viem/_esm/actions/getContract.js
168
+ function getContract({ abi, address, client: client_ }) {
169
+ const client = client_;
170
+ const [publicClient, walletClient] = (() => {
171
+ if (!client)
172
+ return [void 0, void 0];
173
+ if ("public" in client && "wallet" in client)
174
+ return [client.public, client.wallet];
175
+ if ("public" in client)
176
+ return [client.public, void 0];
177
+ if ("wallet" in client)
178
+ return [void 0, client.wallet];
179
+ return [client, client];
180
+ })();
181
+ const hasPublicClient = publicClient !== void 0 && publicClient !== null;
182
+ const hasWalletClient = walletClient !== void 0 && walletClient !== null;
183
+ const contract = {};
184
+ let hasReadFunction = false;
185
+ let hasWriteFunction = false;
186
+ let hasEvent = false;
187
+ for (const item of abi) {
188
+ if (item.type === "function")
189
+ if (item.stateMutability === "view" || item.stateMutability === "pure")
190
+ hasReadFunction = true;
191
+ else
192
+ hasWriteFunction = true;
193
+ else if (item.type === "event")
194
+ hasEvent = true;
195
+ if (hasReadFunction && hasWriteFunction && hasEvent)
196
+ break;
197
+ }
198
+ if (hasPublicClient) {
199
+ if (hasReadFunction)
200
+ contract.read = new Proxy({}, {
201
+ get(_, functionName) {
202
+ return (...parameters) => {
203
+ const { args, options } = getFunctionParameters(parameters);
204
+ return getAction(publicClient, readContract, "readContract")({
205
+ abi,
206
+ address,
207
+ functionName,
208
+ args,
209
+ ...options
210
+ });
211
+ };
212
+ }
213
+ });
214
+ if (hasWriteFunction)
215
+ contract.simulate = new Proxy({}, {
216
+ get(_, functionName) {
217
+ return (...parameters) => {
218
+ const { args, options } = getFunctionParameters(parameters);
219
+ return getAction(publicClient, simulateContract, "simulateContract")({
220
+ abi,
221
+ address,
222
+ functionName,
223
+ args,
224
+ ...options
225
+ });
226
+ };
227
+ }
228
+ });
229
+ if (hasEvent) {
230
+ contract.createEventFilter = new Proxy({}, {
231
+ get(_, eventName) {
232
+ return (...parameters) => {
233
+ const abiEvent = abi.find((x) => x.type === "event" && x.name === eventName);
234
+ const { args, options } = getEventParameters(parameters, abiEvent);
235
+ return getAction(publicClient, createContractEventFilter, "createContractEventFilter")({
236
+ abi,
237
+ address,
238
+ eventName,
239
+ args,
240
+ ...options
241
+ });
242
+ };
243
+ }
244
+ });
245
+ contract.getEvents = new Proxy({}, {
246
+ get(_, eventName) {
247
+ return (...parameters) => {
248
+ const abiEvent = abi.find((x) => x.type === "event" && x.name === eventName);
249
+ const { args, options } = getEventParameters(parameters, abiEvent);
250
+ return getAction(publicClient, getContractEvents, "getContractEvents")({
251
+ abi,
252
+ address,
253
+ eventName,
254
+ args,
255
+ ...options
256
+ });
257
+ };
258
+ }
259
+ });
260
+ contract.watchEvent = new Proxy({}, {
261
+ get(_, eventName) {
262
+ return (...parameters) => {
263
+ const abiEvent = abi.find((x) => x.type === "event" && x.name === eventName);
264
+ const { args, options } = getEventParameters(parameters, abiEvent);
265
+ return getAction(publicClient, watchContractEvent, "watchContractEvent")({
266
+ abi,
267
+ address,
268
+ eventName,
269
+ args,
270
+ ...options
271
+ });
272
+ };
273
+ }
274
+ });
275
+ }
276
+ }
277
+ if (hasWalletClient) {
278
+ if (hasWriteFunction)
279
+ contract.write = new Proxy({}, {
280
+ get(_, functionName) {
281
+ return (...parameters) => {
282
+ const { args, options } = getFunctionParameters(parameters);
283
+ return getAction(walletClient, writeContract, "writeContract")({
284
+ abi,
285
+ address,
286
+ functionName,
287
+ args,
288
+ ...options
289
+ });
290
+ };
291
+ }
292
+ });
293
+ }
294
+ if (hasPublicClient || hasWalletClient) {
295
+ if (hasWriteFunction)
296
+ contract.estimateGas = new Proxy({}, {
297
+ get(_, functionName) {
298
+ return (...parameters) => {
299
+ const { args, options } = getFunctionParameters(parameters);
300
+ const client2 = publicClient ?? walletClient;
301
+ return getAction(client2, estimateContractGas, "estimateContractGas")({
302
+ abi,
303
+ address,
304
+ functionName,
305
+ args,
306
+ ...options,
307
+ account: options.account ?? walletClient.account
308
+ });
309
+ };
310
+ }
311
+ });
312
+ }
313
+ contract.address = address;
314
+ contract.abi = abi;
315
+ return contract;
316
+ }
317
+ function getFunctionParameters(values) {
318
+ const hasArgs = values.length && Array.isArray(values[0]);
319
+ const args = hasArgs ? values[0] : [];
320
+ const options = (hasArgs ? values[1] : values[0]) ?? {};
321
+ return { args, options };
322
+ }
323
+ function getEventParameters(values, abiEvent) {
324
+ let hasArgs = false;
325
+ if (Array.isArray(values[0]))
326
+ hasArgs = true;
327
+ else if (values.length === 1) {
328
+ hasArgs = abiEvent.inputs.some((x) => x.indexed);
329
+ } else if (values.length === 2) {
330
+ hasArgs = true;
331
+ }
332
+ const args = hasArgs ? values[0] : void 0;
333
+ const options = (hasArgs ? values[1] : values[0]) ?? {};
334
+ return { args, options };
335
+ }
336
+
337
+ // node_modules/viem/_esm/utils/uid.js
338
+ var size = 256;
339
+ var index = size;
340
+ var buffer;
341
+ function uid(length = 11) {
342
+ if (!buffer || index + length > size * 2) {
343
+ buffer = "";
344
+ index = 0;
345
+ for (let i = 0; i < size; i++) {
346
+ buffer += (256 + Math.random() * 256 | 0).toString(16).substring(1);
347
+ }
348
+ }
349
+ return buffer.substring(index, index++ + length);
350
+ }
351
+
352
+ // node_modules/viem/_esm/clients/createClient.js
353
+ function createClient(parameters) {
354
+ const { batch, chain, ccipRead, dataSuffix, key = "base", name = "Base Client", tokens, type = "base" } = parameters;
355
+ const experimental_blockTag = parameters.experimental_blockTag ?? (typeof chain?.experimental_preconfirmationTime === "number" ? "pending" : void 0);
356
+ const blockTime = chain?.blockTime ?? 12e3;
357
+ const defaultPollingInterval = Math.min(Math.max(Math.floor(blockTime / 2), 500), 4e3);
358
+ const pollingInterval = parameters.pollingInterval ?? defaultPollingInterval;
359
+ const cacheTime = parameters.cacheTime ?? pollingInterval;
360
+ const account = parameters.account ? parseAccount(parameters.account) : void 0;
361
+ const { config, request, value } = parameters.transport({
362
+ account,
363
+ chain,
364
+ pollingInterval
365
+ });
366
+ const transport = { ...config, ...value };
367
+ const client = {
368
+ account,
369
+ batch,
370
+ cacheTime,
371
+ ccipRead,
372
+ chain,
373
+ dataSuffix,
374
+ key,
375
+ name,
376
+ pollingInterval,
377
+ request,
378
+ tokens,
379
+ transport,
380
+ type,
381
+ uid: uid(),
382
+ ...experimental_blockTag ? { experimental_blockTag } : {}
383
+ };
384
+ function extend(base) {
385
+ return (extendFn) => {
386
+ const extended = extendFn(base);
387
+ for (const key2 in client)
388
+ delete extended[key2];
389
+ const combined = { ...base, ...extended };
390
+ for (const key2 in extended) {
391
+ const a = base[key2];
392
+ const b = extended[key2];
393
+ if (isPlainObject(a) && isPlainObject(b))
394
+ combined[key2] = { ...a, ...b };
395
+ }
396
+ return Object.assign(combined, { extend: extend(combined) });
397
+ };
398
+ }
399
+ return Object.assign(client, { extend: extend(client) });
400
+ }
401
+ function isPlainObject(value) {
402
+ if (typeof value !== "object" || value === null)
403
+ return false;
404
+ const prototype = Object.getPrototypeOf(value);
405
+ return prototype === Object.prototype || prototype === null;
406
+ }
407
+ function bindActionDecorators(client, action) {
408
+ const wrapped = (parameters = {}) => action(client, parameters);
409
+ for (const key of [
410
+ "call",
411
+ "calls",
412
+ "callWithPeriod",
413
+ "estimateGas",
414
+ "prepare",
415
+ "prepareRecipient",
416
+ "simulate"
417
+ ])
418
+ if (Object.hasOwn(action, key)) {
419
+ const helper = action[key];
420
+ wrapped[key] = (args = {}) => {
421
+ if (helper.length === 1)
422
+ return helper(args);
423
+ return helper(client, args);
424
+ };
425
+ }
426
+ for (const key of ["extractEvent", "extractEvents"])
427
+ if (Object.hasOwn(action, key))
428
+ wrapped[key] = action[key];
429
+ return wrapped;
430
+ }
431
+ function rpcSchema() {
432
+ return null;
433
+ }
434
+
435
+ // node_modules/viem/_esm/utils/siwe/parseSiweMessage.js
436
+ function parseSiweMessage(message) {
437
+ const { scheme, statement, ...prefix } = message.match(prefixRegex)?.groups ?? {};
438
+ const { chainId, expirationTime, issuedAt, notBefore, requestId, ...suffix } = message.match(suffixRegex)?.groups ?? {};
439
+ const resources = message.split("Resources:")[1]?.split("\n- ").slice(1);
440
+ return {
441
+ ...prefix,
442
+ ...suffix,
443
+ ...chainId ? { chainId: Number(chainId) } : {},
444
+ ...expirationTime ? { expirationTime: new Date(expirationTime) } : {},
445
+ ...issuedAt ? { issuedAt: new Date(issuedAt) } : {},
446
+ ...notBefore ? { notBefore: new Date(notBefore) } : {},
447
+ ...requestId ? { requestId } : {},
448
+ ...resources ? { resources } : {},
449
+ ...scheme ? { scheme } : {},
450
+ ...statement ? { statement } : {}
451
+ };
452
+ }
453
+ var prefixRegex = /^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/;
454
+ var suffixRegex = /(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;
455
+
456
+ // node_modules/viem/_esm/utils/siwe/validateSiweMessage.js
457
+ function validateSiweMessage(parameters) {
458
+ const { address, domain, message, nonce, scheme, time = /* @__PURE__ */ new Date() } = parameters;
459
+ if (domain && message.domain !== domain)
460
+ return false;
461
+ if (nonce && message.nonce !== nonce)
462
+ return false;
463
+ if (scheme && message.scheme !== scheme)
464
+ return false;
465
+ if (message.expirationTime && time >= message.expirationTime)
466
+ return false;
467
+ if (message.notBefore && time < message.notBefore)
468
+ return false;
469
+ try {
470
+ if (!message.address)
471
+ return false;
472
+ if (!isAddress(message.address, { strict: false }))
473
+ return false;
474
+ if (address && !isAddressEqual(message.address, address))
475
+ return false;
476
+ } catch {
477
+ return false;
478
+ }
479
+ return true;
480
+ }
481
+
482
+ // node_modules/viem/_esm/actions/siwe/verifySiweMessage.js
483
+ async function verifySiweMessage(client, parameters) {
484
+ const { address, domain, message, nonce, scheme, signature, time = /* @__PURE__ */ new Date(), ...callRequest } = parameters;
485
+ const parsed = parseSiweMessage(message);
486
+ if (!parsed.address)
487
+ return false;
488
+ const isValid = validateSiweMessage({
489
+ address,
490
+ domain,
491
+ message: parsed,
492
+ nonce,
493
+ scheme,
494
+ time
495
+ });
496
+ if (!isValid)
497
+ return false;
498
+ const hash = hashMessage(message);
499
+ return verifyHash(client, {
500
+ address: parsed.address,
501
+ hash,
502
+ signature,
503
+ ...callRequest
504
+ });
505
+ }
506
+
507
+ // node_modules/viem/_esm/clients/decorators/public.js
508
+ function publicActions(client) {
509
+ return {
510
+ call: (args) => call(client, args),
511
+ createAccessList: (args) => createAccessList(client, args),
512
+ createBlockFilter: () => createBlockFilter(client),
513
+ createContractEventFilter: (args) => createContractEventFilter(client, args),
514
+ createEventFilter: (args) => createEventFilter(client, args),
515
+ createPendingTransactionFilter: () => createPendingTransactionFilter(client),
516
+ estimateContractGas: (args) => estimateContractGas(client, args),
517
+ estimateGas: (args) => estimateGas(client, args),
518
+ getBalance: (args) => getBalance(client, args),
519
+ getBlobBaseFee: () => getBlobBaseFee(client),
520
+ getBlock: (args) => getBlock(client, args),
521
+ getBlockNumber: (args) => getBlockNumber(client, args),
522
+ getBlockReceipts: (args) => getBlockReceipts(client, args),
523
+ getBlockTransactionCount: (args) => getBlockTransactionCount(client, args),
524
+ getBytecode: (args) => getCode(client, args),
525
+ getChainId: () => getChainId(client),
526
+ getCode: (args) => getCode(client, args),
527
+ getContractEvents: (args) => getContractEvents(client, args),
528
+ getDelegation: (args) => getDelegation(client, args),
529
+ getEip712Domain: (args) => getEip712Domain(client, args),
530
+ getEnsAddress: (args) => getEnsAddress(client, args),
531
+ getEnsAvatar: (args) => getEnsAvatar(client, args),
532
+ getEnsName: (args) => getEnsName(client, args),
533
+ getEnsResolver: (args) => getEnsResolver(client, args),
534
+ getEnsText: (args) => getEnsText(client, args),
535
+ getFeeHistory: (args) => getFeeHistory(client, args),
536
+ estimateFeesPerGas: (args) => estimateFeesPerGas(client, args),
537
+ getFilterChanges: (args) => getFilterChanges(client, args),
538
+ getFilterLogs: (args) => getFilterLogs(client, args),
539
+ getGasPrice: () => getGasPrice(client),
540
+ getLogs: (args) => getLogs(client, args),
541
+ getProof: (args) => getProof(client, args),
542
+ estimateMaxPriorityFeePerGas: (args) => estimateMaxPriorityFeePerGas(client, args),
543
+ fillTransaction: (args) => fillTransaction(client, args),
544
+ getRawTransaction: (args) => getRawTransaction(client, args),
545
+ getStorageAt: (args) => getStorageAt(client, args),
546
+ getTransaction: (args) => getTransaction(client, args),
547
+ getTransactionConfirmations: (args) => getTransactionConfirmations(client, args),
548
+ getTransactionCount: (args) => getTransactionCount(client, args),
549
+ getTransactionReceipt: (args) => getTransactionReceipt(client, args),
550
+ multicall: (args) => multicall(client, args),
551
+ prepareTransactionRequest: (args) => prepareTransactionRequest(client, args),
552
+ readContract: (args) => readContract(client, args),
553
+ sendRawTransaction: (args) => sendRawTransaction(client, args),
554
+ sendRawTransactionSync: (args) => sendRawTransactionSync(client, args),
555
+ simulate: (args) => simulateBlocks(client, args),
556
+ simulateBlocks: (args) => simulateBlocks(client, args),
557
+ simulateCalls: (args) => simulateCalls(client, args),
558
+ simulateContract: (args) => simulateContract(client, args),
559
+ verifyHash: (args) => verifyHash(client, args),
560
+ verifyMessage: (args) => verifyMessage(client, args),
561
+ verifySiweMessage: (args) => verifySiweMessage(client, args),
562
+ verifyTypedData: (args) => verifyTypedData(client, args),
563
+ uninstallFilter: (args) => uninstallFilter(client, args),
564
+ waitForTransactionReceipt: (args) => waitForTransactionReceipt(client, args),
565
+ watchBlocks: (args) => watchBlocks(client, args),
566
+ watchBlockNumber: (args) => watchBlockNumber(client, args),
567
+ watchContractEvent: (args) => watchContractEvent(client, args),
568
+ watchEvent: (args) => watchEvent(client, args),
569
+ watchPendingTransactions: (args) => watchPendingTransactions(client, args),
570
+ token: bindPublicToken(client)
571
+ };
572
+ }
573
+ function bindPublicToken(client) {
574
+ return {
575
+ getAllowance: bindActionDecorators(client, getAllowance),
576
+ getBalance: bindActionDecorators(client, getBalance2),
577
+ getMetadata: bindActionDecorators(client, getMetadata),
578
+ getTotalSupply: bindActionDecorators(client, getTotalSupply)
579
+ };
580
+ }
581
+
582
+ // node_modules/viem/_esm/clients/createPublicClient.js
583
+ function createPublicClient(parameters) {
584
+ const { key = "public", name = "Public Client" } = parameters;
585
+ const client = createClient({
586
+ ...parameters,
587
+ key,
588
+ name,
589
+ type: "publicClient"
590
+ });
591
+ return client.extend(publicActions);
592
+ }
593
+
594
+ // node_modules/viem/_esm/clients/decorators/test.js
595
+ function testActions({ mode }) {
596
+ return (client_) => {
597
+ const client = client_.extend(() => ({
598
+ mode
599
+ }));
600
+ return {
601
+ dropTransaction: (args) => dropTransaction(client, args),
602
+ dumpState: () => dumpState(client),
603
+ getAutomine: () => getAutomine(client),
604
+ getTxpoolContent: () => getTxpoolContent(client),
605
+ getTxpoolStatus: () => getTxpoolStatus(client),
606
+ impersonateAccount: (args) => impersonateAccount(client, args),
607
+ increaseTime: (args) => increaseTime(client, args),
608
+ inspectTxpool: () => inspectTxpool(client),
609
+ loadState: (args) => loadState(client, args),
610
+ mine: (args) => mine(client, args),
611
+ removeBlockTimestampInterval: () => removeBlockTimestampInterval(client),
612
+ reset: (args) => reset(client, args),
613
+ revert: (args) => revert(client, args),
614
+ sendUnsignedTransaction: (args) => sendUnsignedTransaction(client, args),
615
+ setAutomine: (args) => setAutomine(client, args),
616
+ setBalance: (args) => setBalance(client, args),
617
+ setBlockGasLimit: (args) => setBlockGasLimit(client, args),
618
+ setBlockTimestampInterval: (args) => setBlockTimestampInterval(client, args),
619
+ setCode: (args) => setCode(client, args),
620
+ setCoinbase: (args) => setCoinbase(client, args),
621
+ setIntervalMining: (args) => setIntervalMining(client, args),
622
+ setLoggingEnabled: (args) => setLoggingEnabled(client, args),
623
+ setMinGasPrice: (args) => setMinGasPrice(client, args),
624
+ setNextBlockBaseFeePerGas: (args) => setNextBlockBaseFeePerGas(client, args),
625
+ setNextBlockTimestamp: (args) => setNextBlockTimestamp(client, args),
626
+ setNonce: (args) => setNonce(client, args),
627
+ setRpcUrl: (args) => setRpcUrl(client, args),
628
+ setStorageAt: (args) => setStorageAt(client, args),
629
+ snapshot: () => snapshot(client),
630
+ stopImpersonatingAccount: (args) => stopImpersonatingAccount(client, args)
631
+ };
632
+ };
633
+ }
634
+
635
+ // node_modules/viem/_esm/clients/createTestClient.js
636
+ function createTestClient(parameters) {
637
+ const { key = "test", name = "Test Client", mode } = parameters;
638
+ const client = createClient({
639
+ ...parameters,
640
+ key,
641
+ name,
642
+ type: "testClient"
643
+ });
644
+ return client.extend((config) => ({
645
+ mode,
646
+ ...testActions({ mode })(config)
647
+ }));
648
+ }
649
+
650
+ // node_modules/viem/_esm/clients/decorators/wallet.js
651
+ function walletActions(client) {
652
+ return {
653
+ addChain: (args) => addChain(client, args),
654
+ deployContract: (args) => deployContract(client, args),
655
+ fillTransaction: (args) => fillTransaction(client, args),
656
+ getAddresses: () => getAddresses(client),
657
+ getCallsStatus: (args) => getCallsStatus(client, args),
658
+ getCapabilities: (args) => getCapabilities(client, args),
659
+ getChainId: () => getChainId(client),
660
+ getPermissions: () => getPermissions(client),
661
+ prepareAuthorization: (args) => prepareAuthorization(client, args),
662
+ prepareTransactionRequest: (args) => prepareTransactionRequest(client, args),
663
+ requestAddresses: () => requestAddresses(client),
664
+ requestPermissions: (args) => requestPermissions(client, args),
665
+ sendCalls: (args) => sendCalls(client, args),
666
+ sendCallsSync: (args) => sendCallsSync(client, args),
667
+ sendRawTransaction: (args) => sendRawTransaction(client, args),
668
+ sendRawTransactionSync: (args) => sendRawTransactionSync(client, args),
669
+ sendTransaction: (args) => sendTransaction(client, args),
670
+ sendTransactionSync: (args) => sendTransactionSync(client, args),
671
+ showCallsStatus: (args) => showCallsStatus(client, args),
672
+ signAuthorization: (args) => signAuthorization(client, args),
673
+ signMessage: (args) => signMessage(client, args),
674
+ signTransaction: (args) => signTransaction(client, args),
675
+ signTypedData: (args) => signTypedData(client, args),
676
+ switchChain: (args) => switchChain(client, args),
677
+ waitForCallsStatus: (args) => waitForCallsStatus(client, args),
678
+ watchAsset: (args) => watchAsset(client, args),
679
+ writeContract: (args) => writeContract(client, args),
680
+ writeContractSync: (args) => writeContractSync(client, args),
681
+ token: {
682
+ approve: bindActionDecorators(client, approve),
683
+ approveSync: bindActionDecorators(client, approveSync),
684
+ transfer: bindActionDecorators(client, transfer),
685
+ transferSync: bindActionDecorators(client, transferSync)
686
+ }
687
+ };
688
+ }
689
+
690
+ // node_modules/viem/_esm/clients/createWalletClient.js
691
+ function createWalletClient(parameters) {
692
+ const { key = "wallet", name = "Wallet Client", transport } = parameters;
693
+ const client = createClient({
694
+ ...parameters,
695
+ key,
696
+ name,
697
+ transport,
698
+ type: "walletClient"
699
+ });
700
+ return client.extend(walletActions);
701
+ }
702
+
703
+ // node_modules/viem/_esm/clients/transports/createTransport.js
704
+ function createTransport({ key, methods, name, request, retryCount = 3, retryDelay = 150, timeout, type }, value) {
705
+ const uid2 = uid();
706
+ return {
707
+ config: {
708
+ key,
709
+ methods,
710
+ name,
711
+ request,
712
+ retryCount,
713
+ retryDelay,
714
+ timeout,
715
+ type
716
+ },
717
+ request: buildRequest(request, { methods, retryCount, retryDelay, uid: uid2 }),
718
+ value
719
+ };
720
+ }
721
+
722
+ // node_modules/viem/_esm/clients/transports/custom.js
723
+ function custom(provider, config = {}) {
724
+ const { key = "custom", methods, name = "Custom Provider", retryDelay } = config;
725
+ return ({ retryCount: defaultRetryCount }) => createTransport({
726
+ key,
727
+ methods,
728
+ name,
729
+ request: provider.request.bind(provider),
730
+ retryCount: config.retryCount ?? defaultRetryCount,
731
+ retryDelay,
732
+ type: "custom"
733
+ });
734
+ }
735
+
736
+ // node_modules/viem/_esm/clients/transports/fallback.js
737
+ function fallback(transports_, config = {}) {
738
+ const { key = "fallback", name = "Fallback", rank = false, shouldThrow: shouldThrow_ = shouldThrow, retryCount, retryDelay } = config;
739
+ return (({ chain, pollingInterval = 4e3, timeout, ...rest }) => {
740
+ let transports = transports_;
741
+ let onResponse = () => {
742
+ };
743
+ const transport = createTransport({
744
+ key,
745
+ name,
746
+ async request({ method, params }) {
747
+ let includes;
748
+ const fetch = async (i = 0) => {
749
+ const transport2 = transports[i]({
750
+ ...rest,
751
+ chain,
752
+ retryCount: 0,
753
+ timeout
754
+ });
755
+ try {
756
+ const response = await transport2.request({
757
+ method,
758
+ params
759
+ });
760
+ onResponse({
761
+ method,
762
+ params,
763
+ response,
764
+ transport: transport2,
765
+ status: "success"
766
+ });
767
+ return response;
768
+ } catch (err) {
769
+ onResponse({
770
+ error: err,
771
+ method,
772
+ params,
773
+ transport: transport2,
774
+ status: "error"
775
+ });
776
+ if (shouldThrow_(err))
777
+ throw err;
778
+ if (i === transports.length - 1)
779
+ throw err;
780
+ includes ??= transports.slice(i + 1).some((transport3) => {
781
+ const { include, exclude } = transport3({ chain }).config.methods || {};
782
+ if (include)
783
+ return include.includes(method);
784
+ if (exclude)
785
+ return !exclude.includes(method);
786
+ return true;
787
+ });
788
+ if (!includes)
789
+ throw err;
790
+ return fetch(i + 1);
791
+ }
792
+ };
793
+ return fetch();
794
+ },
795
+ retryCount,
796
+ retryDelay,
797
+ type: "fallback"
798
+ }, {
799
+ onResponse: (fn) => onResponse = fn,
800
+ transports: transports.map((fn) => fn({ chain, retryCount: 0 }))
801
+ });
802
+ if (rank) {
803
+ const rankOptions = typeof rank === "object" ? rank : {};
804
+ rankTransports({
805
+ chain,
806
+ interval: rankOptions.interval ?? pollingInterval,
807
+ onTransports: (transports_2) => transports = transports_2,
808
+ ping: rankOptions.ping,
809
+ sampleCount: rankOptions.sampleCount,
810
+ timeout: rankOptions.timeout,
811
+ transports,
812
+ weights: rankOptions.weights
813
+ });
814
+ }
815
+ return transport;
816
+ });
817
+ }
818
+ function shouldThrow(error) {
819
+ if ("code" in error && typeof error.code === "number") {
820
+ if (error.code === TransactionRejectedRpcError.code || error.code === UserRejectedRequestError.code || error.code === WalletConnectSessionSettlementError.code || ExecutionRevertedError.nodeMessage.test(error.message) || error.code === 5e3)
821
+ return true;
822
+ }
823
+ return false;
824
+ }
825
+ function rankTransports({ chain, interval = 4e3, onTransports, ping, sampleCount = 10, timeout = 1e3, transports, weights = {} }) {
826
+ const { stability: stabilityWeight = 0.7, latency: latencyWeight = 0.3 } = weights;
827
+ const samples = [];
828
+ const rankTransports_ = async () => {
829
+ const sample = await Promise.all(transports.map(async (transport) => {
830
+ const transport_ = transport({ chain, retryCount: 0, timeout });
831
+ const start = Date.now();
832
+ let end;
833
+ let success;
834
+ try {
835
+ await (ping ? ping({ transport: transport_ }) : transport_.request({ method: "net_listening" }));
836
+ success = 1;
837
+ } catch {
838
+ success = 0;
839
+ } finally {
840
+ end = Date.now();
841
+ }
842
+ const latency = end - start;
843
+ return { latency, success };
844
+ }));
845
+ samples.push(sample);
846
+ if (samples.length > sampleCount)
847
+ samples.shift();
848
+ const maxLatency = Math.max(...samples.map((sample2) => Math.max(...sample2.map(({ latency }) => latency))));
849
+ const scores = transports.map((_, i) => {
850
+ const latencies = samples.map((sample2) => sample2[i].latency);
851
+ const meanLatency = latencies.reduce((acc, latency) => acc + latency, 0) / latencies.length;
852
+ const latencyScore = 1 - meanLatency / maxLatency;
853
+ const successes = samples.map((sample2) => sample2[i].success);
854
+ const stabilityScore = successes.reduce((acc, success) => acc + success, 0) / successes.length;
855
+ if (stabilityScore === 0)
856
+ return [0, i];
857
+ return [
858
+ latencyWeight * latencyScore + stabilityWeight * stabilityScore,
859
+ i
860
+ ];
861
+ }).sort((a, b) => b[0] - a[0]);
862
+ onTransports(scores.map(([, i]) => transports[i]));
863
+ await wait(interval);
864
+ rankTransports_();
865
+ };
866
+ rankTransports_();
867
+ }
868
+
869
+ // node_modules/viem/_esm/errors/transport.js
870
+ var UrlRequiredError = class extends BaseError {
871
+ constructor() {
872
+ super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.", {
873
+ docsPath: "/docs/clients/intro",
874
+ name: "UrlRequiredError"
875
+ });
876
+ }
877
+ };
878
+
879
+ // node_modules/viem/_esm/clients/transports/http.js
880
+ var signalId = 0;
881
+ var signalIds = /* @__PURE__ */ new WeakMap();
882
+ function getSignalId(signal) {
883
+ if (!signal)
884
+ return "default";
885
+ const id = signalIds.get(signal);
886
+ if (id !== void 0)
887
+ return id;
888
+ const nextId = signalId++;
889
+ signalIds.set(signal, nextId);
890
+ return nextId;
891
+ }
892
+ function http(url, config = {}) {
893
+ const { batch, fetchFn, fetchOptions, key = "http", maxResponseBodySize, methods, name = "HTTP JSON-RPC", onFetchRequest, onFetchResponse, retryDelay, raw } = config;
894
+ return ({ chain, retryCount: retryCount_, timeout: timeout_ }) => {
895
+ const { batchSize = 1e3, wait: wait2 = 0 } = typeof batch === "object" ? batch : {};
896
+ const retryCount = config.retryCount ?? retryCount_;
897
+ const timeout = timeout_ ?? config.timeout ?? 1e4;
898
+ const url_ = url || chain?.rpcUrls.default.http[0];
899
+ if (!url_)
900
+ throw new UrlRequiredError();
901
+ const rpcClient = getHttpRpcClient(url_, {
902
+ fetchFn,
903
+ fetchOptions,
904
+ maxResponseBodySize,
905
+ onRequest: onFetchRequest,
906
+ onResponse: onFetchResponse,
907
+ timeout
908
+ });
909
+ return createTransport({
910
+ key,
911
+ methods,
912
+ name,
913
+ async request({ method, params }, options) {
914
+ const body = { method, params };
915
+ const fetchOptions2 = options?.signal ? { signal: options.signal } : void 0;
916
+ const { schedule } = createBatchScheduler({
917
+ id: `${url_}.${getSignalId(options?.signal)}`,
918
+ wait: wait2,
919
+ shouldSplitBatch(requests) {
920
+ return requests.length > batchSize;
921
+ },
922
+ fn: (body2) => rpcClient.request({
923
+ body: body2,
924
+ fetchOptions: fetchOptions2
925
+ }),
926
+ sort: (a, b) => a.id - b.id
927
+ });
928
+ const fn = async (body2) => batch ? schedule(body2) : [
929
+ await rpcClient.request({
930
+ body: body2,
931
+ fetchOptions: fetchOptions2
932
+ })
933
+ ];
934
+ const [{ error, result }] = await fn(body);
935
+ if (raw)
936
+ return { error, result };
937
+ if (error)
938
+ throw new RpcRequestError({
939
+ body,
940
+ error,
941
+ url: url_
942
+ });
943
+ return result;
944
+ },
945
+ retryCount,
946
+ retryDelay,
947
+ timeout,
948
+ type: "http"
949
+ }, {
950
+ fetchOptions,
951
+ url: url_
952
+ });
953
+ };
954
+ }
955
+
956
+ // node_modules/viem/_esm/clients/transports/webSocket.js
957
+ function webSocket(url, config = {}) {
958
+ const { keepAlive, key = "webSocket", methods, name = "WebSocket JSON-RPC", reconnect, retryDelay } = config;
959
+ return ({ chain, retryCount: retryCount_, timeout: timeout_ }) => {
960
+ const retryCount = config.retryCount ?? retryCount_;
961
+ const timeout = timeout_ ?? config.timeout ?? 1e4;
962
+ const url_ = url || chain?.rpcUrls.default.webSocket?.[0];
963
+ const wsRpcClientOpts = { keepAlive, reconnect };
964
+ if (!url_)
965
+ throw new UrlRequiredError();
966
+ return createTransport({
967
+ key,
968
+ methods,
969
+ name,
970
+ async request({ method, params }) {
971
+ const body = { method, params };
972
+ const rpcClient = await getWebSocketRpcClient(url_, wsRpcClientOpts);
973
+ const { error, result } = await rpcClient.requestAsync({
974
+ body,
975
+ timeout
976
+ });
977
+ if (error)
978
+ throw new RpcRequestError({
979
+ body,
980
+ error,
981
+ url: url_
982
+ });
983
+ return result;
984
+ },
985
+ retryCount,
986
+ retryDelay,
987
+ timeout,
988
+ type: "webSocket"
989
+ }, {
990
+ getSocket() {
991
+ return getSocket(url_);
992
+ },
993
+ getRpcClient() {
994
+ return getWebSocketRpcClient(url_, wsRpcClientOpts);
995
+ },
996
+ async subscribe({ params, onData, onError }) {
997
+ const rpcClient = await getWebSocketRpcClient(url_, wsRpcClientOpts);
998
+ const { result: subscriptionId } = await new Promise((resolve, reject) => rpcClient.request({
999
+ body: {
1000
+ method: "eth_subscribe",
1001
+ params
1002
+ },
1003
+ onError(error) {
1004
+ reject(error);
1005
+ onError?.(error);
1006
+ return;
1007
+ },
1008
+ onResponse(response) {
1009
+ if (response.error) {
1010
+ reject(response.error);
1011
+ onError?.(response.error);
1012
+ return;
1013
+ }
1014
+ if (typeof response.id === "number") {
1015
+ resolve(response);
1016
+ return;
1017
+ }
1018
+ if (response.method !== "eth_subscription")
1019
+ return;
1020
+ onData(response.params);
1021
+ }
1022
+ }));
1023
+ return {
1024
+ subscriptionId,
1025
+ async unsubscribe() {
1026
+ return new Promise((resolve) => rpcClient.request({
1027
+ body: {
1028
+ method: "eth_unsubscribe",
1029
+ params: [subscriptionId]
1030
+ },
1031
+ onResponse: resolve
1032
+ }));
1033
+ }
1034
+ };
1035
+ }
1036
+ });
1037
+ };
1038
+ }
1039
+
1040
+ // node_modules/viem/_esm/constants/unit.js
1041
+ var etherUnits = {
1042
+ gwei: 9,
1043
+ wei: 18
1044
+ };
1045
+ var gweiUnits = {
1046
+ ether: -9,
1047
+ wei: 9
1048
+ };
1049
+ var weiUnits = {
1050
+ ether: -18,
1051
+ gwei: -9
1052
+ };
1053
+
1054
+ // node_modules/viem/_esm/errors/unit.js
1055
+ var InvalidDecimalNumberError = class extends BaseError {
1056
+ constructor({ value }) {
1057
+ super(`Number \`${value}\` is not a valid decimal number.`, {
1058
+ name: "InvalidDecimalNumberError"
1059
+ });
1060
+ }
1061
+ };
1062
+
1063
+ // node_modules/viem/_esm/types/eip1193.js
1064
+ var ProviderRpcError = class extends Error {
1065
+ constructor(code, message) {
1066
+ super(message);
1067
+ Object.defineProperty(this, "code", {
1068
+ enumerable: true,
1069
+ configurable: true,
1070
+ writable: true,
1071
+ value: void 0
1072
+ });
1073
+ Object.defineProperty(this, "details", {
1074
+ enumerable: true,
1075
+ configurable: true,
1076
+ writable: true,
1077
+ value: void 0
1078
+ });
1079
+ this.code = code;
1080
+ this.details = message;
1081
+ }
1082
+ };
1083
+
1084
+ // node_modules/viem/_esm/utils/abi/decodeDeployData.js
1085
+ var docsPath = "/docs/contract/decodeDeployData";
1086
+ function decodeDeployData(parameters) {
1087
+ const { abi, bytecode, data } = parameters;
1088
+ if (data === bytecode)
1089
+ return { bytecode };
1090
+ const description = abi.find((x) => "type" in x && x.type === "constructor");
1091
+ if (!description)
1092
+ throw new AbiConstructorNotFoundError({ docsPath });
1093
+ if (!("inputs" in description))
1094
+ throw new AbiConstructorParamsNotFoundError({ docsPath });
1095
+ if (!description.inputs || description.inputs.length === 0)
1096
+ throw new AbiConstructorParamsNotFoundError({ docsPath });
1097
+ const args = decodeAbiParameters(description.inputs, `0x${data.replace(bytecode, "")}`);
1098
+ return { args, bytecode };
1099
+ }
1100
+
1101
+ // node_modules/viem/_esm/utils/blob/fromBlobs.js
1102
+ function fromBlobs(parameters) {
1103
+ const to = parameters.to ?? (typeof parameters.blobs[0] === "string" ? "hex" : "bytes");
1104
+ const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes(x)) : parameters.blobs;
1105
+ const length = blobs.reduce((length2, blob) => length2 + blob.length, 0);
1106
+ const data = createCursor(new Uint8Array(length));
1107
+ let active = true;
1108
+ for (const [index2, blob] of blobs.entries()) {
1109
+ const cursor = createCursor(blob);
1110
+ const isLastBlob = index2 === blobs.length - 1;
1111
+ while (active && cursor.position < blob.length) {
1112
+ cursor.incrementPosition(1);
1113
+ let consume = 31;
1114
+ if (blob.length - cursor.position < 31)
1115
+ consume = blob.length - cursor.position;
1116
+ for (const _ in Array.from({ length: consume })) {
1117
+ const byte = cursor.readByte();
1118
+ const isTerminator = isLastBlob && byte === 128 && !cursor.inspectBytes(cursor.remaining).includes(128);
1119
+ if (isTerminator) {
1120
+ active = false;
1121
+ break;
1122
+ }
1123
+ data.pushByte(byte);
1124
+ }
1125
+ }
1126
+ }
1127
+ const trimmedData = data.bytes.slice(0, data.position);
1128
+ return to === "hex" ? bytesToHex(trimmedData) : trimmedData;
1129
+ }
1130
+
1131
+ // node_modules/viem/_esm/utils/blob/sidecarsToVersionedHashes.js
1132
+ function sidecarsToVersionedHashes(parameters) {
1133
+ const { sidecars, version } = parameters;
1134
+ const to = parameters.to ?? (typeof sidecars[0].blob === "string" ? "hex" : "bytes");
1135
+ const hashes = [];
1136
+ for (const { commitment } of sidecars) {
1137
+ hashes.push(commitmentToVersionedHash({
1138
+ commitment,
1139
+ to,
1140
+ version
1141
+ }));
1142
+ }
1143
+ return hashes;
1144
+ }
1145
+
1146
+ // node_modules/viem/_esm/utils/ens/toCoinType.js
1147
+ var SLIP44_MSB = 2147483648;
1148
+ function toCoinType(chainId) {
1149
+ if (chainId === 1)
1150
+ return 60n;
1151
+ if (chainId >= SLIP44_MSB || chainId < 0)
1152
+ throw new EnsInvalidChainIdError({ chainId });
1153
+ return BigInt((2147483648 | chainId) >>> 0);
1154
+ }
1155
+
1156
+ // node_modules/viem/_esm/utils/kzg/defineKzg.js
1157
+ function defineKzg({ blobToKzgCommitment, computeBlobKzgProof }) {
1158
+ return {
1159
+ blobToKzgCommitment,
1160
+ computeBlobKzgProof
1161
+ };
1162
+ }
1163
+
1164
+ // node_modules/viem/_esm/utils/kzg/setupKzg.js
1165
+ function setupKzg(parameters, path) {
1166
+ try {
1167
+ parameters.loadTrustedSetup(path);
1168
+ } catch (e) {
1169
+ const error = e;
1170
+ if (!error.message.includes("trusted setup is already loaded"))
1171
+ throw error;
1172
+ }
1173
+ return defineKzg(parameters);
1174
+ }
1175
+
1176
+ // node_modules/viem/_esm/utils/signature/compactSignatureToSignature.js
1177
+ function compactSignatureToSignature({ r, yParityAndS }) {
1178
+ const yParityAndS_bytes = hexToBytes(yParityAndS);
1179
+ const yParity = yParityAndS_bytes[0] & 128 ? 1 : 0;
1180
+ const s = yParityAndS_bytes;
1181
+ if (yParity === 1)
1182
+ s[0] &= 127;
1183
+ return { r, s: bytesToHex(s), yParity };
1184
+ }
1185
+
1186
+ // node_modules/viem/_esm/utils/signature/parseCompactSignature.js
1187
+ function parseCompactSignature(signatureHex) {
1188
+ const { r, s } = secp256k1.Signature.fromCompact(signatureHex.slice(2, 130));
1189
+ return {
1190
+ r: numberToHex(r, { size: 32 }),
1191
+ yParityAndS: numberToHex(s, { size: 32 })
1192
+ };
1193
+ }
1194
+
1195
+ // node_modules/viem/_esm/utils/signature/parseSignature.js
1196
+ function parseSignature(signatureHex) {
1197
+ const { r, s } = secp256k1.Signature.fromCompact(signatureHex.slice(2, 130));
1198
+ const yParityOrV = Number(`0x${signatureHex.slice(130)}`);
1199
+ const [v, yParity] = (() => {
1200
+ if (yParityOrV === 0 || yParityOrV === 1)
1201
+ return [void 0, yParityOrV];
1202
+ if (yParityOrV === 27)
1203
+ return [BigInt(yParityOrV), 0];
1204
+ if (yParityOrV === 28)
1205
+ return [BigInt(yParityOrV), 1];
1206
+ throw new Error("Invalid yParityOrV value");
1207
+ })();
1208
+ if (typeof v !== "undefined")
1209
+ return {
1210
+ r: numberToHex(r, { size: 32 }),
1211
+ s: numberToHex(s, { size: 32 }),
1212
+ v,
1213
+ yParity
1214
+ };
1215
+ return {
1216
+ r: numberToHex(r, { size: 32 }),
1217
+ s: numberToHex(s, { size: 32 }),
1218
+ yParity
1219
+ };
1220
+ }
1221
+
1222
+ // node_modules/viem/_esm/utils/signature/recoverTransactionAddress.js
1223
+ async function recoverTransactionAddress(parameters) {
1224
+ const { serializedTransaction, signature: signature_ } = parameters;
1225
+ const transaction = parseTransaction(serializedTransaction);
1226
+ const signature = signature_ ?? {
1227
+ r: transaction.r,
1228
+ s: transaction.s,
1229
+ v: transaction.v,
1230
+ yParity: transaction.yParity
1231
+ };
1232
+ const serialized = serializeTransaction({
1233
+ ...transaction,
1234
+ r: void 0,
1235
+ s: void 0,
1236
+ v: void 0,
1237
+ yParity: void 0,
1238
+ sidecars: void 0
1239
+ });
1240
+ return await recoverAddress({
1241
+ hash: keccak256(serialized),
1242
+ signature
1243
+ });
1244
+ }
1245
+
1246
+ // node_modules/viem/_esm/utils/signature/serializeCompactSignature.js
1247
+ function serializeCompactSignature({ r, yParityAndS }) {
1248
+ return `0x${new secp256k1.Signature(hexToBigInt(r), hexToBigInt(yParityAndS)).toCompactHex()}`;
1249
+ }
1250
+
1251
+ // node_modules/viem/_esm/utils/signature/signatureToCompactSignature.js
1252
+ function signatureToCompactSignature(signature) {
1253
+ const { r, s, v, yParity } = signature;
1254
+ const yParity_ = Number(yParity ?? v - 27n);
1255
+ let yParityAndS = s;
1256
+ if (yParity_ === 1) {
1257
+ const bytes = hexToBytes(s);
1258
+ bytes[0] |= 128;
1259
+ yParityAndS = bytesToHex(bytes);
1260
+ }
1261
+ return { r, yParityAndS };
1262
+ }
1263
+
1264
+ export {
1265
+ getContract,
1266
+ createClient,
1267
+ rpcSchema,
1268
+ publicActions,
1269
+ createPublicClient,
1270
+ testActions,
1271
+ createTestClient,
1272
+ walletActions,
1273
+ createWalletClient,
1274
+ createTransport,
1275
+ custom,
1276
+ fallback,
1277
+ shouldThrow,
1278
+ UrlRequiredError,
1279
+ http,
1280
+ webSocket,
1281
+ etherUnits,
1282
+ gweiUnits,
1283
+ weiUnits,
1284
+ InvalidDecimalNumberError,
1285
+ ProviderRpcError,
1286
+ decodeDeployData,
1287
+ fromBlobs,
1288
+ sidecarsToVersionedHashes,
1289
+ toCoinType,
1290
+ defineKzg,
1291
+ setupKzg,
1292
+ compactSignatureToSignature,
1293
+ parseCompactSignature,
1294
+ parseSignature,
1295
+ recoverTransactionAddress,
1296
+ serializeCompactSignature,
1297
+ signatureToCompactSignature
1298
+ };