x402-proxy 0.10.7 → 0.10.9

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 (90) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/README.md +7 -1
  3. package/dist/Credential-COZQnr1-.js +2055 -0
  4. package/dist/Mcp-CrCEqLqO.js +10 -0
  5. package/dist/Sse-ChldYgU7.js +9742 -0
  6. package/dist/Sse-kCB38G56.js +16482 -0
  7. package/dist/accounts-DsuvWwph.js +232 -0
  8. package/dist/accounts-DzvAlQRn.js +5 -0
  9. package/dist/accounts-IG-Cmrwy.js +229 -0
  10. package/dist/api-CUzmQvTQ.js +2802 -0
  11. package/dist/auth-DTzQmnZ_.js +1196 -0
  12. package/dist/bin/cli.js +585 -242
  13. package/dist/ccip-Bx-zoUCJ.js +240 -0
  14. package/dist/ccip-C2k1DD1T.js +153 -0
  15. package/dist/ccip-C6CQOJYv.js +152 -0
  16. package/dist/ccip-RZzsZ5Mv.js +156 -0
  17. package/dist/chain-CafcHffR.js +1997 -0
  18. package/dist/chain-DwfP5RGZ.js +1968 -0
  19. package/dist/chunk-DBEY4PJZ.js +16 -0
  20. package/dist/chunk-DjEMn6fM.js +36 -0
  21. package/dist/client-Blw2V7LF.js +657 -0
  22. package/dist/client-C37gWJOZ.js +102 -0
  23. package/dist/client-CEc4NYAA.js +6388 -0
  24. package/dist/client-CVDTUY0l.js +5152 -0
  25. package/dist/config-BUQsit4s.js +3 -0
  26. package/dist/config-DR1Fs_wL.js +6600 -0
  27. package/dist/{config-D9wIR3xc.js → config-rvKA3SYT.js} +10 -5
  28. package/dist/decodeFunctionData-DuFcwhC_.js +4510 -0
  29. package/dist/decodeFunctionData-JPOUdvil.js +4394 -0
  30. package/dist/derive-DNUl8LU9.js +9109 -0
  31. package/dist/dist-C2YO6HSQ.js +6581 -0
  32. package/dist/dist-DM5_F3r5.js +4 -0
  33. package/dist/dist-DxJCYyL5.js +1388 -0
  34. package/dist/hashTypedData-BHmP9dBd.js +859 -0
  35. package/dist/hashTypedData-CtEdfx4y.js +846 -0
  36. package/dist/helpers-CuUSw-tH.js +7125 -0
  37. package/dist/hmac-59IlS_by.js +648 -0
  38. package/dist/http-BAtucMbS.js +2060 -0
  39. package/dist/index.d.ts +1903 -9
  40. package/dist/index.js +18006 -50
  41. package/dist/index.node-CxkL0OFh.js +3592 -0
  42. package/dist/index.node-DvmeuZBj.js +3 -0
  43. package/dist/isAddressEqual-BLrd1Hg1.js +9 -0
  44. package/dist/isAddressEqual-DsAqfQOD.js +10 -0
  45. package/dist/localBatchGatewayRequest-C-RPJyDO.js +6260 -0
  46. package/dist/localBatchGatewayRequest-DOdQ9bR7.js +93 -0
  47. package/dist/localBatchGatewayRequest-DQkbZaSy.js +6261 -0
  48. package/dist/parseUnits-CApwcKSD.js +49 -0
  49. package/dist/parseUnits-cMO2udMe.js +48 -0
  50. package/dist/schemas-BxMFYNbH.js +1270 -0
  51. package/dist/secp256k1-BZpiyffY.js +2525 -0
  52. package/dist/secp256k1-BjenrLl5.js +1877 -0
  53. package/dist/secp256k1-CLPUX17u.js +3 -0
  54. package/dist/sendRawTransactionSync-DvSkhZtW.js +3612 -0
  55. package/dist/server-CSq0IuUq.js +565 -0
  56. package/dist/setup-BY4J49Lv.js +1110 -0
  57. package/dist/setup-wMOAgrsN.js +3 -0
  58. package/dist/sha256-FAs0qeni.js +17 -0
  59. package/dist/sha3-CYkWM8Xa.js +195 -0
  60. package/dist/sha3-DbMJRJ3C.js +194 -0
  61. package/dist/sse-B4LLqBQm.js +408 -0
  62. package/dist/status-Bu23RjW6.js +3 -0
  63. package/dist/{status-DihAcUSC.js → status-X21VnGUO.js} +16 -15
  64. package/dist/stdio-BADqxZdZ.js +85 -0
  65. package/dist/streamableHttp-BHkJypcI.js +358 -0
  66. package/dist/tempo-3nttrxgQ.js +17 -0
  67. package/dist/tempo-DER0P-ul.js +18 -0
  68. package/dist/types-BEKUz-Mf.js +1240 -0
  69. package/dist/types-DatK5vR5.js +3 -0
  70. package/dist/utils-BYjkXZDF.js +444 -0
  71. package/dist/utils-SeGHMW9O.js +445 -0
  72. package/dist/wallet-DKVlrR1S.js +3 -0
  73. package/dist/wallet-DSyht15_.js +17759 -0
  74. package/package.json +18 -71
  75. package/dist/config-B_upkJeK.js +0 -66
  76. package/dist/config-Be35NM5s.js +0 -3
  77. package/dist/config-J1m-CWXT.js +0 -27
  78. package/dist/derive-CL6e8K0Z.js +0 -81
  79. package/dist/openclaw/plugin.d.ts +0 -15
  80. package/dist/openclaw/plugin.js +0 -2067
  81. package/dist/openclaw.plugin.json +0 -93
  82. package/dist/setup-CNyMLnM-.js +0 -197
  83. package/dist/setup-DTIxPe58.js +0 -3
  84. package/dist/status-DZlJ4pS7.js +0 -3
  85. package/dist/wallet-B0S-rma9.js +0 -544
  86. package/dist/wallet-DBrVZJqe.js +0 -3
  87. package/openclaw.plugin.json +0 -93
  88. package/skills/SKILL.md +0 -183
  89. package/skills/references/library.md +0 -85
  90. package/skills/references/openclaw-plugin.md +0 -145
