@springmicro/auth 0.7.20 → 0.7.22

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.
@@ -1,1512 +0,0 @@
1
- import { i as H, t as ne, q as l, B as u, o as Ee, s as P, z as se, D as Ue, v as Oe, j as $e, d as w, n as y, f as G, g as B, e as X } from "./Web3Auth-DG8Yz_cD.js";
2
- import { w as Fe, H as Ge, n as W, d as Le, e as Y, t as je, b as ze, o as Ce, s as Ae } from "./sha256-C90UGNQg.js";
3
- const F = /* @__PURE__ */ BigInt(2 ** 32 - 1), J = /* @__PURE__ */ BigInt(32);
4
- function He(e, t = !1) {
5
- return t ? { h: Number(e & F), l: Number(e >> J & F) } : { h: Number(e >> J & F) | 0, l: Number(e & F) | 0 };
6
- }
7
- function Ne(e, t = !1) {
8
- let n = new Uint32Array(e.length), i = new Uint32Array(e.length);
9
- for (let s = 0; s < e.length; s++) {
10
- const { h: o, l: r } = He(e[s], t);
11
- [n[s], i[s]] = [o, r];
12
- }
13
- return [n, i];
14
- }
15
- const ke = (e, t, n) => e << n | t >>> 32 - n, Se = (e, t, n) => t << n | e >>> 32 - n, Me = (e, t, n) => t << n - 32 | e >>> 64 - n, Ve = (e, t, n) => e << n - 32 | t >>> 64 - n, [ie, re, oe] = [[], [], []], _e = /* @__PURE__ */ BigInt(0), T = /* @__PURE__ */ BigInt(1), Re = /* @__PURE__ */ BigInt(2), De = /* @__PURE__ */ BigInt(7), Ke = /* @__PURE__ */ BigInt(256), Xe = /* @__PURE__ */ BigInt(113);
16
- for (let e = 0, t = T, n = 1, i = 0; e < 24; e++) {
17
- [n, i] = [i, (2 * n + 3 * i) % 5], ie.push(2 * (5 * i + n)), re.push((e + 1) * (e + 2) / 2 % 64);
18
- let s = _e;
19
- for (let o = 0; o < 7; o++)
20
- t = (t << T ^ (t >> De) * Xe) % Ke, t & Re && (s ^= T << (T << /* @__PURE__ */ BigInt(o)) - T);
21
- oe.push(s);
22
- }
23
- const [We, Ye] = /* @__PURE__ */ Ne(oe, !0), Q = (e, t, n) => n > 32 ? Me(e, t, n) : ke(e, t, n), Z = (e, t, n) => n > 32 ? Ve(e, t, n) : Se(e, t, n);
24
- function Je(e, t = 24) {
25
- const n = new Uint32Array(10);
26
- for (let i = 24 - t; i < 24; i++) {
27
- for (let r = 0; r < 10; r++)
28
- n[r] = e[r] ^ e[r + 10] ^ e[r + 20] ^ e[r + 30] ^ e[r + 40];
29
- for (let r = 0; r < 10; r += 2) {
30
- const a = (r + 8) % 10, c = (r + 2) % 10, f = n[c], d = n[c + 1], b = Q(f, d, 1) ^ n[a], m = Z(f, d, 1) ^ n[a + 1];
31
- for (let h = 0; h < 50; h += 10)
32
- e[r + h] ^= b, e[r + h + 1] ^= m;
33
- }
34
- let s = e[2], o = e[3];
35
- for (let r = 0; r < 24; r++) {
36
- const a = re[r], c = Q(s, o, a), f = Z(s, o, a), d = ie[r];
37
- s = e[d], o = e[d + 1], e[d] = c, e[d + 1] = f;
38
- }
39
- for (let r = 0; r < 50; r += 10) {
40
- for (let a = 0; a < 10; a++)
41
- n[a] = e[r + a];
42
- for (let a = 0; a < 10; a++)
43
- e[r + a] ^= ~n[(a + 2) % 10] & n[(a + 4) % 10];
44
- }
45
- e[0] ^= We[i], e[1] ^= Ye[i];
46
- }
47
- n.fill(0);
48
- }
49
- class N extends Ge {
50
- // NOTE: we accept arguments in bytes instead of bits here.
51
- constructor(t, n, i, s = !1, o = 24) {
52
- if (super(), this.blockLen = t, this.suffix = n, this.outputLen = i, this.enableXOF = s, this.rounds = o, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, W(i), 0 >= this.blockLen || this.blockLen >= 200)
53
- throw new Error("Sha3 supports only keccak-f1600 function");
54
- this.state = new Uint8Array(200), this.state32 = Le(this.state);
55
- }
56
- keccak() {
57
- Je(this.state32, this.rounds), this.posOut = 0, this.pos = 0;
58
- }
59
- update(t) {
60
- Y(this);
61
- const { blockLen: n, state: i } = this;
62
- t = je(t);
63
- const s = t.length;
64
- for (let o = 0; o < s; ) {
65
- const r = Math.min(n - this.pos, s - o);
66
- for (let a = 0; a < r; a++)
67
- i[this.pos++] ^= t[o++];
68
- this.pos === n && this.keccak();
69
- }
70
- return this;
71
- }
72
- finish() {
73
- if (this.finished)
74
- return;
75
- this.finished = !0;
76
- const { state: t, suffix: n, pos: i, blockLen: s } = this;
77
- t[i] ^= n, n & 128 && i === s - 1 && this.keccak(), t[s - 1] ^= 128, this.keccak();
78
- }
79
- writeInto(t) {
80
- Y(this, !1), ze(t), this.finish();
81
- const n = this.state, { blockLen: i } = this;
82
- for (let s = 0, o = t.length; s < o; ) {
83
- this.posOut >= i && this.keccak();
84
- const r = Math.min(i - this.posOut, o - s);
85
- t.set(n.subarray(this.posOut, this.posOut + r), s), this.posOut += r, s += r;
86
- }
87
- return t;
88
- }
89
- xofInto(t) {
90
- if (!this.enableXOF)
91
- throw new Error("XOF is not possible for this instance");
92
- return this.writeInto(t);
93
- }
94
- xof(t) {
95
- return W(t), this.xofInto(new Uint8Array(t));
96
- }
97
- digestInto(t) {
98
- if (Ce(t, this), this.finished)
99
- throw new Error("digest() was already called");
100
- return this.writeInto(t), this.destroy(), t;
101
- }
102
- digest() {
103
- return this.digestInto(new Uint8Array(this.outputLen));
104
- }
105
- destroy() {
106
- this.destroyed = !0, this.state.fill(0);
107
- }
108
- _cloneInto(t) {
109
- const { blockLen: n, suffix: i, outputLen: s, rounds: o, enableXOF: r } = this;
110
- return t || (t = new N(n, i, s, r, o)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = o, t.suffix = i, t.outputLen = s, t.enableXOF = r, t.destroyed = this.destroyed, t;
111
- }
112
- }
113
- const Qe = (e, t, n) => Fe(() => new N(t, e, n)), Ze = /* @__PURE__ */ Qe(1, 136, 256 / 8);
114
- function qe(e, t) {
115
- const n = t || "hex", i = Ze(H(e, { strict: !1 }) ? ne(e) : e);
116
- return n === "bytes" ? i : l(i);
117
- }
118
- class E extends u {
119
- constructor({ address: t }) {
120
- super(`Address "${t}" is invalid.`, {
121
- metaMessages: [
122
- "- Address must be a hex value of 20 bytes (40 hex characters).",
123
- "- Address must match its checksum counterpart."
124
- ]
125
- }), Object.defineProperty(this, "name", {
126
- enumerable: !0,
127
- configurable: !0,
128
- writable: !0,
129
- value: "InvalidAddressError"
130
- });
131
- }
132
- }
133
- class ae extends Map {
134
- constructor(t) {
135
- super(), Object.defineProperty(this, "maxSize", {
136
- enumerable: !0,
137
- configurable: !0,
138
- writable: !0,
139
- value: void 0
140
- }), this.maxSize = t;
141
- }
142
- set(t, n) {
143
- return super.set(t, n), this.maxSize && this.size > this.maxSize && this.delete(this.keys().next().value), this;
144
- }
145
- }
146
- const C = /* @__PURE__ */ new ae(8192);
147
- function ue(e, t) {
148
- if (C.has(`${e}.${t}`))
149
- return C.get(`${e}.${t}`);
150
- const n = t ? `${t}${e.toLowerCase()}` : e.substring(2).toLowerCase(), i = qe(Ee(n), "bytes"), s = (t ? n.substring(`${t}0x`.length) : n).split("");
151
- for (let r = 0; r < 40; r += 2)
152
- i[r >> 1] >> 4 >= 8 && s[r] && (s[r] = s[r].toUpperCase()), (i[r >> 1] & 15) >= 8 && s[r + 1] && (s[r + 1] = s[r + 1].toUpperCase());
153
- const o = `0x${s.join("")}`;
154
- return C.set(`${e}.${t}`, o), o;
155
- }
156
- function Dt(e, t) {
157
- if (!U(e, { strict: !1 }))
158
- throw new E({ address: e });
159
- return ue(e, t);
160
- }
161
- const et = /^0x[a-fA-F0-9]{40}$/, A = /* @__PURE__ */ new ae(8192);
162
- function U(e, t) {
163
- const { strict: n = !0 } = t ?? {};
164
- if (A.has(e))
165
- return A.get(e);
166
- const i = et.test(e) ? e.toLowerCase() === e ? !0 : n ? ue(e) === e : !0 : !1;
167
- return A.set(e, i), i;
168
- }
169
- function Kt(e) {
170
- return typeof e[0] == "string" ? L(e) : tt(e);
171
- }
172
- function tt(e) {
173
- let t = 0;
174
- for (const s of e)
175
- t += s.length;
176
- const n = new Uint8Array(t);
177
- let i = 0;
178
- for (const s of e)
179
- n.set(s, i), i += s.length;
180
- return n;
181
- }
182
- function L(e) {
183
- return `0x${e.reduce((t, n) => t + n.replace("0x", ""), "")}`;
184
- }
185
- function nt(e, t, n, { strict: i } = {}) {
186
- return H(e, { strict: !1 }) ? it(e, t, n, {
187
- strict: i
188
- }) : st(e, t, n, {
189
- strict: i
190
- });
191
- }
192
- function ce(e, t) {
193
- if (typeof t == "number" && t > 0 && t > P(e) - 1)
194
- throw new se({
195
- offset: t,
196
- position: "start",
197
- size: P(e)
198
- });
199
- }
200
- function le(e, t, n) {
201
- if (typeof t == "number" && typeof n == "number" && P(e) !== n - t)
202
- throw new se({
203
- offset: n,
204
- position: "end",
205
- size: P(e)
206
- });
207
- }
208
- function st(e, t, n, { strict: i } = {}) {
209
- ce(e, t);
210
- const s = e.slice(t, n);
211
- return i && le(s, t, n), s;
212
- }
213
- function it(e, t, n, { strict: i } = {}) {
214
- ce(e, t);
215
- const s = `0x${e.replace("0x", "").slice((t ?? 0) * 2, (n ?? e.length) * 2)}`;
216
- return i && le(s, t, n), s;
217
- }
218
- class q extends u {
219
- constructor({ offset: t }) {
220
- super(`Offset \`${t}\` cannot be negative.`), Object.defineProperty(this, "name", {
221
- enumerable: !0,
222
- configurable: !0,
223
- writable: !0,
224
- value: "NegativeOffsetError"
225
- });
226
- }
227
- }
228
- class rt extends u {
229
- constructor({ length: t, position: n }) {
230
- super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`), Object.defineProperty(this, "name", {
231
- enumerable: !0,
232
- configurable: !0,
233
- writable: !0,
234
- value: "PositionOutOfBoundsError"
235
- });
236
- }
237
- }
238
- class ot extends u {
239
- constructor({ count: t, limit: n }) {
240
- super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`), Object.defineProperty(this, "name", {
241
- enumerable: !0,
242
- configurable: !0,
243
- writable: !0,
244
- value: "RecursiveReadLimitExceededError"
245
- });
246
- }
247
- }
248
- const at = {
249
- bytes: new Uint8Array(),
250
- dataView: new DataView(new ArrayBuffer(0)),
251
- position: 0,
252
- positionReadCount: /* @__PURE__ */ new Map(),
253
- recursiveReadCount: 0,
254
- recursiveReadLimit: Number.POSITIVE_INFINITY,
255
- assertReadLimit() {
256
- if (this.recursiveReadCount >= this.recursiveReadLimit)
257
- throw new ot({
258
- count: this.recursiveReadCount + 1,
259
- limit: this.recursiveReadLimit
260
- });
261
- },
262
- assertPosition(e) {
263
- if (e < 0 || e > this.bytes.length - 1)
264
- throw new rt({
265
- length: this.bytes.length,
266
- position: e
267
- });
268
- },
269
- decrementPosition(e) {
270
- if (e < 0)
271
- throw new q({ offset: e });
272
- const t = this.position - e;
273
- this.assertPosition(t), this.position = t;
274
- },
275
- getReadCount(e) {
276
- return this.positionReadCount.get(e || this.position) || 0;
277
- },
278
- incrementPosition(e) {
279
- if (e < 0)
280
- throw new q({ offset: e });
281
- const t = this.position + e;
282
- this.assertPosition(t), this.position = t;
283
- },
284
- inspectByte(e) {
285
- const t = e ?? this.position;
286
- return this.assertPosition(t), this.bytes[t];
287
- },
288
- inspectBytes(e, t) {
289
- const n = t ?? this.position;
290
- return this.assertPosition(n + e - 1), this.bytes.subarray(n, n + e);
291
- },
292
- inspectUint8(e) {
293
- const t = e ?? this.position;
294
- return this.assertPosition(t), this.bytes[t];
295
- },
296
- inspectUint16(e) {
297
- const t = e ?? this.position;
298
- return this.assertPosition(t + 1), this.dataView.getUint16(t);
299
- },
300
- inspectUint24(e) {
301
- const t = e ?? this.position;
302
- return this.assertPosition(t + 2), (this.dataView.getUint16(t) << 8) + this.dataView.getUint8(t + 2);
303
- },
304
- inspectUint32(e) {
305
- const t = e ?? this.position;
306
- return this.assertPosition(t + 3), this.dataView.getUint32(t);
307
- },
308
- pushByte(e) {
309
- this.assertPosition(this.position), this.bytes[this.position] = e, this.position++;
310
- },
311
- pushBytes(e) {
312
- this.assertPosition(this.position + e.length - 1), this.bytes.set(e, this.position), this.position += e.length;
313
- },
314
- pushUint8(e) {
315
- this.assertPosition(this.position), this.bytes[this.position] = e, this.position++;
316
- },
317
- pushUint16(e) {
318
- this.assertPosition(this.position + 1), this.dataView.setUint16(this.position, e), this.position += 2;
319
- },
320
- pushUint24(e) {
321
- this.assertPosition(this.position + 2), this.dataView.setUint16(this.position, e >> 8), this.dataView.setUint8(this.position + 2, e & 255), this.position += 3;
322
- },
323
- pushUint32(e) {
324
- this.assertPosition(this.position + 3), this.dataView.setUint32(this.position, e), this.position += 4;
325
- },
326
- readByte() {
327
- this.assertReadLimit(), this._touch();
328
- const e = this.inspectByte();
329
- return this.position++, e;
330
- },
331
- readBytes(e, t) {
332
- this.assertReadLimit(), this._touch();
333
- const n = this.inspectBytes(e);
334
- return this.position += t ?? e, n;
335
- },
336
- readUint8() {
337
- this.assertReadLimit(), this._touch();
338
- const e = this.inspectUint8();
339
- return this.position += 1, e;
340
- },
341
- readUint16() {
342
- this.assertReadLimit(), this._touch();
343
- const e = this.inspectUint16();
344
- return this.position += 2, e;
345
- },
346
- readUint24() {
347
- this.assertReadLimit(), this._touch();
348
- const e = this.inspectUint24();
349
- return this.position += 3, e;
350
- },
351
- readUint32() {
352
- this.assertReadLimit(), this._touch();
353
- const e = this.inspectUint32();
354
- return this.position += 4, e;
355
- },
356
- get remaining() {
357
- return this.bytes.length - this.position;
358
- },
359
- setPosition(e) {
360
- const t = this.position;
361
- return this.assertPosition(e), this.position = e, () => this.position = t;
362
- },
363
- _touch() {
364
- if (this.recursiveReadLimit === Number.POSITIVE_INFINITY)
365
- return;
366
- const e = this.getReadCount();
367
- this.positionReadCount.set(this.position, e + 1), e > 0 && this.recursiveReadCount++;
368
- }
369
- };
370
- function fe(e, { recursiveReadLimit: t = 8192 } = {}) {
371
- const n = Object.create(at);
372
- return n.bytes = e, n.dataView = new DataView(e.buffer, e.byteOffset, e.byteLength), n.positionReadCount = /* @__PURE__ */ new Map(), n.recursiveReadLimit = t, n;
373
- }
374
- function x(e, t = "wei") {
375
- return Ue(e, Oe[t]);
376
- }
377
- function de(e) {
378
- const t = Object.entries(e).map(([i, s]) => s === void 0 || s === !1 ? null : [i, s]).filter(Boolean), n = t.reduce((i, [s]) => Math.max(i, s.length), 0);
379
- return t.map(([i, s]) => ` ${`${i}:`.padEnd(n + 1)} ${s}`).join(`
380
- `);
381
- }
382
- class Xt extends u {
383
- constructor() {
384
- super([
385
- "Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.",
386
- "Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."
387
- ].join(`
388
- `)), Object.defineProperty(this, "name", {
389
- enumerable: !0,
390
- configurable: !0,
391
- writable: !0,
392
- value: "FeeConflictError"
393
- });
394
- }
395
- }
396
- class ut extends u {
397
- constructor({ v: t }) {
398
- super(`Invalid \`v\` value "${t}". Expected 27 or 28.`), Object.defineProperty(this, "name", {
399
- enumerable: !0,
400
- configurable: !0,
401
- writable: !0,
402
- value: "InvalidLegacyVError"
403
- });
404
- }
405
- }
406
- class ct extends u {
407
- constructor({ transaction: t }) {
408
- super("Cannot infer a transaction type from provided transaction.", {
409
- metaMessages: [
410
- "Provided Transaction:",
411
- "{",
412
- de(t),
413
- "}",
414
- "",
415
- "To infer the type, either provide:",
416
- "- a `type` to the Transaction, or",
417
- "- an EIP-1559 Transaction with `maxFeePerGas`, or",
418
- "- an EIP-2930 Transaction with `gasPrice` & `accessList`, or",
419
- "- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or",
420
- "- a Legacy Transaction with `gasPrice`"
421
- ]
422
- }), Object.defineProperty(this, "name", {
423
- enumerable: !0,
424
- configurable: !0,
425
- writable: !0,
426
- value: "InvalidSerializableTransactionError"
427
- });
428
- }
429
- }
430
- class Wt extends u {
431
- constructor({ serializedType: t }) {
432
- super(`Serialized transaction type "${t}" is invalid.`), Object.defineProperty(this, "name", {
433
- enumerable: !0,
434
- configurable: !0,
435
- writable: !0,
436
- value: "InvalidSerializedTransactionType"
437
- }), Object.defineProperty(this, "serializedType", {
438
- enumerable: !0,
439
- configurable: !0,
440
- writable: !0,
441
- value: void 0
442
- }), this.serializedType = t;
443
- }
444
- }
445
- class Yt extends u {
446
- constructor({ attributes: t, serializedTransaction: n, type: i }) {
447
- const s = Object.entries(t).map(([o, r]) => typeof r > "u" ? o : void 0).filter(Boolean);
448
- super(`Invalid serialized transaction of type "${i}" was provided.`, {
449
- metaMessages: [
450
- `Serialized Transaction: "${n}"`,
451
- s.length > 0 ? `Missing Attributes: ${s.join(", ")}` : ""
452
- ].filter(Boolean)
453
- }), Object.defineProperty(this, "name", {
454
- enumerable: !0,
455
- configurable: !0,
456
- writable: !0,
457
- value: "InvalidSerializedTransactionError"
458
- }), Object.defineProperty(this, "serializedTransaction", {
459
- enumerable: !0,
460
- configurable: !0,
461
- writable: !0,
462
- value: void 0
463
- }), Object.defineProperty(this, "type", {
464
- enumerable: !0,
465
- configurable: !0,
466
- writable: !0,
467
- value: void 0
468
- }), this.serializedTransaction = n, this.type = i;
469
- }
470
- }
471
- class lt extends u {
472
- constructor({ storageKey: t }) {
473
- super(`Size for storage key "${t}" is invalid. Expected 32 bytes. Got ${Math.floor((t.length - 2) / 2)} bytes.`), Object.defineProperty(this, "name", {
474
- enumerable: !0,
475
- configurable: !0,
476
- writable: !0,
477
- value: "InvalidStorageKeySizeError"
478
- });
479
- }
480
- }
481
- class Jt extends u {
482
- constructor(t, { account: n, docsPath: i, chain: s, data: o, gas: r, gasPrice: a, maxFeePerGas: c, maxPriorityFeePerGas: f, nonce: d, to: b, value: m }) {
483
- var O;
484
- const h = de({
485
- chain: s && `${s == null ? void 0 : s.name} (id: ${s == null ? void 0 : s.id})`,
486
- from: n == null ? void 0 : n.address,
487
- to: b,
488
- value: typeof m < "u" && `${$e(m)} ${((O = s == null ? void 0 : s.nativeCurrency) == null ? void 0 : O.symbol) || "ETH"}`,
489
- data: o,
490
- gas: r,
491
- gasPrice: typeof a < "u" && `${x(a)} gwei`,
492
- maxFeePerGas: typeof c < "u" && `${x(c)} gwei`,
493
- maxPriorityFeePerGas: typeof f < "u" && `${x(f)} gwei`,
494
- nonce: d
495
- });
496
- super(t.shortMessage, {
497
- cause: t,
498
- docsPath: i,
499
- metaMessages: [
500
- ...t.metaMessages ? [...t.metaMessages, " "] : [],
501
- "Request Arguments:",
502
- h
503
- ].filter(Boolean)
504
- }), Object.defineProperty(this, "cause", {
505
- enumerable: !0,
506
- configurable: !0,
507
- writable: !0,
508
- value: void 0
509
- }), Object.defineProperty(this, "name", {
510
- enumerable: !0,
511
- configurable: !0,
512
- writable: !0,
513
- value: "TransactionExecutionError"
514
- }), this.cause = t;
515
- }
516
- }
517
- class Qt extends u {
518
- constructor({ blockHash: t, blockNumber: n, blockTag: i, hash: s, index: o }) {
519
- let r = "Transaction";
520
- i && o !== void 0 && (r = `Transaction at block time "${i}" at index "${o}"`), t && o !== void 0 && (r = `Transaction at block hash "${t}" at index "${o}"`), n && o !== void 0 && (r = `Transaction at block number "${n}" at index "${o}"`), s && (r = `Transaction with hash "${s}"`), super(`${r} could not be found.`), Object.defineProperty(this, "name", {
521
- enumerable: !0,
522
- configurable: !0,
523
- writable: !0,
524
- value: "TransactionNotFoundError"
525
- });
526
- }
527
- }
528
- class Zt extends u {
529
- constructor({ hash: t }) {
530
- super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`), Object.defineProperty(this, "name", {
531
- enumerable: !0,
532
- configurable: !0,
533
- writable: !0,
534
- value: "TransactionReceiptNotFoundError"
535
- });
536
- }
537
- }
538
- class qt extends u {
539
- constructor({ hash: t }) {
540
- super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`), Object.defineProperty(this, "name", {
541
- enumerable: !0,
542
- configurable: !0,
543
- writable: !0,
544
- value: "WaitForTransactionReceiptTimeoutError"
545
- });
546
- }
547
- }
548
- class he extends u {
549
- constructor({ cause: t, message: n } = {}) {
550
- var s;
551
- const i = (s = n == null ? void 0 : n.replace("execution reverted: ", "")) == null ? void 0 : s.replace("execution reverted", "");
552
- super(`Execution reverted ${i ? `with reason: ${i}` : "for an unknown reason"}.`, {
553
- cause: t
554
- }), Object.defineProperty(this, "name", {
555
- enumerable: !0,
556
- configurable: !0,
557
- writable: !0,
558
- value: "ExecutionRevertedError"
559
- });
560
- }
561
- }
562
- Object.defineProperty(he, "code", {
563
- enumerable: !0,
564
- configurable: !0,
565
- writable: !0,
566
- value: 3
567
- });
568
- Object.defineProperty(he, "nodeMessage", {
569
- enumerable: !0,
570
- configurable: !0,
571
- writable: !0,
572
- value: /execution reverted/
573
- });
574
- class j extends u {
575
- constructor({ cause: t, maxFeePerGas: n } = {}) {
576
- super(`The fee cap (\`maxFeePerGas\`${n ? ` = ${x(n)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
577
- cause: t
578
- }), Object.defineProperty(this, "name", {
579
- enumerable: !0,
580
- configurable: !0,
581
- writable: !0,
582
- value: "FeeCapTooHigh"
583
- });
584
- }
585
- }
586
- Object.defineProperty(j, "nodeMessage", {
587
- enumerable: !0,
588
- configurable: !0,
589
- writable: !0,
590
- value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
591
- });
592
- class ft extends u {
593
- constructor({ cause: t, maxFeePerGas: n } = {}) {
594
- super(`The fee cap (\`maxFeePerGas\`${n ? ` = ${x(n)}` : ""} gwei) cannot be lower than the block base fee.`, {
595
- cause: t
596
- }), Object.defineProperty(this, "name", {
597
- enumerable: !0,
598
- configurable: !0,
599
- writable: !0,
600
- value: "FeeCapTooLow"
601
- });
602
- }
603
- }
604
- Object.defineProperty(ft, "nodeMessage", {
605
- enumerable: !0,
606
- configurable: !0,
607
- writable: !0,
608
- value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/
609
- });
610
- class dt extends u {
611
- constructor({ cause: t, nonce: n } = {}) {
612
- super(`Nonce provided for the transaction ${n ? `(${n}) ` : ""}is higher than the next one expected.`, { cause: t }), Object.defineProperty(this, "name", {
613
- enumerable: !0,
614
- configurable: !0,
615
- writable: !0,
616
- value: "NonceTooHighError"
617
- });
618
- }
619
- }
620
- Object.defineProperty(dt, "nodeMessage", {
621
- enumerable: !0,
622
- configurable: !0,
623
- writable: !0,
624
- value: /nonce too high/
625
- });
626
- class ht extends u {
627
- constructor({ cause: t, nonce: n } = {}) {
628
- super([
629
- `Nonce provided for the transaction ${n ? `(${n}) ` : ""}is lower than the current nonce of the account.`,
630
- "Try increasing the nonce or find the latest nonce with `getTransactionCount`."
631
- ].join(`
632
- `), { cause: t }), Object.defineProperty(this, "name", {
633
- enumerable: !0,
634
- configurable: !0,
635
- writable: !0,
636
- value: "NonceTooLowError"
637
- });
638
- }
639
- }
640
- Object.defineProperty(ht, "nodeMessage", {
641
- enumerable: !0,
642
- configurable: !0,
643
- writable: !0,
644
- value: /nonce too low|transaction already imported|already known/
645
- });
646
- class bt extends u {
647
- constructor({ cause: t, nonce: n } = {}) {
648
- super(`Nonce provided for the transaction ${n ? `(${n}) ` : ""}exceeds the maximum allowed nonce.`, { cause: t }), Object.defineProperty(this, "name", {
649
- enumerable: !0,
650
- configurable: !0,
651
- writable: !0,
652
- value: "NonceMaxValueError"
653
- });
654
- }
655
- }
656
- Object.defineProperty(bt, "nodeMessage", {
657
- enumerable: !0,
658
- configurable: !0,
659
- writable: !0,
660
- value: /nonce has max value/
661
- });
662
- class mt extends u {
663
- constructor({ cause: t } = {}) {
664
- super([
665
- "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
666
- ].join(`
667
- `), {
668
- cause: t,
669
- metaMessages: [
670
- "This error could arise when the account does not have enough funds to:",
671
- " - pay for the total gas fee,",
672
- " - pay for the value to send.",
673
- " ",
674
- "The cost of the transaction is calculated as `gas * gas fee + value`, where:",
675
- " - `gas` is the amount of gas needed for transaction to execute,",
676
- " - `gas fee` is the gas fee,",
677
- " - `value` is the amount of ether to send to the recipient."
678
- ]
679
- }), Object.defineProperty(this, "name", {
680
- enumerable: !0,
681
- configurable: !0,
682
- writable: !0,
683
- value: "InsufficientFundsError"
684
- });
685
- }
686
- }
687
- Object.defineProperty(mt, "nodeMessage", {
688
- enumerable: !0,
689
- configurable: !0,
690
- writable: !0,
691
- value: /insufficient funds/
692
- });
693
- class pt extends u {
694
- constructor({ cause: t, gas: n } = {}) {
695
- super(`The amount of gas ${n ? `(${n}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, {
696
- cause: t
697
- }), Object.defineProperty(this, "name", {
698
- enumerable: !0,
699
- configurable: !0,
700
- writable: !0,
701
- value: "IntrinsicGasTooHighError"
702
- });
703
- }
704
- }
705
- Object.defineProperty(pt, "nodeMessage", {
706
- enumerable: !0,
707
- configurable: !0,
708
- writable: !0,
709
- value: /intrinsic gas too high|gas limit reached/
710
- });
711
- class yt extends u {
712
- constructor({ cause: t, gas: n } = {}) {
713
- super(`The amount of gas ${n ? `(${n}) ` : ""}provided for the transaction is too low.`, {
714
- cause: t
715
- }), Object.defineProperty(this, "name", {
716
- enumerable: !0,
717
- configurable: !0,
718
- writable: !0,
719
- value: "IntrinsicGasTooLowError"
720
- });
721
- }
722
- }
723
- Object.defineProperty(yt, "nodeMessage", {
724
- enumerable: !0,
725
- configurable: !0,
726
- writable: !0,
727
- value: /intrinsic gas too low/
728
- });
729
- class xt extends u {
730
- constructor({ cause: t }) {
731
- super("The transaction type is not supported for this chain.", {
732
- cause: t
733
- }), Object.defineProperty(this, "name", {
734
- enumerable: !0,
735
- configurable: !0,
736
- writable: !0,
737
- value: "TransactionTypeNotSupportedError"
738
- });
739
- }
740
- }
741
- Object.defineProperty(xt, "nodeMessage", {
742
- enumerable: !0,
743
- configurable: !0,
744
- writable: !0,
745
- value: /transaction type not valid/
746
- });
747
- class be extends u {
748
- constructor({ cause: t, maxPriorityFeePerGas: n, maxFeePerGas: i } = {}) {
749
- super([
750
- `The provided tip (\`maxPriorityFeePerGas\`${n ? ` = ${x(n)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${i ? ` = ${x(i)} gwei` : ""}).`
751
- ].join(`
752
- `), {
753
- cause: t
754
- }), Object.defineProperty(this, "name", {
755
- enumerable: !0,
756
- configurable: !0,
757
- writable: !0,
758
- value: "TipAboveFeeCapError"
759
- });
760
- }
761
- }
762
- Object.defineProperty(be, "nodeMessage", {
763
- enumerable: !0,
764
- configurable: !0,
765
- writable: !0,
766
- value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
767
- });
768
- class en extends u {
769
- constructor({ cause: t }) {
770
- super(`An error occurred while executing: ${t == null ? void 0 : t.shortMessage}`, {
771
- cause: t
772
- }), Object.defineProperty(this, "name", {
773
- enumerable: !0,
774
- configurable: !0,
775
- writable: !0,
776
- value: "UnknownNodeError"
777
- });
778
- }
779
- }
780
- function z(e, t) {
781
- return ({ exclude: n, format: i }) => ({
782
- exclude: n,
783
- format: (s) => {
784
- const o = t(s);
785
- if (n)
786
- for (const r of n)
787
- delete o[r];
788
- return {
789
- ...o,
790
- ...i(s)
791
- };
792
- },
793
- type: e
794
- });
795
- }
796
- const gt = {
797
- legacy: "0x0",
798
- eip2930: "0x1",
799
- eip1559: "0x2",
800
- eip4844: "0x3"
801
- };
802
- function wt(e) {
803
- const t = {};
804
- return typeof e.accessList < "u" && (t.accessList = e.accessList), typeof e.blobVersionedHashes < "u" && (t.blobVersionedHashes = e.blobVersionedHashes), typeof e.blobs < "u" && (typeof e.blobs[0] != "string" ? t.blobs = e.blobs.map((n) => w(n)) : t.blobs = e.blobs), typeof e.data < "u" && (t.data = e.data), typeof e.from < "u" && (t.from = e.from), typeof e.gas < "u" && (t.gas = y(e.gas)), typeof e.gasPrice < "u" && (t.gasPrice = y(e.gasPrice)), typeof e.maxFeePerBlobGas < "u" && (t.maxFeePerBlobGas = y(e.maxFeePerBlobGas)), typeof e.maxFeePerGas < "u" && (t.maxFeePerGas = y(e.maxFeePerGas)), typeof e.maxPriorityFeePerGas < "u" && (t.maxPriorityFeePerGas = y(e.maxPriorityFeePerGas)), typeof e.nonce < "u" && (t.nonce = y(e.nonce)), typeof e.to < "u" && (t.to = e.to), typeof e.type < "u" && (t.type = gt[e.type]), typeof e.value < "u" && (t.value = y(e.value)), t;
805
- }
806
- const tn = /* @__PURE__ */ z("transactionRequest", wt), me = {
807
- "0x0": "legacy",
808
- "0x1": "eip2930",
809
- "0x2": "eip1559",
810
- "0x3": "eip4844"
811
- };
812
- function pe(e) {
813
- const t = {
814
- ...e,
815
- blockHash: e.blockHash ? e.blockHash : null,
816
- blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
817
- chainId: e.chainId ? G(e.chainId) : void 0,
818
- gas: e.gas ? BigInt(e.gas) : void 0,
819
- gasPrice: e.gasPrice ? BigInt(e.gasPrice) : void 0,
820
- maxFeePerBlobGas: e.maxFeePerBlobGas ? BigInt(e.maxFeePerBlobGas) : void 0,
821
- maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
822
- maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
823
- nonce: e.nonce ? G(e.nonce) : void 0,
824
- to: e.to ? e.to : null,
825
- transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
826
- type: e.type ? me[e.type] : void 0,
827
- typeHex: e.type ? e.type : void 0,
828
- value: e.value ? BigInt(e.value) : void 0,
829
- v: e.v ? BigInt(e.v) : void 0
830
- };
831
- return t.yParity = (() => {
832
- if (e.yParity)
833
- return Number(e.yParity);
834
- if (typeof t.v == "bigint") {
835
- if (t.v === 0n || t.v === 27n)
836
- return 0;
837
- if (t.v === 1n || t.v === 28n)
838
- return 1;
839
- if (t.v >= 35n)
840
- return t.v % 2n === 0n ? 1 : 0;
841
- }
842
- })(), t.type === "legacy" && (delete t.accessList, delete t.maxFeePerBlobGas, delete t.maxFeePerGas, delete t.maxPriorityFeePerGas, delete t.yParity), t.type === "eip2930" && (delete t.maxFeePerBlobGas, delete t.maxFeePerGas, delete t.maxPriorityFeePerGas), t.type === "eip1559" && delete t.maxFeePerBlobGas, t;
843
- }
844
- const nn = /* @__PURE__ */ z("transaction", pe);
845
- function Pt(e) {
846
- var n;
847
- const t = (n = e.transactions) == null ? void 0 : n.map((i) => typeof i == "string" ? i : pe(i));
848
- return {
849
- ...e,
850
- baseFeePerGas: e.baseFeePerGas ? BigInt(e.baseFeePerGas) : null,
851
- blobGasUsed: e.blobGasUsed ? BigInt(e.blobGasUsed) : void 0,
852
- difficulty: e.difficulty ? BigInt(e.difficulty) : void 0,
853
- excessBlobGas: e.excessBlobGas ? BigInt(e.excessBlobGas) : void 0,
854
- gasLimit: e.gasLimit ? BigInt(e.gasLimit) : void 0,
855
- gasUsed: e.gasUsed ? BigInt(e.gasUsed) : void 0,
856
- hash: e.hash ? e.hash : null,
857
- logsBloom: e.logsBloom ? e.logsBloom : null,
858
- nonce: e.nonce ? e.nonce : null,
859
- number: e.number ? BigInt(e.number) : null,
860
- size: e.size ? BigInt(e.size) : void 0,
861
- timestamp: e.timestamp ? BigInt(e.timestamp) : void 0,
862
- transactions: t,
863
- totalDifficulty: e.totalDifficulty ? BigInt(e.totalDifficulty) : null
864
- };
865
- }
866
- const sn = /* @__PURE__ */ z("block", Pt);
867
- function ye(e) {
868
- const { kzg: t } = e, n = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), i = typeof e.blobs[0] == "string" ? e.blobs.map((o) => B(o)) : e.blobs, s = [];
869
- for (const o of i)
870
- s.push(Uint8Array.from(t.blobToKzgCommitment(o)));
871
- return n === "bytes" ? s : s.map((o) => w(o));
872
- }
873
- function xe(e) {
874
- const { kzg: t } = e, n = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), i = typeof e.blobs[0] == "string" ? e.blobs.map((r) => B(r)) : e.blobs, s = typeof e.commitments[0] == "string" ? e.commitments.map((r) => B(r)) : e.commitments, o = [];
875
- for (let r = 0; r < i.length; r++) {
876
- const a = i[r], c = s[r];
877
- o.push(Uint8Array.from(t.computeBlobKzgProof(a, c)));
878
- }
879
- return n === "bytes" ? o : o.map((r) => w(r));
880
- }
881
- function It(e, t) {
882
- const n = t || "hex", i = Ae(H(e, { strict: !1 }) ? ne(e) : e);
883
- return n === "bytes" ? i : l(i);
884
- }
885
- function vt(e) {
886
- const { commitment: t, version: n = 1 } = e, i = e.to ?? (typeof t == "string" ? "hex" : "bytes"), s = It(t, "bytes");
887
- return s.set([n], 0), i === "bytes" ? s : w(s);
888
- }
889
- function Tt(e) {
890
- const { commitments: t, version: n } = e, i = e.to ?? (typeof t[0] == "string" ? "hex" : "bytes"), s = [];
891
- for (const o of t)
892
- s.push(vt({
893
- commitment: o,
894
- to: i,
895
- version: n
896
- }));
897
- return s;
898
- }
899
- const ee = 6, ge = 32, k = 4096, we = ge * k, te = we * ee - // terminator byte (0x80).
900
- 1 - // zero byte (0x00) appended to each field element.
901
- 1 * k * ee, Pe = 1;
902
- class Bt extends u {
903
- constructor({ maxSize: t, size: n }) {
904
- super("Blob size is too large.", {
905
- metaMessages: [`Max: ${t} bytes`, `Given: ${n} bytes`]
906
- }), Object.defineProperty(this, "name", {
907
- enumerable: !0,
908
- configurable: !0,
909
- writable: !0,
910
- value: "BlobSizeTooLargeError"
911
- });
912
- }
913
- }
914
- class Ie extends u {
915
- constructor() {
916
- super("Blob data must not be empty."), Object.defineProperty(this, "name", {
917
- enumerable: !0,
918
- configurable: !0,
919
- writable: !0,
920
- value: "EmptyBlobError"
921
- });
922
- }
923
- }
924
- class Et extends u {
925
- constructor({ hash: t, size: n }) {
926
- super(`Versioned hash "${t}" size is invalid.`, {
927
- metaMessages: ["Expected: 32", `Received: ${n}`]
928
- }), Object.defineProperty(this, "name", {
929
- enumerable: !0,
930
- configurable: !0,
931
- writable: !0,
932
- value: "InvalidVersionedHashSizeError"
933
- });
934
- }
935
- }
936
- class Ut extends u {
937
- constructor({ hash: t, version: n }) {
938
- super(`Versioned hash "${t}" version is invalid.`, {
939
- metaMessages: [
940
- `Expected: ${Pe}`,
941
- `Received: ${n}`
942
- ]
943
- }), Object.defineProperty(this, "name", {
944
- enumerable: !0,
945
- configurable: !0,
946
- writable: !0,
947
- value: "InvalidVersionedHashVersionError"
948
- });
949
- }
950
- }
951
- function Ot(e) {
952
- const t = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), n = typeof e.data == "string" ? B(e.data) : e.data, i = P(n);
953
- if (!i)
954
- throw new Ie();
955
- if (i > te)
956
- throw new Bt({
957
- maxSize: te,
958
- size: i
959
- });
960
- const s = [];
961
- let o = !0, r = 0;
962
- for (; o; ) {
963
- const a = fe(new Uint8Array(we));
964
- let c = 0;
965
- for (; c < k; ) {
966
- const f = n.slice(r, r + (ge - 1));
967
- if (a.pushByte(0), a.pushBytes(f), f.length < 31) {
968
- a.pushByte(128), o = !1;
969
- break;
970
- }
971
- c++, r += 31;
972
- }
973
- s.push(a);
974
- }
975
- return t === "bytes" ? s.map((a) => a.bytes) : s.map((a) => w(a.bytes));
976
- }
977
- function $t(e) {
978
- const { data: t, kzg: n, to: i } = e, s = e.blobs ?? Ot({ data: t, to: i }), o = e.commitments ?? ye({ blobs: s, kzg: n, to: i }), r = e.proofs ?? xe({ blobs: s, commitments: o, kzg: n, to: i }), a = [];
979
- for (let c = 0; c < s.length; c++)
980
- a.push({
981
- blob: s[c],
982
- commitment: o[c],
983
- proof: r[c]
984
- });
985
- return a;
986
- }
987
- function Ft(e) {
988
- if (e.type)
989
- return e.type;
990
- if (typeof e.blobs < "u" || typeof e.blobVersionedHashes < "u" || typeof e.maxFeePerBlobGas < "u" || typeof e.sidecars < "u")
991
- return "eip4844";
992
- if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u")
993
- return "eip1559";
994
- if (typeof e.gasPrice < "u")
995
- return typeof e.accessList < "u" ? "eip2930" : "legacy";
996
- throw new ct({ transaction: e });
997
- }
998
- function Gt(e, { args: t, eventName: n } = {}) {
999
- return {
1000
- ...e,
1001
- blockHash: e.blockHash ? e.blockHash : null,
1002
- blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
1003
- logIndex: e.logIndex ? Number(e.logIndex) : null,
1004
- transactionHash: e.transactionHash ? e.transactionHash : null,
1005
- transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
1006
- ...n ? { args: t, eventName: n } : {}
1007
- };
1008
- }
1009
- class rn extends u {
1010
- constructor({ blockNumber: t, chain: n, contract: i }) {
1011
- super(`Chain "${n.name}" does not support contract "${i.name}".`, {
1012
- metaMessages: [
1013
- "This could be due to any of the following:",
1014
- ...t && i.blockCreated && i.blockCreated > t ? [
1015
- `- The contract "${i.name}" was not deployed until block ${i.blockCreated} (current block ${t}).`
1016
- ] : [
1017
- `- The chain does not have the contract "${i.name}" configured.`
1018
- ]
1019
- ]
1020
- }), Object.defineProperty(this, "name", {
1021
- enumerable: !0,
1022
- configurable: !0,
1023
- writable: !0,
1024
- value: "ChainDoesNotSupportContract"
1025
- });
1026
- }
1027
- }
1028
- class on extends u {
1029
- constructor({ chain: t, currentChainId: n }) {
1030
- super(`The current chain of the wallet (id: ${n}) does not match the target chain for the transaction (id: ${t.id} – ${t.name}).`, {
1031
- metaMessages: [
1032
- `Current Chain ID: ${n}`,
1033
- `Expected Chain ID: ${t.id} – ${t.name}`
1034
- ]
1035
- }), Object.defineProperty(this, "name", {
1036
- enumerable: !0,
1037
- configurable: !0,
1038
- writable: !0,
1039
- value: "ChainMismatchError"
1040
- });
1041
- }
1042
- }
1043
- class an extends u {
1044
- constructor() {
1045
- super([
1046
- "No chain was provided to the request.",
1047
- "Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."
1048
- ].join(`
1049
- `)), Object.defineProperty(this, "name", {
1050
- enumerable: !0,
1051
- configurable: !0,
1052
- writable: !0,
1053
- value: "ChainNotFoundError"
1054
- });
1055
- }
1056
- }
1057
- class un extends u {
1058
- constructor() {
1059
- super("No chain was provided to the Client."), Object.defineProperty(this, "name", {
1060
- enumerable: !0,
1061
- configurable: !0,
1062
- writable: !0,
1063
- value: "ClientChainNotConfiguredError"
1064
- });
1065
- }
1066
- }
1067
- class S extends u {
1068
- constructor({ chainId: t }) {
1069
- super(typeof t == "number" ? `Chain ID "${t}" is invalid.` : "Chain ID is invalid."), Object.defineProperty(this, "name", {
1070
- enumerable: !0,
1071
- configurable: !0,
1072
- writable: !0,
1073
- value: "InvalidChainIdError"
1074
- });
1075
- }
1076
- }
1077
- function cn(e) {
1078
- return {
1079
- formatters: void 0,
1080
- fees: void 0,
1081
- serializers: void 0,
1082
- ...e
1083
- };
1084
- }
1085
- function g(e, t = "hex") {
1086
- const n = ve(e), i = fe(new Uint8Array(n.length));
1087
- return n.encode(i), t === "hex" ? w(i.bytes) : i.bytes;
1088
- }
1089
- function ln(e, t = "bytes") {
1090
- return g(e, t);
1091
- }
1092
- function fn(e, t = "hex") {
1093
- return g(e, t);
1094
- }
1095
- function ve(e) {
1096
- return Array.isArray(e) ? Lt(e.map((t) => ve(t))) : jt(e);
1097
- }
1098
- function Lt(e) {
1099
- const t = e.reduce((s, o) => s + o.length, 0), n = Te(t);
1100
- return {
1101
- length: t <= 55 ? 1 + t : 1 + n + t,
1102
- encode(s) {
1103
- t <= 55 ? s.pushByte(192 + t) : (s.pushByte(247 + n), n === 1 ? s.pushUint8(t) : n === 2 ? s.pushUint16(t) : n === 3 ? s.pushUint24(t) : s.pushUint32(t));
1104
- for (const { encode: o } of e)
1105
- o(s);
1106
- }
1107
- };
1108
- }
1109
- function jt(e) {
1110
- const t = typeof e == "string" ? B(e) : e, n = Te(t.length);
1111
- return {
1112
- length: t.length === 1 && t[0] < 128 ? 1 : t.length <= 55 ? 1 + t.length : 1 + n + t.length,
1113
- encode(s) {
1114
- t.length === 1 && t[0] < 128 ? s.pushBytes(t) : t.length <= 55 ? (s.pushByte(128 + t.length), s.pushBytes(t)) : (s.pushByte(183 + n), n === 1 ? s.pushUint8(t.length) : n === 2 ? s.pushUint16(t.length) : n === 3 ? s.pushUint24(t.length) : s.pushUint32(t.length), s.pushBytes(t));
1115
- }
1116
- };
1117
- }
1118
- function Te(e) {
1119
- if (e < 2 ** 8)
1120
- return 1;
1121
- if (e < 2 ** 16)
1122
- return 2;
1123
- if (e < 2 ** 24)
1124
- return 3;
1125
- if (e < 2 ** 32)
1126
- return 4;
1127
- throw new u("Length is too large.");
1128
- }
1129
- const zt = {
1130
- "0x0": "reverted",
1131
- "0x1": "success"
1132
- };
1133
- function Ct(e) {
1134
- const t = {
1135
- ...e,
1136
- blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
1137
- contractAddress: e.contractAddress ? e.contractAddress : null,
1138
- cumulativeGasUsed: e.cumulativeGasUsed ? BigInt(e.cumulativeGasUsed) : null,
1139
- effectiveGasPrice: e.effectiveGasPrice ? BigInt(e.effectiveGasPrice) : null,
1140
- gasUsed: e.gasUsed ? BigInt(e.gasUsed) : null,
1141
- logs: e.logs ? e.logs.map((n) => Gt(n)) : null,
1142
- to: e.to ? e.to : null,
1143
- transactionIndex: e.transactionIndex ? G(e.transactionIndex) : null,
1144
- status: e.status ? zt[e.status] : null,
1145
- type: e.type ? me[e.type] || e.type : null
1146
- };
1147
- return e.blobGasPrice && (t.blobGasPrice = BigInt(e.blobGasPrice)), e.blobGasUsed && (t.blobGasUsed = BigInt(e.blobGasUsed)), t;
1148
- }
1149
- const dn = /* @__PURE__ */ z("transactionReceipt", Ct);
1150
- function At(e) {
1151
- const { blobVersionedHashes: t } = e;
1152
- if (t) {
1153
- if (t.length === 0)
1154
- throw new Ie();
1155
- for (const n of t) {
1156
- const i = P(n), s = G(nt(n, 0, 1));
1157
- if (i !== 32)
1158
- throw new Et({ hash: n, size: i });
1159
- if (s !== Pe)
1160
- throw new Ut({
1161
- hash: n,
1162
- version: s
1163
- });
1164
- }
1165
- }
1166
- Be(e);
1167
- }
1168
- function Be(e) {
1169
- const { chainId: t, maxPriorityFeePerGas: n, maxFeePerGas: i, to: s } = e;
1170
- if (t <= 0)
1171
- throw new S({ chainId: t });
1172
- if (s && !U(s))
1173
- throw new E({ address: s });
1174
- if (i && i > 2n ** 256n - 1n)
1175
- throw new j({ maxFeePerGas: i });
1176
- if (n && i && n > i)
1177
- throw new be({ maxFeePerGas: i, maxPriorityFeePerGas: n });
1178
- }
1179
- function Ht(e) {
1180
- const { chainId: t, maxPriorityFeePerGas: n, gasPrice: i, maxFeePerGas: s, to: o } = e;
1181
- if (t <= 0)
1182
- throw new S({ chainId: t });
1183
- if (o && !U(o))
1184
- throw new E({ address: o });
1185
- if (n || s)
1186
- throw new u("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");
1187
- if (i && i > 2n ** 256n - 1n)
1188
- throw new j({ maxFeePerGas: i });
1189
- }
1190
- function Nt(e) {
1191
- const { chainId: t, maxPriorityFeePerGas: n, gasPrice: i, maxFeePerGas: s, to: o, accessList: r } = e;
1192
- if (o && !U(o))
1193
- throw new E({ address: o });
1194
- if (typeof t < "u" && t <= 0)
1195
- throw new S({ chainId: t });
1196
- if (n || s)
1197
- throw new u("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");
1198
- if (i && i > 2n ** 256n - 1n)
1199
- throw new j({ maxFeePerGas: i });
1200
- if (r)
1201
- throw new u("`accessList` is not a valid Legacy Transaction attribute.");
1202
- }
1203
- function M(e) {
1204
- if (!e || e.length === 0)
1205
- return [];
1206
- const t = [];
1207
- for (let n = 0; n < e.length; n++) {
1208
- const { address: i, storageKeys: s } = e[n];
1209
- for (let o = 0; o < s.length; o++)
1210
- if (s[o].length - 2 !== 64)
1211
- throw new lt({ storageKey: s[o] });
1212
- if (!U(i, { strict: !1 }))
1213
- throw new E({ address: i });
1214
- t.push([i, s]);
1215
- }
1216
- return t;
1217
- }
1218
- function hn(e, t) {
1219
- const n = Ft(e);
1220
- return n === "eip1559" ? St(e, t) : n === "eip2930" ? Mt(e, t) : n === "eip4844" ? kt(e, t) : Vt(e, t);
1221
- }
1222
- function kt(e, t) {
1223
- const { chainId: n, gas: i, nonce: s, to: o, value: r, maxFeePerBlobGas: a, maxFeePerGas: c, maxPriorityFeePerGas: f, accessList: d, data: b } = e;
1224
- At(e);
1225
- let m = e.blobVersionedHashes, h = e.sidecars;
1226
- if (e.blobs && (typeof m > "u" || typeof h > "u")) {
1227
- const p = typeof e.blobs[0] == "string" ? e.blobs : e.blobs.map((v) => w(v)), $ = e.kzg, I = ye({
1228
- blobs: p,
1229
- kzg: $
1230
- });
1231
- if (typeof m > "u" && (m = Tt({
1232
- commitments: I
1233
- })), typeof h > "u") {
1234
- const v = xe({ blobs: p, commitments: I, kzg: $ });
1235
- h = $t({ blobs: p, commitments: I, proofs: v });
1236
- }
1237
- }
1238
- const O = M(d), _ = [
1239
- l(n),
1240
- s ? l(s) : "0x",
1241
- f ? l(f) : "0x",
1242
- c ? l(c) : "0x",
1243
- i ? l(i) : "0x",
1244
- o ?? "0x",
1245
- r ? l(r) : "0x",
1246
- b ?? "0x",
1247
- O,
1248
- a ? l(a) : "0x",
1249
- m ?? [],
1250
- ...V(e, t)
1251
- ], R = [], D = [], K = [];
1252
- if (h)
1253
- for (let p = 0; p < h.length; p++) {
1254
- const { blob: $, commitment: I, proof: v } = h[p];
1255
- R.push($), D.push(I), K.push(v);
1256
- }
1257
- return L([
1258
- "0x03",
1259
- // If sidecars are enabled, envelope turns into a "wrapper":
1260
- g(h ? [_, R, D, K] : _)
1261
- ]);
1262
- }
1263
- function St(e, t) {
1264
- const { chainId: n, gas: i, nonce: s, to: o, value: r, maxFeePerGas: a, maxPriorityFeePerGas: c, accessList: f, data: d } = e;
1265
- Be(e);
1266
- const b = M(f), m = [
1267
- l(n),
1268
- s ? l(s) : "0x",
1269
- c ? l(c) : "0x",
1270
- a ? l(a) : "0x",
1271
- i ? l(i) : "0x",
1272
- o ?? "0x",
1273
- r ? l(r) : "0x",
1274
- d ?? "0x",
1275
- b,
1276
- ...V(e, t)
1277
- ];
1278
- return L([
1279
- "0x02",
1280
- g(m)
1281
- ]);
1282
- }
1283
- function Mt(e, t) {
1284
- const { chainId: n, gas: i, data: s, nonce: o, to: r, value: a, accessList: c, gasPrice: f } = e;
1285
- Ht(e);
1286
- const d = M(c), b = [
1287
- l(n),
1288
- o ? l(o) : "0x",
1289
- f ? l(f) : "0x",
1290
- i ? l(i) : "0x",
1291
- r ?? "0x",
1292
- a ? l(a) : "0x",
1293
- s ?? "0x",
1294
- d,
1295
- ...V(e, t)
1296
- ];
1297
- return L([
1298
- "0x01",
1299
- g(b)
1300
- ]);
1301
- }
1302
- function Vt(e, t) {
1303
- const { chainId: n = 0, gas: i, data: s, nonce: o, to: r, value: a, gasPrice: c } = e;
1304
- Nt(e);
1305
- let f = [
1306
- o ? l(o) : "0x",
1307
- c ? l(c) : "0x",
1308
- i ? l(i) : "0x",
1309
- r ?? "0x",
1310
- a ? l(a) : "0x",
1311
- s ?? "0x"
1312
- ];
1313
- if (t) {
1314
- const d = (() => {
1315
- if (t.v >= 35n)
1316
- return (t.v - 35n) / 2n > 0 ? t.v : 27n + (t.v === 35n ? 0n : 1n);
1317
- if (n > 0)
1318
- return BigInt(n * 2) + BigInt(35n + t.v - 27n);
1319
- const b = 27n + (t.v === 27n ? 0n : 1n);
1320
- if (t.v !== b)
1321
- throw new ut({ v: t.v });
1322
- return b;
1323
- })();
1324
- f = [
1325
- ...f,
1326
- l(d),
1327
- t.r,
1328
- t.s
1329
- ];
1330
- } else n > 0 && (f = [
1331
- ...f,
1332
- l(n),
1333
- "0x",
1334
- "0x"
1335
- ]);
1336
- return g(f);
1337
- }
1338
- function V(e, t) {
1339
- const { r: n, s: i, v: s, yParity: o } = t ?? e;
1340
- return typeof n > "u" ? [] : typeof i > "u" ? [] : typeof s > "u" && typeof o > "u" ? [] : [typeof o == "number" ? o ? l(1) : "0x" : s === 0n ? "0x" : s === 1n ? l(1) : s === 27n ? "0x" : l(1), X(n), X(i)];
1341
- }
1342
- const bn = 2n ** (8n - 1n) - 1n, mn = 2n ** (16n - 1n) - 1n, pn = 2n ** (24n - 1n) - 1n, yn = 2n ** (32n - 1n) - 1n, xn = 2n ** (40n - 1n) - 1n, gn = 2n ** (48n - 1n) - 1n, wn = 2n ** (56n - 1n) - 1n, Pn = 2n ** (64n - 1n) - 1n, In = 2n ** (72n - 1n) - 1n, vn = 2n ** (80n - 1n) - 1n, Tn = 2n ** (88n - 1n) - 1n, Bn = 2n ** (96n - 1n) - 1n, En = 2n ** (104n - 1n) - 1n, Un = 2n ** (112n - 1n) - 1n, On = 2n ** (120n - 1n) - 1n, $n = 2n ** (128n - 1n) - 1n, Fn = 2n ** (136n - 1n) - 1n, Gn = 2n ** (144n - 1n) - 1n, Ln = 2n ** (152n - 1n) - 1n, jn = 2n ** (160n - 1n) - 1n, zn = 2n ** (168n - 1n) - 1n, Cn = 2n ** (176n - 1n) - 1n, An = 2n ** (184n - 1n) - 1n, Hn = 2n ** (192n - 1n) - 1n, Nn = 2n ** (200n - 1n) - 1n, kn = 2n ** (208n - 1n) - 1n, Sn = 2n ** (216n - 1n) - 1n, Mn = 2n ** (224n - 1n) - 1n, Vn = 2n ** (232n - 1n) - 1n, _n = 2n ** (240n - 1n) - 1n, Rn = 2n ** (248n - 1n) - 1n, Dn = 2n ** (256n - 1n) - 1n, Kn = -(2n ** (8n - 1n)), Xn = -(2n ** (16n - 1n)), Wn = -(2n ** (24n - 1n)), Yn = -(2n ** (32n - 1n)), Jn = -(2n ** (40n - 1n)), Qn = -(2n ** (48n - 1n)), Zn = -(2n ** (56n - 1n)), qn = -(2n ** (64n - 1n)), es = -(2n ** (72n - 1n)), ts = -(2n ** (80n - 1n)), ns = -(2n ** (88n - 1n)), ss = -(2n ** (96n - 1n)), is = -(2n ** (104n - 1n)), rs = -(2n ** (112n - 1n)), os = -(2n ** (120n - 1n)), as = -(2n ** (128n - 1n)), us = -(2n ** (136n - 1n)), cs = -(2n ** (144n - 1n)), ls = -(2n ** (152n - 1n)), fs = -(2n ** (160n - 1n)), ds = -(2n ** (168n - 1n)), hs = -(2n ** (176n - 1n)), bs = -(2n ** (184n - 1n)), ms = -(2n ** (192n - 1n)), ps = -(2n ** (200n - 1n)), ys = -(2n ** (208n - 1n)), xs = -(2n ** (216n - 1n)), gs = -(2n ** (224n - 1n)), ws = -(2n ** (232n - 1n)), Ps = -(2n ** (240n - 1n)), Is = -(2n ** (248n - 1n)), vs = -(2n ** (256n - 1n)), Ts = 2n ** 8n - 1n, Bs = 2n ** 16n - 1n, Es = 2n ** 24n - 1n, Us = 2n ** 32n - 1n, Os = 2n ** 40n - 1n, $s = 2n ** 48n - 1n, Fs = 2n ** 56n - 1n, Gs = 2n ** 64n - 1n, Ls = 2n ** 72n - 1n, js = 2n ** 80n - 1n, zs = 2n ** 88n - 1n, Cs = 2n ** 96n - 1n, As = 2n ** 104n - 1n, Hs = 2n ** 112n - 1n, Ns = 2n ** 120n - 1n, ks = 2n ** 128n - 1n, Ss = 2n ** 136n - 1n, Ms = 2n ** 144n - 1n, Vs = 2n ** 152n - 1n, _s = 2n ** 160n - 1n, Rs = 2n ** 168n - 1n, Ds = 2n ** 176n - 1n, Ks = 2n ** 184n - 1n, Xs = 2n ** 192n - 1n, Ws = 2n ** 200n - 1n, Ys = 2n ** 208n - 1n, Js = 2n ** 216n - 1n, Qs = 2n ** 224n - 1n, Zs = 2n ** 232n - 1n, qs = 2n ** 240n - 1n, ei = 2n ** 248n - 1n, ti = 2n ** 256n - 1n;
1343
- export {
1344
- hn as $,
1345
- un as A,
1346
- an as B,
1347
- rn as C,
1348
- on as D,
1349
- he as E,
1350
- j as F,
1351
- Jt as G,
1352
- Dt as H,
1353
- E as I,
1354
- g as J,
1355
- it as K,
1356
- Wt as L,
1357
- Yt as M,
1358
- dt as N,
1359
- Be as O,
1360
- rt as P,
1361
- Ht as Q,
1362
- At as R,
1363
- Nt as S,
1364
- xt as T,
1365
- en as U,
1366
- ut as V,
1367
- Qt as W,
1368
- pe as X,
1369
- Zt as Y,
1370
- Ct as Z,
1371
- qt as _,
1372
- L as a,
1373
- qs as a$,
1374
- vt as a0,
1375
- cn as a1,
1376
- S as a2,
1377
- ct as a3,
1378
- lt as a4,
1379
- ln as a5,
1380
- tt as a6,
1381
- sn as a7,
1382
- nn as a8,
1383
- dn as a9,
1384
- gn as aA,
1385
- wn as aB,
1386
- Pn as aC,
1387
- In as aD,
1388
- bn as aE,
1389
- vn as aF,
1390
- Tn as aG,
1391
- Bn as aH,
1392
- As as aI,
1393
- Hs as aJ,
1394
- Ns as aK,
1395
- ks as aL,
1396
- Ss as aM,
1397
- Ms as aN,
1398
- Vs as aO,
1399
- Bs as aP,
1400
- _s as aQ,
1401
- Rs as aR,
1402
- Ds as aS,
1403
- Ks as aT,
1404
- Xs as aU,
1405
- Ws as aV,
1406
- Ys as aW,
1407
- Js as aX,
1408
- Qs as aY,
1409
- Zs as aZ,
1410
- Es as a_,
1411
- tn as aa,
1412
- fn as ab,
1413
- En as ac,
1414
- Un as ad,
1415
- On as ae,
1416
- $n as af,
1417
- Fn as ag,
1418
- Gn as ah,
1419
- Ln as ai,
1420
- mn as aj,
1421
- jn as ak,
1422
- zn as al,
1423
- Cn as am,
1424
- An as an,
1425
- Hn as ao,
1426
- Nn as ap,
1427
- kn as aq,
1428
- Sn as ar,
1429
- Mn as as,
1430
- Vn as at,
1431
- pn as au,
1432
- _n as av,
1433
- Rn as aw,
1434
- Dn as ax,
1435
- yn as ay,
1436
- xn as az,
1437
- fe as b,
1438
- ei as b0,
1439
- ti as b1,
1440
- Us as b2,
1441
- Os as b3,
1442
- $s as b4,
1443
- Fs as b5,
1444
- Gs as b6,
1445
- Ls as b7,
1446
- Ts as b8,
1447
- js as b9,
1448
- Qn as bA,
1449
- Zn as bB,
1450
- qn as bC,
1451
- es as bD,
1452
- Kn as bE,
1453
- ts as bF,
1454
- ns as bG,
1455
- ss as bH,
1456
- gt as bI,
1457
- M as bJ,
1458
- It as bK,
1459
- Ot as bL,
1460
- me as bM,
1461
- V as bN,
1462
- zs as ba,
1463
- Cs as bb,
1464
- is as bc,
1465
- rs as bd,
1466
- os as be,
1467
- as as bf,
1468
- us as bg,
1469
- cs as bh,
1470
- ls as bi,
1471
- Xn as bj,
1472
- fs as bk,
1473
- ds as bl,
1474
- hs as bm,
1475
- bs as bn,
1476
- ms as bo,
1477
- ps as bp,
1478
- ys as bq,
1479
- xs as br,
1480
- gs as bs,
1481
- ws as bt,
1482
- Wn as bu,
1483
- Ps as bv,
1484
- Is as bw,
1485
- vs as bx,
1486
- Yn as by,
1487
- Jn as bz,
1488
- Kt as c,
1489
- ue as d,
1490
- st as e,
1491
- x as f,
1492
- ft as g,
1493
- ht as h,
1494
- U as i,
1495
- bt as j,
1496
- qe as k,
1497
- mt as l,
1498
- pt as m,
1499
- yt as n,
1500
- be as o,
1501
- de as p,
1502
- Xt as q,
1503
- Pt as r,
1504
- nt as s,
1505
- ye as t,
1506
- Tt as u,
1507
- xe as v,
1508
- $t as w,
1509
- Ft as x,
1510
- wt as y,
1511
- Gt as z
1512
- };