@inco/js 0.1.31 → 0.1.33

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 (102) hide show
  1. package/README.md +28 -57
  2. package/dist/binary.js +67 -0
  3. package/dist/chain.js +24 -0
  4. package/dist/encryption/encryption.js +98 -0
  5. package/dist/encryption/index.cjs +132 -123
  6. package/dist/encryption/index.js +2 -0
  7. package/dist/encryption/index.mjs +132 -123
  8. package/dist/fhevm/fhe-environment.js +8 -0
  9. package/dist/fhevm/fhevm.js +139 -0
  10. package/dist/fhevm/index.js +2 -0
  11. package/dist/fhevm/reencrypt.js +123 -0
  12. package/dist/fhevm/tfhe.js +324 -0
  13. package/dist/fhevm/types.js +26 -0
  14. package/dist/generated/abis/addTwo.js +59 -0
  15. package/dist/generated/abis/inco-fhevm.js +6242 -0
  16. package/dist/generated/abis/index.js +3 -0
  17. package/dist/generated/abis/lightning.js +12489 -0
  18. package/dist/generated/es/cosmos/ics23/v1/proofs_pb.js +198 -0
  19. package/dist/generated/es/cosmos/msg/v1/msg_pb.js +33 -0
  20. package/dist/generated/es/cosmos_proto/cosmos_pb.js +115 -0
  21. package/dist/generated/es/google/api/annotations_pb.js +27 -0
  22. package/dist/generated/es/google/api/http_pb.js +34 -0
  23. package/dist/generated/es/inco/fhe/v1/events_pb.js +21 -0
  24. package/dist/generated/es/inco/fhe/v1/genesis_pb.js +46 -0
  25. package/dist/generated/es/inco/fhe/v1/query_pb.js +108 -0
  26. package/dist/generated/es/inco/fhe/v1/tx_pb.js +108 -0
  27. package/dist/generated/es/inco/fhe/v1/types_pb.js +133 -0
  28. package/dist/generated/es/inco/kms/lite/v1/kms_service_pb.js +43 -0
  29. package/dist/generated/es/inco/kms/lite/v1/types_pb.js +44 -0
  30. package/dist/generated/es/inco/preflight/v1/genesis_pb.js +20 -0
  31. package/dist/generated/es/inco/preflight/v1/query_pb.js +38 -0
  32. package/dist/generated/es/inco/preflight/v1/tx_pb.js +48 -0
  33. package/dist/generated/es/inco/preflight/v1/types_pb.js +34 -0
  34. package/dist/generated/es/kms/base_pb.js +238 -0
  35. package/dist/generated/es/sf/ethereum/type/v2/type_pb.js +571 -0
  36. package/dist/generated/fhe-environments.js +15 -0
  37. package/dist/generated/lightning.js +399 -0
  38. package/dist/generated/local-node.js +8 -0
  39. package/dist/generated/ts/amino/amino.js +8 -0
  40. package/dist/generated/ts/cometbft/abci/v1/types.js +5063 -0
  41. package/dist/generated/ts/cometbft/crypto/v1/keys.js +105 -0
  42. package/dist/generated/ts/cometbft/crypto/v1/proof.js +430 -0
  43. package/dist/generated/ts/cometbft/types/v1/params.js +713 -0
  44. package/dist/generated/ts/cometbft/types/v1/validator.js +353 -0
  45. package/dist/generated/ts/cosmos/app/v1alpha1/module.js +218 -0
  46. package/dist/generated/ts/cosmos/msg/v1/msg.js +8 -0
  47. package/dist/generated/ts/cosmos_proto/cosmos.js +211 -0
  48. package/dist/generated/ts/gogoproto/gogo.js +8 -0
  49. package/dist/generated/ts/google/api/annotations.js +8 -0
  50. package/dist/generated/ts/google/api/http.js +353 -0
  51. package/dist/generated/ts/google/protobuf/descriptor.js +5070 -0
  52. package/dist/generated/ts/google/protobuf/duration.js +90 -0
  53. package/dist/generated/ts/google/protobuf/timestamp.js +90 -0
  54. package/dist/generated/ts/google/protobuf/wrappers.js +506 -0
  55. package/dist/generated/ts/inco/abci/v1/types.js +70 -0
  56. package/dist/generated/ts/inco/fhe/module/v1/module.js +63 -0
  57. package/dist/generated/ts/inco/fhe/v1/events.js +187 -0
  58. package/dist/generated/ts/inco/fhe/v1/genesis.js +711 -0
  59. package/dist/generated/ts/inco/fhe/v1/query.js +1391 -0
  60. package/dist/generated/ts/inco/fhe/v1/tx.js +1233 -0
  61. package/dist/generated/ts/inco/fhe/v1/types.js +985 -0
  62. package/dist/generated/ts/inco/originchain/module/v1/module.js +63 -0
  63. package/dist/generated/ts/inco/originchain/v1/abci.js +328 -0
  64. package/dist/generated/ts/inco/originchain/v1/events.js +213 -0
  65. package/dist/generated/ts/inco/originchain/v1/genesis.js +66 -0
  66. package/dist/generated/ts/inco/originchain/v1/query.js +277 -0
  67. package/dist/generated/ts/inco/originchain/v1/tx.js +137 -0
  68. package/dist/generated/ts/inco/originchain/v1/types.js +200 -0
  69. package/dist/generated/ts/inco/preflight/module/v1/module.js +63 -0
  70. package/dist/generated/ts/inco/preflight/v1/genesis.js +182 -0
  71. package/dist/generated/ts/inco/preflight/v1/query.js +256 -0
  72. package/dist/generated/ts/inco/preflight/v1/tx.js +445 -0
  73. package/dist/generated/ts/inco/preflight/v1/types.js +395 -0
  74. package/dist/handle.js +94 -0
  75. package/dist/index.cjs +140 -131
  76. package/dist/index.js +6 -0
  77. package/dist/index.mjs +140 -131
  78. package/dist/l1/client.js +93 -0
  79. package/dist/l1/index.js +3 -0
  80. package/dist/l1/preflight.js +39 -0
  81. package/dist/lite/deployments.js +17 -0
  82. package/dist/lite/ecies.js +124 -0
  83. package/dist/lite/hadu.js +36 -0
  84. package/dist/lite/index.cjs +186 -146
  85. package/dist/lite/index.js +7 -0
  86. package/dist/lite/index.mjs +3890 -3788
  87. package/dist/lite/lightning.js +179 -0
  88. package/dist/lite/reencrypt.d.ts +1 -0
  89. package/dist/lite/reencrypt.js +148 -0
  90. package/dist/local/index.cjs +25 -2573
  91. package/dist/local/index.js +2 -0
  92. package/dist/local/index.mjs +5352 -7837
  93. package/dist/local/local-node.js +24 -0
  94. package/dist/reencryption/eip712.js +81 -0
  95. package/dist/reencryption/index.cjs +132 -123
  96. package/dist/reencryption/index.js +3 -0
  97. package/dist/reencryption/index.mjs +132 -123
  98. package/dist/reencryption/types.js +2 -0
  99. package/dist/schema.js +15 -0
  100. package/dist/viem.d.ts +53 -52
  101. package/dist/viem.js +8 -0
  102. package/package.json +11 -48
@@ -41,1739 +41,6 @@ var __export = (target, all) => {
41
41
  };
42
42
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
43
43
 
