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