@@ -0,0 +1,846 @@
1
+ #!/usr/bin/env node
2
+ import { $ as toBytes, B as slice, C as InvalidStorageKeySizeError, Dt as BytesSizeMismatchError, G as isAddress, I as encodeAbiParameters, K as checksumAddress, M as stringify, Mt as BaseError, N as createCursor, Nt as size, Pt as isHex, R as bytesRegex, U as concat, W as concatHex, X as keccak256, Y as InvalidAddressError, Z as hexToBytes, a as InvalidChainIdError, b as InvalidSerializableTransactionError, c as FeeCapTooHighError, ct as trim, et as bytesToHex, g as TipAboveFeeCapError, o as maxUint256, rt as toHex, st as hexToNumber, tt as numberToHex, y as InvalidLegacyVError, z as integerRegex } from "./chain-CafcHffR.js";
3
+ import { t as sha256$1 } from "./sha256-FAs0qeni.js";
4
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/accounts/utils/publicKeyToAddress.js
5
+ /**
6
+ * @description Converts an ECDSA public key to an address.
7
+ *
8
+ * @param publicKey The public key to convert.
9
+ *
10
+ * @returns The address.
11
+ */
12
+ function publicKeyToAddress(publicKey) {
13
+ return checksumAddress(`0x${keccak256(`0x${publicKey.substring(4)}`).substring(26)}`);
14
+ }
15
+ //#endregion
16
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/encoding/toRlp.js
17
+ function toRlp(bytes, to = "hex") {
18
+ const encodable = getEncodable(bytes);
19
+ const cursor = createCursor(new Uint8Array(encodable.length));
20
+ encodable.encode(cursor);
21
+ if (to === "hex") return bytesToHex(cursor.bytes);
22
+ return cursor.bytes;
23
+ }
24
+ function getEncodable(bytes) {
25
+ if (Array.isArray(bytes)) return getEncodableList(bytes.map((x) => getEncodable(x)));
26
+ return getEncodableBytes(bytes);
27
+ }
28
+ function getEncodableList(list) {
29
+ const bodyLength = list.reduce((acc, x) => acc + x.length, 0);
30
+ const sizeOfBodyLength = getSizeOfLength(bodyLength);
31
+ return {
32
+ length: (() => {
33
+ if (bodyLength <= 55) return 1 + bodyLength;
34
+ return 1 + sizeOfBodyLength + bodyLength;
35
+ })(),
36
+ encode(cursor) {
37
+ if (bodyLength <= 55) cursor.pushByte(192 + bodyLength);
38
+ else {
39
+ cursor.pushByte(247 + sizeOfBodyLength);
40
+ if (sizeOfBodyLength === 1) cursor.pushUint8(bodyLength);
41
+ else if (sizeOfBodyLength === 2) cursor.pushUint16(bodyLength);
42
+ else if (sizeOfBodyLength === 3) cursor.pushUint24(bodyLength);
43
+ else cursor.pushUint32(bodyLength);
44
+ }
45
+ for (const { encode } of list) encode(cursor);
46
+ }
47
+ };
48
+ }
49
+ function getEncodableBytes(bytesOrHex) {
50
+ const bytes = typeof bytesOrHex === "string" ? hexToBytes(bytesOrHex) : bytesOrHex;
51
+ const sizeOfBytesLength = getSizeOfLength(bytes.length);
52
+ return {
53
+ length: (() => {
54
+ if (bytes.length === 1 && bytes[0] < 128) return 1;
55
+ if (bytes.length <= 55) return 1 + bytes.length;
56
+ return 1 + sizeOfBytesLength + bytes.length;
57
+ })(),
58
+ encode(cursor) {
59
+ if (bytes.length === 1 && bytes[0] < 128) cursor.pushBytes(bytes);
60
+ else if (bytes.length <= 55) {
61
+ cursor.pushByte(128 + bytes.length);
62
+ cursor.pushBytes(bytes);
63
+ } else {
64
+ cursor.pushByte(183 + sizeOfBytesLength);
65
+ if (sizeOfBytesLength === 1) cursor.pushUint8(bytes.length);
66
+ else if (sizeOfBytesLength === 2) cursor.pushUint16(bytes.length);
67
+ else if (sizeOfBytesLength === 3) cursor.pushUint24(bytes.length);
68
+ else cursor.pushUint32(bytes.length);
69
+ cursor.pushBytes(bytes);
70
+ }
71
+ }
72
+ };
73
+ }
74
+ function getSizeOfLength(length) {
75
+ if (length < 2 ** 8) return 1;
76
+ if (length < 2 ** 16) return 2;
77
+ if (length < 2 ** 24) return 3;
78
+ if (length < 2 ** 32) return 4;
79
+ throw new BaseError("Length is too large.");
80
+ }
81
+ //#endregion
82
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/authorization/hashAuthorization.js
83
+ /**
84
+ * Computes an Authorization hash in [EIP-7702 format](https://eips.ethereum.org/EIPS/eip-7702): `keccak256('0x05' || rlp([chain_id, address, nonce]))`.
85
+ */
86
+ function hashAuthorization(parameters) {
87
+ const { chainId, nonce, to } = parameters;
88
+ const address = parameters.contractAddress ?? parameters.address;
89
+ const hash = keccak256(concatHex(["0x05", toRlp([
90
+ chainId ? numberToHex(chainId) : "0x",
91
+ address,
92
+ nonce ? numberToHex(nonce) : "0x"
93
+ ])]));
94
+ if (to === "bytes") return hexToBytes(hash);
95
+ return hash;
96
+ }
97
+ //#endregion
98
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/blob/blobsToCommitments.js
99
+ /**
100
+ * Compute commitments from a list of blobs.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * import { blobsToCommitments, toBlobs } from 'viem'
105
+ * import { kzg } from './kzg'
106
+ *
107
+ * const blobs = toBlobs({ data: '0x1234' })
108
+ * const commitments = blobsToCommitments({ blobs, kzg })
109
+ * ```
110
+ */
111
+ function blobsToCommitments(parameters) {
112
+ const { kzg } = parameters;
113
+ const to = parameters.to ?? (typeof parameters.blobs[0] === "string" ? "hex" : "bytes");
114
+ const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes(x)) : parameters.blobs;
115
+ const commitments = [];
116
+ for (const blob of blobs) commitments.push(Uint8Array.from(kzg.blobToKzgCommitment(blob)));
117
+ return to === "bytes" ? commitments : commitments.map((x) => bytesToHex(x));
118
+ }
119
+ //#endregion
120
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/blob/blobsToProofs.js
121
+ /**
122
+ * Compute the proofs for a list of blobs and their commitments.
123
+ *
124
+ * @example
125
+ * ```ts
126
+ * import {
127
+ * blobsToCommitments,
128
+ * toBlobs
129
+ * } from 'viem'
130
+ * import { kzg } from './kzg'
131
+ *
132
+ * const blobs = toBlobs({ data: '0x1234' })
133
+ * const commitments = blobsToCommitments({ blobs, kzg })
134
+ * const proofs = blobsToProofs({ blobs, commitments, kzg })
135
+ * ```
136
+ */
137
+ function blobsToProofs(parameters) {
138
+ const { kzg } = parameters;
139
+ const to = parameters.to ?? (typeof parameters.blobs[0] === "string" ? "hex" : "bytes");
140
+ const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes(x)) : parameters.blobs;
141
+ const commitments = typeof parameters.commitments[0] === "string" ? parameters.commitments.map((x) => hexToBytes(x)) : parameters.commitments;
142
+ const proofs = [];
143
+ for (let i = 0; i < blobs.length; i++) {
144
+ const blob = blobs[i];
145
+ const commitment = commitments[i];
146
+ proofs.push(Uint8Array.from(kzg.computeBlobKzgProof(blob, commitment)));
147
+ }
148
+ return to === "bytes" ? proofs : proofs.map((x) => bytesToHex(x));
149
+ }
150
+ //#endregion
151
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/hash/sha256.js
152
+ function sha256(value, to_) {
153
+ const to = to_ || "hex";
154
+ const bytes = sha256$1(isHex(value, { strict: false }) ? toBytes(value) : value);
155
+ if (to === "bytes") return bytes;
156
+ return toHex(bytes);
157
+ }
158
+ //#endregion
159
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/blob/commitmentToVersionedHash.js
160
+ /**
161
+ * Transform a commitment to it's versioned hash.
162
+ *
163
+ * @example
164
+ * ```ts
165
+ * import {
166
+ * blobsToCommitments,
167
+ * commitmentToVersionedHash,
168
+ * toBlobs
169
+ * } from 'viem'
170
+ * import { kzg } from './kzg'
171
+ *
172
+ * const blobs = toBlobs({ data: '0x1234' })
173
+ * const [commitment] = blobsToCommitments({ blobs, kzg })
174
+ * const versionedHash = commitmentToVersionedHash({ commitment })
175
+ * ```
176
+ */
177
+ function commitmentToVersionedHash(parameters) {
178
+ const { commitment, version = 1 } = parameters;
179
+ const to = parameters.to ?? (typeof commitment === "string" ? "hex" : "bytes");
180
+ const versionedHash = sha256(commitment, "bytes");
181
+ versionedHash.set([version], 0);
182
+ return to === "bytes" ? versionedHash : bytesToHex(versionedHash);
183
+ }
184
+ //#endregion
185
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/blob/commitmentsToVersionedHashes.js
186
+ /**
187
+ * Transform a list of commitments to their versioned hashes.
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * import {
192
+ * blobsToCommitments,
193
+ * commitmentsToVersionedHashes,
194
+ * toBlobs
195
+ * } from 'viem'
196
+ * import { kzg } from './kzg'
197
+ *
198
+ * const blobs = toBlobs({ data: '0x1234' })
199
+ * const commitments = blobsToCommitments({ blobs, kzg })
200
+ * const versionedHashes = commitmentsToVersionedHashes({ commitments })
201
+ * ```
202
+ */
203
+ function commitmentsToVersionedHashes(parameters) {
204
+ const { commitments, version } = parameters;
205
+ const to = parameters.to ?? (typeof commitments[0] === "string" ? "hex" : "bytes");
206
+ const hashes = [];
207
+ for (const commitment of commitments) hashes.push(commitmentToVersionedHash({
208
+ commitment,
209
+ to,
210
+ version
211
+ }));
212
+ return hashes;
213
+ }
214
+ //#endregion
215
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/constants/blob.js
216
+ /** Blob limit per transaction. */
217
+ const blobsPerTransaction = 6;
218
+ /** The number of field elements in a blob. */
219
+ const fieldElementsPerBlob = 4096;
220
+ /** The number of bytes in a blob. */
221
+ const bytesPerBlob = 32 * fieldElementsPerBlob;
222
+ /** Blob bytes limit per transaction. */
223
+ const maxBytesPerTransaction = bytesPerBlob * blobsPerTransaction - 1 - 1 * fieldElementsPerBlob * blobsPerTransaction;
224
+ //#endregion
225
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/blob.js
226
+ var BlobSizeTooLargeError = class extends BaseError {
227
+ constructor({ maxSize, size }) {
228
+ super("Blob size is too large.", {
229
+ metaMessages: [`Max: ${maxSize} bytes`, `Given: ${size} bytes`],
230
+ name: "BlobSizeTooLargeError"
231
+ });
232
+ }
233
+ };
234
+ var EmptyBlobError = class extends BaseError {
235
+ constructor() {
236
+ super("Blob data must not be empty.", { name: "EmptyBlobError" });
237
+ }
238
+ };
239
+ var InvalidVersionedHashSizeError = class extends BaseError {
240
+ constructor({ hash, size }) {
241
+ super(`Versioned hash "${hash}" size is invalid.`, {
242
+ metaMessages: ["Expected: 32", `Received: ${size}`],
243
+ name: "InvalidVersionedHashSizeError"
244
+ });
245
+ }
246
+ };
247
+ var InvalidVersionedHashVersionError = class extends BaseError {
248
+ constructor({ hash, version }) {
249
+ super(`Versioned hash "${hash}" version is invalid.`, {
250
+ metaMessages: [`Expected: 1`, `Received: ${version}`],
251
+ name: "InvalidVersionedHashVersionError"
252
+ });
253
+ }
254
+ };
255
+ //#endregion
256
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/blob/toBlobs.js
257
+ /**
258
+ * Transforms arbitrary data to blobs.
259
+ *
260
+ * @example
261
+ * ```ts
262
+ * import { toBlobs, stringToHex } from 'viem'
263
+ *
264
+ * const blobs = toBlobs({ data: stringToHex('hello world') })
265
+ * ```
266
+ */
267
+ function toBlobs(parameters) {
268
+ const to = parameters.to ?? (typeof parameters.data === "string" ? "hex" : "bytes");
269
+ const data = typeof parameters.data === "string" ? hexToBytes(parameters.data) : parameters.data;
270
+ const size_ = size(data);
271
+ if (!size_) throw new EmptyBlobError();
272
+ if (size_ > 761855) throw new BlobSizeTooLargeError({
273
+ maxSize: maxBytesPerTransaction,
274
+ size: size_
275
+ });
276
+ const blobs = [];
277
+ let active = true;
278
+ let position = 0;
279
+ while (active) {
280
+ const blob = createCursor(new Uint8Array(bytesPerBlob));
281
+ let size = 0;
282
+ while (size < fieldElementsPerBlob) {
283
+ const bytes = data.slice(position, position + 31);
284
+ blob.pushByte(0);
285
+ blob.pushBytes(bytes);
286
+ if (bytes.length < 31) {
287
+ blob.pushByte(128);
288
+ active = false;
289
+ break;
290
+ }
291
+ size++;
292
+ position += 31;
293
+ }
294
+ blobs.push(blob);
295
+ }
296
+ return to === "bytes" ? blobs.map((x) => x.bytes) : blobs.map((x) => bytesToHex(x.bytes));
297
+ }
298
+ //#endregion
299
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/blob/toBlobSidecars.js
300
+ /**
301
+ * Transforms arbitrary data (or blobs, commitments, & proofs) into a sidecar array.
302
+ *
303
+ * @example
304
+ * ```ts
305
+ * import { toBlobSidecars, stringToHex } from 'viem'
306
+ *
307
+ * const sidecars = toBlobSidecars({ data: stringToHex('hello world') })
308
+ * ```
309
+ *
310
+ * @example
311
+ * ```ts
312
+ * import {
313
+ * blobsToCommitments,
314
+ * toBlobs,
315
+ * blobsToProofs,
316
+ * toBlobSidecars,
317
+ * stringToHex
318
+ * } from 'viem'
319
+ *
320
+ * const blobs = toBlobs({ data: stringToHex('hello world') })
321
+ * const commitments = blobsToCommitments({ blobs, kzg })
322
+ * const proofs = blobsToProofs({ blobs, commitments, kzg })
323
+ *
324
+ * const sidecars = toBlobSidecars({ blobs, commitments, proofs })
325
+ * ```
326
+ */
327
+ function toBlobSidecars(parameters) {
328
+ const { data, kzg, to } = parameters;
329
+ const blobs = parameters.blobs ?? toBlobs({
330
+ data,
331
+ to
332
+ });
333
+ const commitments = parameters.commitments ?? blobsToCommitments({
334
+ blobs,
335
+ kzg,
336
+ to
337
+ });
338
+ const proofs = parameters.proofs ?? blobsToProofs({
339
+ blobs,
340
+ commitments,
341
+ kzg,
342
+ to
343
+ });
344
+ const sidecars = [];
345
+ for (let i = 0; i < blobs.length; i++) sidecars.push({
346
+ blob: blobs[i],
347
+ commitment: commitments[i],
348
+ proof: proofs[i]
349
+ });
350
+ return sidecars;
351
+ }
352
+ //#endregion
353
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/transaction/getTransactionType.js
354
+ function getTransactionType(transaction) {
355
+ if (transaction.type) return transaction.type;
356
+ if (typeof transaction.authorizationList !== "undefined") return "eip7702";
357
+ if (typeof transaction.blobs !== "undefined" || typeof transaction.blobVersionedHashes !== "undefined" || typeof transaction.maxFeePerBlobGas !== "undefined" || typeof transaction.sidecars !== "undefined") return "eip4844";
358
+ if (typeof transaction.maxFeePerGas !== "undefined" || typeof transaction.maxPriorityFeePerGas !== "undefined") return "eip1559";
359
+ if (typeof transaction.gasPrice !== "undefined") {
360
+ if (typeof transaction.accessList !== "undefined") return "eip2930";
361
+ return "legacy";
362
+ }
363
+ throw new InvalidSerializableTransactionError({ transaction });
364
+ }
365
+ //#endregion
366
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/transaction/assertTransaction.js
367
+ function assertTransactionEIP7702(transaction) {
368
+ const { authorizationList } = transaction;
369
+ if (authorizationList) for (const authorization of authorizationList) {
370
+ const { chainId } = authorization;
371
+ const address = authorization.address;
372
+ if (!isAddress(address)) throw new InvalidAddressError({ address });
373
+ if (chainId < 0) throw new InvalidChainIdError({ chainId });
374
+ }
375
+ assertTransactionEIP1559(transaction);
376
+ }
377
+ function assertTransactionEIP4844(transaction) {
378
+ const { blobVersionedHashes } = transaction;
379
+ if (blobVersionedHashes) {
380
+ if (blobVersionedHashes.length === 0) throw new EmptyBlobError();
381
+ for (const hash of blobVersionedHashes) {
382
+ const size_ = size(hash);
383
+ const version = hexToNumber(slice(hash, 0, 1));
384
+ if (size_ !== 32) throw new InvalidVersionedHashSizeError({
385
+ hash,
386
+ size: size_
387
+ });
388
+ if (version !== 1) throw new InvalidVersionedHashVersionError({
389
+ hash,
390
+ version
391
+ });
392
+ }
393
+ }
394
+ assertTransactionEIP1559(transaction);
395
+ }
396
+ function assertTransactionEIP1559(transaction) {
397
+ const { chainId, maxPriorityFeePerGas, maxFeePerGas, to } = transaction;
398
+ if (chainId <= 0) throw new InvalidChainIdError({ chainId });
399
+ if (to && !isAddress(to)) throw new InvalidAddressError({ address: to });
400
+ if (maxFeePerGas && maxFeePerGas > maxUint256) throw new FeeCapTooHighError({ maxFeePerGas });
401
+ if (maxPriorityFeePerGas && maxFeePerGas && maxPriorityFeePerGas > maxFeePerGas) throw new TipAboveFeeCapError({
402
+ maxFeePerGas,
403
+ maxPriorityFeePerGas
404
+ });
405
+ }
406
+ function assertTransactionEIP2930(transaction) {
407
+ const { chainId, maxPriorityFeePerGas, gasPrice, maxFeePerGas, to } = transaction;
408
+ if (chainId <= 0) throw new InvalidChainIdError({ chainId });
409
+ if (to && !isAddress(to)) throw new InvalidAddressError({ address: to });
410
+ if (maxPriorityFeePerGas || maxFeePerGas) throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");
411
+ if (gasPrice && gasPrice > maxUint256) throw new FeeCapTooHighError({ maxFeePerGas: gasPrice });
412
+ }
413
+ function assertTransactionLegacy(transaction) {
414
+ const { chainId, maxPriorityFeePerGas, gasPrice, maxFeePerGas, to } = transaction;
415
+ if (to && !isAddress(to)) throw new InvalidAddressError({ address: to });
416
+ if (typeof chainId !== "undefined" && chainId <= 0) throw new InvalidChainIdError({ chainId });
417
+ if (maxPriorityFeePerGas || maxFeePerGas) throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");
418
+ if (gasPrice && gasPrice > maxUint256) throw new FeeCapTooHighError({ maxFeePerGas: gasPrice });
419
+ }
420
+ //#endregion
421
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/transaction/serializeAccessList.js
422
+ function serializeAccessList(accessList) {
423
+ if (!accessList || accessList.length === 0) return [];
424
+ const serializedAccessList = [];
425
+ for (let i = 0; i < accessList.length; i++) {
426
+ const { address, storageKeys } = accessList[i];
427
+ for (let j = 0; j < storageKeys.length; j++) if (storageKeys[j].length - 2 !== 64) throw new InvalidStorageKeySizeError({ storageKey: storageKeys[j] });
428
+ if (!isAddress(address, { strict: false })) throw new InvalidAddressError({ address });
429
+ serializedAccessList.push([address, storageKeys]);
430
+ }
431
+ return serializedAccessList;
432
+ }
433
+ //#endregion
434
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/transaction/serializeTransaction.js
435
+ function serializeTransaction(transaction, signature) {
436
+ const type = getTransactionType(transaction);
437
+ if (type === "eip1559") return serializeTransactionEIP1559(transaction, signature);
438
+ if (type === "eip2930") return serializeTransactionEIP2930(transaction, signature);
439
+ if (type === "eip4844") return serializeTransactionEIP4844(transaction, signature);
440
+ if (type === "eip7702") return serializeTransactionEIP7702(transaction, signature);
441
+ return serializeTransactionLegacy(transaction, signature);
442
+ }
443
+ function serializeTransactionEIP7702(transaction, signature) {
444
+ const { authorizationList, chainId, gas, nonce, to, value, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
445
+ assertTransactionEIP7702(transaction);
446
+ const serializedAccessList = serializeAccessList(accessList);
447
+ const serializedAuthorizationList = serializeAuthorizationList(authorizationList);
448
+ return concatHex(["0x04", toRlp([
449
+ numberToHex(chainId),
450
+ nonce ? numberToHex(nonce) : "0x",
451
+ maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : "0x",
452
+ maxFeePerGas ? numberToHex(maxFeePerGas) : "0x",
453
+ gas ? numberToHex(gas) : "0x",
454
+ to ?? "0x",
455
+ value ? numberToHex(value) : "0x",
456
+ data ?? "0x",
457
+ serializedAccessList,
458
+ serializedAuthorizationList,
459
+ ...toYParitySignatureArray(transaction, signature)
460
+ ])]);
461
+ }
462
+ function serializeTransactionEIP4844(transaction, signature) {
463
+ const { chainId, gas, nonce, to, value, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
464
+ assertTransactionEIP4844(transaction);
465
+ let blobVersionedHashes = transaction.blobVersionedHashes;
466
+ let sidecars = transaction.sidecars;
467
+ if (transaction.blobs && (typeof blobVersionedHashes === "undefined" || typeof sidecars === "undefined")) {
468
+ const blobs = typeof transaction.blobs[0] === "string" ? transaction.blobs : transaction.blobs.map((x) => bytesToHex(x));
469
+ const kzg = transaction.kzg;
470
+ const commitments = blobsToCommitments({
471
+ blobs,
472
+ kzg
473
+ });
474
+ if (typeof blobVersionedHashes === "undefined") blobVersionedHashes = commitmentsToVersionedHashes({ commitments });
475
+ if (typeof sidecars === "undefined") sidecars = toBlobSidecars({
476
+ blobs,
477
+ commitments,
478
+ proofs: blobsToProofs({
479
+ blobs,
480
+ commitments,
481
+ kzg
482
+ })
483
+ });
484
+ }
485
+ const serializedAccessList = serializeAccessList(accessList);
486
+ const serializedTransaction = [
487
+ numberToHex(chainId),
488
+ nonce ? numberToHex(nonce) : "0x",
489
+ maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : "0x",
490
+ maxFeePerGas ? numberToHex(maxFeePerGas) : "0x",
491
+ gas ? numberToHex(gas) : "0x",
492
+ to ?? "0x",
493
+ value ? numberToHex(value) : "0x",
494
+ data ?? "0x",
495
+ serializedAccessList,
496
+ maxFeePerBlobGas ? numberToHex(maxFeePerBlobGas) : "0x",
497
+ blobVersionedHashes ?? [],
498
+ ...toYParitySignatureArray(transaction, signature)
499
+ ];
500
+ const blobs = [];
501
+ const commitments = [];
502
+ const proofs = [];
503
+ if (sidecars) for (let i = 0; i < sidecars.length; i++) {
504
+ const { blob, commitment, proof } = sidecars[i];
505
+ blobs.push(blob);
506
+ commitments.push(commitment);
507
+ proofs.push(proof);
508
+ }
509
+ return concatHex(["0x03", sidecars ? toRlp([
510
+ serializedTransaction,
511
+ blobs,
512
+ commitments,
513
+ proofs
514
+ ]) : toRlp(serializedTransaction)]);
515
+ }
516
+ function serializeTransactionEIP1559(transaction, signature) {
517
+ const { chainId, gas, nonce, to, value, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
518
+ assertTransactionEIP1559(transaction);
519
+ const serializedAccessList = serializeAccessList(accessList);
520
+ return concatHex(["0x02", toRlp([
521
+ numberToHex(chainId),
522
+ nonce ? numberToHex(nonce) : "0x",
523
+ maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : "0x",
524
+ maxFeePerGas ? numberToHex(maxFeePerGas) : "0x",
525
+ gas ? numberToHex(gas) : "0x",
526
+ to ?? "0x",
527
+ value ? numberToHex(value) : "0x",
528
+ data ?? "0x",
529
+ serializedAccessList,
530
+ ...toYParitySignatureArray(transaction, signature)
531
+ ])]);
532
+ }
533
+ function serializeTransactionEIP2930(transaction, signature) {
534
+ const { chainId, gas, data, nonce, to, value, accessList, gasPrice } = transaction;
535
+ assertTransactionEIP2930(transaction);
536
+ const serializedAccessList = serializeAccessList(accessList);
537
+ return concatHex(["0x01", toRlp([
538
+ numberToHex(chainId),
539
+ nonce ? numberToHex(nonce) : "0x",
540
+ gasPrice ? numberToHex(gasPrice) : "0x",
541
+ gas ? numberToHex(gas) : "0x",
542
+ to ?? "0x",
543
+ value ? numberToHex(value) : "0x",
544
+ data ?? "0x",
545
+ serializedAccessList,
546
+ ...toYParitySignatureArray(transaction, signature)
547
+ ])]);
548
+ }
549
+ function serializeTransactionLegacy(transaction, signature) {
550
+ const { chainId = 0, gas, data, nonce, to, value, gasPrice } = transaction;
551
+ assertTransactionLegacy(transaction);
552
+ let serializedTransaction = [
553
+ nonce ? numberToHex(nonce) : "0x",
554
+ gasPrice ? numberToHex(gasPrice) : "0x",
555
+ gas ? numberToHex(gas) : "0x",
556
+ to ?? "0x",
557
+ value ? numberToHex(value) : "0x",
558
+ data ?? "0x"
559
+ ];
560
+ if (signature) {
561
+ const v = (() => {
562
+ if (signature.v >= 35n) {
563
+ if ((signature.v - 35n) / 2n > 0) return signature.v;
564
+ return 27n + (signature.v === 35n ? 0n : 1n);
565
+ }
566
+ if (chainId > 0) return BigInt(chainId * 2) + BigInt(35n + signature.v - 27n);
567
+ const v = 27n + (signature.v === 27n ? 0n : 1n);
568
+ if (signature.v !== v) throw new InvalidLegacyVError({ v: signature.v });
569
+ return v;
570
+ })();
571
+ const r = trim(signature.r);
572
+ const s = trim(signature.s);
573
+ serializedTransaction = [
574
+ ...serializedTransaction,
575
+ numberToHex(v),
576
+ r === "0x00" ? "0x" : r,
577
+ s === "0x00" ? "0x" : s
578
+ ];
579
+ } else if (chainId > 0) serializedTransaction = [
580
+ ...serializedTransaction,
581
+ numberToHex(chainId),
582
+ "0x",
583
+ "0x"
584
+ ];
585
+ return toRlp(serializedTransaction);
586
+ }
587
+ function toYParitySignatureArray(transaction, signature_) {
588
+ const signature = signature_ ?? transaction;
589
+ const { v, yParity } = signature;
590
+ if (typeof signature.r === "undefined") return [];
591
+ if (typeof signature.s === "undefined") return [];
592
+ if (typeof v === "undefined" && typeof yParity === "undefined") return [];
593
+ const r = trim(signature.r);
594
+ const s = trim(signature.s);
595
+ return [
596
+ (() => {
597
+ if (typeof yParity === "number") return yParity ? numberToHex(1) : "0x";
598
+ if (v === 0n) return "0x";
599
+ if (v === 1n) return numberToHex(1);
600
+ return v === 27n ? "0x" : numberToHex(1);
601
+ })(),
602
+ r === "0x00" ? "0x" : r,
603
+ s === "0x00" ? "0x" : s
604
+ ];
605
+ }
606
+ //#endregion
607
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/authorization/serializeAuthorizationList.js
608
+ function serializeAuthorizationList(authorizationList) {
609
+ if (!authorizationList || authorizationList.length === 0) return [];
610
+ const serializedAuthorizationList = [];
611
+ for (const authorization of authorizationList) {
612
+ const { chainId, nonce, ...signature } = authorization;
613
+ const contractAddress = authorization.address;
614
+ serializedAuthorizationList.push([
615
+ chainId ? toHex(chainId) : "0x",
616
+ contractAddress,
617
+ nonce ? toHex(nonce) : "0x",
618
+ ...toYParitySignatureArray({}, signature)
619
+ ]);
620
+ }
621
+ return serializedAuthorizationList;
622
+ }
623
+ //#endregion
624
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/typedData.js
625
+ var InvalidDomainError = class extends BaseError {
626
+ constructor({ domain }) {
627
+ super(`Invalid domain "${stringify(domain)}".`, { metaMessages: ["Must be a valid EIP-712 domain."] });
628
+ }
629
+ };
630
+ var InvalidPrimaryTypeError = class extends BaseError {
631
+ constructor({ primaryType, types }) {
632
+ super(`Invalid primary type \`${primaryType}\` must be one of \`${JSON.stringify(Object.keys(types))}\`.`, {
633
+ docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror",
634
+ metaMessages: ["Check that the primary type is a key in `types`."]
635
+ });
636
+ }
637
+ };
638
+ var InvalidStructTypeError = class extends BaseError {
639
+ constructor({ type }) {
640
+ super(`Struct type "${type}" is invalid.`, {
641
+ metaMessages: ["Struct type must not be a Solidity type."],
642
+ name: "InvalidStructTypeError"
643
+ });
644
+ }
645
+ };
646
+ //#endregion
647
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/typedData.js
648
+ function serializeTypedData(parameters) {
649
+ const { domain: domain_, message: message_, primaryType, types } = parameters;
650
+ const normalizeData = (struct, data_) => {
651
+ const data = { ...data_ };
652
+ for (const param of struct) {
653
+ const { name, type } = param;
654
+ if (type === "address") data[name] = data[name].toLowerCase();
655
+ }
656
+ return data;
657
+ };
658
+ return stringify({
659
+ domain: (() => {
660
+ if (!types.EIP712Domain) return {};
661
+ if (!domain_) return {};
662
+ return normalizeData(types.EIP712Domain, domain_);
663
+ })(),
664
+ message: (() => {
665
+ if (primaryType === "EIP712Domain") return void 0;
666
+ return normalizeData(types[primaryType], message_);
667
+ })(),
668
+ primaryType,
669
+ types
670
+ });
671
+ }
672
+ function validateTypedData(parameters) {
673
+ const { domain, message, primaryType, types } = parameters;
674
+ const validateData = (struct, data) => {
675
+ for (const param of struct) {
676
+ const { name, type } = param;
677
+ const value = data[name];
678
+ const integerMatch = type.match(integerRegex);
679
+ if (integerMatch && (typeof value === "number" || typeof value === "bigint")) {
680
+ const [_type, base, size_] = integerMatch;
681
+ numberToHex(value, {
682
+ signed: base === "int",
683
+ size: Number.parseInt(size_, 10) / 8
684
+ });
685
+ }
686
+ if (type === "address" && typeof value === "string" && !isAddress(value)) throw new InvalidAddressError({ address: value });
687
+ const bytesMatch = type.match(bytesRegex);
688
+ if (bytesMatch) {
689
+ const [_type, size_] = bytesMatch;
690
+ if (size_ && size(value) !== Number.parseInt(size_, 10)) throw new BytesSizeMismatchError({
691
+ expectedSize: Number.parseInt(size_, 10),
692
+ givenSize: size(value)
693
+ });
694
+ }
695
+ const struct = types[type];
696
+ if (struct) {
697
+ validateReference(type);
698
+ validateData(struct, value);
699
+ }
700
+ }
701
+ };
702
+ if (types.EIP712Domain && domain) {
703
+ if (typeof domain !== "object") throw new InvalidDomainError({ domain });
704
+ validateData(types.EIP712Domain, domain);
705
+ }
706
+ if (primaryType !== "EIP712Domain") if (types[primaryType]) validateData(types[primaryType], message);
707
+ else throw new InvalidPrimaryTypeError({
708
+ primaryType,
709
+ types
710
+ });
711
+ }
712
+ function getTypesForEIP712Domain({ domain }) {
713
+ return [
714
+ typeof domain?.name === "string" && {
715
+ name: "name",
716
+ type: "string"
717
+ },
718
+ domain?.version && {
719
+ name: "version",
720
+ type: "string"
721
+ },
722
+ (typeof domain?.chainId === "number" || typeof domain?.chainId === "bigint") && {
723
+ name: "chainId",
724
+ type: "uint256"
725
+ },
726
+ domain?.verifyingContract && {
727
+ name: "verifyingContract",
728
+ type: "address"
729
+ },
730
+ domain?.salt && {
731
+ name: "salt",
732
+ type: "bytes32"
733
+ }
734
+ ].filter(Boolean);
735
+ }
736
+ /** @internal */
737
+ function validateReference(type) {
738
+ if (type === "address" || type === "bool" || type === "string" || type.startsWith("bytes") || type.startsWith("uint") || type.startsWith("int")) throw new InvalidStructTypeError({ type });
739
+ }
740
+ //#endregion
741
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/signature/hashTypedData.js
742
+ function hashTypedData(parameters) {
743
+ const { domain = {}, message, primaryType } = parameters;
744
+ const types = {
745
+ EIP712Domain: getTypesForEIP712Domain({ domain }),
746
+ ...parameters.types
747
+ };
748
+ validateTypedData({
749
+ domain,
750
+ message,
751
+ primaryType,
752
+ types
753
+ });
754
+ const parts = ["0x1901"];
755
+ if (domain) parts.push(hashDomain({
756
+ domain,
757
+ types
758
+ }));
759
+ if (primaryType !== "EIP712Domain") parts.push(hashStruct({
760
+ data: message,
761
+ primaryType,
762
+ types
763
+ }));
764
+ return keccak256(concat(parts));
765
+ }
766
+ function hashDomain({ domain, types }) {
767
+ return hashStruct({
768
+ data: domain,
769
+ primaryType: "EIP712Domain",
770
+ types
771
+ });
772
+ }
773
+ function hashStruct({ data, primaryType, types }) {
774
+ return keccak256(encodeData({
775
+ data,
776
+ primaryType,
777
+ types
778
+ }));
779
+ }
780
+ function encodeData({ data, primaryType, types }) {
781
+ const encodedTypes = [{ type: "bytes32" }];
782
+ const encodedValues = [hashType({
783
+ primaryType,
784
+ types
785
+ })];
786
+ for (const field of types[primaryType]) {
787
+ const [type, value] = encodeField({
788
+ types,
789
+ name: field.name,
790
+ type: field.type,
791
+ value: data[field.name]
792
+ });
793
+ encodedTypes.push(type);
794
+ encodedValues.push(value);
795
+ }
796
+ return encodeAbiParameters(encodedTypes, encodedValues);
797
+ }
798
+ function hashType({ primaryType, types }) {
799
+ return keccak256(toHex(encodeType({
800
+ primaryType,
801
+ types
802
+ })));
803
+ }
804
+ function encodeType({ primaryType, types }) {
805
+ let result = "";
806
+ const unsortedDeps = findTypeDependencies({
807
+ primaryType,
808
+ types
809
+ });
810
+ unsortedDeps.delete(primaryType);
811
+ const deps = [primaryType, ...Array.from(unsortedDeps).sort()];
812
+ for (const type of deps) result += `${type}(${types[type].map(({ name, type: t }) => `${t} ${name}`).join(",")})`;
813
+ return result;
814
+ }
815
+ function findTypeDependencies({ primaryType: primaryType_, types }, results = /* @__PURE__ */ new Set()) {
816
+ const primaryType = primaryType_.match(/^\w*/u)?.[0];
817
+ if (results.has(primaryType) || types[primaryType] === void 0) return results;
818
+ results.add(primaryType);
819
+ for (const field of types[primaryType]) findTypeDependencies({
820
+ primaryType: field.type,
821
+ types
822
+ }, results);
823
+ return results;
824
+ }
825
+ function encodeField({ types, name, type, value }) {
826
+ if (types[type] !== void 0) return [{ type: "bytes32" }, keccak256(encodeData({
827
+ data: value,
828
+ primaryType: type,
829
+ types
830
+ }))];
831
+ if (type === "bytes") return [{ type: "bytes32" }, keccak256(value)];
832
+ if (type === "string") return [{ type: "bytes32" }, keccak256(toHex(value))];
833
+ if (type.lastIndexOf("]") === type.length - 1) {
834
+ const parsedType = type.slice(0, type.lastIndexOf("["));
835
+ const typeValuePairs = value.map((item) => encodeField({
836
+ name,
837
+ type: parsedType,
838
+ types,
839
+ value: item
840
+ }));
841
+ return [{ type: "bytes32" }, keccak256(encodeAbiParameters(typeValuePairs.map(([t]) => t), typeValuePairs.map(([, v]) => v)))];
842
+ }
843
+ return [{ type }, value];
844
+ }
845
+ //#endregion
846
+ export { toRlp as _, serializeTransaction as a, assertTransactionEIP4844 as c, getTransactionType as d, toBlobSidecars as f, hashAuthorization as g, blobsToCommitments as h, validateTypedData as i, assertTransactionEIP7702 as l, blobsToProofs as m, getTypesForEIP712Domain as n, assertTransactionEIP1559 as o, commitmentsToVersionedHashes as p, serializeTypedData as r, assertTransactionEIP2930 as s, hashTypedData as t, assertTransactionLegacy as u, publicKeyToAddress as v };