44
- // ../node_modules/viem/_esm/utils/data/isHex.js
45
- function isHex(value6, { strict: strict2 = true } = {}) {
46
- if (!value6)
47
- return false;
48
- if (typeof value6 !== "string")
49
- return false;
50
- return strict2 ? /^0x[0-9a-fA-F]*$/.test(value6) : value6.startsWith("0x");
51
- }
52
-
53
- // ../node_modules/viem/_esm/utils/data/size.js
54
- function size21(value6) {
55
- if (isHex(value6, { strict: false }))
56
- return Math.ceil((value6.length - 2) / 2);
57
- return value6.length;
58
- }
59
- var init_size = () => {};
60
-
61
- // ../node_modules/viem/_esm/errors/version.js
62
- var version = "2.24.3";
63
-
64
- // ../node_modules/viem/_esm/errors/base.js
65
- function walk(err, fn) {
66
- if (fn?.(err))
67
- return err;
68
- if (err && typeof err === "object" && "cause" in err && err.cause !== undefined)
69
- return walk(err.cause, fn);
70
- return fn ? null : err;
71
- }
72
- var errorConfig, BaseError;
73
- var init_base = __esm(() => {
74
- errorConfig = {
75
- getDocsUrl: ({ docsBaseUrl, docsPath = "", docsSlug }) => docsPath ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath}${docsSlug ? `#${docsSlug}` : ""}` : undefined,
76
- version: `viem@${version}`
77
- };
78
- BaseError = class BaseError extends Error {
79
- constructor(shortMessage, args2 = {}) {
80
- const details = (() => {
81
- if (args2.cause instanceof BaseError)
82
- return args2.cause.details;
83
- if (args2.cause?.message)
84
- return args2.cause.message;
85
- return args2.details;
86
- })();
87
- const docsPath = (() => {
88
- if (args2.cause instanceof BaseError)
89
- return args2.cause.docsPath || args2.docsPath;
90
- return args2.docsPath;
91
- })();
92
- const docsUrl = errorConfig.getDocsUrl?.({ ...args2, docsPath });
93
- const message = [
94
- shortMessage || "An error occurred.",
95
- "",
96
- ...args2.metaMessages ? [...args2.metaMessages, ""] : [],
97
- ...docsUrl ? [`Docs: ${docsUrl}`] : [],
98
- ...details ? [`Details: ${details}`] : [],
99
- ...errorConfig.version ? [`Version: ${errorConfig.version}`] : []
100
- ].join(`
101
- `);
102
- super(message, args2.cause ? { cause: args2.cause } : undefined);
103
- Object.defineProperty(this, "details", {
104
- enumerable: true,
105
- configurable: true,
106
- writable: true,
107
- value: undefined
108
- });
109
- Object.defineProperty(this, "docsPath", {
110
- enumerable: true,
111
- configurable: true,
112
- writable: true,
113
- value: undefined
114
- });
115
- Object.defineProperty(this, "metaMessages", {
116
- enumerable: true,
117
- configurable: true,
118
- writable: true,
119
- value: undefined
120
- });
121
- Object.defineProperty(this, "shortMessage", {
122
- enumerable: true,
123
- configurable: true,
124
- writable: true,
125
- value: undefined
126
- });
127
- Object.defineProperty(this, "version", {
128
- enumerable: true,
129
- configurable: true,
130
- writable: true,
131
- value: undefined
132
- });
133
- Object.defineProperty(this, "name", {
134
- enumerable: true,
135
- configurable: true,
136
- writable: true,
137
- value: "BaseError"
138
- });
139
- this.details = details;
140
- this.docsPath = docsPath;
141
- this.metaMessages = args2.metaMessages;
142
- this.name = args2.name ?? this.name;
143
- this.shortMessage = shortMessage;
144
- this.version = version;
145
- }
146
- walk(fn) {
147
- return walk(this, fn);
148
- }
149
- };
150
- });
151
-
152
- // ../node_modules/viem/_esm/errors/abi.js
153
- var AbiEncodingLengthMismatchError, BytesSizeMismatchError, UnsupportedPackedAbiType;
154
- var init_abi = __esm(() => {
155
- init_base();
156
- AbiEncodingLengthMismatchError = class AbiEncodingLengthMismatchError extends BaseError {
157
- constructor({ expectedLength, givenLength }) {
158
- super([
159
- "ABI encoding params/values length mismatch.",
160
- `Expected length (params): ${expectedLength}`,
161
- `Given length (values): ${givenLength}`
162
- ].join(`
163
- `), { name: "AbiEncodingLengthMismatchError" });
164
- }
165
- };
166
- BytesSizeMismatchError = class BytesSizeMismatchError extends BaseError {
167
- constructor({ expectedSize, givenSize }) {
168
- super(`Expected bytes${expectedSize}, got bytes${givenSize}.`, {
169
- name: "BytesSizeMismatchError"
170
- });
171
- }
172
- };
173
- UnsupportedPackedAbiType = class UnsupportedPackedAbiType extends BaseError {
174
- constructor(type2) {
175
- super(`Type "${type2}" is not supported for packed encoding.`, {
176
- name: "UnsupportedPackedAbiType"
177
- });
178
- }
179
- };
180
- });
181
-
182
- // ../node_modules/viem/_esm/errors/data.js
183
- var SliceOffsetOutOfBoundsError, SizeExceedsPaddingSizeError;
184
- var init_data = __esm(() => {
185
- init_base();
186
- SliceOffsetOutOfBoundsError = class SliceOffsetOutOfBoundsError extends BaseError {
187
- constructor({ offset, position, size: size22 }) {
188
- super(`Slice ${position === "start" ? "starting" : "ending"} at offset "${offset}" is out-of-bounds (size: ${size22}).`, { name: "SliceOffsetOutOfBoundsError" });
189
- }
190
- };
191
- SizeExceedsPaddingSizeError = class SizeExceedsPaddingSizeError extends BaseError {
192
- constructor({ size: size22, targetSize, type: type2 }) {
193
- super(`${type2.charAt(0).toUpperCase()}${type2.slice(1).toLowerCase()} size (${size22}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
194
- }
195
- };
196
- });
197
-
198
- // ../node_modules/viem/_esm/utils/data/pad.js
199
- function pad(hexOrBytes, { dir: dir2, size: size22 = 32 } = {}) {
200
- if (typeof hexOrBytes === "string")
201
- return padHex(hexOrBytes, { dir: dir2, size: size22 });
202
- return padBytes(hexOrBytes, { dir: dir2, size: size22 });
203
- }
204
- function padHex(hex_, { dir: dir2, size: size22 = 32 } = {}) {
205
- if (size22 === null)
206
- return hex_;
207
- const hex = hex_.replace("0x", "");
208
- if (hex.length > size22 * 2)
209
- throw new SizeExceedsPaddingSizeError({
210
- size: Math.ceil(hex.length / 2),
211
- targetSize: size22,
212
- type: "hex"
213
- });
214
- return `0x${hex[dir2 === "right" ? "padEnd" : "padStart"](size22 * 2, "0")}`;
215
- }
216
- function padBytes(bytes, { dir: dir2, size: size22 = 32 } = {}) {
217
- if (size22 === null)
218
- return bytes;
219
- if (bytes.length > size22)
220
- throw new SizeExceedsPaddingSizeError({
221
- size: bytes.length,
222
- targetSize: size22,
223
- type: "bytes"
224
- });
225
- const paddedBytes = new Uint8Array(size22);
226
- for (let i = 0;i < size22; i++) {
227
- const padEnd = dir2 === "right";
228
- paddedBytes[padEnd ? i : size22 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
229
- }
230
- return paddedBytes;
231
- }
232
- var init_pad = __esm(() => {
233
- init_data();
234
- });
235
-
236
- // ../node_modules/viem/_esm/errors/encoding.js
237
- var IntegerOutOfRangeError, SizeOverflowError;
238
- var init_encoding = __esm(() => {
239
- init_base();
240
- IntegerOutOfRangeError = class IntegerOutOfRangeError extends BaseError {
241
- constructor({ max: max6, min: min4, signed, size: size22, value: value6 }) {
242
- super(`Number "${value6}" is not in safe ${size22 ? `${size22 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max6 ? `(${min4} to ${max6})` : `(above ${min4})`}`, { name: "IntegerOutOfRangeError" });
243
- }
244
- };
245
- SizeOverflowError = class SizeOverflowError extends BaseError {
246
- constructor({ givenSize, maxSize }) {
247
- super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
248
- }
249
- };
250
- });
251
-
252
- // ../node_modules/viem/_esm/utils/data/trim.js
253
- function trim(hexOrBytes, { dir: dir2 = "left" } = {}) {
254
- let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
255
- let sliceLength = 0;
256
- for (let i = 0;i < data.length - 1; i++) {
257
- if (data[dir2 === "left" ? i : data.length - i - 1].toString() === "0")
258
- sliceLength++;
259
- else
260
- break;
261
- }
262
- data = dir2 === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
263
- if (typeof hexOrBytes === "string") {
264
- if (data.length === 1 && dir2 === "right")
265
- data = `${data}0`;
266
- return `0x${data.length % 2 === 1 ? `0${data}` : data}`;
267
- }
268
- return data;
269
- }
270
-
271
- // ../node_modules/viem/_esm/utils/encoding/fromHex.js
272
- function assertSize(hexOrBytes, { size: size22 }) {
273
- if (size21(hexOrBytes) > size22)
274
- throw new SizeOverflowError({
275
- givenSize: size21(hexOrBytes),
276
- maxSize: size22
277
- });
278
- }
279
- function hexToBigInt(hex, opts = {}) {
280
- const { signed } = opts;
281
- if (opts.size)
282
- assertSize(hex, { size: opts.size });
283
- const value6 = BigInt(hex);
284
- if (!signed)
285
- return value6;
286
- const size22 = (hex.length - 2) / 2;
287
- const max6 = (1n << BigInt(size22) * 8n - 1n) - 1n;
288
- if (value6 <= max6)
289
- return value6;
290
- return value6 - BigInt(`0x${"f".padStart(size22 * 2, "f")}`) - 1n;
291
- }
292
- function hexToNumber(hex, opts = {}) {
293
- return Number(hexToBigInt(hex, opts));
294
- }
295
- var init_fromHex = __esm(() => {
296
- init_encoding();
297
- init_size();
298
- });
299
-
300
- // ../node_modules/viem/_esm/utils/encoding/toHex.js
301
- function toHex(value6, opts = {}) {
302
- if (typeof value6 === "number" || typeof value6 === "bigint")
303
- return numberToHex(value6, opts);
304
- if (typeof value6 === "string") {
305
- return stringToHex(value6, opts);
306
- }
307
- if (typeof value6 === "boolean")
308
- return boolToHex(value6, opts);
309
- return bytesToHex2(value6, opts);
310
- }
311
- function boolToHex(value6, opts = {}) {
312
- const hex = `0x${Number(value6)}`;
313
- if (typeof opts.size === "number") {
314
- assertSize(hex, { size: opts.size });
315
- return pad(hex, { size: opts.size });
316
- }
317
- return hex;
318
- }
319
- function bytesToHex2(value6, opts = {}) {
320
- let string6 = "";
321
- for (let i = 0;i < value6.length; i++) {
322
- string6 += hexes[value6[i]];
323
- }
324
- const hex = `0x${string6}`;
325
- if (typeof opts.size === "number") {
326
- assertSize(hex, { size: opts.size });
327
- return pad(hex, { dir: "right", size: opts.size });
328
- }
329
- return hex;
330
- }
331
- function numberToHex(value_, opts = {}) {
332
- const { signed, size: size22 } = opts;
333
- const value6 = BigInt(value_);
334
- let maxValue;
335
- if (size22) {
336
- if (signed)
337
- maxValue = (1n << BigInt(size22) * 8n - 1n) - 1n;
338
- else
339
- maxValue = 2n ** (BigInt(size22) * 8n) - 1n;
340
- } else if (typeof value_ === "number") {
341
- maxValue = BigInt(Number.MAX_SAFE_INTEGER);
342
- }
343
- const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
344
- if (maxValue && value6 > maxValue || value6 < minValue) {
345
- const suffix = typeof value_ === "bigint" ? "n" : "";
346
- throw new IntegerOutOfRangeError({
347
- max: maxValue ? `${maxValue}${suffix}` : undefined,
348
- min: `${minValue}${suffix}`,
349
- signed,
350
- size: size22,
351
- value: `${value_}${suffix}`
352
- });
353
- }
354
- const hex = `0x${(signed && value6 < 0 ? (1n << BigInt(size22 * 8)) + BigInt(value6) : value6).toString(16)}`;
355
- if (size22)
356
- return pad(hex, { size: size22 });
357
- return hex;
358
- }
359
- function stringToHex(value_, opts = {}) {
360
- const value6 = encoder2.encode(value_);
361
- return bytesToHex2(value6, opts);
362
- }
363
- var hexes, encoder2;
364
- var init_toHex = __esm(() => {
365
- init_encoding();
366
- init_pad();
367
- init_fromHex();
368
- hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
369
- encoder2 = /* @__PURE__ */ new TextEncoder;
370
- });
371
-
372
- // ../node_modules/viem/_esm/utils/encoding/toBytes.js
373
- function toBytes(value6, opts = {}) {
374
- if (typeof value6 === "number" || typeof value6 === "bigint")
375
- return numberToBytes(value6, opts);
376
- if (typeof value6 === "boolean")
377
- return boolToBytes(value6, opts);
378
- if (isHex(value6))
379
- return hexToBytes(value6, opts);
380
- return stringToBytes(value6, opts);
381
- }
382
- function boolToBytes(value6, opts = {}) {
383
- const bytes = new Uint8Array(1);
384
- bytes[0] = Number(value6);
385
- if (typeof opts.size === "number") {
386
- assertSize(bytes, { size: opts.size });
387
- return pad(bytes, { size: opts.size });
388
- }
389
- return bytes;
390
- }
391
- function charCodeToBase16(char) {
392
- if (char >= charCodeMap.zero && char <= charCodeMap.nine)
393
- return char - charCodeMap.zero;
394
- if (char >= charCodeMap.A && char <= charCodeMap.F)
395
- return char - (charCodeMap.A - 10);
396
- if (char >= charCodeMap.a && char <= charCodeMap.f)
397
- return char - (charCodeMap.a - 10);
398
- return;
399
- }
400
- function hexToBytes(hex_, opts = {}) {
401
- let hex = hex_;
402
- if (opts.size) {
403
- assertSize(hex, { size: opts.size });
404
- hex = pad(hex, { dir: "right", size: opts.size });
405
- }
406
- let hexString = hex.slice(2);
407
- if (hexString.length % 2)
408
- hexString = `0${hexString}`;
409
- const length4 = hexString.length / 2;
410
- const bytes = new Uint8Array(length4);
411
- for (let index = 0, j = 0;index < length4; index++) {
412
- const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
413
- const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
414
- if (nibbleLeft === undefined || nibbleRight === undefined) {
415
- throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
416
- }
417
- bytes[index] = nibbleLeft * 16 + nibbleRight;
418
- }
419
- return bytes;
420
- }
421
- function numberToBytes(value6, opts) {
422
- const hex = numberToHex(value6, opts);
423
- return hexToBytes(hex);
424
- }
425
- function stringToBytes(value6, opts = {}) {
426
- const bytes = encoder3.encode(value6);
427
- if (typeof opts.size === "number") {
428
- assertSize(bytes, { size: opts.size });
429
- return pad(bytes, { dir: "right", size: opts.size });
430
- }
431
- return bytes;
432
- }
433
- var encoder3, charCodeMap;
434
- var init_toBytes = __esm(() => {
435
- init_base();
436
- init_pad();
437
- init_fromHex();
438
- init_toHex();
439
- encoder3 = /* @__PURE__ */ new TextEncoder;
440
- charCodeMap = {
441
- zero: 48,
442
- nine: 57,
443
- A: 65,
444
- F: 70,
445
- a: 97,
446
- f: 102
447
- };
448
- });
449
-
450
- // ../node_modules/@noble/hashes/esm/_assert.js
451
- function anumber(n) {
452
- if (!Number.isSafeInteger(n) || n < 0)
453
- throw new Error("positive integer expected, got " + n);
454
- }
455
- function isBytes(a) {
456
- return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
457
- }
458
- function abytes(b, ...lengths) {
459
- if (!isBytes(b))
460
- throw new Error("Uint8Array expected");
461
- if (lengths.length > 0 && !lengths.includes(b.length))
462
- throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
463
- }
464
- function aexists(instance, checkFinished = true) {
465
- if (instance.destroyed)
466
- throw new Error("Hash instance has been destroyed");
467
- if (checkFinished && instance.finished)
468
- throw new Error("Hash#digest() has already been called");
469
- }
470
- function aoutput(out, instance) {
471
- abytes(out);
472
- const min4 = instance.outputLen;
473
- if (out.length < min4) {
474
- throw new Error("digestInto() expects output buffer of length at least " + min4);
475
- }
476
- }
477
- var init__assert = () => {};
478
-
479
- // ../node_modules/@noble/hashes/esm/_u64.js
480
- function fromBig(n, le = false) {
481
- if (le)
482
- return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
483
- return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
484
- }
485
- function split3(lst, le = false) {
486
- let Ah = new Uint32Array(lst.length);
487
- let Al = new Uint32Array(lst.length);
488
- for (let i = 0;i < lst.length; i++) {
489
- const { h, l } = fromBig(lst[i], le);
490
- [Ah[i], Al[i]] = [h, l];
491
- }
492
- return [Ah, Al];
493
- }
494
- var U32_MASK64, _32n, rotlSH = (h, l, s) => h << s | l >>> 32 - s, rotlSL = (h, l, s) => l << s | h >>> 32 - s, rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s, rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
495
- var init__u64 = __esm(() => {
496
- U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
497
- _32n = /* @__PURE__ */ BigInt(32);
498
- });
499
-
500
- // ../node_modules/@noble/hashes/esm/utils.js
501
- function u32(arr) {
502
- return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
503
- }
504
- function createView(arr) {
505
- return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
506
- }
507
- function rotr(word, shift2) {
508
- return word << 32 - shift2 | word >>> shift2;
509
- }
510
- function byteSwap(word) {
511
- return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
512
- }
513
- function byteSwap32(arr) {
514
- for (let i = 0;i < arr.length; i++) {
515
- arr[i] = byteSwap(arr[i]);
516
- }
517
- }
518
- function utf8ToBytes(str) {
519
- if (typeof str !== "string")
520
- throw new Error("utf8ToBytes expected string, got " + typeof str);
521
- return new Uint8Array(new TextEncoder().encode(str));
522
- }
523
- function toBytes2(data) {
524
- if (typeof data === "string")
525
- data = utf8ToBytes(data);
526
- abytes(data);
527
- return data;
528
- }
529
-
530
- class Hash {
531
- clone() {
532
- return this._cloneInto();
533
- }
534
- }
535
- function wrapConstructor(hashCons) {
536
- const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
537
- const tmp = hashCons();
538
- hashC.outputLen = tmp.outputLen;
539
- hashC.blockLen = tmp.blockLen;
540
- hashC.create = () => hashCons();
541
- return hashC;
542
- }
543
- function wrapXOFConstructorWithOpts(hashCons) {
544
- const hashC = (msg, opts) => hashCons(opts).update(toBytes2(msg)).digest();
545
- const tmp = hashCons({});
546
- hashC.outputLen = tmp.outputLen;
547
- hashC.blockLen = tmp.blockLen;
548
- hashC.create = (opts) => hashCons(opts);
549
- return hashC;
550
- }
551
- var isLE;
552
- var init_utils = __esm(() => {
553
- init__assert();
554
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
555
- isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
556
- });
557
-
558
- // ../node_modules/@noble/hashes/esm/sha3.js
559
- function keccakP(s, rounds = 24) {
560
- const B = new Uint32Array(5 * 2);
561
- for (let round = 24 - rounds;round < 24; round++) {
562
- for (let x = 0;x < 10; x++)
563
- B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
564
- for (let x = 0;x < 10; x += 2) {
565
- const idx1 = (x + 8) % 10;
566
- const idx0 = (x + 2) % 10;
567
- const B0 = B[idx0];
568
- const B1 = B[idx0 + 1];
569
- const Th = rotlH(B0, B1, 1) ^ B[idx1];
570
- const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
571
- for (let y = 0;y < 50; y += 10) {
572
- s[x + y] ^= Th;
573
- s[x + y + 1] ^= Tl;
574
- }
575
- }
576
- let curH = s[2];
577
- let curL = s[3];
578
- for (let t = 0;t < 24; t++) {
579
- const shift2 = SHA3_ROTL[t];
580
- const Th = rotlH(curH, curL, shift2);
581
- const Tl = rotlL(curH, curL, shift2);
582
- const PI = SHA3_PI[t];
583
- curH = s[PI];
584
- curL = s[PI + 1];
585
- s[PI] = Th;
586
- s[PI + 1] = Tl;
587
- }
588
- for (let y = 0;y < 50; y += 10) {
589
- for (let x = 0;x < 10; x++)
590
- B[x] = s[y + x];
591
- for (let x = 0;x < 10; x++)
592
- s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
593
- }
594
- s[0] ^= SHA3_IOTA_H[round];
595
- s[1] ^= SHA3_IOTA_L[round];
596
- }
597
- B.fill(0);
598
- }
599
- var SHA3_PI, SHA3_ROTL, _SHA3_IOTA, _0n, _1n, _2n, _7n, _256n, _0x71n, SHA3_IOTA_H, SHA3_IOTA_L, rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s), rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s), Keccak, gen5 = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen)), sha3_224, sha3_256, sha3_384, sha3_512, keccak_224, keccak_256, keccak_384, keccak_512, genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true)), shake128, shake256;
600
- var init_sha3 = __esm(() => {
601
- init__assert();
602
- init__u64();
603
- init_utils();
604
- SHA3_PI = [];
605
- SHA3_ROTL = [];
606
- _SHA3_IOTA = [];
607
- _0n = /* @__PURE__ */ BigInt(0);
608
- _1n = /* @__PURE__ */ BigInt(1);
609
- _2n = /* @__PURE__ */ BigInt(2);
610
- _7n = /* @__PURE__ */ BigInt(7);
611
- _256n = /* @__PURE__ */ BigInt(256);
612
- _0x71n = /* @__PURE__ */ BigInt(113);
613
- for (let round = 0, R = _1n, x = 1, y = 0;round < 24; round++) {
614
- [x, y] = [y, (2 * x + 3 * y) % 5];
615
- SHA3_PI.push(2 * (5 * y + x));
616
- SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
617
- let t = _0n;
618
- for (let j = 0;j < 7; j++) {
619
- R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
620
- if (R & _2n)
621
- t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
622
- }
623
- _SHA3_IOTA.push(t);
624
- }
625
- [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split3(_SHA3_IOTA, true);
626
- Keccak = class Keccak extends Hash {
627
- constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
628
- super();
629
- this.blockLen = blockLen;
630
- this.suffix = suffix;
631
- this.outputLen = outputLen;
632
- this.enableXOF = enableXOF;
633
- this.rounds = rounds;
634
- this.pos = 0;
635
- this.posOut = 0;
636
- this.finished = false;
637
- this.destroyed = false;
638
- anumber(outputLen);
639
- if (0 >= this.blockLen || this.blockLen >= 200)
640
- throw new Error("Sha3 supports only keccak-f1600 function");
641
- this.state = new Uint8Array(200);
642
- this.state32 = u32(this.state);
643
- }
644
- keccak() {
645
- if (!isLE)
646
- byteSwap32(this.state32);
647
- keccakP(this.state32, this.rounds);
648
- if (!isLE)
649
- byteSwap32(this.state32);
650
- this.posOut = 0;
651
- this.pos = 0;
652
- }
653
- update(data) {
654
- aexists(this);
655
- const { blockLen, state } = this;
656
- data = toBytes2(data);
657
- const len = data.length;
658
- for (let pos = 0;pos < len; ) {
659
- const take10 = Math.min(blockLen - this.pos, len - pos);
660
- for (let i = 0;i < take10; i++)
661
- state[this.pos++] ^= data[pos++];
662
- if (this.pos === blockLen)
663
- this.keccak();
664
- }
665
- return this;
666
- }
667
- finish() {
668
- if (this.finished)
669
- return;
670
- this.finished = true;
671
- const { state, suffix, pos, blockLen } = this;
672
- state[pos] ^= suffix;
673
- if ((suffix & 128) !== 0 && pos === blockLen - 1)
674
- this.keccak();
675
- state[blockLen - 1] ^= 128;
676
- this.keccak();
677
- }
678
- writeInto(out) {
679
- aexists(this, false);
680
- abytes(out);
681
- this.finish();
682
- const bufferOut = this.state;
683
- const { blockLen } = this;
684
- for (let pos = 0, len = out.length;pos < len; ) {
685
- if (this.posOut >= blockLen)
686
- this.keccak();
687
- const take10 = Math.min(blockLen - this.posOut, len - pos);
688
- out.set(bufferOut.subarray(this.posOut, this.posOut + take10), pos);
689
- this.posOut += take10;
690
- pos += take10;
691
- }
692
- return out;
693
- }
694
- xofInto(out) {
695
- if (!this.enableXOF)
696
- throw new Error("XOF is not possible for this instance");
697
- return this.writeInto(out);
698
- }
699
- xof(bytes) {
700
- anumber(bytes);
701
- return this.xofInto(new Uint8Array(bytes));
702
- }
703
- digestInto(out) {
704
- aoutput(out, this);
705
- if (this.finished)
706
- throw new Error("digest() was already called");
707
- this.writeInto(out);
708
- this.destroy();
709
- return out;
710
- }
711
- digest() {
712
- return this.digestInto(new Uint8Array(this.outputLen));
713
- }
714
- destroy() {
715
- this.destroyed = true;
716
- this.state.fill(0);
717
- }
718
- _cloneInto(to) {
719
- const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
720
- to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
721
- to.state32.set(this.state32);
722
- to.pos = this.pos;
723
- to.posOut = this.posOut;
724
- to.finished = this.finished;
725
- to.rounds = rounds;
726
- to.suffix = suffix;
727
- to.outputLen = outputLen;
728
- to.enableXOF = enableXOF;
729
- to.destroyed = this.destroyed;
730
- return to;
731
- }
732
- };
733
- sha3_224 = /* @__PURE__ */ gen5(6, 144, 224 / 8);
734
- sha3_256 = /* @__PURE__ */ gen5(6, 136, 256 / 8);
735
- sha3_384 = /* @__PURE__ */ gen5(6, 104, 384 / 8);
736
- sha3_512 = /* @__PURE__ */ gen5(6, 72, 512 / 8);
737
- keccak_224 = /* @__PURE__ */ gen5(1, 144, 224 / 8);
738
- keccak_256 = /* @__PURE__ */ gen5(1, 136, 256 / 8);
739
- keccak_384 = /* @__PURE__ */ gen5(1, 104, 384 / 8);
740
- keccak_512 = /* @__PURE__ */ gen5(1, 72, 512 / 8);
741
- shake128 = /* @__PURE__ */ genShake(31, 168, 128 / 8);
742
- shake256 = /* @__PURE__ */ genShake(31, 136, 256 / 8);
743
- });
744
-
745
- // ../node_modules/viem/_esm/utils/hash/keccak256.js
746
- function keccak256(value6, to_) {
747
- const to = to_ || "hex";
748
- const bytes = keccak_256(isHex(value6, { strict: false }) ? toBytes(value6) : value6);
749
- if (to === "bytes")
750
- return bytes;
751
- return toHex(bytes);
752
- }
753
- var init_keccak256 = __esm(() => {
754
- init_sha3();
755
- init_toBytes();
756
- init_toHex();
757
- });
758
-
759
- // ../node_modules/viem/_esm/errors/address.js
760
- var InvalidAddressError;
761
- var init_address = __esm(() => {
762
- init_base();
763
- InvalidAddressError = class InvalidAddressError extends BaseError {
764
- constructor({ address }) {
765
- super(`Address "${address}" is invalid.`, {
766
- metaMessages: [
767
- "- Address must be a hex value of 20 bytes (40 hex characters).",
768
- "- Address must match its checksum counterpart."
769
- ],
770
- name: "InvalidAddressError"
771
- });
772
- }
773
- };
774
- });
775
-
776
- // ../node_modules/viem/_esm/utils/lru.js
777
- var LruMap;
778
- var init_lru = __esm(() => {
779
- LruMap = class LruMap extends Map {
780
- constructor(size22) {
781
- super();
782
- Object.defineProperty(this, "maxSize", {
783
- enumerable: true,
784
- configurable: true,
785
- writable: true,
786
- value: undefined
787
- });
788
- this.maxSize = size22;
789
- }
790
- get(key) {
791
- const value6 = super.get(key);
792
- if (super.has(key) && value6 !== undefined) {
793
- this.delete(key);
794
- super.set(key, value6);
795
- }
796
- return value6;
797
- }
798
- set(key, value6) {
799
- super.set(key, value6);
800
- if (this.maxSize && this.size > this.maxSize) {
801
- const firstKey = this.keys().next().value;
802
- if (firstKey)
803
- this.delete(firstKey);
804
- }
805
- return this;
806
- }
807
- };
808
- });
809
-
810
- // ../node_modules/viem/_esm/utils/address/getAddress.js
811
- function checksumAddress(address_, chainId) {
812
- if (checksumAddressCache.has(`${address_}.${chainId}`))
813
- return checksumAddressCache.get(`${address_}.${chainId}`);
814
- const hexAddress = chainId ? `${chainId}${address_.toLowerCase()}` : address_.substring(2).toLowerCase();
815
- const hash2 = keccak256(stringToBytes(hexAddress), "bytes");
816
- const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split("");
817
- for (let i = 0;i < 40; i += 2) {
818
- if (hash2[i >> 1] >> 4 >= 8 && address[i]) {
819
- address[i] = address[i].toUpperCase();
820
- }
821
- if ((hash2[i >> 1] & 15) >= 8 && address[i + 1]) {
822
- address[i + 1] = address[i + 1].toUpperCase();
823
- }
824
- }
825
- const result = `0x${address.join("")}`;
826
- checksumAddressCache.set(`${address_}.${chainId}`, result);
827
- return result;
828
- }
829
- var checksumAddressCache;
830
- var init_getAddress = __esm(() => {
831
- init_toBytes();
832
- init_keccak256();
833
- init_lru();
834
- checksumAddressCache = /* @__PURE__ */ new LruMap(8192);
835
- });
836
-
837
- // ../node_modules/viem/_esm/utils/address/isAddress.js
838
- function isAddress(address, options) {
839
- const { strict: strict2 = true } = options ?? {};
840
- const cacheKey = `${address}.${strict2}`;
841
- if (isAddressCache.has(cacheKey))
842
- return isAddressCache.get(cacheKey);
843
- const result = (() => {
844
- if (!addressRegex.test(address))
845
- return false;
846
- if (address.toLowerCase() === address)
847
- return true;
848
- if (strict2)
849
- return checksumAddress(address) === address;
850
- return true;
851
- })();
852
- isAddressCache.set(cacheKey, result);
853
- return result;
854
- }
855
- var addressRegex, isAddressCache;
856
- var init_isAddress = __esm(() => {
857
- init_lru();
858
- init_getAddress();
859
- addressRegex = /^0x[a-fA-F0-9]{40}$/;
860
- isAddressCache = /* @__PURE__ */ new LruMap(8192);
861
- });
862
-
863
- // ../node_modules/viem/_esm/utils/data/concat.js
864
- function concatHex(values7) {
865
- return `0x${values7.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
866
- }
867
-
868
- // ../node_modules/viem/_esm/utils/data/slice.js
869
- function slice(value6, start5, end6, { strict: strict2 } = {}) {
870
- if (isHex(value6, { strict: false }))
871
- return sliceHex(value6, start5, end6, {
872
- strict: strict2
873
- });
874
- return sliceBytes(value6, start5, end6, {
875
- strict: strict2
876
- });
877
- }
878
- function assertStartOffset(value6, start5) {
879
- if (typeof start5 === "number" && start5 > 0 && start5 > size21(value6) - 1)
880
- throw new SliceOffsetOutOfBoundsError({
881
- offset: start5,
882
- position: "start",
883
- size: size21(value6)
884
- });
885
- }
886
- function assertEndOffset(value6, start5, end6) {
887
- if (typeof start5 === "number" && typeof end6 === "number" && size21(value6) !== end6 - start5) {
888
- throw new SliceOffsetOutOfBoundsError({
889
- offset: end6,
890
- position: "end",
891
- size: size21(value6)
892
- });
893
- }
894
- }
895
- function sliceBytes(value_, start5, end6, { strict: strict2 } = {}) {
896
- assertStartOffset(value_, start5);
897
- const value6 = value_.slice(start5, end6);
898
- if (strict2)
899
- assertEndOffset(value6, start5, end6);
900
- return value6;
901
- }
902
- function sliceHex(value_, start5, end6, { strict: strict2 } = {}) {
903
- assertStartOffset(value_, start5);
904
- const value6 = `0x${value_.replace("0x", "").slice((start5 ?? 0) * 2, (end6 ?? value_.length) * 2)}`;
905
- if (strict2)
906
- assertEndOffset(value6, start5, end6);
907
- return value6;
908
- }
909
- var init_slice = __esm(() => {
910
- init_data();
911
- init_size();
912
- });
913
-
914
- // ../node_modules/viem/_esm/utils/regex.js
915
- var arrayRegex, bytesRegex, integerRegex;
916
- var init_regex = __esm(() => {
917
- arrayRegex = /^(.*)\[([0-9]*)\]$/;
918
- bytesRegex = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/;
919
- integerRegex = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
920
- });
921
-
922
- // ../node_modules/viem/_esm/errors/cursor.js
923
- var NegativeOffsetError, PositionOutOfBoundsError, RecursiveReadLimitExceededError;
924
- var init_cursor = __esm(() => {
925
- init_base();
926
- NegativeOffsetError = class NegativeOffsetError extends BaseError {
927
- constructor({ offset }) {
928
- super(`Offset \`${offset}\` cannot be negative.`, {
929
- name: "NegativeOffsetError"
930
- });
931
- }
932
- };
933
- PositionOutOfBoundsError = class PositionOutOfBoundsError extends BaseError {
934
- constructor({ length: length4, position }) {
935
- super(`Position \`${position}\` is out of bounds (\`0 < position < ${length4}\`).`, { name: "PositionOutOfBoundsError" });
936
- }
937
- };
938
- RecursiveReadLimitExceededError = class RecursiveReadLimitExceededError extends BaseError {
939
- constructor({ count: count5, limit }) {
940
- super(`Recursive read limit of \`${limit}\` exceeded (recursive read count: \`${count5}\`).`, { name: "RecursiveReadLimitExceededError" });
941
- }
942
- };
943
- });
944
-
945
- // ../node_modules/viem/_esm/utils/cursor.js
946
- function createCursor(bytes, { recursiveReadLimit = 8192 } = {}) {
947
- const cursor = Object.create(staticCursor);
948
- cursor.bytes = bytes;
949
- cursor.dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
950
- cursor.positionReadCount = new Map;
951
- cursor.recursiveReadLimit = recursiveReadLimit;
952
- return cursor;
953
- }
954
- var staticCursor;
955
- var init_cursor2 = __esm(() => {
956
- init_cursor();
957
- staticCursor = {
958
- bytes: new Uint8Array,
959
- dataView: new DataView(new ArrayBuffer(0)),
960
- position: 0,
961
- positionReadCount: new Map,
962
- recursiveReadCount: 0,
963
- recursiveReadLimit: Number.POSITIVE_INFINITY,
964
- assertReadLimit() {
965
- if (this.recursiveReadCount >= this.recursiveReadLimit)
966
- throw new RecursiveReadLimitExceededError({
967
- count: this.recursiveReadCount + 1,
968
- limit: this.recursiveReadLimit
969
- });
970
- },
971
- assertPosition(position) {
972
- if (position < 0 || position > this.bytes.length - 1)
973
- throw new PositionOutOfBoundsError({
974
- length: this.bytes.length,
975
- position
976
- });
977
- },
978
- decrementPosition(offset) {
979
- if (offset < 0)
980
- throw new NegativeOffsetError({ offset });
981
- const position = this.position - offset;
982
- this.assertPosition(position);
983
- this.position = position;
984
- },
985
- getReadCount(position) {
986
- return this.positionReadCount.get(position || this.position) || 0;
987
- },
988
- incrementPosition(offset) {
989
- if (offset < 0)
990
- throw new NegativeOffsetError({ offset });
991
- const position = this.position + offset;
992
- this.assertPosition(position);
993
- this.position = position;
994
- },
995
- inspectByte(position_) {
996
- const position = position_ ?? this.position;
997
- this.assertPosition(position);
998
- return this.bytes[position];
999
- },
1000
- inspectBytes(length4, position_) {
1001
- const position = position_ ?? this.position;
1002
- this.assertPosition(position + length4 - 1);
1003
- return this.bytes.subarray(position, position + length4);
1004
- },
1005
- inspectUint8(position_) {
1006
- const position = position_ ?? this.position;
1007
- this.assertPosition(position);
1008
- return this.bytes[position];
1009
- },
1010
- inspectUint16(position_) {
1011
- const position = position_ ?? this.position;
1012
- this.assertPosition(position + 1);
1013
- return this.dataView.getUint16(position);
1014
- },
1015
- inspectUint24(position_) {
1016
- const position = position_ ?? this.position;
1017
- this.assertPosition(position + 2);
1018
- return (this.dataView.getUint16(position) << 8) + this.dataView.getUint8(position + 2);
1019
- },
1020
- inspectUint32(position_) {
1021
- const position = position_ ?? this.position;
1022
- this.assertPosition(position + 3);
1023
- return this.dataView.getUint32(position);
1024
- },
1025
- pushByte(byte) {
1026
- this.assertPosition(this.position);
1027
- this.bytes[this.position] = byte;
1028
- this.position++;
1029
- },
1030
- pushBytes(bytes) {
1031
- this.assertPosition(this.position + bytes.length - 1);
1032
- this.bytes.set(bytes, this.position);
1033
- this.position += bytes.length;
1034
- },
1035
- pushUint8(value6) {
1036
- this.assertPosition(this.position);
1037
- this.bytes[this.position] = value6;
1038
- this.position++;
1039
- },
1040
- pushUint16(value6) {
1041
- this.assertPosition(this.position + 1);
1042
- this.dataView.setUint16(this.position, value6);
1043
- this.position += 2;
1044
- },
1045
- pushUint24(value6) {
1046
- this.assertPosition(this.position + 2);
1047
- this.dataView.setUint16(this.position, value6 >> 8);
1048
- this.dataView.setUint8(this.position + 2, value6 & ~4294967040);
1049
- this.position += 3;
1050
- },
1051
- pushUint32(value6) {
1052
- this.assertPosition(this.position + 3);
1053
- this.dataView.setUint32(this.position, value6);
1054
- this.position += 4;
1055
- },
1056
- readByte() {
1057
- this.assertReadLimit();
1058
- this._touch();
1059
- const value6 = this.inspectByte();
1060
- this.position++;
1061
- return value6;
1062
- },
1063
- readBytes(length4, size22) {
1064
- this.assertReadLimit();
1065
- this._touch();
1066
- const value6 = this.inspectBytes(length4);
1067
- this.position += size22 ?? length4;
1068
- return value6;
1069
- },
1070
- readUint8() {
1071
- this.assertReadLimit();
1072
- this._touch();
1073
- const value6 = this.inspectUint8();
1074
- this.position += 1;
1075
- return value6;
1076
- },
1077
- readUint16() {
1078
- this.assertReadLimit();
1079
- this._touch();
1080
- const value6 = this.inspectUint16();
1081
- this.position += 2;
1082
- return value6;
1083
- },
1084
- readUint24() {
1085
- this.assertReadLimit();
1086
- this._touch();
1087
- const value6 = this.inspectUint24();
1088
- this.position += 3;
1089
- return value6;
1090
- },
1091
- readUint32() {
1092
- this.assertReadLimit();
1093
- this._touch();
1094
- const value6 = this.inspectUint32();
1095
- this.position += 4;
1096
- return value6;
1097
- },
1098
- get remaining() {
1099
- return this.bytes.length - this.position;
1100
- },
1101
- setPosition(position) {
1102
- const oldPosition = this.position;
1103
- this.assertPosition(position);
1104
- this.position = position;
1105
- return () => this.position = oldPosition;
1106
- },
1107
- _touch() {
1108
- if (this.recursiveReadLimit === Number.POSITIVE_INFINITY)
1109
- return;
1110
- const count5 = this.getReadCount();
1111
- this.positionReadCount.set(this.position, count5 + 1);
1112
- if (count5 > 0)
1113
- this.recursiveReadCount++;
1114
- }
1115
- };
1116
- });
1117
-
1118
- // ../node_modules/viem/_esm/constants/unit.js
1119
- var gweiUnits;
1120
- var init_unit = __esm(() => {
1121
- gweiUnits = {
1122
- ether: -9,
1123
- wei: 9
1124
- };
1125
- });
1126
-
1127
- // ../node_modules/viem/_esm/utils/unit/formatUnits.js
1128
- function formatUnits(value6, decimals) {
1129
- let display = value6.toString();
1130
- const negative2 = display.startsWith("-");
1131
- if (negative2)
1132
- display = display.slice(1);
1133
- display = display.padStart(decimals, "0");
1134
- let [integer3, fraction] = [
1135
- display.slice(0, display.length - decimals),
1136
- display.slice(display.length - decimals)
1137
- ];
1138
- fraction = fraction.replace(/(0+)$/, "");
1139
- return `${negative2 ? "-" : ""}${integer3 || "0"}${fraction ? `.${fraction}` : ""}`;
1140
- }
1141
-
1142
- // ../node_modules/viem/_esm/utils/unit/formatGwei.js
1143
- function formatGwei(wei, unit = "wei") {
1144
- return formatUnits(wei, gweiUnits[unit]);
1145
- }
1146
- var init_formatGwei = __esm(() => {
1147
- init_unit();
1148
- });
1149
-
1150
- // ../node_modules/viem/_esm/errors/transaction.js
1151
- function prettyPrint(args2) {
1152
- const entries3 = Object.entries(args2).map(([key, value6]) => {
1153
- if (value6 === undefined || value6 === false)
1154
- return null;
1155
- return [key, value6];
1156
- }).filter(Boolean);
1157
- const maxLength2 = entries3.reduce((acc, [key]) => Math.max(acc, key.length), 0);
1158
- return entries3.map(([key, value6]) => ` ${`${key}:`.padEnd(maxLength2 + 1)} ${value6}`).join(`
1159
- `);
1160
- }
1161
- var InvalidLegacyVError, InvalidSerializableTransactionError, InvalidStorageKeySizeError;
1162
- var init_transaction = __esm(() => {
1163
- init_base();
1164
- InvalidLegacyVError = class InvalidLegacyVError extends BaseError {
1165
- constructor({ v }) {
1166
- super(`Invalid \`v\` value "${v}". Expected 27 or 28.`, {
1167
- name: "InvalidLegacyVError"
1168
- });
1169
- }
1170
- };
1171
- InvalidSerializableTransactionError = class InvalidSerializableTransactionError extends BaseError {
1172
- constructor({ transaction }) {
1173
- super("Cannot infer a transaction type from provided transaction.", {
1174
- metaMessages: [
1175
- "Provided Transaction:",
1176
- "{",
1177
- prettyPrint(transaction),
1178
- "}",
1179
- "",
1180
- "To infer the type, either provide:",
1181
- "- a `type` to the Transaction, or",
1182
- "- an EIP-1559 Transaction with `maxFeePerGas`, or",
1183
- "- an EIP-2930 Transaction with `gasPrice` & `accessList`, or",
1184
- "- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or",
1185
- "- an EIP-7702 Transaction with `authorizationList`, or",
1186
- "- a Legacy Transaction with `gasPrice`"
1187
- ],
1188
- name: "InvalidSerializableTransactionError"
1189
- });
1190
- }
1191
- };
1192
- InvalidStorageKeySizeError = class InvalidStorageKeySizeError extends BaseError {
1193
- constructor({ storageKey }) {
1194
- super(`Size for storage key "${storageKey}" is invalid. Expected 32 bytes. Got ${Math.floor((storageKey.length - 2) / 2)} bytes.`, { name: "InvalidStorageKeySizeError" });
1195
- }
1196
- };
1197
- });
1198
-
1199
- // ../node_modules/viem/_esm/errors/node.js
1200
- var ExecutionRevertedError, FeeCapTooHighError, FeeCapTooLowError, NonceTooHighError, NonceTooLowError, NonceMaxValueError, InsufficientFundsError, IntrinsicGasTooHighError, IntrinsicGasTooLowError, TransactionTypeNotSupportedError, TipAboveFeeCapError;
1201
- var init_node = __esm(() => {
1202
- init_formatGwei();
1203
- init_base();
1204
- ExecutionRevertedError = class ExecutionRevertedError extends BaseError {
1205
- constructor({ cause: cause2, message } = {}) {
1206
- const reason = message?.replace("execution reverted: ", "")?.replace("execution reverted", "");
1207
- super(`Execution reverted ${reason ? `with reason: ${reason}` : "for an unknown reason"}.`, {
1208
- cause: cause2,
1209
- name: "ExecutionRevertedError"
1210
- });
1211
- }
1212
- };
1213
- Object.defineProperty(ExecutionRevertedError, "code", {
1214
- enumerable: true,
1215
- configurable: true,
1216
- writable: true,
1217
- value: 3
1218
- });
1219
- Object.defineProperty(ExecutionRevertedError, "nodeMessage", {
1220
- enumerable: true,
1221
- configurable: true,
1222
- writable: true,
1223
- value: /execution reverted/
1224
- });
1225
- FeeCapTooHighError = class FeeCapTooHighError extends BaseError {
1226
- constructor({ cause: cause2, maxFeePerGas } = {}) {
1227
- super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
1228
- cause: cause2,
1229
- name: "FeeCapTooHighError"
1230
- });
1231
- }
1232
- };
1233
- Object.defineProperty(FeeCapTooHighError, "nodeMessage", {
1234
- enumerable: true,
1235
- configurable: true,
1236
- writable: true,
1237
- value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
1238
- });
1239
- FeeCapTooLowError = class FeeCapTooLowError extends BaseError {
1240
- constructor({ cause: cause2, maxFeePerGas } = {}) {
1241
- super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)}` : ""} gwei) cannot be lower than the block base fee.`, {
1242
- cause: cause2,
1243
- name: "FeeCapTooLowError"
1244
- });
1245
- }
1246
- };
1247
- Object.defineProperty(FeeCapTooLowError, "nodeMessage", {
1248
- enumerable: true,
1249
- configurable: true,
1250
- writable: true,
1251
- value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/
1252
- });
1253
- NonceTooHighError = class NonceTooHighError extends BaseError {
1254
- constructor({ cause: cause2, nonce } = {}) {
1255
- super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is higher than the next one expected.`, { cause: cause2, name: "NonceTooHighError" });
1256
- }
1257
- };
1258
- Object.defineProperty(NonceTooHighError, "nodeMessage", {
1259
- enumerable: true,
1260
- configurable: true,
1261
- writable: true,
1262
- value: /nonce too high/
1263
- });
1264
- NonceTooLowError = class NonceTooLowError extends BaseError {
1265
- constructor({ cause: cause2, nonce } = {}) {
1266
- super([
1267
- `Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is lower than the current nonce of the account.`,
1268
- "Try increasing the nonce or find the latest nonce with `getTransactionCount`."
1269
- ].join(`
1270
- `), { cause: cause2, name: "NonceTooLowError" });
1271
- }
1272
- };
1273
- Object.defineProperty(NonceTooLowError, "nodeMessage", {
1274
- enumerable: true,
1275
- configurable: true,
1276
- writable: true,
1277
- value: /nonce too low|transaction already imported|already known/
1278
- });
1279
- NonceMaxValueError = class NonceMaxValueError extends BaseError {
1280
- constructor({ cause: cause2, nonce } = {}) {
1281
- super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}exceeds the maximum allowed nonce.`, { cause: cause2, name: "NonceMaxValueError" });
1282
- }
1283
- };
1284
- Object.defineProperty(NonceMaxValueError, "nodeMessage", {
1285
- enumerable: true,
1286
- configurable: true,
1287
- writable: true,
1288
- value: /nonce has max value/
1289
- });
1290
- InsufficientFundsError = class InsufficientFundsError extends BaseError {
1291
- constructor({ cause: cause2 } = {}) {
1292
- super([
1293
- "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
1294
- ].join(`
1295
- `), {
1296
- cause: cause2,
1297
- metaMessages: [
1298
- "This error could arise when the account does not have enough funds to:",
1299
- " - pay for the total gas fee,",
1300
- " - pay for the value to send.",
1301
- " ",
1302
- "The cost of the transaction is calculated as `gas * gas fee + value`, where:",
1303
- " - `gas` is the amount of gas needed for transaction to execute,",
1304
- " - `gas fee` is the gas fee,",
1305
- " - `value` is the amount of ether to send to the recipient."
1306
- ],
1307
- name: "InsufficientFundsError"
1308
- });
1309
- }
1310
- };
1311
- Object.defineProperty(InsufficientFundsError, "nodeMessage", {
1312
- enumerable: true,
1313
- configurable: true,
1314
- writable: true,
1315
- value: /insufficient funds|exceeds transaction sender account balance/
1316
- });
1317
- IntrinsicGasTooHighError = class IntrinsicGasTooHighError extends BaseError {
1318
- constructor({ cause: cause2, gas } = {}) {
1319
- super(`The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, {
1320
- cause: cause2,
1321
- name: "IntrinsicGasTooHighError"
1322
- });
1323
- }
1324
- };
1325
- Object.defineProperty(IntrinsicGasTooHighError, "nodeMessage", {
1326
- enumerable: true,
1327
- configurable: true,
1328
- writable: true,
1329
- value: /intrinsic gas too high|gas limit reached/
1330
- });
1331
- IntrinsicGasTooLowError = class IntrinsicGasTooLowError extends BaseError {
1332
- constructor({ cause: cause2, gas } = {}) {
1333
- super(`The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction is too low.`, {
1334
- cause: cause2,
1335
- name: "IntrinsicGasTooLowError"
1336
- });
1337
- }
1338
- };
1339
- Object.defineProperty(IntrinsicGasTooLowError, "nodeMessage", {
1340
- enumerable: true,
1341
- configurable: true,
1342
- writable: true,
1343
- value: /intrinsic gas too low/
1344
- });
1345
- TransactionTypeNotSupportedError = class TransactionTypeNotSupportedError extends BaseError {
1346
- constructor({ cause: cause2 }) {
1347
- super("The transaction type is not supported for this chain.", {
1348
- cause: cause2,
1349
- name: "TransactionTypeNotSupportedError"
1350
- });
1351
- }
1352
- };
1353
- Object.defineProperty(TransactionTypeNotSupportedError, "nodeMessage", {
1354
- enumerable: true,
1355
- configurable: true,
1356
- writable: true,
1357
- value: /transaction type not valid/
1358
- });
1359
- TipAboveFeeCapError = class TipAboveFeeCapError extends BaseError {
1360
- constructor({ cause: cause2, maxPriorityFeePerGas, maxFeePerGas } = {}) {
1361
- super([
1362
- `The provided tip (\`maxPriorityFeePerGas\`${maxPriorityFeePerGas ? ` = ${formatGwei(maxPriorityFeePerGas)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}).`
1363
- ].join(`
1364
- `), {
1365
- cause: cause2,
1366
- name: "TipAboveFeeCapError"
1367
- });
1368
- }
1369
- };
1370
- Object.defineProperty(TipAboveFeeCapError, "nodeMessage", {
1371
- enumerable: true,
1372
- configurable: true,
1373
- writable: true,
1374
- value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
1375
- });
1376
- });
1377
-
1378
- // ../node_modules/viem/_esm/utils/formatters/formatter.js
1379
- function defineFormatter(type2, format7) {
1380
- return ({ exclude: exclude3, format: overrides }) => {
1381
- return {
1382
- exclude: exclude3,
1383
- format: (args2) => {
1384
- const formatted = format7(args2);
1385
- if (exclude3) {
1386
- for (const key of exclude3) {
1387
- delete formatted[key];
1388
- }
1389
- }
1390
- return {
1391
- ...formatted,
1392
- ...overrides(args2)
1393
- };
1394
- },
1395
- type: type2
1396
- };
1397
- };
1398
- }
1399
-
1400
- // ../node_modules/viem/_esm/constants/number.js
1401
- var maxInt8, maxInt16, maxInt24, maxInt32, maxInt40, maxInt48, maxInt56, maxInt64, maxInt72, maxInt80, maxInt88, maxInt96, maxInt104, maxInt112, maxInt120, maxInt128, maxInt136, maxInt144, maxInt152, maxInt160, maxInt168, maxInt176, maxInt184, maxInt192, maxInt200, maxInt208, maxInt216, maxInt224, maxInt232, maxInt240, maxInt248, maxInt256, minInt8, minInt16, minInt24, minInt32, minInt40, minInt48, minInt56, minInt64, minInt72, minInt80, minInt88, minInt96, minInt104, minInt112, minInt120, minInt128, minInt136, minInt144, minInt152, minInt160, minInt168, minInt176, minInt184, minInt192, minInt200, minInt208, minInt216, minInt224, minInt232, minInt240, minInt248, minInt256, maxUint8, maxUint16, maxUint24, maxUint32, maxUint40, maxUint48, maxUint56, maxUint64, maxUint72, maxUint80, maxUint88, maxUint96, maxUint104, maxUint112, maxUint120, maxUint128, maxUint136, maxUint144, maxUint152, maxUint160, maxUint168, maxUint176, maxUint184, maxUint192, maxUint200, maxUint208, maxUint216, maxUint224, maxUint232, maxUint240, maxUint248, maxUint256;
1402
- var init_number = __esm(() => {
1403
- maxInt8 = 2n ** (8n - 1n) - 1n;
1404
- maxInt16 = 2n ** (16n - 1n) - 1n;
1405
- maxInt24 = 2n ** (24n - 1n) - 1n;
1406
- maxInt32 = 2n ** (32n - 1n) - 1n;
1407
- maxInt40 = 2n ** (40n - 1n) - 1n;
1408
- maxInt48 = 2n ** (48n - 1n) - 1n;
1409
- maxInt56 = 2n ** (56n - 1n) - 1n;
1410
- maxInt64 = 2n ** (64n - 1n) - 1n;
1411
- maxInt72 = 2n ** (72n - 1n) - 1n;
1412
- maxInt80 = 2n ** (80n - 1n) - 1n;
1413
- maxInt88 = 2n ** (88n - 1n) - 1n;
1414
- maxInt96 = 2n ** (96n - 1n) - 1n;
1415
- maxInt104 = 2n ** (104n - 1n) - 1n;
1416
- maxInt112 = 2n ** (112n - 1n) - 1n;
1417
- maxInt120 = 2n ** (120n - 1n) - 1n;
1418
- maxInt128 = 2n ** (128n - 1n) - 1n;
1419
- maxInt136 = 2n ** (136n - 1n) - 1n;
1420
- maxInt144 = 2n ** (144n - 1n) - 1n;
1421
- maxInt152 = 2n ** (152n - 1n) - 1n;
1422
- maxInt160 = 2n ** (160n - 1n) - 1n;
1423
- maxInt168 = 2n ** (168n - 1n) - 1n;
1424
- maxInt176 = 2n ** (176n - 1n) - 1n;
1425
- maxInt184 = 2n ** (184n - 1n) - 1n;
1426
- maxInt192 = 2n ** (192n - 1n) - 1n;
1427
- maxInt200 = 2n ** (200n - 1n) - 1n;
1428
- maxInt208 = 2n ** (208n - 1n) - 1n;
1429
- maxInt216 = 2n ** (216n - 1n) - 1n;
1430
- maxInt224 = 2n ** (224n - 1n) - 1n;
1431
- maxInt232 = 2n ** (232n - 1n) - 1n;
1432
- maxInt240 = 2n ** (240n - 1n) - 1n;
1433
- maxInt248 = 2n ** (248n - 1n) - 1n;
1434
- maxInt256 = 2n ** (256n - 1n) - 1n;
1435
- minInt8 = -(2n ** (8n - 1n));
1436
- minInt16 = -(2n ** (16n - 1n));
1437
- minInt24 = -(2n ** (24n - 1n));
1438
- minInt32 = -(2n ** (32n - 1n));
1439
- minInt40 = -(2n ** (40n - 1n));
1440
- minInt48 = -(2n ** (48n - 1n));
1441
- minInt56 = -(2n ** (56n - 1n));
1442
- minInt64 = -(2n ** (64n - 1n));
1443
- minInt72 = -(2n ** (72n - 1n));
1444
- minInt80 = -(2n ** (80n - 1n));
1445
- minInt88 = -(2n ** (88n - 1n));
1446
- minInt96 = -(2n ** (96n - 1n));
1447
- minInt104 = -(2n ** (104n - 1n));
1448
- minInt112 = -(2n ** (112n - 1n));
1449
- minInt120 = -(2n ** (120n - 1n));
1450
- minInt128 = -(2n ** (128n - 1n));
1451
- minInt136 = -(2n ** (136n - 1n));
1452
- minInt144 = -(2n ** (144n - 1n));
1453
- minInt152 = -(2n ** (152n - 1n));
1454
- minInt160 = -(2n ** (160n - 1n));
1455
- minInt168 = -(2n ** (168n - 1n));
1456
- minInt176 = -(2n ** (176n - 1n));
1457
- minInt184 = -(2n ** (184n - 1n));
1458
- minInt192 = -(2n ** (192n - 1n));
1459
- minInt200 = -(2n ** (200n - 1n));
1460
- minInt208 = -(2n ** (208n - 1n));
1461
- minInt216 = -(2n ** (216n - 1n));
1462
- minInt224 = -(2n ** (224n - 1n));
1463
- minInt232 = -(2n ** (232n - 1n));
1464
- minInt240 = -(2n ** (240n - 1n));
1465
- minInt248 = -(2n ** (248n - 1n));
1466
- minInt256 = -(2n ** (256n - 1n));
1467
- maxUint8 = 2n ** 8n - 1n;
1468
- maxUint16 = 2n ** 16n - 1n;
1469
- maxUint24 = 2n ** 24n - 1n;
1470
- maxUint32 = 2n ** 32n - 1n;
1471
- maxUint40 = 2n ** 40n - 1n;
1472
- maxUint48 = 2n ** 48n - 1n;
1473
- maxUint56 = 2n ** 56n - 1n;
1474
- maxUint64 = 2n ** 64n - 1n;
1475
- maxUint72 = 2n ** 72n - 1n;
1476
- maxUint80 = 2n ** 80n - 1n;
1477
- maxUint88 = 2n ** 88n - 1n;
1478
- maxUint96 = 2n ** 96n - 1n;
1479
- maxUint104 = 2n ** 104n - 1n;
1480
- maxUint112 = 2n ** 112n - 1n;
1481
- maxUint120 = 2n ** 120n - 1n;
1482
- maxUint128 = 2n ** 128n - 1n;
1483
- maxUint136 = 2n ** 136n - 1n;
1484
- maxUint144 = 2n ** 144n - 1n;
1485
- maxUint152 = 2n ** 152n - 1n;
1486
- maxUint160 = 2n ** 160n - 1n;
1487
- maxUint168 = 2n ** 168n - 1n;
1488
- maxUint176 = 2n ** 176n - 1n;
1489
- maxUint184 = 2n ** 184n - 1n;
1490
- maxUint192 = 2n ** 192n - 1n;
1491
- maxUint200 = 2n ** 200n - 1n;
1492
- maxUint208 = 2n ** 208n - 1n;
1493
- maxUint216 = 2n ** 216n - 1n;
1494
- maxUint224 = 2n ** 224n - 1n;
1495
- maxUint232 = 2n ** 232n - 1n;
1496
- maxUint240 = 2n ** 240n - 1n;
1497
- maxUint248 = 2n ** 248n - 1n;
1498
- maxUint256 = 2n ** 256n - 1n;
1499
- });
1500
-
1501
- // ../node_modules/@noble/hashes/esm/_md.js
1502
- function setBigUint64(view, byteOffset, value6, isLE2) {
1503
- if (typeof view.setBigUint64 === "function")
1504
- return view.setBigUint64(byteOffset, value6, isLE2);
1505
- const _32n2 = BigInt(32);
1506
- const _u32_max = BigInt(4294967295);
1507
- const wh = Number(value6 >> _32n2 & _u32_max);
1508
- const wl = Number(value6 & _u32_max);
1509
- const h = isLE2 ? 4 : 0;
1510
- const l = isLE2 ? 0 : 4;
1511
- view.setUint32(byteOffset + h, wh, isLE2);
1512
- view.setUint32(byteOffset + l, wl, isLE2);
1513
- }
1514
- function Chi(a, b, c) {
1515
- return a & b ^ ~a & c;
1516
- }
1517
- function Maj(a, b, c) {
1518
- return a & b ^ a & c ^ b & c;
1519
- }
1520
- var HashMD;
1521
- var init__md = __esm(() => {
1522
- init__assert();
1523
- init_utils();
1524
- HashMD = class HashMD extends Hash {
1525
- constructor(blockLen, outputLen, padOffset, isLE2) {
1526
- super();
1527
- this.blockLen = blockLen;
1528
- this.outputLen = outputLen;
1529
- this.padOffset = padOffset;
1530
- this.isLE = isLE2;
1531
- this.finished = false;
1532
- this.length = 0;
1533
- this.pos = 0;
1534
- this.destroyed = false;
1535
- this.buffer = new Uint8Array(blockLen);
1536
- this.view = createView(this.buffer);
1537
- }
1538
- update(data) {
1539
- aexists(this);
1540
- const { view, buffer: buffer3, blockLen } = this;
1541
- data = toBytes2(data);
1542
- const len = data.length;
1543
- for (let pos = 0;pos < len; ) {
1544
- const take10 = Math.min(blockLen - this.pos, len - pos);
1545
- if (take10 === blockLen) {
1546
- const dataView = createView(data);
1547
- for (;blockLen <= len - pos; pos += blockLen)
1548
- this.process(dataView, pos);
1549
- continue;
1550
- }
1551
- buffer3.set(data.subarray(pos, pos + take10), this.pos);
1552
- this.pos += take10;
1553
- pos += take10;
1554
- if (this.pos === blockLen) {
1555
- this.process(view, 0);
1556
- this.pos = 0;
1557
- }
1558
- }
1559
- this.length += data.length;
1560
- this.roundClean();
1561
- return this;
1562
- }
1563
- digestInto(out) {
1564
- aexists(this);
1565
- aoutput(out, this);
1566
- this.finished = true;
1567
- const { buffer: buffer3, view, blockLen, isLE: isLE2 } = this;
1568
- let { pos } = this;
1569
- buffer3[pos++] = 128;
1570
- this.buffer.subarray(pos).fill(0);
1571
- if (this.padOffset > blockLen - pos) {
1572
- this.process(view, 0);
1573
- pos = 0;
1574
- }
1575
- for (let i = pos;i < blockLen; i++)
1576
- buffer3[i] = 0;
1577
- setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
1578
- this.process(view, 0);
1579
- const oview = createView(out);
1580
- const len = this.outputLen;
1581
- if (len % 4)
1582
- throw new Error("_sha2: outputLen should be aligned to 32bit");
1583
- const outLen = len / 4;
1584
- const state = this.get();
1585
- if (outLen > state.length)
1586
- throw new Error("_sha2: outputLen bigger than state");
1587
- for (let i = 0;i < outLen; i++)
1588
- oview.setUint32(4 * i, state[i], isLE2);
1589
- }
1590
- digest() {
1591
- const { buffer: buffer3, outputLen } = this;
1592
- this.digestInto(buffer3);
1593
- const res = buffer3.slice(0, outputLen);
1594
- this.destroy();
1595
- return res;
1596
- }
1597
- _cloneInto(to) {
1598
- to || (to = new this.constructor);
1599
- to.set(...this.get());
1600
- const { blockLen, buffer: buffer3, length: length4, finished, destroyed, pos } = this;
1601
- to.length = length4;
1602
- to.pos = pos;
1603
- to.finished = finished;
1604
- to.destroyed = destroyed;
1605
- if (length4 % blockLen)
1606
- to.buffer.set(buffer3);
1607
- return to;
1608
- }
1609
- };
1610
- });
1611
-
1612
- // ../node_modules/@noble/hashes/esm/sha256.js
1613
- var SHA256_K, SHA256_IV, SHA256_W, SHA256, sha256;
1614
- var init_sha256 = __esm(() => {
1615
- init__md();
1616
- init_utils();
1617
- SHA256_K = /* @__PURE__ */ new Uint32Array([
1618
- 1116352408,
1619
- 1899447441,
1620
- 3049323471,
1621
- 3921009573,
1622
- 961987163,
1623
- 1508970993,
1624
- 2453635748,
1625
- 2870763221,
1626
- 3624381080,
1627
- 310598401,
1628
- 607225278,
1629
- 1426881987,
1630
- 1925078388,
1631
- 2162078206,
1632
- 2614888103,
1633
- 3248222580,
1634
- 3835390401,
1635
- 4022224774,
1636
- 264347078,
1637
- 604807628,
1638
- 770255983,
1639
- 1249150122,
1640
- 1555081692,
1641
- 1996064986,
1642
- 2554220882,
1643
- 2821834349,
1644
- 2952996808,
1645
- 3210313671,
1646
- 3336571891,
1647
- 3584528711,
1648
- 113926993,
1649
- 338241895,
1650
- 666307205,
1651
- 773529912,
1652
- 1294757372,
1653
- 1396182291,
1654
- 1695183700,
1655
- 1986661051,
1656
- 2177026350,
1657
- 2456956037,
1658
- 2730485921,
1659
- 2820302411,
1660
- 3259730800,
1661
- 3345764771,
1662
- 3516065817,
1663
- 3600352804,
1664
- 4094571909,
1665
- 275423344,
1666
- 430227734,
1667
- 506948616,
1668
- 659060556,
1669
- 883997877,
1670
- 958139571,
1671
- 1322822218,
1672
- 1537002063,
1673
- 1747873779,
1674
- 1955562222,
1675
- 2024104815,
1676
- 2227730452,
1677
- 2361852424,
1678
- 2428436474,
1679
- 2756734187,
1680
- 3204031479,
1681
- 3329325298
1682
- ]);
1683
- SHA256_IV = /* @__PURE__ */ new Uint32Array([
1684
- 1779033703,
1685
- 3144134277,
1686
- 1013904242,
1687
- 2773480762,
1688
- 1359893119,
1689
- 2600822924,
1690
- 528734635,
1691
- 1541459225
1692
- ]);
1693
- SHA256_W = /* @__PURE__ */ new Uint32Array(64);
1694
- SHA256 = class SHA256 extends HashMD {
1695
- constructor() {
1696
- super(64, 32, 8, false);
1697
- this.A = SHA256_IV[0] | 0;
1698
- this.B = SHA256_IV[1] | 0;
1699
- this.C = SHA256_IV[2] | 0;
1700
- this.D = SHA256_IV[3] | 0;
1701
- this.E = SHA256_IV[4] | 0;
1702
- this.F = SHA256_IV[5] | 0;
1703
- this.G = SHA256_IV[6] | 0;
1704
- this.H = SHA256_IV[7] | 0;
1705
- }
1706
- get() {
1707
- const { A, B, C, D, E, F, G, H } = this;
1708
- return [A, B, C, D, E, F, G, H];
1709
- }
1710
- set(A, B, C, D, E, F, G, H) {
1711
- this.A = A | 0;
1712
- this.B = B | 0;
1713
- this.C = C | 0;
1714
- this.D = D | 0;
1715
- this.E = E | 0;
1716
- this.F = F | 0;
1717
- this.G = G | 0;
1718
- this.H = H | 0;
1719
- }
1720
- process(view, offset) {
1721
- for (let i = 0;i < 16; i++, offset += 4)
1722
- SHA256_W[i] = view.getUint32(offset, false);
1723
- for (let i = 16;i < 64; i++) {
1724
- const W15 = SHA256_W[i - 15];
1725
- const W2 = SHA256_W[i - 2];
1726
- const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
1727
- const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
1728
- SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
1729
- }
1730
- let { A, B, C, D, E, F, G, H } = this;
1731
- for (let i = 0;i < 64; i++) {
1732
- const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
1733
- const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
1734
- const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
1735
- const T2 = sigma0 + Maj(A, B, C) | 0;
1736
- H = G;
1737
- G = F;
1738
- F = E;
1739
- E = D + T1 | 0;
1740
- D = C;
1741
- C = B;
1742
- B = A;
1743
- A = T1 + T2 | 0;
1744
- }
1745
- A = A + this.A | 0;
1746
- B = B + this.B | 0;
1747
- C = C + this.C | 0;
1748
- D = D + this.D | 0;
1749
- E = E + this.E | 0;
1750
- F = F + this.F | 0;
1751
- G = G + this.G | 0;
1752
- H = H + this.H | 0;
1753
- this.set(A, B, C, D, E, F, G, H);
1754
- }
1755
- roundClean() {
1756
- SHA256_W.fill(0);
1757
- }
1758
- destroy() {
1759
- this.set(0, 0, 0, 0, 0, 0, 0, 0);
1760
- this.buffer.fill(0);
1761
- }
1762
- };
1763
- sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256);
1764
- });
1765
-
1766
- // ../node_modules/viem/_esm/errors/chain.js
1767
- var InvalidChainIdError;
1768
- var init_chain = __esm(() => {
1769
- init_base();
1770
- InvalidChainIdError = class InvalidChainIdError extends BaseError {
1771
- constructor({ chainId }) {
1772
- super(typeof chainId === "number" ? `Chain ID "${chainId}" is invalid.` : "Chain ID is invalid.", { name: "InvalidChainIdError" });
1773
- }
1774
- };
1775
- });
1776
-
1777
44
  // ../node_modules/dotenv/package.json
1778
45
  var require_package = __commonJS((exports2, module2) => {
1779
46
  module2.exports = {
@@ -1847,7 +114,7 @@ var require_main = __commonJS((exports2, module2) => {
1847
114
  var os = require("os");
1848
115
  var crypto = require("crypto");
1849
116
  var packageJson = require_package();
1850
- var version2 = packageJson.version;
117
+ var version = packageJson.version;
1851
118
  var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
1852
119
  function parse3(src) {
1853
120
  const obj = {};
@@ -1896,10 +163,10 @@ var require_main = __commonJS((exports2, module2) => {
1896
163
  return DotenvModule.parse(decrypted);
1897
164
  }
1898
165
  function _warn(message) {
1899
- console.log(`[dotenv@${version2}][WARN] ${message}`);
166
+ console.log(`[dotenv@${version}][WARN] ${message}`);
1900
167
  }
1901
168
  function _debug(message) {
1902
- console.log(`[dotenv@${version2}][DEBUG] ${message}`);
169
+ console.log(`[dotenv@${version}][DEBUG] ${message}`);
1903
170
  }
1904
171
  function _dotenvKey(options) {
1905
172
  if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
@@ -2433,7 +700,8 @@ var tracingFunction = (name) => {
2433
700
  };
2434
701
  };
2435
702
  var internalCall = /* @__PURE__ */ tracingFunction("effect_internal_function");
2436
- var genConstructor = function* () {}.constructor;
703
+ var genConstructor = function* () {
704
+ }.constructor;
2437
705
 
2438
706
  // ../node_modules/effect/dist/esm/Hash.js
2439
707
  var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => new WeakMap);
@@ -2780,7 +1048,8 @@ var StructuralCommitPrototype = {
2780
1048
  ...StructuralPrototype
2781
1049
  };
2782
1050
  var Base = /* @__PURE__ */ function() {
2783
- function Base2() {}
1051
+ function Base2() {
1052
+ }
2784
1053
  Base2.prototype = CommitPrototype;
2785
1054
  return Base2;
2786
1055
  }();
@@ -6283,7 +4552,8 @@ var Reference = () => (id, options) => {
6283
4552
  Error.stackTraceLimit = 2;
6284
4553
  const creationError = new Error;
6285
4554
  Error.stackTraceLimit = limit;
6286
- function ReferenceClass() {}
4555
+ function ReferenceClass() {
4556
+ }
6287
4557
  Object.setPrototypeOf(ReferenceClass, ReferenceProto);
6288
4558
  ReferenceClass.key = id;
6289
4559
  ReferenceClass.defaultValue = options.defaultValue;
@@ -9223,7 +7493,8 @@ var prettyErrorMessage = (u) => {
9223
7493
  if (hasProperty(u, "toString") && isFunction2(u["toString"]) && u["toString"] !== Object.prototype.toString && u["toString"] !== globalThis.Array.prototype.toString) {
9224
7494
  return u["toString"]();
9225
7495
  }
9226
- } catch {}
7496
+ } catch {
7497
+ }
9227
7498
  return stringifyCircular(u);
9228
7499
  };
9229
7500
  var locationRegex = /\((.*)\)/g;
@@ -9797,7 +8068,8 @@ var zip2 = /* @__PURE__ */ dual(2, (self, that) => flatMap6(self, (a) => map9(th
9797
8068
  var zipLeft = /* @__PURE__ */ dual(2, (self, that) => flatMap6(self, (a) => as(that, a)));
9798
8069
  var zipRight = /* @__PURE__ */ dual(2, (self, that) => flatMap6(self, () => that));
9799
8070
  var never = /* @__PURE__ */ asyncInterrupt(() => {
9800
- const interval = setInterval(() => {}, 2 ** 31 - 1);
8071
+ const interval = setInterval(() => {
8072
+ }, 2 ** 31 - 1);
9801
8073
  return sync(() => clearInterval(interval));
9802
8074
  });
9803
8075
  var interruptFiber = (self) => flatMap6(fiberId, (fiberId2) => pipe(self, interruptAsFiber(fiberId2)));
@@ -13617,11 +11889,16 @@ class Const {
13617
11889
  get value() {
13618
11890
  return this.effect;
13619
11891
  }
13620
- onStart(_context, _effect, _parent, _fiber) {}
13621
- onEnd(_value, _fiber) {}
13622
- onEffect(_fiber, _effect) {}
13623
- onSuspend(_fiber) {}
13624
- onResume(_fiber) {}
11892
+ onStart(_context, _effect, _parent, _fiber) {
11893
+ }
11894
+ onEnd(_value, _fiber) {
11895
+ }
11896
+ onEffect(_fiber, _effect) {
11897
+ }
11898
+ onSuspend(_fiber) {
11899
+ }
11900
+ onResume(_fiber) {
11901
+ }
13625
11902
  map(f) {
13626
11903
  return new ProxySupervisor(this, pipe(this.value, map9(f)));
13627
11904
  }
@@ -14095,7 +12372,8 @@ class FiberRuntime extends Class {
14095
12372
  return whileLoop({
14096
12373
  while: () => !isDone3,
14097
12374
  body,
14098
- step: () => {}
12375
+ step: () => {
12376
+ }
14099
12377
  });
14100
12378
  }
14101
12379
  return null;
@@ -23625,832 +21903,6 @@ class TrieIterator {
23625
21903
  }
23626
21904
  }
23627
21905
  var isTrie = (u) => hasProperty(u, TrieTypeId);
23628
- // ../node_modules/viem/_esm/utils/encoding/toRlp.js
23629
- init_base();
23630
- init_cursor2();
23631
- init_toBytes();
23632
- init_toHex();
23633
- function toRlp(bytes, to = "hex") {
23634
- const encodable = getEncodable(bytes);
23635
- const cursor = createCursor(new Uint8Array(encodable.length));
23636
- encodable.encode(cursor);
23637
- if (to === "hex")
23638
- return bytesToHex2(cursor.bytes);
23639
- return cursor.bytes;
23640
- }
23641
- function getEncodable(bytes) {
23642
- if (Array.isArray(bytes))
23643
- return getEncodableList(bytes.map((x) => getEncodable(x)));
23644
- return getEncodableBytes(bytes);
23645
- }
23646
- function getEncodableList(list) {
23647
- const bodyLength = list.reduce((acc, x) => acc + x.length, 0);
23648
- const sizeOfBodyLength = getSizeOfLength(bodyLength);
23649
- const length4 = (() => {
23650
- if (bodyLength <= 55)
23651
- return 1 + bodyLength;
23652
- return 1 + sizeOfBodyLength + bodyLength;
23653
- })();
23654
- return {
23655
- length: length4,
23656
- encode(cursor) {
23657
- if (bodyLength <= 55) {
23658
- cursor.pushByte(192 + bodyLength);
23659
- } else {
23660
- cursor.pushByte(192 + 55 + sizeOfBodyLength);
23661
- if (sizeOfBodyLength === 1)
23662
- cursor.pushUint8(bodyLength);
23663
- else if (sizeOfBodyLength === 2)
23664
- cursor.pushUint16(bodyLength);
23665
- else if (sizeOfBodyLength === 3)
23666
- cursor.pushUint24(bodyLength);
23667
- else
23668
- cursor.pushUint32(bodyLength);
23669
- }
23670
- for (const { encode: encode6 } of list) {
23671
- encode6(cursor);
23672
- }
23673
- }
23674
- };
23675
- }
23676
- function getEncodableBytes(bytesOrHex) {
23677
- const bytes = typeof bytesOrHex === "string" ? hexToBytes(bytesOrHex) : bytesOrHex;
23678
- const sizeOfBytesLength = getSizeOfLength(bytes.length);
23679
- const length4 = (() => {
23680
- if (bytes.length === 1 && bytes[0] < 128)
23681
- return 1;
23682
- if (bytes.length <= 55)
23683
- return 1 + bytes.length;
23684
- return 1 + sizeOfBytesLength + bytes.length;
23685
- })();
23686
- return {
23687
- length: length4,
23688
- encode(cursor) {
23689
- if (bytes.length === 1 && bytes[0] < 128) {
23690
- cursor.pushBytes(bytes);
23691
- } else if (bytes.length <= 55) {
23692
- cursor.pushByte(128 + bytes.length);
23693
- cursor.pushBytes(bytes);
23694
- } else {
23695
- cursor.pushByte(128 + 55 + sizeOfBytesLength);
23696
- if (sizeOfBytesLength === 1)
23697
- cursor.pushUint8(bytes.length);
23698
- else if (sizeOfBytesLength === 2)
23699
- cursor.pushUint16(bytes.length);
23700
- else if (sizeOfBytesLength === 3)
23701
- cursor.pushUint24(bytes.length);
23702
- else
23703
- cursor.pushUint32(bytes.length);
23704
- cursor.pushBytes(bytes);
23705
- }
23706
- }
23707
- };
23708
- }
23709
- function getSizeOfLength(length4) {
23710
- if (length4 < 2 ** 8)
23711
- return 1;
23712
- if (length4 < 2 ** 16)
23713
- return 2;
23714
- if (length4 < 2 ** 24)
23715
- return 3;
23716
- if (length4 < 2 ** 32)
23717
- return 4;
23718
- throw new BaseError("Length is too large.");
23719
- }
23720
- // ../node_modules/viem/_esm/utils/formatters/transaction.js
23721
- init_fromHex();
23722
- var transactionType = {
23723
- "0x0": "legacy",
23724
- "0x1": "eip2930",
23725
- "0x2": "eip1559",
23726
- "0x3": "eip4844",
23727
- "0x4": "eip7702"
23728
- };
23729
- function formatTransaction(transaction) {
23730
- const transaction_ = {
23731
- ...transaction,
23732
- blockHash: transaction.blockHash ? transaction.blockHash : null,
23733
- blockNumber: transaction.blockNumber ? BigInt(transaction.blockNumber) : null,
23734
- chainId: transaction.chainId ? hexToNumber(transaction.chainId) : undefined,
23735
- gas: transaction.gas ? BigInt(transaction.gas) : undefined,
23736
- gasPrice: transaction.gasPrice ? BigInt(transaction.gasPrice) : undefined,
23737
- maxFeePerBlobGas: transaction.maxFeePerBlobGas ? BigInt(transaction.maxFeePerBlobGas) : undefined,
23738
- maxFeePerGas: transaction.maxFeePerGas ? BigInt(transaction.maxFeePerGas) : undefined,
23739
- maxPriorityFeePerGas: transaction.maxPriorityFeePerGas ? BigInt(transaction.maxPriorityFeePerGas) : undefined,
23740
- nonce: transaction.nonce ? hexToNumber(transaction.nonce) : undefined,
23741
- to: transaction.to ? transaction.to : null,
23742
- transactionIndex: transaction.transactionIndex ? Number(transaction.transactionIndex) : null,
23743
- type: transaction.type ? transactionType[transaction.type] : undefined,
23744
- typeHex: transaction.type ? transaction.type : undefined,
23745
- value: transaction.value ? BigInt(transaction.value) : undefined,
23746
- v: transaction.v ? BigInt(transaction.v) : undefined
23747
- };
23748
- if (transaction.authorizationList)
23749
- transaction_.authorizationList = formatAuthorizationList(transaction.authorizationList);
23750
- transaction_.yParity = (() => {
23751
- if (transaction.yParity)
23752
- return Number(transaction.yParity);
23753
- if (typeof transaction_.v === "bigint") {
23754
- if (transaction_.v === 0n || transaction_.v === 27n)
23755
- return 0;
23756
- if (transaction_.v === 1n || transaction_.v === 28n)
23757
- return 1;
23758
- if (transaction_.v >= 35n)
23759
- return transaction_.v % 2n === 0n ? 1 : 0;
23760
- }
23761
- return;
23762
- })();
23763
- if (transaction_.type === "legacy") {
23764
- delete transaction_.accessList;
23765
- delete transaction_.maxFeePerBlobGas;
23766
- delete transaction_.maxFeePerGas;
23767
- delete transaction_.maxPriorityFeePerGas;
23768
- delete transaction_.yParity;
23769
- }
23770
- if (transaction_.type === "eip2930") {
23771
- delete transaction_.maxFeePerBlobGas;
23772
- delete transaction_.maxFeePerGas;
23773
- delete transaction_.maxPriorityFeePerGas;
23774
- }
23775
- if (transaction_.type === "eip1559") {
23776
- delete transaction_.maxFeePerBlobGas;
23777
- }
23778
- return transaction_;
23779
- }
23780
- var defineTransaction = /* @__PURE__ */ defineFormatter("transaction", formatTransaction);
23781
- function formatAuthorizationList(authorizationList) {
23782
- return authorizationList.map((authorization) => ({
23783
- address: authorization.address,
23784
- chainId: Number(authorization.chainId),
23785
- nonce: Number(authorization.nonce),
23786
- r: authorization.r,
23787
- s: authorization.s,
23788
- yParity: Number(authorization.yParity)
23789
- }));
23790
- }
23791
-
23792
- // ../node_modules/viem/_esm/utils/formatters/block.js
23793
- function formatBlock(block) {
23794
- const transactions = (block.transactions ?? []).map((transaction) => {
23795
- if (typeof transaction === "string")
23796
- return transaction;
23797
- return formatTransaction(transaction);
23798
- });
23799
- return {
23800
- ...block,
23801
- baseFeePerGas: block.baseFeePerGas ? BigInt(block.baseFeePerGas) : null,
23802
- blobGasUsed: block.blobGasUsed ? BigInt(block.blobGasUsed) : undefined,
23803
- difficulty: block.difficulty ? BigInt(block.difficulty) : undefined,
23804
- excessBlobGas: block.excessBlobGas ? BigInt(block.excessBlobGas) : undefined,
23805
- gasLimit: block.gasLimit ? BigInt(block.gasLimit) : undefined,
23806
- gasUsed: block.gasUsed ? BigInt(block.gasUsed) : undefined,
23807
- hash: block.hash ? block.hash : null,
23808
- logsBloom: block.logsBloom ? block.logsBloom : null,
23809
- nonce: block.nonce ? block.nonce : null,
23810
- number: block.number ? BigInt(block.number) : null,
23811
- size: block.size ? BigInt(block.size) : undefined,
23812
- timestamp: block.timestamp ? BigInt(block.timestamp) : undefined,
23813
- transactions,
23814
- totalDifficulty: block.totalDifficulty ? BigInt(block.totalDifficulty) : null
23815
- };
23816
- }
23817
- var defineBlock = /* @__PURE__ */ defineFormatter("block", formatBlock);
23818
-
23819
- // ../node_modules/viem/_esm/utils/blob/blobsToCommitments.js
23820
- init_toBytes();
23821
- init_toHex();
23822
- function blobsToCommitments(parameters) {
23823
- const { kzg } = parameters;
23824
- const to = parameters.to ?? (typeof parameters.blobs[0] === "string" ? "hex" : "bytes");
23825
- const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes(x)) : parameters.blobs;
23826
- const commitments = [];
23827
- for (const blob of blobs)
23828
- commitments.push(Uint8Array.from(kzg.blobToKzgCommitment(blob)));
23829
- return to === "bytes" ? commitments : commitments.map((x) => bytesToHex2(x));
23830
- }
23831
-
23832
- // ../node_modules/viem/_esm/utils/blob/blobsToProofs.js
23833
- init_toBytes();
23834
- init_toHex();
23835
- function blobsToProofs(parameters) {
23836
- const { kzg } = parameters;
23837
- const to = parameters.to ?? (typeof parameters.blobs[0] === "string" ? "hex" : "bytes");
23838
- const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes(x)) : parameters.blobs;
23839
- const commitments = typeof parameters.commitments[0] === "string" ? parameters.commitments.map((x) => hexToBytes(x)) : parameters.commitments;
23840
- const proofs = [];
23841
- for (let i = 0;i < blobs.length; i++) {
23842
- const blob = blobs[i];
23843
- const commitment = commitments[i];
23844
- proofs.push(Uint8Array.from(kzg.computeBlobKzgProof(blob, commitment)));
23845
- }
23846
- return to === "bytes" ? proofs : proofs.map((x) => bytesToHex2(x));
23847
- }
23848
-
23849
- // ../node_modules/viem/_esm/utils/blob/commitmentToVersionedHash.js
23850
- init_toHex();
23851
-
23852
- // ../node_modules/viem/_esm/utils/hash/sha256.js
23853
- init_sha256();
23854
- init_toBytes();
23855
- init_toHex();
23856
- function sha2562(value6, to_) {
23857
- const to = to_ || "hex";
23858
- const bytes = sha256(isHex(value6, { strict: false }) ? toBytes(value6) : value6);
23859
- if (to === "bytes")
23860
- return bytes;
23861
- return toHex(bytes);
23862
- }
23863
-
23864
- // ../node_modules/viem/_esm/utils/blob/commitmentToVersionedHash.js
23865
- function commitmentToVersionedHash(parameters) {
23866
- const { commitment, version: version2 = 1 } = parameters;
23867
- const to = parameters.to ?? (typeof commitment === "string" ? "hex" : "bytes");
23868
- const versionedHash = sha2562(commitment, "bytes");
23869
- versionedHash.set([version2], 0);
23870
- return to === "bytes" ? versionedHash : bytesToHex2(versionedHash);
23871
- }
23872
-
23873
- // ../node_modules/viem/_esm/utils/blob/commitmentsToVersionedHashes.js
23874
- function commitmentsToVersionedHashes(parameters) {
23875
- const { commitments, version: version2 } = parameters;
23876
- const to = parameters.to ?? (typeof commitments[0] === "string" ? "hex" : "bytes");
23877
- const hashes = [];
23878
- for (const commitment of commitments) {
23879
- hashes.push(commitmentToVersionedHash({
23880
- commitment,
23881
- to,
23882
- version: version2
23883
- }));
23884
- }
23885
- return hashes;
23886
- }
23887
-
23888
- // ../node_modules/viem/_esm/constants/blob.js
23889
- var blobsPerTransaction = 6;
23890
- var bytesPerFieldElement = 32;
23891
- var fieldElementsPerBlob = 4096;
23892
- var bytesPerBlob = bytesPerFieldElement * fieldElementsPerBlob;
23893
- var maxBytesPerTransaction = bytesPerBlob * blobsPerTransaction - 1 - 1 * fieldElementsPerBlob * blobsPerTransaction;
23894
-
23895
- // ../node_modules/viem/_esm/constants/kzg.js
23896
- var versionedHashVersionKzg = 1;
23897
-
23898
- // ../node_modules/viem/_esm/errors/blob.js
23899
- init_base();
23900
-
23901
- class BlobSizeTooLargeError extends BaseError {
23902
- constructor({ maxSize, size: size22 }) {
23903
- super("Blob size is too large.", {
23904
- metaMessages: [`Max: ${maxSize} bytes`, `Given: ${size22} bytes`],
23905
- name: "BlobSizeTooLargeError"
23906
- });
23907
- }
23908
- }
23909
-
23910
- class EmptyBlobError extends BaseError {
23911
- constructor() {
23912
- super("Blob data must not be empty.", { name: "EmptyBlobError" });
23913
- }
23914
- }
23915
-
23916
- class InvalidVersionedHashSizeError extends BaseError {
23917
- constructor({ hash: hash2, size: size22 }) {
23918
- super(`Versioned hash "${hash2}" size is invalid.`, {
23919
- metaMessages: ["Expected: 32", `Received: ${size22}`],
23920
- name: "InvalidVersionedHashSizeError"
23921
- });
23922
- }
23923
- }
23924
-
23925
- class InvalidVersionedHashVersionError extends BaseError {
23926
- constructor({ hash: hash2, version: version2 }) {
23927
- super(`Versioned hash "${hash2}" version is invalid.`, {
23928
- metaMessages: [
23929
- `Expected: ${versionedHashVersionKzg}`,
23930
- `Received: ${version2}`
23931
- ],
23932
- name: "InvalidVersionedHashVersionError"
23933
- });
23934
- }
23935
- }
23936
-
23937
- // ../node_modules/viem/_esm/utils/blob/toBlobs.js
23938
- init_cursor2();
23939
- init_size();
23940
- init_toBytes();
23941
- init_toHex();
23942
- function toBlobs(parameters) {
23943
- const to = parameters.to ?? (typeof parameters.data === "string" ? "hex" : "bytes");
23944
- const data = typeof parameters.data === "string" ? hexToBytes(parameters.data) : parameters.data;
23945
- const size_ = size21(data);
23946
- if (!size_)
23947
- throw new EmptyBlobError;
23948
- if (size_ > maxBytesPerTransaction)
23949
- throw new BlobSizeTooLargeError({
23950
- maxSize: maxBytesPerTransaction,
23951
- size: size_
23952
- });
23953
- const blobs = [];
23954
- let active2 = true;
23955
- let position = 0;
23956
- while (active2) {
23957
- const blob = createCursor(new Uint8Array(bytesPerBlob));
23958
- let size22 = 0;
23959
- while (size22 < fieldElementsPerBlob) {
23960
- const bytes = data.slice(position, position + (bytesPerFieldElement - 1));
23961
- blob.pushByte(0);
23962
- blob.pushBytes(bytes);
23963
- if (bytes.length < 31) {
23964
- blob.pushByte(128);
23965
- active2 = false;
23966
- break;
23967
- }
23968
- size22++;
23969
- position += 31;
23970
- }
23971
- blobs.push(blob);
23972
- }
23973
- return to === "bytes" ? blobs.map((x) => x.bytes) : blobs.map((x) => bytesToHex2(x.bytes));
23974
- }
23975
-
23976
- // ../node_modules/viem/_esm/utils/blob/toBlobSidecars.js
23977
- function toBlobSidecars(parameters) {
23978
- const { data, kzg, to } = parameters;
23979
- const blobs = parameters.blobs ?? toBlobs({ data, to });
23980
- const commitments = parameters.commitments ?? blobsToCommitments({ blobs, kzg, to });
23981
- const proofs = parameters.proofs ?? blobsToProofs({ blobs, commitments, kzg, to });
23982
- const sidecars = [];
23983
- for (let i = 0;i < blobs.length; i++)
23984
- sidecars.push({
23985
- blob: blobs[i],
23986
- commitment: commitments[i],
23987
- proof: proofs[i]
23988
- });
23989
- return sidecars;
23990
- }
23991
-
23992
- // ../node_modules/viem/_esm/utils/transaction/getTransactionType.js
23993
- init_transaction();
23994
- function getTransactionType(transaction) {
23995
- if (transaction.type)
23996
- return transaction.type;
23997
- if (typeof transaction.authorizationList !== "undefined")
23998
- return "eip7702";
23999
- if (typeof transaction.blobs !== "undefined" || typeof transaction.blobVersionedHashes !== "undefined" || typeof transaction.maxFeePerBlobGas !== "undefined" || typeof transaction.sidecars !== "undefined")
24000
- return "eip4844";
24001
- if (typeof transaction.maxFeePerGas !== "undefined" || typeof transaction.maxPriorityFeePerGas !== "undefined") {
24002
- return "eip1559";
24003
- }
24004
- if (typeof transaction.gasPrice !== "undefined") {
24005
- if (typeof transaction.accessList !== "undefined")
24006
- return "eip2930";
24007
- return "legacy";
24008
- }
24009
- throw new InvalidSerializableTransactionError({ transaction });
24010
- }
24011
-
24012
- // ../node_modules/viem/_esm/utils/formatters/log.js
24013
- function formatLog(log3, { args: args2, eventName } = {}) {
24014
- return {
24015
- ...log3,
24016
- blockHash: log3.blockHash ? log3.blockHash : null,
24017
- blockNumber: log3.blockNumber ? BigInt(log3.blockNumber) : null,
24018
- logIndex: log3.logIndex ? Number(log3.logIndex) : null,
24019
- transactionHash: log3.transactionHash ? log3.transactionHash : null,
24020
- transactionIndex: log3.transactionIndex ? Number(log3.transactionIndex) : null,
24021
- ...eventName ? { args: args2, eventName } : {}
24022
- };
24023
- }
24024
-
24025
- // ../node_modules/viem/_esm/utils/chain/defineChain.js
24026
- function defineChain(chain) {
24027
- return {
24028
- formatters: undefined,
24029
- fees: undefined,
24030
- serializers: undefined,
24031
- ...chain
24032
- };
24033
- }
24034
-
24035
- // ../node_modules/viem/_esm/utils/abi/encodePacked.js
24036
- init_abi();
24037
- init_address();
24038
- init_isAddress();
24039
- init_pad();
24040
- init_toHex();
24041
- init_regex();
24042
- function encodePacked(types, values7) {
24043
- if (types.length !== values7.length)
24044
- throw new AbiEncodingLengthMismatchError({
24045
- expectedLength: types.length,
24046
- givenLength: values7.length
24047
- });
24048
- const data = [];
24049
- for (let i = 0;i < types.length; i++) {
24050
- const type2 = types[i];
24051
- const value6 = values7[i];
24052
- data.push(encode6(type2, value6));
24053
- }
24054
- return concatHex(data);
24055
- }
24056
- function encode6(type2, value6, isArray2 = false) {
24057
- if (type2 === "address") {
24058
- const address = value6;
24059
- if (!isAddress(address))
24060
- throw new InvalidAddressError({ address });
24061
- return pad(address.toLowerCase(), {
24062
- size: isArray2 ? 32 : null
24063
- });
24064
- }
24065
- if (type2 === "string")
24066
- return stringToHex(value6);
24067
- if (type2 === "bytes")
24068
- return value6;
24069
- if (type2 === "bool")
24070
- return pad(boolToHex(value6), { size: isArray2 ? 32 : 1 });
24071
- const intMatch = type2.match(integerRegex);
24072
- if (intMatch) {
24073
- const [_type, baseType, bits = "256"] = intMatch;
24074
- const size22 = Number.parseInt(bits) / 8;
24075
- return numberToHex(value6, {
24076
- size: isArray2 ? 32 : size22,
24077
- signed: baseType === "int"
24078
- });
24079
- }
24080
- const bytesMatch = type2.match(bytesRegex);
24081
- if (bytesMatch) {
24082
- const [_type, size22] = bytesMatch;
24083
- if (Number.parseInt(size22) !== (value6.length - 2) / 2)
24084
- throw new BytesSizeMismatchError({
24085
- expectedSize: Number.parseInt(size22),
24086
- givenSize: (value6.length - 2) / 2
24087
- });
24088
- return pad(value6, { dir: "right", size: isArray2 ? 32 : null });
24089
- }
24090
- const arrayMatch = type2.match(arrayRegex);
24091
- if (arrayMatch && Array.isArray(value6)) {
24092
- const [_type, childType] = arrayMatch;
24093
- const data = [];
24094
- for (let i = 0;i < value6.length; i++) {
24095
- data.push(encode6(childType, value6[i], true));
24096
- }
24097
- if (data.length === 0)
24098
- return "0x";
24099
- return concatHex(data);
24100
- }
24101
- throw new UnsupportedPackedAbiType(type2);
24102
- }
24103
-
24104
- // ../node_modules/viem/_esm/utils/authorization/serializeAuthorizationList.js
24105
- init_toHex();
24106
-
24107
- // ../node_modules/viem/_esm/utils/transaction/serializeTransaction.js
24108
- init_transaction();
24109
- init_toHex();
24110
-
24111
- // ../node_modules/viem/_esm/utils/transaction/assertTransaction.js
24112
- init_number();
24113
- init_address();
24114
- init_base();
24115
- init_chain();
24116
- init_node();
24117
- init_isAddress();
24118
- init_size();
24119
- init_slice();
24120
- init_fromHex();
24121
- function assertTransactionEIP7702(transaction) {
24122
- const { authorizationList } = transaction;
24123
- if (authorizationList) {
24124
- for (const authorization of authorizationList) {
24125
- const { chainId } = authorization;
24126
- const address = authorization.address;
24127
- if (!isAddress(address))
24128
- throw new InvalidAddressError({ address });
24129
- if (chainId < 0)
24130
- throw new InvalidChainIdError({ chainId });
24131
- }
24132
- }
24133
- assertTransactionEIP1559(transaction);
24134
- }
24135
- function assertTransactionEIP4844(transaction) {
24136
- const { blobVersionedHashes } = transaction;
24137
- if (blobVersionedHashes) {
24138
- if (blobVersionedHashes.length === 0)
24139
- throw new EmptyBlobError;
24140
- for (const hash2 of blobVersionedHashes) {
24141
- const size_ = size21(hash2);
24142
- const version2 = hexToNumber(slice(hash2, 0, 1));
24143
- if (size_ !== 32)
24144
- throw new InvalidVersionedHashSizeError({ hash: hash2, size: size_ });
24145
- if (version2 !== versionedHashVersionKzg)
24146
- throw new InvalidVersionedHashVersionError({
24147
- hash: hash2,
24148
- version: version2
24149
- });
24150
- }
24151
- }
24152
- assertTransactionEIP1559(transaction);
24153
- }
24154
- function assertTransactionEIP1559(transaction) {
24155
- const { chainId, maxPriorityFeePerGas, maxFeePerGas, to } = transaction;
24156
- if (chainId <= 0)
24157
- throw new InvalidChainIdError({ chainId });
24158
- if (to && !isAddress(to))
24159
- throw new InvalidAddressError({ address: to });
24160
- if (maxFeePerGas && maxFeePerGas > maxUint256)
24161
- throw new FeeCapTooHighError({ maxFeePerGas });
24162
- if (maxPriorityFeePerGas && maxFeePerGas && maxPriorityFeePerGas > maxFeePerGas)
24163
- throw new TipAboveFeeCapError({ maxFeePerGas, maxPriorityFeePerGas });
24164
- }
24165
- function assertTransactionEIP2930(transaction) {
24166
- const { chainId, maxPriorityFeePerGas, gasPrice, maxFeePerGas, to } = transaction;
24167
- if (chainId <= 0)
24168
- throw new InvalidChainIdError({ chainId });
24169
- if (to && !isAddress(to))
24170
- throw new InvalidAddressError({ address: to });
24171
- if (maxPriorityFeePerGas || maxFeePerGas)
24172
- throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");
24173
- if (gasPrice && gasPrice > maxUint256)
24174
- throw new FeeCapTooHighError({ maxFeePerGas: gasPrice });
24175
- }
24176
- function assertTransactionLegacy(transaction) {
24177
- const { chainId, maxPriorityFeePerGas, gasPrice, maxFeePerGas, to } = transaction;
24178
- if (to && !isAddress(to))
24179
- throw new InvalidAddressError({ address: to });
24180
- if (typeof chainId !== "undefined" && chainId <= 0)
24181
- throw new InvalidChainIdError({ chainId });
24182
- if (maxPriorityFeePerGas || maxFeePerGas)
24183
- throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");
24184
- if (gasPrice && gasPrice > maxUint256)
24185
- throw new FeeCapTooHighError({ maxFeePerGas: gasPrice });
24186
- }
24187
-
24188
- // ../node_modules/viem/_esm/utils/transaction/serializeAccessList.js
24189
- init_address();
24190
- init_transaction();
24191
- init_isAddress();
24192
- function serializeAccessList(accessList) {
24193
- if (!accessList || accessList.length === 0)
24194
- return [];
24195
- const serializedAccessList = [];
24196
- for (let i = 0;i < accessList.length; i++) {
24197
- const { address, storageKeys } = accessList[i];
24198
- for (let j = 0;j < storageKeys.length; j++) {
24199
- if (storageKeys[j].length - 2 !== 64) {
24200
- throw new InvalidStorageKeySizeError({ storageKey: storageKeys[j] });
24201
- }
24202
- }
24203
- if (!isAddress(address, { strict: false })) {
24204
- throw new InvalidAddressError({ address });
24205
- }
24206
- serializedAccessList.push([address, storageKeys]);
24207
- }
24208
- return serializedAccessList;
24209
- }
24210
-
24211
- // ../node_modules/viem/_esm/utils/transaction/serializeTransaction.js
24212
- function serializeTransaction(transaction, signature) {
24213
- const type2 = getTransactionType(transaction);
24214
- if (type2 === "eip1559")
24215
- return serializeTransactionEIP1559(transaction, signature);
24216
- if (type2 === "eip2930")
24217
- return serializeTransactionEIP2930(transaction, signature);
24218
- if (type2 === "eip4844")
24219
- return serializeTransactionEIP4844(transaction, signature);
24220
- if (type2 === "eip7702")
24221
- return serializeTransactionEIP7702(transaction, signature);
24222
- return serializeTransactionLegacy(transaction, signature);
24223
- }
24224
- function serializeTransactionEIP7702(transaction, signature) {
24225
- const { authorizationList, chainId, gas, nonce, to, value: value6, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
24226
- assertTransactionEIP7702(transaction);
24227
- const serializedAccessList = serializeAccessList(accessList);
24228
- const serializedAuthorizationList = serializeAuthorizationList(authorizationList);
24229
- return concatHex([
24230
- "0x04",
24231
- toRlp([
24232
- toHex(chainId),
24233
- nonce ? toHex(nonce) : "0x",
24234
- maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : "0x",
24235
- maxFeePerGas ? toHex(maxFeePerGas) : "0x",
24236
- gas ? toHex(gas) : "0x",
24237
- to ?? "0x",
24238
- value6 ? toHex(value6) : "0x",
24239
- data ?? "0x",
24240
- serializedAccessList,
24241
- serializedAuthorizationList,
24242
- ...toYParitySignatureArray(transaction, signature)
24243
- ])
24244
- ]);
24245
- }
24246
- function serializeTransactionEIP4844(transaction, signature) {
24247
- const { chainId, gas, nonce, to, value: value6, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
24248
- assertTransactionEIP4844(transaction);
24249
- let blobVersionedHashes = transaction.blobVersionedHashes;
24250
- let sidecars = transaction.sidecars;
24251
- if (transaction.blobs && (typeof blobVersionedHashes === "undefined" || typeof sidecars === "undefined")) {
24252
- const blobs2 = typeof transaction.blobs[0] === "string" ? transaction.blobs : transaction.blobs.map((x) => bytesToHex2(x));
24253
- const kzg = transaction.kzg;
24254
- const commitments2 = blobsToCommitments({
24255
- blobs: blobs2,
24256
- kzg
24257
- });
24258
- if (typeof blobVersionedHashes === "undefined")
24259
- blobVersionedHashes = commitmentsToVersionedHashes({
24260
- commitments: commitments2
24261
- });
24262
- if (typeof sidecars === "undefined") {
24263
- const proofs2 = blobsToProofs({ blobs: blobs2, commitments: commitments2, kzg });
24264
- sidecars = toBlobSidecars({ blobs: blobs2, commitments: commitments2, proofs: proofs2 });
24265
- }
24266
- }
24267
- const serializedAccessList = serializeAccessList(accessList);
24268
- const serializedTransaction = [
24269
- toHex(chainId),
24270
- nonce ? toHex(nonce) : "0x",
24271
- maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : "0x",
24272
- maxFeePerGas ? toHex(maxFeePerGas) : "0x",
24273
- gas ? toHex(gas) : "0x",
24274
- to ?? "0x",
24275
- value6 ? toHex(value6) : "0x",
24276
- data ?? "0x",
24277
- serializedAccessList,
24278
- maxFeePerBlobGas ? toHex(maxFeePerBlobGas) : "0x",
24279
- blobVersionedHashes ?? [],
24280
- ...toYParitySignatureArray(transaction, signature)
24281
- ];
24282
- const blobs = [];
24283
- const commitments = [];
24284
- const proofs = [];
24285
- if (sidecars)
24286
- for (let i = 0;i < sidecars.length; i++) {
24287
- const { blob, commitment, proof } = sidecars[i];
24288
- blobs.push(blob);
24289
- commitments.push(commitment);
24290
- proofs.push(proof);
24291
- }
24292
- return concatHex([
24293
- "0x03",
24294
- sidecars ? toRlp([serializedTransaction, blobs, commitments, proofs]) : toRlp(serializedTransaction)
24295
- ]);
24296
- }
24297
- function serializeTransactionEIP1559(transaction, signature) {
24298
- const { chainId, gas, nonce, to, value: value6, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
24299
- assertTransactionEIP1559(transaction);
24300
- const serializedAccessList = serializeAccessList(accessList);
24301
- const serializedTransaction = [
24302
- toHex(chainId),
24303
- nonce ? toHex(nonce) : "0x",
24304
- maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : "0x",
24305
- maxFeePerGas ? toHex(maxFeePerGas) : "0x",
24306
- gas ? toHex(gas) : "0x",
24307
- to ?? "0x",
24308
- value6 ? toHex(value6) : "0x",
24309
- data ?? "0x",
24310
- serializedAccessList,
24311
- ...toYParitySignatureArray(transaction, signature)
24312
- ];
24313
- return concatHex([
24314
- "0x02",
24315
- toRlp(serializedTransaction)
24316
- ]);
24317
- }
24318
- function serializeTransactionEIP2930(transaction, signature) {
24319
- const { chainId, gas, data, nonce, to, value: value6, accessList, gasPrice } = transaction;
24320
- assertTransactionEIP2930(transaction);
24321
- const serializedAccessList = serializeAccessList(accessList);
24322
- const serializedTransaction = [
24323
- toHex(chainId),
24324
- nonce ? toHex(nonce) : "0x",
24325
- gasPrice ? toHex(gasPrice) : "0x",
24326
- gas ? toHex(gas) : "0x",
24327
- to ?? "0x",
24328
- value6 ? toHex(value6) : "0x",
24329
- data ?? "0x",
24330
- serializedAccessList,
24331
- ...toYParitySignatureArray(transaction, signature)
24332
- ];
24333
- return concatHex([
24334
- "0x01",
24335
- toRlp(serializedTransaction)
24336
- ]);
24337
- }
24338
- function serializeTransactionLegacy(transaction, signature) {
24339
- const { chainId = 0, gas, data, nonce, to, value: value6, gasPrice } = transaction;
24340
- assertTransactionLegacy(transaction);
24341
- let serializedTransaction = [
24342
- nonce ? toHex(nonce) : "0x",
24343
- gasPrice ? toHex(gasPrice) : "0x",
24344
- gas ? toHex(gas) : "0x",
24345
- to ?? "0x",
24346
- value6 ? toHex(value6) : "0x",
24347
- data ?? "0x"
24348
- ];
24349
- if (signature) {
24350
- const v = (() => {
24351
- if (signature.v >= 35n) {
24352
- const inferredChainId = (signature.v - 35n) / 2n;
24353
- if (inferredChainId > 0)
24354
- return signature.v;
24355
- return 27n + (signature.v === 35n ? 0n : 1n);
24356
- }
24357
- if (chainId > 0)
24358
- return BigInt(chainId * 2) + BigInt(35n + signature.v - 27n);
24359
- const v2 = 27n + (signature.v === 27n ? 0n : 1n);
24360
- if (signature.v !== v2)
24361
- throw new InvalidLegacyVError({ v: signature.v });
24362
- return v2;
24363
- })();
24364
- const r = trim(signature.r);
24365
- const s = trim(signature.s);
24366
- serializedTransaction = [
24367
- ...serializedTransaction,
24368
- toHex(v),
24369
- r === "0x00" ? "0x" : r,
24370
- s === "0x00" ? "0x" : s
24371
- ];
24372
- } else if (chainId > 0) {
24373
- serializedTransaction = [
24374
- ...serializedTransaction,
24375
- toHex(chainId),
24376
- "0x",
24377
- "0x"
24378
- ];
24379
- }
24380
- return toRlp(serializedTransaction);
24381
- }
24382
- function toYParitySignatureArray(transaction, signature_) {
24383
- const signature = signature_ ?? transaction;
24384
- const { v, yParity } = signature;
24385
- if (typeof signature.r === "undefined")
24386
- return [];
24387
- if (typeof signature.s === "undefined")
24388
- return [];
24389
- if (typeof v === "undefined" && typeof yParity === "undefined")
24390
- return [];
24391
- const r = trim(signature.r);
24392
- const s = trim(signature.s);
24393
- const yParity_ = (() => {
24394
- if (typeof yParity === "number")
24395
- return yParity ? toHex(1) : "0x";
24396
- if (v === 0n)
24397
- return "0x";
24398
- if (v === 1n)
24399
- return toHex(1);
24400
- return v === 27n ? "0x" : toHex(1);
24401
- })();
24402
- return [yParity_, r === "0x00" ? "0x" : r, s === "0x00" ? "0x" : s];
24403
- }
24404
-
24405
- // ../node_modules/viem/_esm/utils/authorization/serializeAuthorizationList.js
24406
- function serializeAuthorizationList(authorizationList) {
24407
- if (!authorizationList || authorizationList.length === 0)
24408
- return [];
24409
- const serializedAuthorizationList = [];
24410
- for (const authorization of authorizationList) {
24411
- const { chainId, nonce, ...signature } = authorization;
24412
- const contractAddress = authorization.address;
24413
- serializedAuthorizationList.push([
24414
- chainId ? toHex(chainId) : "0x",
24415
- contractAddress,
24416
- nonce ? toHex(nonce) : "0x",
24417
- ...toYParitySignatureArray({}, signature)
24418
- ]);
24419
- }
24420
- return serializedAuthorizationList;
24421
- }
24422
-
24423
- // ../node_modules/viem/_esm/utils/formatters/transactionReceipt.js
24424
- init_fromHex();
24425
- var receiptStatuses = {
24426
- "0x0": "reverted",
24427
- "0x1": "success"
24428
- };
24429
- function formatTransactionReceipt(transactionReceipt) {
24430
- const receipt = {
24431
- ...transactionReceipt,
24432
- blockNumber: transactionReceipt.blockNumber ? BigInt(transactionReceipt.blockNumber) : null,
24433
- contractAddress: transactionReceipt.contractAddress ? transactionReceipt.contractAddress : null,
24434
- cumulativeGasUsed: transactionReceipt.cumulativeGasUsed ? BigInt(transactionReceipt.cumulativeGasUsed) : null,
24435
- effectiveGasPrice: transactionReceipt.effectiveGasPrice ? BigInt(transactionReceipt.effectiveGasPrice) : null,
24436
- gasUsed: transactionReceipt.gasUsed ? BigInt(transactionReceipt.gasUsed) : null,
24437
- logs: transactionReceipt.logs ? transactionReceipt.logs.map((log3) => formatLog(log3)) : null,
24438
- to: transactionReceipt.to ? transactionReceipt.to : null,
24439
- transactionIndex: transactionReceipt.transactionIndex ? hexToNumber(transactionReceipt.transactionIndex) : null,
24440
- status: transactionReceipt.status ? receiptStatuses[transactionReceipt.status] : null,
24441
- type: transactionReceipt.type ? transactionType[transactionReceipt.type] || transactionReceipt.type : null
24442
- };
24443
- if (transactionReceipt.blobGasPrice)
24444
- receipt.blobGasPrice = BigInt(transactionReceipt.blobGasPrice);
24445
- if (transactionReceipt.blobGasUsed)
24446
- receipt.blobGasUsed = BigInt(transactionReceipt.blobGasUsed);
24447
- return receipt;
24448
- }
24449
- var defineTransactionReceipt = /* @__PURE__ */ defineFormatter("transactionReceipt", formatTransactionReceipt);
24450
-
24451
- // ../node_modules/viem/_esm/index.js
24452
- init_toBytes();
24453
- init_toHex();
24454
21906
  // ../contracts/pega/lib/hex.ts
24455
21907
  var HexString = exports_Schema.TemplateLiteral("0x", exports_Schema.String);
24456
21908
  var Address = HexString.pipe(exports_Schema.filter((s) => s.length === 42 || `Address must be a 20-byte '0x'-prefixed hex string, but got: ${s}`), exports_Schema.brand("Address"));