@bestinslot/wallet-kit 0.14.1 → 0.14.2

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,5 +1,5 @@
1
- import { i as rn, Y as Xn, Z as da, _ as pa, $ as ha, J as B, f as Lt, n as ds, a0 as di, a1 as Ur, a2 as X, a3 as z, R as Jt, h as Sn, K as xt, a4 as Pe, a5 as Y, a6 as Kt, a7 as qr, a8 as pi, a9 as wa, aa as ps, ab as _t, ac as le, ad as dn, ae as Dt, af as Qe, ag as Dr, e as Fe, G as he, ah as ga, ai as hs, aj as pn, ak as Mr, m as De, al as zn, r as Wr, I as ya, am as ba, an as Jn, ao as ma, ap as xa, aq as _a, ar as Sa, as as hi, at as Ea, au as wi } from "./mint-CSk_3TfL.js";
2
- async function Cd(e, t, n, r, s, i) {
1
+ import { i as rn, Y as Xn, Z as da, _ as pa, $ as ha, J as B, f as Lt, n as ps, a0 as pi, a1 as Ur, a2 as X, a3 as z, R as Ht, h as Sn, K as mt, a4 as Pe, a5 as Y, a6 as zt, a7 as qr, a8 as hi, a9 as wa, aa as hs, ab as _t, ac as fe, ad as dn, ae as Dt, af as Qe, ag as Dr, e as Fe, G as Vt, ah as ga, ai as ws, aj as pn, ak as Mr, m as De, al as zn, r as Wr, I as ya, am as ba, an as Jn, ao as ma, ap as xa, aq as _a, ar as Sa, as as wi, at as Ea, au as gi } from "./mint-CSk_3TfL.js";
2
+ async function Ad(e, t, n, r, s, i) {
3
3
  const o = rn();
4
4
  if (!o)
5
5
  throw new Error("No wallet connected");
@@ -28,7 +28,7 @@ async function Cd(e, t, n, r, s, i) {
28
28
  return await ha(e, t, r, n, s, a);
29
29
  throw new Error(`Unsupported wallet type: ${i}`);
30
30
  }
31
- function gi(e) {
31
+ function yi(e) {
32
32
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
33
33
  }
34
34
  function tn(e, t = "") {
@@ -38,7 +38,7 @@ function tn(e, t = "") {
38
38
  }
39
39
  }
40
40
  function ft(e, t, n = "") {
41
- const r = gi(e), s = e?.length, i = t !== void 0;
41
+ const r = yi(e), s = e?.length, i = t !== void 0;
42
42
  if (!r || i && s !== t) {
43
43
  const o = n && `"${n}" `, a = i ? ` of length ${t}` : "", c = r ? `length=${s}` : `type=${typeof e}`;
44
44
  throw new Error(o + "expected Uint8Array" + a + ", got " + c);
@@ -69,38 +69,38 @@ function hn(...e) {
69
69
  function br(e) {
70
70
  return new DataView(e.buffer, e.byteOffset, e.byteLength);
71
71
  }
72
- function Vt(e, t) {
72
+ function Yt(e, t) {
73
73
  return e << 32 - t | e >>> t;
74
74
  }
75
- const yi = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", va = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
75
+ const bi = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", va = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
76
76
  function wn(e) {
77
- if (ft(e), yi)
77
+ if (ft(e), bi)
78
78
  return e.toHex();
79
79
  let t = "";
80
80
  for (let n = 0; n < e.length; n++)
81
81
  t += va[e[n]];
82
82
  return t;
83
83
  }
84
- const se = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
85
- function ws(e) {
86
- if (e >= se._0 && e <= se._9)
87
- return e - se._0;
88
- if (e >= se.A && e <= se.F)
89
- return e - (se.A - 10);
90
- if (e >= se.a && e <= se.f)
91
- return e - (se.a - 10);
84
+ const ie = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
85
+ function gs(e) {
86
+ if (e >= ie._0 && e <= ie._9)
87
+ return e - ie._0;
88
+ if (e >= ie.A && e <= ie.F)
89
+ return e - (ie.A - 10);
90
+ if (e >= ie.a && e <= ie.f)
91
+ return e - (ie.a - 10);
92
92
  }
93
93
  function Dn(e) {
94
94
  if (typeof e != "string")
95
95
  throw new Error("hex string expected, got " + typeof e);
96
- if (yi)
96
+ if (bi)
97
97
  return Uint8Array.fromHex(e);
98
98
  const t = e.length, n = t / 2;
99
99
  if (t % 2)
100
100
  throw new Error("hex string expected, got unpadded hex of length " + t);
101
101
  const r = new Uint8Array(n);
102
102
  for (let s = 0, i = 0; s < n; s++, i += 2) {
103
- const o = ws(e.charCodeAt(i)), a = ws(e.charCodeAt(i + 1));
103
+ const o = gs(e.charCodeAt(i)), a = gs(e.charCodeAt(i + 1));
104
104
  if (o === void 0 || a === void 0) {
105
105
  const c = e[i] + e[i + 1];
106
106
  throw new Error('hex string expected, got non-hex character "' + c + '" at index ' + i);
@@ -126,7 +126,7 @@ function Oa(e, t = {}) {
126
126
  const n = (s, i) => e(i).update(s).digest(), r = e(void 0);
127
127
  return n.outputLen = r.outputLen, n.blockLen = r.blockLen, n.create = (s) => e(s), Object.assign(n, t), Object.freeze(n);
128
128
  }
129
- function bi(e = 32) {
129
+ function mi(e = 32) {
130
130
  const t = typeof globalThis == "object" ? globalThis.crypto : null;
131
131
  if (typeof t?.getRandomValues != "function")
132
132
  throw new Error("crypto.getRandomValues must be defined");
@@ -136,7 +136,7 @@ const Ia = (e) => ({
136
136
  oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, e])
137
137
  });
138
138
  const Hr = /* @__PURE__ */ BigInt(0), Mn = /* @__PURE__ */ BigInt(1);
139
- function gs(e, t = "") {
139
+ function ys(e, t = "") {
140
140
  if (typeof e != "boolean") {
141
141
  const n = t && `"${t}" `;
142
142
  throw new Error(n + "expected boolean, got type=" + typeof e);
@@ -157,28 +157,28 @@ function en(e, t = "") {
157
157
  throw new Error(n + "expected safe integer, got type=" + typeof e);
158
158
  }
159
159
  }
160
- function mi(e) {
160
+ function xi(e) {
161
161
  if (typeof e != "string")
162
162
  throw new Error("hex string expected, got " + typeof e);
163
163
  return e === "" ? Hr : BigInt("0x" + e);
164
164
  }
165
- function Xt(e) {
166
- return mi(wn(e));
165
+ function Jt(e) {
166
+ return xi(wn(e));
167
167
  }
168
- function xi(e) {
169
- return mi(wn(Si(ft(e)).reverse()));
168
+ function _i(e) {
169
+ return xi(wn(Ei(ft(e)).reverse()));
170
170
  }
171
- function mt(e, t) {
171
+ function xt(e, t) {
172
172
  tn(t), e = Ta(e);
173
173
  const n = Dn(e.toString(16).padStart(t * 2, "0"));
174
174
  if (n.length !== t)
175
175
  throw new Error("number too large");
176
176
  return n;
177
177
  }
178
- function _i(e, t) {
179
- return mt(e, t).reverse();
178
+ function Si(e, t) {
179
+ return xt(e, t).reverse();
180
180
  }
181
- function Si(e) {
181
+ function Ei(e) {
182
182
  return Uint8Array.from(e);
183
183
  }
184
184
  function jn(e) {
@@ -227,12 +227,12 @@ function kr(e) {
227
227
  return t.set(n, i), i;
228
228
  };
229
229
  }
230
- const At = /* @__PURE__ */ BigInt(0), Rt = /* @__PURE__ */ BigInt(1), Ce = /* @__PURE__ */ BigInt(2), Ei = /* @__PURE__ */ BigInt(3), Bi = /* @__PURE__ */ BigInt(4), vi = /* @__PURE__ */ BigInt(5), Na = /* @__PURE__ */ BigInt(7), Oi = /* @__PURE__ */ BigInt(8), Ca = /* @__PURE__ */ BigInt(9), Ii = /* @__PURE__ */ BigInt(16);
230
+ const At = /* @__PURE__ */ BigInt(0), Rt = /* @__PURE__ */ BigInt(1), Ce = /* @__PURE__ */ BigInt(2), Bi = /* @__PURE__ */ BigInt(3), vi = /* @__PURE__ */ BigInt(4), Oi = /* @__PURE__ */ BigInt(5), Na = /* @__PURE__ */ BigInt(7), Ii = /* @__PURE__ */ BigInt(8), Ca = /* @__PURE__ */ BigInt(9), Ti = /* @__PURE__ */ BigInt(16);
231
231
  function qt(e, t) {
232
232
  const n = e % t;
233
233
  return n >= At ? n : t + n;
234
234
  }
235
- function ys(e, t) {
235
+ function bs(e, t) {
236
236
  if (e === At)
237
237
  throw new Error("invert: expected non-zero number");
238
238
  if (t <= At)
@@ -250,16 +250,16 @@ function Zr(e, t, n) {
250
250
  if (!e.eql(e.sqr(t), n))
251
251
  throw new Error("Cannot find square root");
252
252
  }
253
- function Ti(e, t) {
254
- const n = (e.ORDER + Rt) / Bi, r = e.pow(t, n);
253
+ function Ri(e, t) {
254
+ const n = (e.ORDER + Rt) / vi, r = e.pow(t, n);
255
255
  return Zr(e, r, t), r;
256
256
  }
257
257
  function $a(e, t) {
258
- const n = (e.ORDER - vi) / Oi, r = e.mul(t, Ce), s = e.pow(r, n), i = e.mul(t, s), o = e.mul(e.mul(i, Ce), s), a = e.mul(i, e.sub(o, e.ONE));
258
+ const n = (e.ORDER - Oi) / Ii, r = e.mul(t, Ce), s = e.pow(r, n), i = e.mul(t, s), o = e.mul(e.mul(i, Ce), s), a = e.mul(i, e.sub(o, e.ONE));
259
259
  return Zr(e, a, t), a;
260
260
  }
261
261
  function Aa(e) {
262
- const t = Bn(e), n = Ri(e), r = n(t, t.neg(t.ONE)), s = n(t, r), i = n(t, t.neg(r)), o = (e + Na) / Ii;
262
+ const t = Bn(e), n = ki(e), r = n(t, t.neg(t.ONE)), s = n(t, r), i = n(t, t.neg(r)), o = (e + Na) / Ti;
263
263
  return (a, c) => {
264
264
  let u = a.pow(c, o), l = a.mul(u, r);
265
265
  const f = a.mul(u, s), d = a.mul(u, i), p = a.eql(a.sqr(l), c), w = a.eql(a.sqr(f), c);
@@ -268,8 +268,8 @@ function Aa(e) {
268
268
  return Zr(a, g, c), g;
269
269
  };
270
270
  }
271
- function Ri(e) {
272
- if (e < Ei)
271
+ function ki(e) {
272
+ if (e < Bi)
273
273
  throw new Error("sqrt is not defined for small field");
274
274
  let t = e - Rt, n = 0;
275
275
  for (; t % Ce === At; )
@@ -280,7 +280,7 @@ function Ri(e) {
280
280
  if (r++ > 1e3)
281
281
  throw new Error("Cannot find square root: probably non-prime P");
282
282
  if (n === 1)
283
- return Ti;
283
+ return Ri;
284
284
  let i = s.pow(r, t);
285
285
  const o = (t + Rt) / Ce;
286
286
  return function(c, u) {
@@ -303,7 +303,7 @@ function Ri(e) {
303
303
  };
304
304
  }
305
305
  function La(e) {
306
- return e % Bi === Ei ? Ti : e % Oi === vi ? $a : e % Ii === Ca ? Aa(e) : Ri(e);
306
+ return e % vi === Bi ? Ri : e % Ii === Oi ? $a : e % Ti === Ca ? Aa(e) : ki(e);
307
307
  }
308
308
  const Pa = [
309
309
  "create",
@@ -324,7 +324,7 @@ const Pa = [
324
324
  "mulN",
325
325
  "sqrN"
326
326
  ];
327
- function ki(e) {
327
+ function Ni(e) {
328
328
  const t = {
329
329
  ORDER: "bigint",
330
330
  BYTES: "number",
@@ -420,7 +420,7 @@ class Ua {
420
420
  return Qn(this, t, n);
421
421
  }
422
422
  div(t, n) {
423
- return qt(t * ys(n, this.ORDER), this.ORDER);
423
+ return qt(t * bs(n, this.ORDER), this.ORDER);
424
424
  }
425
425
  // Same as above, but doesn't normalize
426
426
  sqrN(t) {
@@ -436,13 +436,13 @@ class Ua {
436
436
  return t * n;
437
437
  }
438
438
  inv(t) {
439
- return ys(t, this.ORDER);
439
+ return bs(t, this.ORDER);
440
440
  }
441
441
  sqrt(t) {
442
442
  return this._sqrt || (this._sqrt = La(this.ORDER)), this._sqrt(this, t);
443
443
  }
444
444
  toBytes(t) {
445
- return this.isLE ? _i(t, this.BYTES) : mt(t, this.BYTES);
445
+ return this.isLE ? Si(t, this.BYTES) : xt(t, this.BYTES);
446
446
  }
447
447
  fromBytes(t, n = !1) {
448
448
  ft(t);
@@ -455,7 +455,7 @@ class Ua {
455
455
  }
456
456
  if (t.length !== s)
457
457
  throw new Error("Field.fromBytes: expected " + s + " bytes, got " + t.length);
458
- let c = i ? xi(t) : Xt(t);
458
+ let c = i ? _i(t) : Jt(t);
459
459
  if (a && (c = qt(c, o)), !n && !this.isValid(c))
460
460
  throw new Error("invalid field element: outside of range 0..ORDER");
461
461
  return c;
@@ -473,23 +473,23 @@ class Ua {
473
473
  function Bn(e, t = {}) {
474
474
  return new Ua(e, t);
475
475
  }
476
- function Ni(e) {
476
+ function Ci(e) {
477
477
  if (typeof e != "bigint")
478
478
  throw new Error("field order must be bigint");
479
479
  const t = e.toString(2).length;
480
480
  return Math.ceil(t / 8);
481
481
  }
482
- function Ci(e) {
483
- const t = Ni(e);
482
+ function $i(e) {
483
+ const t = Ci(e);
484
484
  return t + Math.ceil(t / 2);
485
485
  }
486
- function $i(e, t, n = !1) {
486
+ function Ai(e, t, n = !1) {
487
487
  ft(e);
488
- const r = e.length, s = Ni(t), i = Ci(t);
488
+ const r = e.length, s = Ci(t), i = $i(t);
489
489
  if (r < 16 || r < i || r > 1024)
490
490
  throw new Error("expected " + i + "-1024 bytes of input, got " + r);
491
- const o = n ? xi(e) : Xt(e), a = qt(o, t - Rt) + Rt;
492
- return n ? _i(a, s) : mt(a, s);
491
+ const o = n ? _i(e) : Jt(e), a = qt(o, t - Rt) + Rt;
492
+ return n ? Si(a, s) : xt(a, s);
493
493
  }
494
494
  function qa(e, t, n) {
495
495
  return e & t ^ ~e & n;
@@ -650,12 +650,12 @@ class Ga extends Ma {
650
650
  for (let f = 0; f < 16; f++, n += 4)
651
651
  ye[f] = t.getUint32(n, !1);
652
652
  for (let f = 16; f < 64; f++) {
653
- const d = ye[f - 15], p = ye[f - 2], w = Vt(d, 7) ^ Vt(d, 18) ^ d >>> 3, h = Vt(p, 17) ^ Vt(p, 19) ^ p >>> 10;
653
+ const d = ye[f - 15], p = ye[f - 2], w = Yt(d, 7) ^ Yt(d, 18) ^ d >>> 3, h = Yt(p, 17) ^ Yt(p, 19) ^ p >>> 10;
654
654
  ye[f] = h + ye[f - 7] + w + ye[f - 16] | 0;
655
655
  }
656
656
  let { A: r, B: s, C: i, D: o, E: a, F: c, G: u, H: l } = this;
657
657
  for (let f = 0; f < 64; f++) {
658
- const d = Vt(a, 6) ^ Vt(a, 11) ^ Vt(a, 25), p = l + d + qa(a, c, u) + Wa[f] + ye[f] | 0, h = (Vt(r, 2) ^ Vt(r, 13) ^ Vt(r, 22)) + Da(r, s, i) | 0;
658
+ const d = Yt(a, 6) ^ Yt(a, 11) ^ Yt(a, 25), p = l + d + qa(a, c, u) + Wa[f] + ye[f] | 0, h = (Yt(r, 2) ^ Yt(r, 13) ^ Yt(r, 22)) + Da(r, s, i) | 0;
659
659
  l = u, u = c, c = a, a = o + p | 0, o = i, i = s, s = r, r = p + h | 0;
660
660
  }
661
661
  r = r + this.A | 0, s = s + this.B | 0, i = i + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, u = u + this.G | 0, l = l + this.H | 0, this.set(r, s, i, o, a, c, u, l);
@@ -682,7 +682,7 @@ class Ha extends Ga {
682
682
  super(32);
683
683
  }
684
684
  }
685
- const Ai = /* @__PURE__ */ Oa(
685
+ const Li = /* @__PURE__ */ Oa(
686
686
  () => new Ha(),
687
687
  /* @__PURE__ */ Ia(1)
688
688
  );
@@ -695,27 +695,27 @@ function Vn(e, t) {
695
695
  const n = Me(e.Fp, t.map((r) => r.Z));
696
696
  return t.map((r, s) => e.fromAffine(r.toAffine(n[s])));
697
697
  }
698
- function Li(e, t) {
698
+ function Pi(e, t) {
699
699
  if (!Number.isSafeInteger(e) || e <= 0 || e > t)
700
700
  throw new Error("invalid window size, expected [1.." + t + "], got W=" + e);
701
701
  }
702
702
  function mr(e, t) {
703
- Li(e, t);
703
+ Pi(e, t);
704
704
  const n = Math.ceil(t / e) + 1, r = 2 ** (e - 1), s = 2 ** e, i = En(e), o = BigInt(e);
705
705
  return { windows: n, windowSize: r, mask: i, maxNumber: s, shiftBy: o };
706
706
  }
707
- function bs(e, t, n) {
707
+ function ms(e, t, n) {
708
708
  const { windowSize: r, mask: s, maxNumber: i, shiftBy: o } = n;
709
709
  let a = Number(e & s), c = e >> o;
710
710
  a > r && (a -= i, c += $e);
711
711
  const u = t * r, l = u + Math.abs(a) - 1, f = a === 0, d = a < 0, p = t % 2 !== 0;
712
712
  return { nextN: c, offset: l, isZero: f, isNeg: d, isNegF: p, offsetF: u };
713
713
  }
714
- const xr = /* @__PURE__ */ new WeakMap(), Pi = /* @__PURE__ */ new WeakMap();
714
+ const xr = /* @__PURE__ */ new WeakMap(), Fi = /* @__PURE__ */ new WeakMap();
715
715
  function _r(e) {
716
- return Pi.get(e) || 1;
716
+ return Fi.get(e) || 1;
717
717
  }
718
- function ms(e) {
718
+ function xs(e) {
719
719
  if (e !== nn)
720
720
  throw new Error("invalid wNAF");
721
721
  }
@@ -770,10 +770,10 @@ class Va {
770
770
  let s = this.ZERO, i = this.BASE;
771
771
  const o = mr(t, this.bits);
772
772
  for (let a = 0; a < o.windows; a++) {
773
- const { nextN: c, offset: u, isZero: l, isNeg: f, isNegF: d, offsetF: p } = bs(r, a, o);
773
+ const { nextN: c, offset: u, isZero: l, isNeg: f, isNegF: d, offsetF: p } = ms(r, a, o);
774
774
  r = c, l ? i = i.add(Hn(d, n[p])) : s = s.add(Hn(f, n[u]));
775
775
  }
776
- return ms(r), { p: s, f: i };
776
+ return xs(r), { p: s, f: i };
777
777
  }
778
778
  /**
779
779
  * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
@@ -783,13 +783,13 @@ class Va {
783
783
  wNAFUnsafe(t, n, r, s = this.ZERO) {
784
784
  const i = mr(t, this.bits);
785
785
  for (let o = 0; o < i.windows && r !== nn; o++) {
786
- const { nextN: a, offset: c, isZero: u, isNeg: l } = bs(r, o, i);
786
+ const { nextN: a, offset: c, isZero: u, isNeg: l } = ms(r, o, i);
787
787
  if (r = a, !u) {
788
788
  const f = n[c];
789
789
  s = s.add(l ? f.negate() : f);
790
790
  }
791
791
  }
792
- return ms(r), s;
792
+ return xs(r), s;
793
793
  }
794
794
  getPrecomputes(t, n, r) {
795
795
  let s = xr.get(n);
@@ -807,7 +807,7 @@ class Va {
807
807
  // using windowed method. This specifies window size and
808
808
  // stores precomputed values. Usually only base point would be precomputed.
809
809
  createCache(t, n) {
810
- Li(n, this.bits), Pi.set(t, n), xr.delete(t);
810
+ Pi(n, this.bits), Fi.set(t, n), xr.delete(t);
811
811
  }
812
812
  hasCache(t) {
813
813
  return _r(t) !== 1;
@@ -819,11 +819,11 @@ function Za(e, t, n, r) {
819
819
  n & $e && (i = i.add(s)), r & $e && (o = o.add(s)), s = s.double(), n >>= $e, r >>= $e;
820
820
  return { p1: i, p2: o };
821
821
  }
822
- function xs(e, t, n) {
822
+ function _s(e, t, n) {
823
823
  if (t) {
824
824
  if (t.ORDER !== e)
825
825
  throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
826
- return ki(t), t;
826
+ return Ni(t), t;
827
827
  } else
828
828
  return Bn(e, { isLE: n });
829
829
  }
@@ -835,13 +835,13 @@ function Ya(e, t, n = {}, r) {
835
835
  if (!(typeof u == "bigint" && u > nn))
836
836
  throw new Error(`CURVE.${c} must be positive bigint`);
837
837
  }
838
- const s = xs(t.p, n.Fp, r), i = xs(t.n, n.Fn, r), a = ["Gx", "Gy", "a", "b"];
838
+ const s = _s(t.p, n.Fp, r), i = _s(t.n, n.Fn, r), a = ["Gx", "Gy", "a", "b"];
839
839
  for (const c of a)
840
840
  if (!s.isValid(t[c]))
841
841
  throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);
842
842
  return t = Object.freeze(Object.assign({}, t)), { CURVE: t, Fp: s, Fn: i };
843
843
  }
844
- const Ka = Xt;
844
+ const Ka = Jt;
845
845
  function be(e, t) {
846
846
  if (en(e), en(t), e < 0 || e >= 1 << 8 * t)
847
847
  throw new Error("invalid I2OSP input: " + e);
@@ -856,13 +856,13 @@ function Xa(e, t) {
856
856
  n[r] = e[r] ^ t[r];
857
857
  return n;
858
858
  }
859
- function Fi(e) {
860
- if (!gi(e) && typeof e != "string")
859
+ function Ui(e) {
860
+ if (!yi(e) && typeof e != "string")
861
861
  throw new Error("DST must be Uint8Array or ascii string");
862
862
  return typeof e == "string" ? jn(e) : e;
863
863
  }
864
864
  function za(e, t, n, r) {
865
- ft(e), en(n), t = Fi(t), t.length > 255 && (t = r(ht(jn("H2C-OVERSIZE-DST-"), t)));
865
+ ft(e), en(n), t = Ui(t), t.length > 255 && (t = r(ht(jn("H2C-OVERSIZE-DST-"), t)));
866
866
  const { outputLen: s, blockLen: i } = r, o = Math.ceil(n / s);
867
867
  if (n > 65535 || o > 255)
868
868
  throw new Error("expand_message_xmd: invalid lenInBytes");
@@ -875,7 +875,7 @@ function za(e, t, n, r) {
875
875
  return ht(...l).slice(0, n);
876
876
  }
877
877
  function Ja(e, t, n, r, s) {
878
- if (ft(e), en(n), t = Fi(t), t.length > 255) {
878
+ if (ft(e), en(n), t = Ui(t), t.length > 255) {
879
879
  const i = Math.ceil(2 * r / 8);
880
880
  t = s.create({ dkLen: i }).update(jn("H2C-OVERSIZE-DST-")).update(t).digest();
881
881
  }
@@ -913,7 +913,7 @@ function Sr(e, t, n) {
913
913
  }
914
914
  return p;
915
915
  }
916
- function Ui(e, t) {
916
+ function qi(e, t) {
917
917
  const n = t.map((r) => Array.from(r).reverse());
918
918
  return (r, s) => {
919
919
  const [i, o, a, c] = n.map((f) => f.reduce((d, p) => e.add(e.mul(d, r), p))), [u, l] = Me(e, [o, c], !0);
@@ -921,7 +921,7 @@ function Ui(e, t) {
921
921
  };
922
922
  }
923
923
  const ja = jn("HashToScalar-");
924
- function _s(e, t, n) {
924
+ function Ss(e, t, n) {
925
925
  if (typeof t != "function")
926
926
  throw new Error("mapToCurve() must be defined");
927
927
  function r(i) {
@@ -964,7 +964,7 @@ function _s(e, t, n) {
964
964
  }
965
965
  };
966
966
  }
967
- class qi {
967
+ class Di {
968
968
  oHash;
969
969
  iHash;
970
970
  blockLen;
@@ -1006,11 +1006,11 @@ class qi {
1006
1006
  this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
1007
1007
  }
1008
1008
  }
1009
- const Yr = (e, t, n) => new qi(e, t).update(n).digest();
1010
- Yr.create = (e, t) => new qi(e, t);
1011
- const Ss = (e, t) => (e + (e >= 0 ? t : -t) / ie) / t;
1009
+ const Yr = (e, t, n) => new Di(e, t).update(n).digest();
1010
+ Yr.create = (e, t) => new Di(e, t);
1011
+ const Es = (e, t) => (e + (e >= 0 ? t : -t) / oe) / t;
1012
1012
  function Qa(e, t, n) {
1013
- const [[r, s], [i, o]] = t, a = Ss(o * e, n), c = Ss(-s * e, n);
1013
+ const [[r, s], [i, o]] = t, a = Es(o * e, n), c = Es(-s * e, n);
1014
1014
  let u = e - a * r - c * i, l = -a * s - c * o;
1015
1015
  const f = u < Ae, d = l < Ae;
1016
1016
  f && (u = -u), d && (l = -l);
@@ -1019,8 +1019,8 @@ function Qa(e, t, n) {
1019
1019
  throw new Error("splitScalar (endomorphism): failed, k=" + e);
1020
1020
  return { k1neg: f, k1: u, k2neg: d, k2: l };
1021
1021
  }
1022
- const Ae = BigInt(0), kt = BigInt(1), ie = BigInt(2), Ke = BigInt(3), Nr = BigInt(4);
1023
- function Di(e, t = {}) {
1022
+ const Ae = BigInt(0), kt = BigInt(1), oe = BigInt(2), Ke = BigInt(3), Nr = BigInt(4);
1023
+ function Mi(e, t = {}) {
1024
1024
  const n = Ya("weierstrass", e, t), { Fp: r, Fn: s } = n;
1025
1025
  let i = n.CURVE;
1026
1026
  const { h: o, n: a } = i;
@@ -1042,7 +1042,7 @@ function Di(e, t = {}) {
1042
1042
  }
1043
1043
  function f(U, y, S) {
1044
1044
  const { x: O, y: k } = y.toAffine(), F = r.toBytes(O);
1045
- if (gs(S, "isCompressed"), S) {
1045
+ if (ys(S, "isCompressed"), S) {
1046
1046
  l();
1047
1047
  const L = !r.isOdd(k);
1048
1048
  return ht(tc(L), F);
@@ -1302,7 +1302,7 @@ function Di(e, t = {}) {
1302
1302
  return this.multiplyUnsafe(o).is0();
1303
1303
  }
1304
1304
  toBytes(y = !0) {
1305
- return gs(y, "isCompressed"), this.assertValidity(), p(_, this, y);
1305
+ return ys(y, "isCompressed"), this.assertValidity(), p(_, this, y);
1306
1306
  }
1307
1307
  toHex(y = !0) {
1308
1308
  return wn(this.toBytes(y));
@@ -1320,9 +1320,9 @@ function tc(e) {
1320
1320
  function ec(e, t) {
1321
1321
  const n = e.ORDER;
1322
1322
  let r = Ae;
1323
- for (let w = n - kt; w % ie === Ae; w /= ie)
1323
+ for (let w = n - kt; w % oe === Ae; w /= oe)
1324
1324
  r += kt;
1325
- const s = r, i = ie << s - kt - kt, o = i * ie, a = (n - kt) / o, c = (a - kt) / ie, u = o - kt, l = i, f = e.pow(t, a), d = e.pow(t, (a + kt) / ie);
1325
+ const s = r, i = oe << s - kt - kt, o = i * oe, a = (n - kt) / o, c = (a - kt) / oe, u = o - kt, l = i, f = e.pow(t, a), d = e.pow(t, (a + kt) / oe);
1326
1326
  let p = (w, h) => {
1327
1327
  let g = f, b = e.pow(h, u), m = e.sqr(b);
1328
1328
  m = e.mul(m, h);
@@ -1333,8 +1333,8 @@ function ec(e, t) {
1333
1333
  let D = e.eql(v, e.ONE);
1334
1334
  b = e.mul(m, d), v = e.mul(T, g), m = e.cmov(b, m, D), T = e.cmov(v, T, D);
1335
1335
  for (let $ = s; $ > kt; $--) {
1336
- let A = $ - ie;
1337
- A = ie << A - kt;
1336
+ let A = $ - oe;
1337
+ A = oe << A - kt;
1338
1338
  let R = e.pow(T, A);
1339
1339
  const _ = e.eql(R, e.ONE);
1340
1340
  b = e.mul(m, g), g = e.mul(g, g), R = e.mul(T, g), m = e.cmov(b, m, _), T = e.cmov(R, T, _);
@@ -1356,8 +1356,8 @@ function ec(e, t) {
1356
1356
  }
1357
1357
  return p;
1358
1358
  }
1359
- function Mi(e, t) {
1360
- ki(e);
1359
+ function Wi(e, t) {
1360
+ Ni(e);
1361
1361
  const { A: n, B: r, Z: s } = t;
1362
1362
  if (!e.isValid(n) || !e.isValid(r) || !e.isValid(s))
1363
1363
  throw new Error("mapToCurveSimpleSWU: invalid opts");
@@ -1384,7 +1384,7 @@ function nc(e, t) {
1384
1384
  signature: 2 * t.BYTES
1385
1385
  };
1386
1386
  }
1387
- const rc = BigInt(0), Cn = BigInt(1), Es = BigInt(2), Xe = BigInt(3);
1387
+ const rc = BigInt(0), Cn = BigInt(1), Bs = BigInt(2), Xe = BigInt(3);
1388
1388
  function sc(e) {
1389
1389
  const t = [];
1390
1390
  for (; e > Cn; e >>= Cn)
@@ -1404,7 +1404,7 @@ function ic(e, t, n, r) {
1404
1404
  l = ($, A, R, _, M, H) => o.mul034(_, i.mul(R, H), i.mul(A, M), $);
1405
1405
  else
1406
1406
  throw new Error("bls: unknown twist type");
1407
- const f = i.div(i.ONE, i.mul(i.ONE, Es));
1407
+ const f = i.div(i.ONE, i.mul(i.ONE, Bs));
1408
1408
  function d($, A, R, _) {
1409
1409
  const M = i.sqr(R), H = i.sqr(_), U = i.mulByB(i.mul(H, Xe)), y = i.mul(U, Xe), S = i.sub(i.sub(i.sqr(i.add(R, _)), H), M), O = i.sub(U, M), k = i.mul(i.sqr(A), Xe), F = i.neg(S);
1410
1410
  return $.push([O, k, F]), A = i.mul(i.mul(i.mul(i.sub(M, y), A), R), f), R = i.sub(i.sqr(i.mul(i.add(M, y), f)), i.mul(i.sqr(U), Xe)), _ = i.mul(M, S), { Rx: A, Ry: R, Rz: _ };
@@ -1412,7 +1412,7 @@ function ic(e, t, n, r) {
1412
1412
  function p($, A, R, _, M, H) {
1413
1413
  const U = i.sub(R, i.mul(H, _)), y = i.sub(A, i.mul(M, _)), S = i.sub(i.mul(U, M), i.mul(y, H)), O = i.neg(U), k = y;
1414
1414
  $.push([S, O, k]);
1415
- const F = i.sqr(y), L = i.mul(F, y), q = i.mul(F, A), N = i.add(i.sub(L, i.mul(q, Es)), i.mul(i.sqr(U), _));
1415
+ const F = i.sqr(y), L = i.mul(F, y), q = i.mul(F, A), N = i.add(i.sub(L, i.mul(q, Bs)), i.mul(i.sqr(U), _));
1416
1416
  return A = i.mul(y, N), R = i.sub(i.mul(i.sub(q, N), U), i.mul(L, R)), _ = i.mul(_, L), { Rx: A, Ry: R, Rz: _ };
1417
1417
  }
1418
1418
  const w = sc(c), h = kr(($) => {
@@ -1458,8 +1458,8 @@ function ic(e, t, n, r) {
1458
1458
  return b([{ g1: $, g2: A }], R);
1459
1459
  }
1460
1460
  const v = {
1461
- seed: Ci(s.ORDER)
1462
- }, T = r.randomBytes || bi;
1461
+ seed: $i(s.ORDER)
1462
+ }, T = r.randomBytes || mi;
1463
1463
  return {
1464
1464
  lengths: v,
1465
1465
  Fr: s,
@@ -1469,10 +1469,10 @@ function ic(e, t, n, r) {
1469
1469
  pairing: m,
1470
1470
  pairingBatch: b,
1471
1471
  calcPairingPrecomputes: h,
1472
- randomSecretKey: ($ = T(v.seed)) => (ft($, v.seed, "seed"), $i($, s.ORDER))
1472
+ randomSecretKey: ($ = T(v.seed)) => (ft($, v.seed, "seed"), Ai($, s.ORDER))
1473
1473
  };
1474
1474
  }
1475
- function Bs(e, t, n, r, s, i) {
1475
+ function vs(e, t, n, r, s, i) {
1476
1476
  const { Fr: o, Fp12: a, pairingBatch: c, randomSecretKey: u, lengths: l } = e;
1477
1477
  i || (i = {
1478
1478
  fromBytes: xe,
@@ -1593,10 +1593,10 @@ function oc(e, t, n, r) {
1593
1593
  });
1594
1594
  }
1595
1595
  function ac(e, t, n, r, s) {
1596
- const i = oc(e, t, n, r), o = _s(t, s.mapToG1 || xe, {
1596
+ const i = oc(e, t, n, r), o = Ss(t, s.mapToG1 || xe, {
1597
1597
  ...s.hasherOpts,
1598
1598
  ...s.hasherOptsG1
1599
- }), a = _s(n, s.mapToG2 || xe, {
1599
+ }), a = Ss(n, s.mapToG2 || xe, {
1600
1600
  ...s.hasherOpts,
1601
1601
  ...s.hasherOptsG2
1602
1602
  });
@@ -1609,10 +1609,10 @@ function cc(e, t, n, r, s, i) {
1609
1609
  Fp12: o.fields.Fp12,
1610
1610
  calcPairingPrecomputes: o.utils.calcPairingPrecomputes,
1611
1611
  randomSecretKey: o.utils.randomSecretKey
1612
- }, c = Bs(a, t, n, !1, o.G2.hashToCurve, i?.LongSignature), u = Bs(a, n, t, !0, o.G1.hashToCurve, i?.ShortSignature);
1612
+ }, c = vs(a, t, n, !1, o.G2.hashToCurve, i?.LongSignature), u = vs(a, n, t, !0, o.G1.hashToCurve, i?.ShortSignature);
1613
1613
  return Object.freeze({ ...o, longSignatures: c, shortSignatures: u });
1614
1614
  }
1615
- const vs = BigInt(0), ze = BigInt(1), Ot = BigInt(2), Os = BigInt(3);
1615
+ const Os = BigInt(0), ze = BigInt(1), Ot = BigInt(2), Is = BigInt(3);
1616
1616
  function Kr(e, t, n, r, s = 1, i) {
1617
1617
  const o = BigInt(i === void 0 ? r : i), a = n ** BigInt(r), c = [];
1618
1618
  for (let u = 0; u < s; u++) {
@@ -1626,12 +1626,12 @@ function Kr(e, t, n, r, s = 1, i) {
1626
1626
  return c;
1627
1627
  }
1628
1628
  function uc(e, t, n) {
1629
- const r = t.pow(n, (e.ORDER - ze) / Os), s = t.pow(n, (e.ORDER - ze) / Ot);
1629
+ const r = t.pow(n, (e.ORDER - ze) / Is), s = t.pow(n, (e.ORDER - ze) / Ot);
1630
1630
  function i(d, p) {
1631
1631
  const w = t.mul(t.frobeniusMap(d, 1), r), h = t.mul(t.frobeniusMap(p, 1), s);
1632
1632
  return [w, h];
1633
1633
  }
1634
- const o = t.pow(n, (e.ORDER ** Ot - ze) / Os), a = t.pow(n, (e.ORDER ** Ot - ze) / Ot);
1634
+ const o = t.pow(n, (e.ORDER ** Ot - ze) / Is), a = t.pow(n, (e.ORDER ** Ot - ze) / Ot);
1635
1635
  if (!t.eql(a, t.neg(t.ONE)))
1636
1636
  throw new Error("psiFrobenius: PSI2_Y!==-1");
1637
1637
  function c(d, p) {
@@ -1643,7 +1643,7 @@ function uc(e, t, n) {
1643
1643
  }, l = u(i), f = u(c);
1644
1644
  return { psi: i, psi2: c, G2psi: l, G2psi2: f, PSI_X: r, PSI_Y: s, PSI2_X: o, PSI2_Y: a };
1645
1645
  }
1646
- const Is = (e, t) => {
1646
+ const Ts = (e, t) => {
1647
1647
  if (t.length !== 2)
1648
1648
  throw new Error("invalid tuple");
1649
1649
  const n = t.map((r) => e.create(r));
@@ -1664,17 +1664,17 @@ class lc {
1664
1664
  FROBENIUS_COEFFICIENTS;
1665
1665
  constructor(t, n = {}) {
1666
1666
  const r = t.ORDER, s = r * r;
1667
- this.Fp = t, this.ORDER = s, this.BITS = Wn(s), this.BYTES = Math.ceil(Wn(s) / 8), this.isLE = t.isLE, this.ZERO = { c0: t.ZERO, c1: t.ZERO }, this.ONE = { c0: t.ONE, c1: t.ZERO }, this.Fp_NONRESIDUE = t.create(n.NONRESIDUE || BigInt(-1)), this.Fp_div2 = t.div(t.ONE, Ot), this.NONRESIDUE = Is(t, n.FP2_NONRESIDUE), this.FROBENIUS_COEFFICIENTS = Kr(t, this.Fp_NONRESIDUE, t.ORDER, 2)[0], this.mulByB = n.Fp2mulByB, Object.seal(this);
1667
+ this.Fp = t, this.ORDER = s, this.BITS = Wn(s), this.BYTES = Math.ceil(Wn(s) / 8), this.isLE = t.isLE, this.ZERO = { c0: t.ZERO, c1: t.ZERO }, this.ONE = { c0: t.ONE, c1: t.ZERO }, this.Fp_NONRESIDUE = t.create(n.NONRESIDUE || BigInt(-1)), this.Fp_div2 = t.div(t.ONE, Ot), this.NONRESIDUE = Ts(t, n.FP2_NONRESIDUE), this.FROBENIUS_COEFFICIENTS = Kr(t, this.Fp_NONRESIDUE, t.ORDER, 2)[0], this.mulByB = n.Fp2mulByB, Object.seal(this);
1668
1668
  }
1669
1669
  fromBigTuple(t) {
1670
- return Is(this.Fp, t);
1670
+ return Ts(this.Fp, t);
1671
1671
  }
1672
1672
  create(t) {
1673
1673
  return t;
1674
1674
  }
1675
1675
  isValid({ c0: t, c1: n }) {
1676
1676
  function r(s, i) {
1677
- return typeof s == "bigint" && vs <= s && s < i;
1677
+ return typeof s == "bigint" && Os <= s && s < i;
1678
1678
  }
1679
1679
  return r(t, this.ORDER) && r(n, this.ORDER);
1680
1680
  }
@@ -1760,7 +1760,7 @@ class lc {
1760
1760
  }
1761
1761
  // Same as sgn0_m_eq_2 in RFC 9380
1762
1762
  isOdd(t) {
1763
- const { re: n, im: r } = this.reim(t), s = n % Ot, i = n === vs, o = r % Ot;
1763
+ const { re: n, im: r } = this.reim(t), s = n % Ot, i = n === Os, o = r % Ot;
1764
1764
  return BigInt(s || i && o) == ze;
1765
1765
  }
1766
1766
  // Bytes util
@@ -2237,14 +2237,14 @@ const St = BigInt(0), Zn = BigInt(1), Mt = BigInt(2), tr = BigInt(3), gn = BigIn
2237
2237
  const t = Se, n = K.div(K.frobeniusMap(e, 6), e), r = K.mul(K.frobeniusMap(n, 2), n), s = K.conjugate(K._cyclotomicExp(r, t)), i = K.mul(K.conjugate(K._cyclotomicSquare(r)), s), o = K.conjugate(K._cyclotomicExp(i, t)), a = K.conjugate(K._cyclotomicExp(o, t)), c = K.mul(K.conjugate(K._cyclotomicExp(a, t)), K._cyclotomicSquare(s)), u = K.conjugate(K._cyclotomicExp(c, t)), l = K.frobeniusMap(K.mul(s, a), 2), f = K.frobeniusMap(K.mul(o, r), 3), d = K.frobeniusMap(K.mul(c, K.conjugate(r)), 1), p = K.mul(K.mul(u, K.conjugate(i)), r);
2238
2238
  return K.mul(K.mul(K.mul(l, f), d), p);
2239
2239
  }
2240
- }), { G2psi: Ts, G2psi2: gc } = uc(C, V, V.div(V.ONE, V.NONRESIDUE)), Br = Object.freeze({
2240
+ }), { G2psi: Rs, G2psi2: gc } = uc(C, V, V.div(V.ONE, V.NONRESIDUE)), Br = Object.freeze({
2241
2241
  DST: "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_",
2242
2242
  encodeDST: "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_",
2243
2243
  p: C.ORDER,
2244
2244
  m: 2,
2245
2245
  k: 128,
2246
2246
  expand: "xmd",
2247
- hash: Ai
2247
+ hash: Li
2248
2248
  }), zr = {
2249
2249
  p: V.ORDER,
2250
2250
  n: sn.n,
@@ -2261,7 +2261,7 @@ const St = BigInt(0), Zn = BigInt(1), Mt = BigInt(2), tr = BigInt(3), gn = BigIn
2261
2261
  ])
2262
2262
  }, er = vn(C.toBytes(St), { infinity: !0, compressed: !0 });
2263
2263
  function nr(e) {
2264
- e = Si(e);
2264
+ e = Ei(e);
2265
2265
  const t = e[0] & 224, n = !!(t >> 7 & 1), r = !!(t >> 6 & 1), s = !!(t >> 5 & 1);
2266
2266
  return e[0] &= 31, { compressed: n, infinity: r, sort: s, value: e };
2267
2267
  }
@@ -2276,9 +2276,9 @@ function yc(e, t, n) {
2276
2276
  if (i)
2277
2277
  return er.slice();
2278
2278
  const c = !!(a * Mt / s);
2279
- return vn(mt(o, r), { compressed: !0, sort: c });
2279
+ return vn(xt(o, r), { compressed: !0, sort: c });
2280
2280
  } else
2281
- return i ? ht(Uint8Array.of(64), new Uint8Array(2 * r - 1)) : ht(mt(o, r), mt(a, r));
2281
+ return i ? ht(Uint8Array.of(64), new Uint8Array(2 * r - 1)) : ht(xt(o, r), xt(a, r));
2282
2282
  }
2283
2283
  function vr(e) {
2284
2284
  e.assertValidity();
@@ -2286,12 +2286,12 @@ function vr(e) {
2286
2286
  if (e.is0())
2287
2287
  return er.slice();
2288
2288
  const i = !!(s * Mt / n);
2289
- return vn(mt(r, t), { compressed: !0, sort: i });
2289
+ return vn(xt(r, t), { compressed: !0, sort: i });
2290
2290
  }
2291
2291
  function bc(e) {
2292
2292
  const { compressed: t, infinity: n, sort: r, value: s } = nr(e), { BYTES: i, ORDER: o } = C;
2293
2293
  if (s.length === 48 && t) {
2294
- const a = Xt(s), c = C.create(a & En(C.BITS));
2294
+ const a = Jt(s), c = C.create(a & En(C.BITS));
2295
2295
  if (n) {
2296
2296
  if (c !== St)
2297
2297
  throw new Error("invalid G1 point: non-empty, at infinity, with compression");
@@ -2303,7 +2303,7 @@ function bc(e) {
2303
2303
  throw new Error("invalid G1 point: compressed point");
2304
2304
  return l * Mt / o !== BigInt(r) && (l = C.neg(l)), { x: C.create(c), y: C.create(l) };
2305
2305
  } else if (s.length === 96 && !t) {
2306
- const a = Xt(s.subarray(0, i)), c = Xt(s.subarray(i));
2306
+ const a = Jt(s.subarray(0, i)), c = Jt(s.subarray(i));
2307
2307
  if (n) {
2308
2308
  if (a !== St || c !== St)
2309
2309
  throw new Error("G1: non-empty point at infinity");
@@ -2313,8 +2313,8 @@ function bc(e) {
2313
2313
  } else
2314
2314
  throw new Error("invalid G1 point: expected 48/96 bytes");
2315
2315
  }
2316
- function Rs(e) {
2317
- const { infinity: t, sort: n, value: r } = nr(ft(e, 48, "signature")), s = C.ORDER, i = I.G1.Point, o = Xt(r);
2316
+ function ks(e) {
2317
+ const { infinity: t, sort: n, value: r } = nr(ft(e, 48, "signature")), s = C.ORDER, i = I.G1.Point, o = Jt(r);
2318
2318
  if (t)
2319
2319
  return i.ZERO;
2320
2320
  const a = C.create(o & En(C.BITS)), c = C.add(C.pow(a, tr), C.create(sn.b));
@@ -2330,23 +2330,23 @@ function mc(e, t, n) {
2330
2330
  const { BYTES: r, ORDER: s } = C, i = t.is0(), { x: o, y: a } = t.toAffine();
2331
2331
  if (n) {
2332
2332
  if (i)
2333
- return ht(er, mt(St, r));
2333
+ return ht(er, xt(St, r));
2334
2334
  const c = !!(a.c1 === St ? a.c0 * Mt / s : a.c1 * Mt / s);
2335
- return ht(vn(mt(o.c1, r), { compressed: !0, sort: c }), mt(o.c0, r));
2335
+ return ht(vn(xt(o.c1, r), { compressed: !0, sort: c }), xt(o.c0, r));
2336
2336
  } else {
2337
2337
  if (i)
2338
2338
  return ht(Uint8Array.of(64), new Uint8Array(4 * r - 1));
2339
2339
  const { re: c, im: u } = V.reim(o), { re: l, im: f } = V.reim(a);
2340
- return ht(mt(u, r), mt(c, r), mt(f, r), mt(l, r));
2340
+ return ht(xt(u, r), xt(c, r), xt(f, r), xt(l, r));
2341
2341
  }
2342
2342
  }
2343
2343
  function Or(e) {
2344
2344
  e.assertValidity();
2345
2345
  const { BYTES: t } = C;
2346
2346
  if (e.is0())
2347
- return ht(er, mt(St, t));
2347
+ return ht(er, xt(St, t));
2348
2348
  const { x: n, y: r } = e.toAffine(), { re: s, im: i } = V.reim(n), { re: o, im: a } = V.reim(r), u = !!((a > St ? a * Mt : o * Mt) / C.ORDER & Zn), l = s;
2349
- return ht(vn(mt(i, t), { sort: u, compressed: !0 }), mt(l, t));
2349
+ return ht(vn(xt(i, t), { sort: u, compressed: !0 }), xt(l, t));
2350
2350
  }
2351
2351
  function xc(e) {
2352
2352
  const { BYTES: t, ORDER: n } = C, { compressed: r, infinity: s, sort: i, value: o } = nr(e);
@@ -2354,7 +2354,7 @@ function xc(e) {
2354
2354
  !r && s && i || // 01100000
2355
2355
  i && s && r)
2356
2356
  throw new Error("invalid encoding flag: " + (e[0] & 224));
2357
- const a = (c, u, l) => Xt(c.slice(u, l));
2357
+ const a = (c, u, l) => Jt(c.slice(u, l));
2358
2358
  if (o.length === 96 && r) {
2359
2359
  if (s) {
2360
2360
  if (o.reduce((w, h) => w !== 0 ? h + 1 : h, 0) > 0)
@@ -2376,11 +2376,11 @@ function xc(e) {
2376
2376
  } else
2377
2377
  throw new Error("invalid G2 point: expected 96/192 bytes");
2378
2378
  }
2379
- function ks(e) {
2379
+ function Ns(e) {
2380
2380
  const { ORDER: t } = C, { infinity: n, sort: r, value: s } = nr(ft(e)), i = I.G2.Point, o = s.length / 2;
2381
2381
  if (o !== 48 && o !== 96)
2382
2382
  throw new Error("invalid compressed signature length, expected 96/192 bytes");
2383
- const a = Xt(s.slice(0, o)), c = Xt(s.slice(o));
2383
+ const a = Jt(s.slice(0, o)), c = Jt(s.slice(o));
2384
2384
  if (n)
2385
2385
  return i.ZERO;
2386
2386
  const u = C.create(a & En(C.BITS)), l = C.create(c), f = V.create({ c0: l, c1: u }), d = V.add(V.pow(f, tr), zr.b);
@@ -2395,10 +2395,10 @@ function ks(e) {
2395
2395
  const _c = {
2396
2396
  ShortSignature: {
2397
2397
  fromBytes(e) {
2398
- return Rs(ft(e));
2398
+ return ks(ft(e));
2399
2399
  },
2400
2400
  fromHex(e) {
2401
- return Rs(Dn(e));
2401
+ return ks(Dn(e));
2402
2402
  },
2403
2403
  toBytes(e) {
2404
2404
  return vr(e);
@@ -2412,10 +2412,10 @@ const _c = {
2412
2412
  },
2413
2413
  LongSignature: {
2414
2414
  fromBytes(e) {
2415
- return ks(ft(e));
2415
+ return Ns(ft(e));
2416
2416
  },
2417
2417
  fromHex(e) {
2418
- return ks(Dn(e));
2418
+ return Ns(Dn(e));
2419
2419
  },
2420
2420
  toBytes(e) {
2421
2421
  return Or(e);
@@ -2433,7 +2433,7 @@ const _c = {
2433
2433
  Fp6: wc,
2434
2434
  Fp12: K,
2435
2435
  Fr: Xr
2436
- }, Ec = Di(sn, {
2436
+ }, Ec = Mi(sn, {
2437
2437
  allowInfinityPoint: !0,
2438
2438
  Fn: Xr,
2439
2439
  fromBytes: bc,
@@ -2449,7 +2449,7 @@ const _c = {
2449
2449
  // Clear cofactor of G1
2450
2450
  // https://eprint.iacr.org/2019/403
2451
2451
  clearCofactor: (e, t) => t.multiplyUnsafe(Se).add(t)
2452
- }), Bc = Di(zr, {
2452
+ }), Bc = Mi(zr, {
2453
2453
  Fp: V,
2454
2454
  allowInfinityPoint: !0,
2455
2455
  Fn: Xr,
@@ -2457,13 +2457,13 @@ const _c = {
2457
2457
  toBytes: mc,
2458
2458
  // https://eprint.iacr.org/2021/1130.pdf
2459
2459
  // Older version: https://eprint.iacr.org/2019/814.pdf
2460
- isTorsionFree: (e, t) => t.multiplyUnsafe(Se).negate().equals(Ts(e, t)),
2460
+ isTorsionFree: (e, t) => t.multiplyUnsafe(Se).negate().equals(Rs(e, t)),
2461
2461
  // clear_cofactor_bls12381_g2 from RFC 9380.
2462
2462
  // https://eprint.iacr.org/2017/419.pdf
2463
2463
  // prettier-ignore
2464
2464
  clearCofactor: (e, t) => {
2465
2465
  const n = Se;
2466
- let r = t.multiplyUnsafe(n).negate(), s = Ts(e, t), i = t.double();
2466
+ let r = t.multiplyUnsafe(n).negate(), s = Rs(e, t), i = t.double();
2467
2467
  return i = gc(e, i), i = i.subtract(s), s = r.add(s), s = s.multiplyUnsafe(n).negate(), i = i.add(s), i = i.subtract(r), i.subtract(t);
2468
2468
  }
2469
2469
  }), vc = {
@@ -2476,8 +2476,8 @@ const _c = {
2476
2476
  ateLoopSize: Se,
2477
2477
  // The BLS parameter x for BLS12-381
2478
2478
  twistType: "multiplicative",
2479
- randomBytes: bi
2480
- }, I = cc(Sc, Ec, Bc, Oc, vc, _c), Ic = Ui(V, [
2479
+ randomBytes: mi
2480
+ }, I = cc(Sc, Ec, Bc, Oc, vc, _c), Ic = qi(V, [
2481
2481
  // xNum
2482
2482
  [
2483
2483
  [
@@ -2546,7 +2546,7 @@ const _c = {
2546
2546
  ["0x1", "0x0"]
2547
2547
  // LAST 1
2548
2548
  ]
2549
- ].map((e) => e.map((t) => V.fromBigTuple(t.map(BigInt))))), Tc = Ui(C, [
2549
+ ].map((e) => e.map((t) => V.fromBigTuple(t.map(BigInt))))), Tc = qi(C, [
2550
2550
  // xNum
2551
2551
  [
2552
2552
  "0x11a05f2b1e833340b809101dd99815856b303e88a2d7005ff2627b56cdb4e2c85610c2d5f2e62d6eaeac1662734649b7",
@@ -2616,11 +2616,11 @@ const _c = {
2616
2616
  "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001"
2617
2617
  // LAST 1
2618
2618
  ]
2619
- ].map((e) => e.map((t) => BigInt(t)))), Rc = Mi(C, {
2619
+ ].map((e) => e.map((t) => BigInt(t)))), Rc = Wi(C, {
2620
2620
  A: C.create(BigInt("0x144698a3b8e9433d693a02c96d4982b0ea985383ee66a8d8e8981aefd881ac98936f8da0e0f97f5cf428082d584c1d")),
2621
2621
  B: C.create(BigInt("0x12e2908d11688030018b12e8753eee3b2016c1f0f24f4070a0b9c14fcef35ef55a23215a316ceaa5d1cc48e98e172be0")),
2622
2622
  Z: C.create(BigInt(11))
2623
- }), kc = Mi(V, {
2623
+ }), kc = Wi(V, {
2624
2624
  A: V.create({ c0: C.create(St), c1: C.create(BigInt(240)) }),
2625
2625
  // A' = 240 * I
2626
2626
  B: V.create({ c0: C.create(BigInt(1012)), c1: C.create(BigInt(1012)) }),
@@ -2639,17 +2639,17 @@ function Cc(e) {
2639
2639
  function $c(e, t, n) {
2640
2640
  return Gr(e), n === void 0 && (n = new Uint8Array(e.outputLen)), Yr(e, n, t);
2641
2641
  }
2642
- const Ir = /* @__PURE__ */ Uint8Array.of(0), Ns = /* @__PURE__ */ Uint8Array.of();
2642
+ const Ir = /* @__PURE__ */ Uint8Array.of(0), Cs = /* @__PURE__ */ Uint8Array.of();
2643
2643
  function Ac(e, t, n, r = 32) {
2644
2644
  Gr(e), tn(r, "length");
2645
2645
  const s = e.outputLen;
2646
2646
  if (r > 255 * s)
2647
2647
  throw new Error("Length must be <= 255*HashLen");
2648
2648
  const i = Math.ceil(r / s);
2649
- n === void 0 ? n = Ns : ft(n, void 0, "info");
2649
+ n === void 0 ? n = Cs : ft(n, void 0, "info");
2650
2650
  const o = new Uint8Array(i * s), a = Yr.create(e, t), c = a._cloneInto(), u = new Uint8Array(a.outputLen);
2651
2651
  for (let l = 0; l < i; l++)
2652
- Ir[0] = l + 1, c.update(l === 0 ? Ns : u).update(n).update(Ir).digestInto(u), o.set(u, s * l), a._cloneInto(c);
2652
+ Ir[0] = l + 1, c.update(l === 0 ? Cs : u).update(n).update(Ir).digestInto(u), o.set(u, s * l), a._cloneInto(c);
2653
2653
  return a.destroy(), c.destroy(), hn(u, Ir), o.slice(0, r);
2654
2654
  }
2655
2655
  const Lc = (e, t, n, r, s) => Ac(e, $c(e, t, n), r, s), Pc = "6.16.0";
@@ -2711,10 +2711,10 @@ function Je(e, t) {
2711
2711
  }
2712
2712
  return "[ COULD NOT SERIALIZE ]";
2713
2713
  }
2714
- function Cs(e, t) {
2714
+ function $s(e, t) {
2715
2715
  return e && e.code === t;
2716
2716
  }
2717
- function Wi(e, t, n) {
2717
+ function Gi(e, t, n) {
2718
2718
  let r = e;
2719
2719
  {
2720
2720
  const i = [];
@@ -2746,12 +2746,12 @@ function Wi(e, t, n) {
2746
2746
  }
2747
2747
  function at(e, t, n, r) {
2748
2748
  if (!e)
2749
- throw Wi(t, n, r);
2749
+ throw Gi(t, n, r);
2750
2750
  }
2751
2751
  function x(e, t, n, r) {
2752
2752
  at(e, t, "INVALID_ARGUMENT", { argument: n, value: r });
2753
2753
  }
2754
- function Gi(e, t, n) {
2754
+ function Hi(e, t, n) {
2755
2755
  n == null && (n = ""), n && (n = ": " + n), at(e >= t, "missing argument" + n, "MISSING_ARGUMENT", {
2756
2756
  count: e,
2757
2757
  expectedCount: t
@@ -2779,7 +2779,7 @@ function Jr(e, t, n) {
2779
2779
  });
2780
2780
  }
2781
2781
  }
2782
- function Hi(e, t, n) {
2782
+ function Vi(e, t, n) {
2783
2783
  if (e instanceof Uint8Array)
2784
2784
  return n ? new Uint8Array(e) : e;
2785
2785
  if (typeof e == "string" && e.length % 2 === 0 && e.match(/^0x[0-9a-f]*$/i)) {
@@ -2792,21 +2792,21 @@ function Hi(e, t, n) {
2792
2792
  x(!1, "invalid BytesLike value", t || "value", e);
2793
2793
  }
2794
2794
  function yt(e, t) {
2795
- return Hi(e, t, !1);
2795
+ return Vi(e, t, !1);
2796
2796
  }
2797
- function zt(e, t) {
2798
- return Hi(e, t, !0);
2797
+ function jt(e, t) {
2798
+ return Vi(e, t, !0);
2799
2799
  }
2800
2800
  function fn(e, t) {
2801
2801
  return !(typeof e != "string" || !e.match(/^0x[0-9A-Fa-f]*$/) || typeof t == "number" && e.length !== 2 + 2 * t || t === !0 && e.length % 2 !== 0);
2802
2802
  }
2803
- const $s = "0123456789abcdef";
2803
+ const As = "0123456789abcdef";
2804
2804
  function bt(e) {
2805
2805
  const t = yt(e);
2806
2806
  let n = "0x";
2807
2807
  for (let r = 0; r < t.length; r++) {
2808
2808
  const s = t[r];
2809
- n += $s[(s & 240) >> 4] + $s[s & 15];
2809
+ n += As[(s & 240) >> 4] + As[s & 15];
2810
2810
  }
2811
2811
  return n;
2812
2812
  }
@@ -2824,7 +2824,7 @@ function Ze(e, t, n) {
2824
2824
  offset: n
2825
2825
  }), bt(r.slice(t ?? 0, n ?? r.length));
2826
2826
  }
2827
- function Vi(e, t, n) {
2827
+ function Zi(e, t, n) {
2828
2828
  const r = yt(e);
2829
2829
  at(t >= r.length, "padding exceeds data length", "BUFFER_OVERRUN", {
2830
2830
  buffer: new Uint8Array(r),
@@ -2835,10 +2835,10 @@ function Vi(e, t, n) {
2835
2835
  return s.fill(0), n ? s.set(r, t - r.length) : s.set(r, 0), bt(s);
2836
2836
  }
2837
2837
  function Un(e, t) {
2838
- return Vi(e, t, !0);
2838
+ return Zi(e, t, !0);
2839
2839
  }
2840
- function Zi(e, t) {
2841
- return Vi(e, t, !1);
2840
+ function Yi(e, t) {
2841
+ return Zi(e, t, !1);
2842
2842
  }
2843
2843
  const On = BigInt(0), Gt = BigInt(1), je = 9007199254740991;
2844
2844
  function qc(e, t) {
@@ -2853,7 +2853,7 @@ function qc(e, t) {
2853
2853
  }
2854
2854
  return n;
2855
2855
  }
2856
- function Yi(e, t) {
2856
+ function Ki(e, t) {
2857
2857
  let n = on(e, "value");
2858
2858
  const r = BigInt(Be(t, "width")), s = Gt << r - Gt;
2859
2859
  if (n < On) {
@@ -2901,12 +2901,12 @@ function rr(e, t) {
2901
2901
  value: e
2902
2902
  }), n;
2903
2903
  }
2904
- const As = "0123456789abcdef";
2905
- function Ki(e) {
2904
+ const Ls = "0123456789abcdef";
2905
+ function Xi(e) {
2906
2906
  if (e instanceof Uint8Array) {
2907
2907
  let t = "0x0";
2908
2908
  for (const n of e)
2909
- t += As[n >> 4], t += As[n & 15];
2909
+ t += Ls[n >> 4], t += Ls[n & 15];
2910
2910
  return BigInt(t);
2911
2911
  }
2912
2912
  return on(e);
@@ -2929,9 +2929,9 @@ function Be(e, t) {
2929
2929
  x(!1, "invalid numeric value", t || "value", e);
2930
2930
  }
2931
2931
  function Dc(e) {
2932
- return Be(Ki(e));
2932
+ return Be(Xi(e));
2933
2933
  }
2934
- function Xi(e, t) {
2934
+ function zi(e, t) {
2935
2935
  const n = rr(e, "value");
2936
2936
  let r = n.toString(16);
2937
2937
  if (t == null)
@@ -2949,7 +2949,7 @@ function Xi(e, t) {
2949
2949
  }
2950
2950
  return "0x" + r;
2951
2951
  }
2952
- function zi(e, t) {
2952
+ function Ji(e, t) {
2953
2953
  const n = rr(e, "value");
2954
2954
  if (n === On)
2955
2955
  return new Uint8Array(0);
@@ -2965,7 +2965,7 @@ function zi(e, t) {
2965
2965
  function Mc(e, t, n, r, s) {
2966
2966
  x(!1, `invalid codepoint at offset ${t}; ${e}`, "bytes", n);
2967
2967
  }
2968
- function Ji(e, t, n, r, s) {
2968
+ function ji(e, t, n, r, s) {
2969
2969
  if (e === "BAD_PREFIX" || e === "UNEXPECTED_CONTINUE") {
2970
2970
  let i = 0;
2971
2971
  for (let o = t + 1; o < n.length && n[o] >> 6 === 2; o++)
@@ -2975,11 +2975,11 @@ function Ji(e, t, n, r, s) {
2975
2975
  return e === "OVERRUN" ? n.length - t - 1 : 0;
2976
2976
  }
2977
2977
  function Wc(e, t, n, r, s) {
2978
- return e === "OVERLONG" ? (x(typeof s == "number", "invalid bad code point for replacement", "badCodepoint", s), r.push(s), 0) : (r.push(65533), Ji(e, t, n));
2978
+ return e === "OVERLONG" ? (x(typeof s == "number", "invalid bad code point for replacement", "badCodepoint", s), r.push(s), 0) : (r.push(65533), ji(e, t, n));
2979
2979
  }
2980
2980
  const Gc = Object.freeze({
2981
2981
  error: Mc,
2982
- ignore: Ji,
2982
+ ignore: ji,
2983
2983
  replace: Wc
2984
2984
  });
2985
2985
  function Hc(e, t) {
@@ -3060,24 +3060,24 @@ function Vc(e) {
3060
3060
  function Zc(e, t) {
3061
3061
  return Vc(Hc(e, t));
3062
3062
  }
3063
- const It = 32, Cr = new Uint8Array(It), Yc = ["then"], An = {}, ji = /* @__PURE__ */ new WeakMap();
3063
+ const It = 32, Cr = new Uint8Array(It), Yc = ["then"], An = {}, Qi = /* @__PURE__ */ new WeakMap();
3064
3064
  function Ne(e) {
3065
- return ji.get(e);
3065
+ return Qi.get(e);
3066
3066
  }
3067
- function Ls(e, t) {
3068
- ji.set(e, t);
3067
+ function Ps(e, t) {
3068
+ Qi.set(e, t);
3069
3069
  }
3070
3070
  function un(e, t) {
3071
3071
  const n = new Error(`deferred error during ABI decoding triggered accessing ${e}`);
3072
3072
  throw n.error = t, n;
3073
3073
  }
3074
3074
  function $r(e, t, n) {
3075
- return e.indexOf(null) >= 0 ? t.map((r, s) => r instanceof ce ? $r(Ne(r), r, n) : r) : e.reduce((r, s, i) => {
3075
+ return e.indexOf(null) >= 0 ? t.map((r, s) => r instanceof ue ? $r(Ne(r), r, n) : r) : e.reduce((r, s, i) => {
3076
3076
  let o = t.getValue(s);
3077
- return s in r || (n && o instanceof ce && (o = $r(Ne(o), o, n)), r[s] = o), r;
3077
+ return s in r || (n && o instanceof ue && (o = $r(Ne(o), o, n)), r[s] = o), r;
3078
3078
  }, {});
3079
3079
  }
3080
- class ce extends Array {
3080
+ class ue extends Array {
3081
3081
  // No longer used; but cannot be removed as it will remove the
3082
3082
  // #private field from the .d.ts which may break backwards
3083
3083
  // compatibility
@@ -3092,7 +3092,7 @@ class ce extends Array {
3092
3092
  this[u] = c;
3093
3093
  });
3094
3094
  const o = s.reduce((c, u) => (typeof u == "string" && c.set(u, (c.get(u) || 0) + 1), c), /* @__PURE__ */ new Map());
3095
- if (Ls(this, Object.freeze(r.map((c, u) => {
3095
+ if (Ps(this, Object.freeze(r.map((c, u) => {
3096
3096
  const l = s[u];
3097
3097
  return l != null && o.get(l) === 1 ? l : null;
3098
3098
  }))), this.#t = [], this.#t == null && this.#t, !i)
@@ -3121,7 +3121,7 @@ class ce extends Array {
3121
3121
  return Reflect.get(c, u, l);
3122
3122
  }
3123
3123
  });
3124
- return Ls(a, Ne(this)), a;
3124
+ return Ps(a, Ne(this)), a;
3125
3125
  }
3126
3126
  /**
3127
3127
  * Returns the Result as a normal Array. If %%deep%%, any children
@@ -3133,7 +3133,7 @@ class ce extends Array {
3133
3133
  toArray(t) {
3134
3134
  const n = [];
3135
3135
  return this.forEach((r, s) => {
3136
- r instanceof Error && un(`index ${s}`, r), t && r instanceof ce && (r = r.toArray(t)), n.push(r);
3136
+ r instanceof Error && un(`index ${s}`, r), t && r instanceof ue && (r = r.toArray(t)), n.push(r);
3137
3137
  }), n;
3138
3138
  }
3139
3139
  /**
@@ -3158,7 +3158,7 @@ class ce extends Array {
3158
3158
  const r = Ne(this), s = [], i = [];
3159
3159
  for (let o = t; o < n; o++)
3160
3160
  s.push(this[o]), i.push(r[o]);
3161
- return new ce(An, s, i);
3161
+ return new ue(An, s, i);
3162
3162
  }
3163
3163
  /**
3164
3164
  * @_ignore
@@ -3169,7 +3169,7 @@ class ce extends Array {
3169
3169
  const a = this[o];
3170
3170
  a instanceof Error && un(`index ${o}`, a), t.call(n, a, o, this) && (s.push(a), i.push(r[o]));
3171
3171
  }
3172
- return new ce(An, s, i);
3172
+ return new ue(An, s, i);
3173
3173
  }
3174
3174
  /**
3175
3175
  * @_ignore
@@ -3202,12 +3202,12 @@ class ce extends Array {
3202
3202
  * also accessible by its corresponding name in %%keys%%.
3203
3203
  */
3204
3204
  static fromItems(t, n) {
3205
- return new ce(An, t, n);
3205
+ return new ue(An, t, n);
3206
3206
  }
3207
3207
  }
3208
- function Ps(e) {
3209
- let t = zi(e);
3210
- return at(t.length <= It, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: t, length: It, offset: t.length }), t.length !== It && (t = zt(Ee([Cr.slice(t.length % It), t]))), t;
3208
+ function Fs(e) {
3209
+ let t = Ji(e);
3210
+ return at(t.length <= It, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: t, length: It, offset: t.length }), t.length !== It && (t = jt(Ee([Cr.slice(t.length % It), t]))), t;
3211
3211
  }
3212
3212
  class we {
3213
3213
  // The coder name:
@@ -3252,24 +3252,24 @@ class Ar {
3252
3252
  return this.#t.push(t), this.#e += t.length, t.length;
3253
3253
  }
3254
3254
  appendWriter(t) {
3255
- return this.#n(zt(t.data));
3255
+ return this.#n(jt(t.data));
3256
3256
  }
3257
3257
  // Arrayish item; pad on the right to *nearest* WordSize
3258
3258
  writeBytes(t) {
3259
- let n = zt(t);
3259
+ let n = jt(t);
3260
3260
  const r = n.length % It;
3261
- return r && (n = zt(Ee([n, Cr.slice(r)]))), this.#n(n);
3261
+ return r && (n = jt(Ee([n, Cr.slice(r)]))), this.#n(n);
3262
3262
  }
3263
3263
  // Numeric item; pad on the left *to* WordSize
3264
3264
  writeValue(t) {
3265
- return this.#n(Ps(t));
3265
+ return this.#n(Fs(t));
3266
3266
  }
3267
3267
  // Inserts a numeric place-holder, returning a callback that can
3268
3268
  // be used to asjust the value later
3269
3269
  writeUpdatableValue() {
3270
3270
  const t = this.#t.length;
3271
3271
  return this.#t.push(Cr), this.#e += It, (n) => {
3272
- this.#t[t] = Ps(n);
3272
+ this.#t[t] = Fs(n);
3273
3273
  };
3274
3274
  }
3275
3275
  }
@@ -3285,7 +3285,7 @@ class Qr {
3285
3285
  #r;
3286
3286
  #s;
3287
3287
  constructor(t, n, r) {
3288
- st(this, { allowLoose: !!n }), this.#t = zt(t), this.#n = 0, this.#r = null, this.#s = r ?? 1024, this.#e = 0;
3288
+ st(this, { allowLoose: !!n }), this.#t = jt(t), this.#n = 0, this.#r = null, this.#s = r ?? 1024, this.#e = 0;
3289
3289
  }
3290
3290
  get data() {
3291
3291
  return bt(this.#t);
@@ -3303,7 +3303,7 @@ class Qr {
3303
3303
  if (this.#r)
3304
3304
  return this.#r.#i(t);
3305
3305
  this.#n += t, at(this.#s < 1 || this.#n <= this.#s * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#s} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", {
3306
- buffer: zt(this.#t),
3306
+ buffer: jt(this.#t),
3307
3307
  offset: this.#e,
3308
3308
  length: t,
3309
3309
  info: {
@@ -3315,7 +3315,7 @@ class Qr {
3315
3315
  #o(t, n, r) {
3316
3316
  let s = Math.ceil(n / It) * It;
3317
3317
  return this.#e + s > this.#t.length && (this.allowLoose && r && this.#e + n <= this.#t.length ? s = n : at(!1, "data out-of-bounds", "BUFFER_OVERRUN", {
3318
- buffer: zt(this.#t),
3318
+ buffer: jt(this.#t),
3319
3319
  length: this.#t.length,
3320
3320
  offset: this.#e + s
3321
3321
  })), this.#t.slice(this.#e, this.#e + s);
@@ -3332,30 +3332,30 @@ class Qr {
3332
3332
  }
3333
3333
  // Read a numeric values
3334
3334
  readValue() {
3335
- return Ki(this.readBytes(It));
3335
+ return Xi(this.readBytes(It));
3336
3336
  }
3337
3337
  readIndex() {
3338
3338
  return Dc(this.readBytes(It));
3339
3339
  }
3340
3340
  }
3341
- function Fs(e) {
3341
+ function Us(e) {
3342
3342
  if (!Number.isSafeInteger(e) || e < 0)
3343
3343
  throw new Error(`Wrong positive integer: ${e}`);
3344
3344
  }
3345
- function Qi(e, ...t) {
3345
+ function to(e, ...t) {
3346
3346
  if (!(e instanceof Uint8Array))
3347
3347
  throw new Error("Expected Uint8Array");
3348
3348
  if (t.length > 0 && !t.includes(e.length))
3349
3349
  throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`);
3350
3350
  }
3351
- function Us(e, t = !0) {
3351
+ function qs(e, t = !0) {
3352
3352
  if (e.destroyed)
3353
3353
  throw new Error("Hash instance has been destroyed");
3354
3354
  if (t && e.finished)
3355
3355
  throw new Error("Hash#digest() has already been called");
3356
3356
  }
3357
3357
  function Kc(e, t) {
3358
- Qi(e);
3358
+ to(e);
3359
3359
  const n = t.outputLen;
3360
3360
  if (e.length < n)
3361
3361
  throw new Error(`digestInto() expects output buffer of length at least ${n}`);
@@ -3368,7 +3368,7 @@ function jc(e) {
3368
3368
  throw new Error(`utf8ToBytes expected string, got ${typeof e}`);
3369
3369
  return new Uint8Array(new TextEncoder().encode(e));
3370
3370
  }
3371
- function to(e) {
3371
+ function eo(e) {
3372
3372
  if (typeof e == "string" && (e = jc(e)), !Xc(e))
3373
3373
  throw new Error(`expected Uint8Array, got ${typeof e}`);
3374
3374
  return e;
@@ -3380,12 +3380,12 @@ class Qc {
3380
3380
  }
3381
3381
  }
3382
3382
  function tu(e) {
3383
- const t = (r) => e().update(to(r)).digest(), n = e();
3383
+ const t = (r) => e().update(eo(r)).digest(), n = e();
3384
3384
  return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
3385
3385
  }
3386
- const Ln = /* @__PURE__ */ BigInt(2 ** 32 - 1), qs = /* @__PURE__ */ BigInt(32);
3386
+ const Ln = /* @__PURE__ */ BigInt(2 ** 32 - 1), Ds = /* @__PURE__ */ BigInt(32);
3387
3387
  function eu(e, t = !1) {
3388
- return t ? { h: Number(e & Ln), l: Number(e >> qs & Ln) } : { h: Number(e >> qs & Ln) | 0, l: Number(e & Ln) | 0 };
3388
+ return t ? { h: Number(e & Ln), l: Number(e >> Ds & Ln) } : { h: Number(e >> Ds & Ln) | 0, l: Number(e & Ln) | 0 };
3389
3389
  }
3390
3390
  function nu(e, t = !1) {
3391
3391
  let n = new Uint32Array(e.length), r = new Uint32Array(e.length);
@@ -3395,28 +3395,28 @@ function nu(e, t = !1) {
3395
3395
  }
3396
3396
  return [n, r];
3397
3397
  }
3398
- const ru = (e, t, n) => e << n | t >>> 32 - n, su = (e, t, n) => t << n | e >>> 32 - n, iu = (e, t, n) => t << n - 32 | e >>> 64 - n, ou = (e, t, n) => e << n - 32 | t >>> 64 - n, [eo, no, ro] = [[], [], []], au = /* @__PURE__ */ BigInt(0), ln = /* @__PURE__ */ BigInt(1), cu = /* @__PURE__ */ BigInt(2), uu = /* @__PURE__ */ BigInt(7), lu = /* @__PURE__ */ BigInt(256), fu = /* @__PURE__ */ BigInt(113);
3398
+ const ru = (e, t, n) => e << n | t >>> 32 - n, su = (e, t, n) => t << n | e >>> 32 - n, iu = (e, t, n) => t << n - 32 | e >>> 64 - n, ou = (e, t, n) => e << n - 32 | t >>> 64 - n, [no, ro, so] = [[], [], []], au = /* @__PURE__ */ BigInt(0), ln = /* @__PURE__ */ BigInt(1), cu = /* @__PURE__ */ BigInt(2), uu = /* @__PURE__ */ BigInt(7), lu = /* @__PURE__ */ BigInt(256), fu = /* @__PURE__ */ BigInt(113);
3399
3399
  for (let e = 0, t = ln, n = 1, r = 0; e < 24; e++) {
3400
- [n, r] = [r, (2 * n + 3 * r) % 5], eo.push(2 * (5 * r + n)), no.push((e + 1) * (e + 2) / 2 % 64);
3400
+ [n, r] = [r, (2 * n + 3 * r) % 5], no.push(2 * (5 * r + n)), ro.push((e + 1) * (e + 2) / 2 % 64);
3401
3401
  let s = au;
3402
3402
  for (let i = 0; i < 7; i++)
3403
3403
  t = (t << ln ^ (t >> uu) * fu) % lu, t & cu && (s ^= ln << (ln << /* @__PURE__ */ BigInt(i)) - ln);
3404
- ro.push(s);
3404
+ so.push(s);
3405
3405
  }
3406
- const [du, pu] = /* @__PURE__ */ nu(ro, !0), Ds = (e, t, n) => n > 32 ? iu(e, t, n) : ru(e, t, n), Ms = (e, t, n) => n > 32 ? ou(e, t, n) : su(e, t, n);
3406
+ const [du, pu] = /* @__PURE__ */ nu(so, !0), Ms = (e, t, n) => n > 32 ? iu(e, t, n) : ru(e, t, n), Ws = (e, t, n) => n > 32 ? ou(e, t, n) : su(e, t, n);
3407
3407
  function hu(e, t = 24) {
3408
3408
  const n = new Uint32Array(10);
3409
3409
  for (let r = 24 - t; r < 24; r++) {
3410
3410
  for (let o = 0; o < 10; o++)
3411
3411
  n[o] = e[o] ^ e[o + 10] ^ e[o + 20] ^ e[o + 30] ^ e[o + 40];
3412
3412
  for (let o = 0; o < 10; o += 2) {
3413
- const a = (o + 8) % 10, c = (o + 2) % 10, u = n[c], l = n[c + 1], f = Ds(u, l, 1) ^ n[a], d = Ms(u, l, 1) ^ n[a + 1];
3413
+ const a = (o + 8) % 10, c = (o + 2) % 10, u = n[c], l = n[c + 1], f = Ms(u, l, 1) ^ n[a], d = Ws(u, l, 1) ^ n[a + 1];
3414
3414
  for (let p = 0; p < 50; p += 10)
3415
3415
  e[o + p] ^= f, e[o + p + 1] ^= d;
3416
3416
  }
3417
3417
  let s = e[2], i = e[3];
3418
3418
  for (let o = 0; o < 24; o++) {
3419
- const a = no[o], c = Ds(s, i, a), u = Ms(s, i, a), l = eo[o];
3419
+ const a = ro[o], c = Ms(s, i, a), u = Ws(s, i, a), l = no[o];
3420
3420
  s = e[l], i = e[l + 1], e[l] = c, e[l + 1] = u;
3421
3421
  }
3422
3422
  for (let o = 0; o < 50; o += 10) {
@@ -3432,7 +3432,7 @@ function hu(e, t = 24) {
3432
3432
  class ts extends Qc {
3433
3433
  // NOTE: we accept arguments in bytes instead of bits here.
3434
3434
  constructor(t, n, r, s = !1, i = 24) {
3435
- if (super(), this.blockLen = t, this.suffix = n, this.outputLen = r, this.enableXOF = s, this.rounds = i, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, Fs(r), 0 >= this.blockLen || this.blockLen >= 200)
3435
+ if (super(), this.blockLen = t, this.suffix = n, this.outputLen = r, this.enableXOF = s, this.rounds = i, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, Us(r), 0 >= this.blockLen || this.blockLen >= 200)
3436
3436
  throw new Error("Sha3 supports only keccak-f1600 function");
3437
3437
  this.state = new Uint8Array(200), this.state32 = zc(this.state);
3438
3438
  }
@@ -3440,9 +3440,9 @@ class ts extends Qc {
3440
3440
  hu(this.state32, this.rounds), this.posOut = 0, this.pos = 0;
3441
3441
  }
3442
3442
  update(t) {
3443
- Us(this);
3443
+ qs(this);
3444
3444
  const { blockLen: n, state: r } = this;
3445
- t = to(t);
3445
+ t = eo(t);
3446
3446
  const s = t.length;
3447
3447
  for (let i = 0; i < s; ) {
3448
3448
  const o = Math.min(n - this.pos, s - i);
@@ -3460,7 +3460,7 @@ class ts extends Qc {
3460
3460
  t[r] ^= n, (n & 128) !== 0 && r === s - 1 && this.keccak(), t[s - 1] ^= 128, this.keccak();
3461
3461
  }
3462
3462
  writeInto(t) {
3463
- Us(this, !1), Qi(t), this.finish();
3463
+ qs(this, !1), to(t), this.finish();
3464
3464
  const n = this.state, { blockLen: r } = this;
3465
3465
  for (let s = 0, i = t.length; s < i; ) {
3466
3466
  this.posOut >= r && this.keccak();
@@ -3475,7 +3475,7 @@ class ts extends Qc {
3475
3475
  return this.writeInto(t);
3476
3476
  }
3477
3477
  xof(t) {
3478
- return Fs(t), this.xofInto(new Uint8Array(t));
3478
+ return Us(t), this.xofInto(new Uint8Array(t));
3479
3479
  }
3480
3480
  digestInto(t) {
3481
3481
  if (Kc(t, this), this.finished)
@@ -3494,27 +3494,27 @@ class ts extends Qc {
3494
3494
  }
3495
3495
  }
3496
3496
  const wu = (e, t, n) => tu(() => new ts(t, e, n)), gu = /* @__PURE__ */ wu(1, 136, 256 / 8);
3497
- let so = !1;
3498
- const io = function(e) {
3497
+ let io = !1;
3498
+ const oo = function(e) {
3499
3499
  return gu(e);
3500
3500
  };
3501
- let oo = io;
3501
+ let ao = oo;
3502
3502
  function tt(e) {
3503
3503
  const t = yt(e, "data");
3504
- return bt(oo(t));
3504
+ return bt(ao(t));
3505
3505
  }
3506
- tt._ = io;
3506
+ tt._ = oo;
3507
3507
  tt.lock = function() {
3508
- so = !0;
3508
+ io = !0;
3509
3509
  };
3510
3510
  tt.register = function(e) {
3511
- if (so)
3511
+ if (io)
3512
3512
  throw new TypeError("keccak256 is locked");
3513
- oo = e;
3513
+ ao = e;
3514
3514
  };
3515
3515
  Object.freeze(tt);
3516
3516
  const yu = BigInt(0), bu = BigInt(36);
3517
- function Ws(e) {
3517
+ function Gs(e) {
3518
3518
  e = e.toLowerCase();
3519
3519
  const t = e.substring(2).split(""), n = new Uint8Array(40);
3520
3520
  for (let s = 0; s < 40; s++)
@@ -3529,12 +3529,12 @@ for (let e = 0; e < 10; e++)
3529
3529
  es[String(e)] = String(e);
3530
3530
  for (let e = 0; e < 26; e++)
3531
3531
  es[String.fromCharCode(65 + e)] = String(10 + e);
3532
- const Gs = 15;
3532
+ const Hs = 15;
3533
3533
  function mu(e) {
3534
3534
  e = e.toUpperCase(), e = e.substring(4) + e.substring(0, 2) + "00";
3535
3535
  let t = e.split("").map((r) => es[r]).join("");
3536
- for (; t.length >= Gs; ) {
3537
- let r = t.substring(0, Gs);
3536
+ for (; t.length >= Hs; ) {
3537
+ let r = t.substring(0, Hs);
3538
3538
  t = parseInt(r, 10) % 97 + t.substring(r.length);
3539
3539
  }
3540
3540
  let n = String(98 - parseInt(t, 10) % 97);
@@ -3560,7 +3560,7 @@ function _u(e) {
3560
3560
  function yn(e) {
3561
3561
  if (x(typeof e == "string", "invalid address", "address", e), e.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
3562
3562
  e.startsWith("0x") || (e = "0x" + e);
3563
- const t = Ws(e);
3563
+ const t = Gs(e);
3564
3564
  return x(!e.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || t === e, "bad address checksum", "address", e), t;
3565
3565
  }
3566
3566
  if (e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
@@ -3568,19 +3568,19 @@ function yn(e) {
3568
3568
  let t = _u(e.substring(4)).toString(16);
3569
3569
  for (; t.length < 40; )
3570
3570
  t = "0" + t;
3571
- return Ws("0x" + t);
3571
+ return Gs("0x" + t);
3572
3572
  }
3573
3573
  x(!1, "invalid address", "address", e);
3574
3574
  }
3575
- const oe = {};
3575
+ const ae = {};
3576
3576
  function E(e, t) {
3577
3577
  let n = !1;
3578
- return t < 0 && (n = !0, t *= -1), new pt(oe, `${n ? "" : "u"}int${t}`, e, { signed: n, width: t });
3578
+ return t < 0 && (n = !0, t *= -1), new pt(ae, `${n ? "" : "u"}int${t}`, e, { signed: n, width: t });
3579
3579
  }
3580
3580
  function J(e, t) {
3581
- return new pt(oe, `bytes${t || ""}`, e, { size: t });
3581
+ return new pt(ae, `bytes${t || ""}`, e, { size: t });
3582
3582
  }
3583
- const Hs = /* @__PURE__ */ Symbol.for("_ethers_typed");
3583
+ const Vs = /* @__PURE__ */ Symbol.for("_ethers_typed");
3584
3584
  class pt {
3585
3585
  /**
3586
3586
  * The type, as a Solidity-compatible type.
@@ -3599,7 +3599,7 @@ class pt {
3599
3599
  * @_ignore:
3600
3600
  */
3601
3601
  constructor(t, n, r, s) {
3602
- s == null && (s = null), Jr(oe, t, "Typed"), st(this, { _typedSymbol: Hs, type: n, value: r }), this.#t = s, this.format();
3602
+ s == null && (s = null), Jr(ae, t, "Typed"), st(this, { _typedSymbol: Vs, type: n, value: r }), this.#t = s, this.format();
3603
3603
  }
3604
3604
  /**
3605
3605
  * Format the type as a Human-Readable type.
@@ -3673,7 +3673,7 @@ class pt {
3673
3673
  * Returns a new **Typed** of %%type%% with the %%value%%.
3674
3674
  */
3675
3675
  static from(t, n) {
3676
- return new pt(oe, t, n);
3676
+ return new pt(ae, t, n);
3677
3677
  }
3678
3678
  /**
3679
3679
  * Return a new ``uint8`` type for %%v%%.
@@ -4267,25 +4267,25 @@ class pt {
4267
4267
  * Return a new ``address`` type for %%v%%.
4268
4268
  */
4269
4269
  static address(t) {
4270
- return new pt(oe, "address", t);
4270
+ return new pt(ae, "address", t);
4271
4271
  }
4272
4272
  /**
4273
4273
  * Return a new ``bool`` type for %%v%%.
4274
4274
  */
4275
4275
  static bool(t) {
4276
- return new pt(oe, "bool", !!t);
4276
+ return new pt(ae, "bool", !!t);
4277
4277
  }
4278
4278
  /**
4279
4279
  * Return a new ``bytes`` type for %%v%%.
4280
4280
  */
4281
4281
  static bytes(t) {
4282
- return new pt(oe, "bytes", t);
4282
+ return new pt(ae, "bytes", t);
4283
4283
  }
4284
4284
  /**
4285
4285
  * Return a new ``string`` type for %%v%%.
4286
4286
  */
4287
4287
  static string(t) {
4288
- return new pt(oe, "string", t);
4288
+ return new pt(ae, "string", t);
4289
4289
  }
4290
4290
  /**
4291
4291
  * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length.
@@ -4303,13 +4303,13 @@ class pt {
4303
4303
  * Return a new ``uint8`` type for %%v%%.
4304
4304
  */
4305
4305
  static overrides(t) {
4306
- return new pt(oe, "overrides", Object.assign({}, t));
4306
+ return new pt(ae, "overrides", Object.assign({}, t));
4307
4307
  }
4308
4308
  /**
4309
4309
  * Returns true only if %%value%% is a [[Typed]] instance.
4310
4310
  */
4311
4311
  static isTyped(t) {
4312
- return t && typeof t == "object" && "_typedSymbol" in t && t._typedSymbol === Hs;
4312
+ return t && typeof t == "object" && "_typedSymbol" in t && t._typedSymbol === Vs;
4313
4313
  }
4314
4314
  /**
4315
4315
  * If the value is a [[Typed]] instance, validates the underlying value
@@ -4344,7 +4344,7 @@ class Su extends we {
4344
4344
  return t.writeValue(r);
4345
4345
  }
4346
4346
  decode(t) {
4347
- return yn(Xi(t.readValue(), 20));
4347
+ return yn(zi(t.readValue(), 20));
4348
4348
  }
4349
4349
  }
4350
4350
  class Eu extends we {
@@ -4362,7 +4362,7 @@ class Eu extends we {
4362
4362
  return this.coder.decode(t);
4363
4363
  }
4364
4364
  }
4365
- function ao(e, t, n) {
4365
+ function co(e, t, n) {
4366
4366
  let r = [];
4367
4367
  if (Array.isArray(n))
4368
4368
  r = n;
@@ -4393,7 +4393,7 @@ function ao(e, t, n) {
4393
4393
  let a = e.appendWriter(s);
4394
4394
  return a += e.appendWriter(i), a;
4395
4395
  }
4396
- function co(e, t) {
4396
+ function uo(e, t) {
4397
4397
  let n = [], r = [], s = e.subReader(0);
4398
4398
  return t.forEach((i) => {
4399
4399
  let o = null;
@@ -4402,7 +4402,7 @@ function co(e, t) {
4402
4402
  try {
4403
4403
  o = i.decode(c);
4404
4404
  } catch (u) {
4405
- if (Cs(u, "BUFFER_OVERRUN"))
4405
+ if ($s(u, "BUFFER_OVERRUN"))
4406
4406
  throw u;
4407
4407
  o = u, o.baseType = i.name, o.name = i.localName, o.type = i.type;
4408
4408
  }
@@ -4410,14 +4410,14 @@ function co(e, t) {
4410
4410
  try {
4411
4411
  o = i.decode(e);
4412
4412
  } catch (a) {
4413
- if (Cs(a, "BUFFER_OVERRUN"))
4413
+ if ($s(a, "BUFFER_OVERRUN"))
4414
4414
  throw a;
4415
4415
  o = a, o.baseType = i.name, o.name = i.localName, o.type = i.type;
4416
4416
  }
4417
4417
  if (o == null)
4418
4418
  throw new Error("investigate");
4419
4419
  n.push(o), r.push(i.localName || null);
4420
- }), ce.fromItems(n, r);
4420
+ }), ue.fromItems(n, r);
4421
4421
  }
4422
4422
  class Bu extends we {
4423
4423
  coder;
@@ -4436,11 +4436,11 @@ class Bu extends we {
4436
4436
  const r = pt.dereference(n, "array");
4437
4437
  Array.isArray(r) || this._throwError("expected array value", r);
4438
4438
  let s = this.length;
4439
- s === -1 && (s = r.length, t.writeValue(r.length)), Gi(r.length, s, "coder array" + (this.localName ? " " + this.localName : ""));
4439
+ s === -1 && (s = r.length, t.writeValue(r.length)), Hi(r.length, s, "coder array" + (this.localName ? " " + this.localName : ""));
4440
4440
  let i = [];
4441
4441
  for (let o = 0; o < r.length; o++)
4442
4442
  i.push(this.coder);
4443
- return ao(t, i, r);
4443
+ return co(t, i, r);
4444
4444
  }
4445
4445
  decode(t) {
4446
4446
  let n = this.length;
@@ -4448,7 +4448,7 @@ class Bu extends we {
4448
4448
  let r = [];
4449
4449
  for (let s = 0; s < n; s++)
4450
4450
  r.push(new Eu(this.coder));
4451
- return co(t, r);
4451
+ return uo(t, r);
4452
4452
  }
4453
4453
  }
4454
4454
  class vu extends we {
@@ -4466,7 +4466,7 @@ class vu extends we {
4466
4466
  return !!t.readValue();
4467
4467
  }
4468
4468
  }
4469
- class uo extends we {
4469
+ class lo extends we {
4470
4470
  constructor(t, n) {
4471
4471
  super(t, t, n, !0);
4472
4472
  }
@@ -4474,7 +4474,7 @@ class uo extends we {
4474
4474
  return "0x";
4475
4475
  }
4476
4476
  encode(t, n) {
4477
- n = zt(n);
4477
+ n = jt(n);
4478
4478
  let r = t.writeValue(n.length);
4479
4479
  return r += t.writeBytes(n), r;
4480
4480
  }
@@ -4482,7 +4482,7 @@ class uo extends we {
4482
4482
  return t.readBytes(t.readIndex(), !0);
4483
4483
  }
4484
4484
  }
4485
- class Ou extends uo {
4485
+ class Ou extends lo {
4486
4486
  constructor(t) {
4487
4487
  super("bytes", t);
4488
4488
  }
@@ -4500,7 +4500,7 @@ class Iu extends we {
4500
4500
  return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0, 2 + this.size * 2);
4501
4501
  }
4502
4502
  encode(t, n) {
4503
- let r = zt(pt.dereference(n, this.type));
4503
+ let r = jt(pt.dereference(n, this.type));
4504
4504
  return r.length !== this.size && this._throwError("incorrect data length", n), t.writeBytes(r);
4505
4505
  }
4506
4506
  decode(t) {
@@ -4537,7 +4537,7 @@ class $u extends we {
4537
4537
  let r = on(pt.dereference(n, this.type)), s = $n(Cu, It * 8);
4538
4538
  if (this.signed) {
4539
4539
  let i = $n(s, this.size * 8 - 1);
4540
- (r > i || r < -(i + Nu)) && this._throwError("value out-of-bounds", n), r = Yi(r, 8 * It);
4540
+ (r > i || r < -(i + Nu)) && this._throwError("value out-of-bounds", n), r = Ki(r, 8 * It);
4541
4541
  } else (r < ku || r > $n(s, this.size * 8)) && this._throwError("value out-of-bounds", n);
4542
4542
  return t.writeValue(r);
4543
4543
  }
@@ -4546,7 +4546,7 @@ class $u extends we {
4546
4546
  return this.signed && (n = qc(n, this.size * 8)), n;
4547
4547
  }
4548
4548
  }
4549
- class Au extends uo {
4549
+ class Au extends lo {
4550
4550
  constructor(t) {
4551
4551
  super("string", t);
4552
4552
  }
@@ -4587,17 +4587,17 @@ class Pn extends we {
4587
4587
  }
4588
4588
  encode(t, n) {
4589
4589
  const r = pt.dereference(n, "tuple");
4590
- return ao(t, this.coders, r);
4590
+ return co(t, this.coders, r);
4591
4591
  }
4592
4592
  decode(t) {
4593
- return co(t, this.coders);
4593
+ return uo(t, this.coders);
4594
4594
  }
4595
4595
  }
4596
4596
  function bn(e) {
4597
4597
  return tt(jr(e));
4598
4598
  }
4599
4599
  const Lu = new RegExp("^bytes([0-9]+)$"), Pu = new RegExp("^(u?int)([0-9]*)$"), Fu = new RegExp("^(.*)\\[([0-9]*)\\]$");
4600
- function lo(e, t, n) {
4600
+ function fo(e, t, n) {
4601
4601
  switch (e) {
4602
4602
  case "address":
4603
4603
  return yt(n ? Un(t, 32) : yn(t));
@@ -4611,41 +4611,41 @@ function lo(e, t, n) {
4611
4611
  let r = e.match(Pu);
4612
4612
  if (r) {
4613
4613
  let s = r[1] === "int", i = parseInt(r[2] || "256");
4614
- return x((!r[2] || r[2] === String(i)) && i % 8 === 0 && i !== 0 && i <= 256, "invalid number type", "type", e), n && (i = 256), s && (t = Yi(t, i)), yt(Un(zi(t), i / 8));
4614
+ return x((!r[2] || r[2] === String(i)) && i % 8 === 0 && i !== 0 && i <= 256, "invalid number type", "type", e), n && (i = 256), s && (t = Ki(t, i)), yt(Un(Ji(t), i / 8));
4615
4615
  }
4616
4616
  if (r = e.match(Lu), r) {
4617
4617
  const s = parseInt(r[1]);
4618
- return x(String(s) === r[1] && s !== 0 && s <= 32, "invalid bytes type", "type", e), x(Uc(t) === s, `invalid value for ${e}`, "value", t), n ? yt(Zi(t, 32)) : t;
4618
+ return x(String(s) === r[1] && s !== 0 && s <= 32, "invalid bytes type", "type", e), x(Uc(t) === s, `invalid value for ${e}`, "value", t), n ? yt(Yi(t, 32)) : t;
4619
4619
  }
4620
4620
  if (r = e.match(Fu), r && Array.isArray(t)) {
4621
4621
  const s = r[1], i = parseInt(r[2] || String(t.length));
4622
4622
  x(i === t.length, `invalid array length for ${e}`, "value", t);
4623
4623
  const o = [];
4624
4624
  return t.forEach(function(a) {
4625
- o.push(lo(s, a, !0));
4625
+ o.push(fo(s, a, !0));
4626
4626
  }), yt(Ee(o));
4627
4627
  }
4628
4628
  x(!1, "invalid type", "type", e);
4629
4629
  }
4630
- function Vs(e, t) {
4630
+ function Zs(e, t) {
4631
4631
  x(e.length === t.length, "wrong number of values; expected ${ types.length }", "values", t);
4632
4632
  const n = [];
4633
4633
  return e.forEach(function(r, s) {
4634
- n.push(lo(r, t[s]));
4634
+ n.push(fo(r, t[s]));
4635
4635
  }), bt(Ee(n));
4636
4636
  }
4637
4637
  function Tt(e) {
4638
4638
  const t = /* @__PURE__ */ new Set();
4639
4639
  return e.forEach((n) => t.add(n)), Object.freeze(t);
4640
4640
  }
4641
- const Uu = "external public payable override", qu = Tt(Uu.split(" ")), fo = "constant external internal payable private public pure view override", Du = Tt(fo.split(" ")), po = "constructor error event fallback function receive struct", ho = Tt(po.split(" ")), wo = "calldata memory storage payable indexed", Mu = Tt(wo.split(" ")), Wu = "tuple returns", Gu = [po, wo, Wu, fo].join(" "), Hu = Tt(Gu.split(" ")), Vu = {
4641
+ const Uu = "external public payable override", qu = Tt(Uu.split(" ")), po = "constant external internal payable private public pure view override", Du = Tt(po.split(" ")), ho = "constructor error event fallback function receive struct", wo = Tt(ho.split(" ")), go = "calldata memory storage payable indexed", Mu = Tt(go.split(" ")), Wu = "tuple returns", Gu = [ho, go, Wu, po].join(" "), Hu = Tt(Gu.split(" ")), Vu = {
4642
4642
  "(": "OPEN_PAREN",
4643
4643
  ")": "CLOSE_PAREN",
4644
4644
  "[": "OPEN_BRACKET",
4645
4645
  "]": "CLOSE_BRACKET",
4646
4646
  ",": "COMMA",
4647
4647
  "@": "AT"
4648
- }, Zu = new RegExp("^(\\s*)"), Yu = new RegExp("^([0-9]+)"), Ku = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"), go = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"), yo = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");
4648
+ }, Zu = new RegExp("^(\\s*)"), Yu = new RegExp("^([0-9]+)"), Ku = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"), yo = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"), bo = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");
4649
4649
  class Wt {
4650
4650
  #t;
4651
4651
  #e;
@@ -4776,7 +4776,7 @@ function ve(e) {
4776
4776
  c.type = "KEYWORD";
4777
4777
  continue;
4778
4778
  }
4779
- if (c.text.match(yo)) {
4779
+ if (c.text.match(bo)) {
4780
4780
  c.type = "TYPE";
4781
4781
  continue;
4782
4782
  }
@@ -4791,7 +4791,7 @@ function ve(e) {
4791
4791
  }
4792
4792
  return new Wt(t.map((o) => Object.freeze(o)));
4793
4793
  }
4794
- function Zs(e, t) {
4794
+ function Ys(e, t) {
4795
4795
  let n = [];
4796
4796
  for (const r in t.keys())
4797
4797
  e.has(r) && n.push(r);
@@ -4799,14 +4799,14 @@ function Zs(e, t) {
4799
4799
  throw new Error(`conflicting types: ${n.join(", ")}`);
4800
4800
  }
4801
4801
  function sr(e, t) {
4802
- if (t.peekKeyword(ho)) {
4802
+ if (t.peekKeyword(wo)) {
4803
4803
  const n = t.pop().text;
4804
4804
  if (n !== e)
4805
4805
  throw new Error(`expected ${e}, got ${n}`);
4806
4806
  }
4807
4807
  return t.popType("ID");
4808
4808
  }
4809
- function de(e, t) {
4809
+ function pe(e, t) {
4810
4810
  const n = /* @__PURE__ */ new Set();
4811
4811
  for (; ; ) {
4812
4812
  const r = e.peekType("KEYWORD");
@@ -4818,14 +4818,14 @@ function de(e, t) {
4818
4818
  }
4819
4819
  return Object.freeze(n);
4820
4820
  }
4821
- function bo(e) {
4822
- let t = de(e, Du);
4823
- return Zs(t, Tt("constant payable nonpayable".split(" "))), Zs(t, Tt("pure view payable nonpayable".split(" "))), t.has("view") ? "view" : t.has("pure") ? "pure" : t.has("payable") ? "payable" : t.has("nonpayable") ? "nonpayable" : t.has("constant") ? "view" : "nonpayable";
4821
+ function mo(e) {
4822
+ let t = pe(e, Du);
4823
+ return Ys(t, Tt("constant payable nonpayable".split(" "))), Ys(t, Tt("pure view payable nonpayable".split(" "))), t.has("view") ? "view" : t.has("pure") ? "pure" : t.has("payable") ? "payable" : t.has("nonpayable") ? "nonpayable" : t.has("constant") ? "view" : "nonpayable";
4824
4824
  }
4825
- function fe(e, t) {
4825
+ function de(e, t) {
4826
4826
  return e.popParams().map((n) => nt.from(n, t));
4827
4827
  }
4828
- function mo(e) {
4828
+ function xo(e) {
4829
4829
  if (e.peekType("AT")) {
4830
4830
  if (e.pop(), e.peekType("NUMBER"))
4831
4831
  return on(e.pop().text);
@@ -4838,8 +4838,8 @@ function Ue(e) {
4838
4838
  throw new Error(`unexpected tokens at offset ${e.offset}: ${e.toString()}`);
4839
4839
  }
4840
4840
  const Xu = new RegExp(/^(.*)\[([0-9]*)\]$/);
4841
- function Ys(e) {
4842
- const t = e.match(yo);
4841
+ function Ks(e) {
4842
+ const t = e.match(bo);
4843
4843
  if (x(t, "invalid type", "type", e), e === "uint")
4844
4844
  return "uint256";
4845
4845
  if (e === "int")
@@ -4853,7 +4853,7 @@ function Ys(e) {
4853
4853
  }
4854
4854
  return e;
4855
4855
  }
4856
- const ot = {}, Ct = /* @__PURE__ */ Symbol.for("_ethers_internal"), Ks = "_ParamTypeInternal", Xs = "_ErrorInternal", zs = "_EventInternal", Js = "_ConstructorInternal", js = "_FallbackInternal", Qs = "_FunctionInternal", ti = "_StructInternal";
4856
+ const ot = {}, Ct = /* @__PURE__ */ Symbol.for("_ethers_internal"), Xs = "_ParamTypeInternal", zs = "_ErrorInternal", Js = "_EventInternal", js = "_ConstructorInternal", Qs = "_FallbackInternal", ti = "_FunctionInternal", ei = "_StructInternal";
4857
4857
  class nt {
4858
4858
  /**
4859
4859
  * The local name of the parameter (or ``""`` if unbound)
@@ -4896,7 +4896,7 @@ class nt {
4896
4896
  * @private
4897
4897
  */
4898
4898
  constructor(t, n, r, s, i, o, a, c) {
4899
- if (Jr(t, ot, "ParamType"), Object.defineProperty(this, Ct, { value: Ks }), o && (o = Object.freeze(o.slice())), s === "array") {
4899
+ if (Jr(t, ot, "ParamType"), Object.defineProperty(this, Ct, { value: Xs }), o && (o = Object.freeze(o.slice())), s === "array") {
4900
4900
  if (a == null || c == null)
4901
4901
  throw new Error("");
4902
4902
  } else if (a != null || c != null)
@@ -5067,14 +5067,14 @@ class nt {
5067
5067
  }
5068
5068
  else if (t instanceof Wt) {
5069
5069
  let a = "", c = "", u = null;
5070
- de(t, Tt(["tuple"])).has("tuple") || t.peekType("OPEN_PAREN") ? (c = "tuple", u = t.popParams().map((h) => nt.from(h)), a = `tuple(${u.map((h) => h.format()).join(",")})`) : (a = Ys(t.popType("TYPE")), c = a);
5070
+ pe(t, Tt(["tuple"])).has("tuple") || t.peekType("OPEN_PAREN") ? (c = "tuple", u = t.popParams().map((h) => nt.from(h)), a = `tuple(${u.map((h) => h.format()).join(",")})`) : (a = Ks(t.popType("TYPE")), c = a);
5071
5071
  let l = null, f = null;
5072
5072
  for (; t.length && t.peekType("BRACKET"); ) {
5073
5073
  const h = t.pop();
5074
5074
  l = new nt(ot, "", a, c, null, u, f, l), f = h.value, a += h.text, c = "array", u = null;
5075
5075
  }
5076
5076
  let d = null;
5077
- if (de(t, Mu).has("indexed")) {
5077
+ if (pe(t, Mu).has("indexed")) {
5078
5078
  if (!n)
5079
5079
  throw new Error("");
5080
5080
  d = !0;
@@ -5085,7 +5085,7 @@ class nt {
5085
5085
  return new nt(ot, w, a, c, d, u, f, l);
5086
5086
  }
5087
5087
  const r = t.name;
5088
- x(!r || typeof r == "string" && r.match(go), "invalid name", "obj.name", r);
5088
+ x(!r || typeof r == "string" && r.match(yo), "invalid name", "obj.name", r);
5089
5089
  let s = t.indexed;
5090
5090
  s != null && (x(n, "parameter cannot be indexed", "obj.indexed", t.indexed), s = !!s);
5091
5091
  let i = t.type, o = i.match(Xu);
@@ -5106,13 +5106,13 @@ class nt {
5106
5106
  const a = t.components != null ? t.components.map((u) => nt.from(u)) : null;
5107
5107
  return new nt(ot, r || "", i, "tuple", s, a, null, null);
5108
5108
  }
5109
- return i = Ys(t.type), new nt(ot, r || "", i, i, s, null, null, null);
5109
+ return i = Ks(t.type), new nt(ot, r || "", i, i, s, null, null, null);
5110
5110
  }
5111
5111
  /**
5112
5112
  * Returns true if %%value%% is a **ParamType**.
5113
5113
  */
5114
5114
  static isParamType(t) {
5115
- return t && t[Ct] === Ks;
5115
+ return t && t[Ct] === Xs;
5116
5116
  }
5117
5117
  }
5118
5118
  class qe {
@@ -5143,34 +5143,34 @@ class qe {
5143
5143
  return qe.from(ve(t));
5144
5144
  }
5145
5145
  if (t instanceof Wt)
5146
- switch (t.peekKeyword(ho)) {
5146
+ switch (t.peekKeyword(wo)) {
5147
5147
  case "constructor":
5148
- return ue.from(t);
5148
+ return le.from(t);
5149
5149
  case "error":
5150
5150
  return Nt.from(t);
5151
5151
  case "event":
5152
- return Zt.from(t);
5152
+ return Kt.from(t);
5153
5153
  case "fallback":
5154
5154
  case "receive":
5155
- return ae.from(t);
5155
+ return ce.from(t);
5156
5156
  case "function":
5157
- return Yt.from(t);
5157
+ return Xt.from(t);
5158
5158
  case "struct":
5159
5159
  return Le.from(t);
5160
5160
  }
5161
5161
  else if (typeof t == "object") {
5162
5162
  switch (t.type) {
5163
5163
  case "constructor":
5164
- return ue.from(t);
5164
+ return le.from(t);
5165
5165
  case "error":
5166
5166
  return Nt.from(t);
5167
5167
  case "event":
5168
- return Zt.from(t);
5168
+ return Kt.from(t);
5169
5169
  case "fallback":
5170
5170
  case "receive":
5171
- return ae.from(t);
5171
+ return ce.from(t);
5172
5172
  case "function":
5173
- return Yt.from(t);
5173
+ return Xt.from(t);
5174
5174
  case "struct":
5175
5175
  return Le.from(t);
5176
5176
  }
@@ -5184,7 +5184,7 @@ class qe {
5184
5184
  * Returns true if %%value%% is a [[ConstructorFragment]].
5185
5185
  */
5186
5186
  static isConstructor(t) {
5187
- return ue.isFragment(t);
5187
+ return le.isFragment(t);
5188
5188
  }
5189
5189
  /**
5190
5190
  * Returns true if %%value%% is an [[ErrorFragment]].
@@ -5196,13 +5196,13 @@ class qe {
5196
5196
  * Returns true if %%value%% is an [[EventFragment]].
5197
5197
  */
5198
5198
  static isEvent(t) {
5199
- return Zt.isFragment(t);
5199
+ return Kt.isFragment(t);
5200
5200
  }
5201
5201
  /**
5202
5202
  * Returns true if %%value%% is a [[FunctionFragment]].
5203
5203
  */
5204
5204
  static isFunction(t) {
5205
- return Yt.isFragment(t);
5205
+ return Xt.isFragment(t);
5206
5206
  }
5207
5207
  /**
5208
5208
  * Returns true if %%value%% is a [[StructFragment]].
@@ -5220,7 +5220,7 @@ class ir extends qe {
5220
5220
  * @private
5221
5221
  */
5222
5222
  constructor(t, n, r, s) {
5223
- super(t, n, s), x(typeof r == "string" && r.match(go), "invalid identifier", "name", r), s = Object.freeze(s.slice()), st(this, { name: r });
5223
+ super(t, n, s), x(typeof r == "string" && r.match(yo), "invalid identifier", "name", r), s = Object.freeze(s.slice()), st(this, { name: r });
5224
5224
  }
5225
5225
  }
5226
5226
  function mn(e, t) {
@@ -5231,7 +5231,7 @@ class Nt extends ir {
5231
5231
  * @private
5232
5232
  */
5233
5233
  constructor(t, n, r) {
5234
- super(t, "error", n, r), Object.defineProperty(this, Ct, { value: Xs });
5234
+ super(t, "error", n, r), Object.defineProperty(this, Ct, { value: zs });
5235
5235
  }
5236
5236
  /**
5237
5237
  * The Custom Error selector.
@@ -5261,7 +5261,7 @@ class Nt extends ir {
5261
5261
  if (typeof t == "string")
5262
5262
  return Nt.from(ve(t));
5263
5263
  if (t instanceof Wt) {
5264
- const n = sr("error", t), r = fe(t);
5264
+ const n = sr("error", t), r = de(t);
5265
5265
  return Ue(t), new Nt(ot, n, r);
5266
5266
  }
5267
5267
  return new Nt(ot, t.name, t.inputs ? t.inputs.map(nt.from) : []);
@@ -5271,10 +5271,10 @@ class Nt extends ir {
5271
5271
  * **ErrorFragment**.
5272
5272
  */
5273
5273
  static isFragment(t) {
5274
- return t && t[Ct] === Xs;
5274
+ return t && t[Ct] === zs;
5275
5275
  }
5276
5276
  }
5277
- class Zt extends ir {
5277
+ class Kt extends ir {
5278
5278
  /**
5279
5279
  * Whether this event is anonymous.
5280
5280
  */
@@ -5283,7 +5283,7 @@ class Zt extends ir {
5283
5283
  * @private
5284
5284
  */
5285
5285
  constructor(t, n, r, s) {
5286
- super(t, "event", n, r), Object.defineProperty(this, Ct, { value: zs }), st(this, { anonymous: s });
5286
+ super(t, "event", n, r), Object.defineProperty(this, Ct, { value: Js }), st(this, { anonymous: s });
5287
5287
  }
5288
5288
  /**
5289
5289
  * The Event topic hash.
@@ -5309,35 +5309,35 @@ class Zt extends ir {
5309
5309
  * Return the topic hash for an event with %%name%% and %%params%%.
5310
5310
  */
5311
5311
  static getTopicHash(t, n) {
5312
- return n = (n || []).map((s) => nt.from(s)), new Zt(ot, t, n, !1).topicHash;
5312
+ return n = (n || []).map((s) => nt.from(s)), new Kt(ot, t, n, !1).topicHash;
5313
5313
  }
5314
5314
  /**
5315
5315
  * Returns a new **EventFragment** for %%obj%%.
5316
5316
  */
5317
5317
  static from(t) {
5318
- if (Zt.isFragment(t))
5318
+ if (Kt.isFragment(t))
5319
5319
  return t;
5320
5320
  if (typeof t == "string")
5321
5321
  try {
5322
- return Zt.from(ve(t));
5322
+ return Kt.from(ve(t));
5323
5323
  } catch {
5324
5324
  x(!1, "invalid event fragment", "obj", t);
5325
5325
  }
5326
5326
  else if (t instanceof Wt) {
5327
- const n = sr("event", t), r = fe(t, !0), s = !!de(t, Tt(["anonymous"])).has("anonymous");
5328
- return Ue(t), new Zt(ot, n, r, s);
5327
+ const n = sr("event", t), r = de(t, !0), s = !!pe(t, Tt(["anonymous"])).has("anonymous");
5328
+ return Ue(t), new Kt(ot, n, r, s);
5329
5329
  }
5330
- return new Zt(ot, t.name, t.inputs ? t.inputs.map((n) => nt.from(n, !0)) : [], !!t.anonymous);
5330
+ return new Kt(ot, t.name, t.inputs ? t.inputs.map((n) => nt.from(n, !0)) : [], !!t.anonymous);
5331
5331
  }
5332
5332
  /**
5333
5333
  * Returns ``true`` and provides a type guard if %%value%% is an
5334
5334
  * **EventFragment**.
5335
5335
  */
5336
5336
  static isFragment(t) {
5337
- return t && t[Ct] === zs;
5337
+ return t && t[Ct] === Js;
5338
5338
  }
5339
5339
  }
5340
- class ue extends qe {
5340
+ class le extends qe {
5341
5341
  /**
5342
5342
  * Whether the constructor can receive an endowment.
5343
5343
  */
@@ -5350,7 +5350,7 @@ class ue extends qe {
5350
5350
  * @private
5351
5351
  */
5352
5352
  constructor(t, n, r, s, i) {
5353
- super(t, n, r), Object.defineProperty(this, Ct, { value: Js }), st(this, { payable: s, gas: i });
5353
+ super(t, n, r), Object.defineProperty(this, Ct, { value: js }), st(this, { payable: s, gas: i });
5354
5354
  }
5355
5355
  /**
5356
5356
  * Returns a string representation of this constructor as %%format%%.
@@ -5371,36 +5371,36 @@ class ue extends qe {
5371
5371
  * Returns a new **ConstructorFragment** for %%obj%%.
5372
5372
  */
5373
5373
  static from(t) {
5374
- if (ue.isFragment(t))
5374
+ if (le.isFragment(t))
5375
5375
  return t;
5376
5376
  if (typeof t == "string")
5377
5377
  try {
5378
- return ue.from(ve(t));
5378
+ return le.from(ve(t));
5379
5379
  } catch {
5380
5380
  x(!1, "invalid constuctor fragment", "obj", t);
5381
5381
  }
5382
5382
  else if (t instanceof Wt) {
5383
- de(t, Tt(["constructor"]));
5384
- const n = fe(t), r = !!de(t, qu).has("payable"), s = mo(t);
5385
- return Ue(t), new ue(ot, "constructor", n, r, s);
5383
+ pe(t, Tt(["constructor"]));
5384
+ const n = de(t), r = !!pe(t, qu).has("payable"), s = xo(t);
5385
+ return Ue(t), new le(ot, "constructor", n, r, s);
5386
5386
  }
5387
- return new ue(ot, "constructor", t.inputs ? t.inputs.map(nt.from) : [], !!t.payable, t.gas != null ? t.gas : null);
5387
+ return new le(ot, "constructor", t.inputs ? t.inputs.map(nt.from) : [], !!t.payable, t.gas != null ? t.gas : null);
5388
5388
  }
5389
5389
  /**
5390
5390
  * Returns ``true`` and provides a type guard if %%value%% is a
5391
5391
  * **ConstructorFragment**.
5392
5392
  */
5393
5393
  static isFragment(t) {
5394
- return t && t[Ct] === Js;
5394
+ return t && t[Ct] === js;
5395
5395
  }
5396
5396
  }
5397
- class ae extends qe {
5397
+ class ce extends qe {
5398
5398
  /**
5399
5399
  * If the function can be sent value during invocation.
5400
5400
  */
5401
5401
  payable;
5402
5402
  constructor(t, n, r) {
5403
- super(t, "fallback", n), Object.defineProperty(this, Ct, { value: js }), st(this, { payable: r });
5403
+ super(t, "fallback", n), Object.defineProperty(this, Ct, { value: Qs }), st(this, { payable: r });
5404
5404
  }
5405
5405
  /**
5406
5406
  * Returns a string representation of this fallback as %%format%%.
@@ -5417,34 +5417,34 @@ class ae extends qe {
5417
5417
  * Returns a new **FallbackFragment** for %%obj%%.
5418
5418
  */
5419
5419
  static from(t) {
5420
- if (ae.isFragment(t))
5420
+ if (ce.isFragment(t))
5421
5421
  return t;
5422
5422
  if (typeof t == "string")
5423
5423
  try {
5424
- return ae.from(ve(t));
5424
+ return ce.from(ve(t));
5425
5425
  } catch {
5426
5426
  x(!1, "invalid fallback fragment", "obj", t);
5427
5427
  }
5428
5428
  else if (t instanceof Wt) {
5429
5429
  const n = t.toString(), r = t.peekKeyword(Tt(["fallback", "receive"]));
5430
5430
  if (x(r, "type must be fallback or receive", "obj", n), t.popKeyword(Tt(["fallback", "receive"])) === "receive") {
5431
- const a = fe(t);
5432
- return x(a.length === 0, "receive cannot have arguments", "obj.inputs", a), de(t, Tt(["payable"])), Ue(t), new ae(ot, [], !0);
5431
+ const a = de(t);
5432
+ return x(a.length === 0, "receive cannot have arguments", "obj.inputs", a), pe(t, Tt(["payable"])), Ue(t), new ce(ot, [], !0);
5433
5433
  }
5434
- let i = fe(t);
5434
+ let i = de(t);
5435
5435
  i.length ? x(i.length === 1 && i[0].type === "bytes", "invalid fallback inputs", "obj.inputs", i.map((a) => a.format("minimal")).join(", ")) : i = [nt.from("bytes")];
5436
- const o = bo(t);
5437
- if (x(o === "nonpayable" || o === "payable", "fallback cannot be constants", "obj.stateMutability", o), de(t, Tt(["returns"])).has("returns")) {
5438
- const a = fe(t);
5436
+ const o = mo(t);
5437
+ if (x(o === "nonpayable" || o === "payable", "fallback cannot be constants", "obj.stateMutability", o), pe(t, Tt(["returns"])).has("returns")) {
5438
+ const a = de(t);
5439
5439
  x(a.length === 1 && a[0].type === "bytes", "invalid fallback outputs", "obj.outputs", a.map((c) => c.format("minimal")).join(", "));
5440
5440
  }
5441
- return Ue(t), new ae(ot, i, o === "payable");
5441
+ return Ue(t), new ce(ot, i, o === "payable");
5442
5442
  }
5443
5443
  if (t.type === "receive")
5444
- return new ae(ot, [], !0);
5444
+ return new ce(ot, [], !0);
5445
5445
  if (t.type === "fallback") {
5446
5446
  const n = [nt.from("bytes")], r = t.stateMutability === "payable";
5447
- return new ae(ot, n, r);
5447
+ return new ce(ot, n, r);
5448
5448
  }
5449
5449
  x(!1, "invalid fallback description", "obj", t);
5450
5450
  }
@@ -5453,10 +5453,10 @@ class ae extends qe {
5453
5453
  * **FallbackFragment**.
5454
5454
  */
5455
5455
  static isFragment(t) {
5456
- return t && t[Ct] === js;
5456
+ return t && t[Ct] === Qs;
5457
5457
  }
5458
5458
  }
5459
- class Yt extends ir {
5459
+ class Xt extends ir {
5460
5460
  /**
5461
5461
  * If the function is constant (e.g. ``pure`` or ``view`` functions).
5462
5462
  */
@@ -5482,7 +5482,7 @@ class Yt extends ir {
5482
5482
  * @private
5483
5483
  */
5484
5484
  constructor(t, n, r, s, i, o) {
5485
- super(t, "function", n, s), Object.defineProperty(this, Ct, { value: Qs }), i = Object.freeze(i.slice()), st(this, { constant: r === "view" || r === "pure", gas: o, outputs: i, payable: r === "payable", stateMutability: r });
5485
+ super(t, "function", n, s), Object.defineProperty(this, Ct, { value: ti }), i = Object.freeze(i.slice()), st(this, { constant: r === "view" || r === "pure", gas: o, outputs: i, payable: r === "payable", stateMutability: r });
5486
5486
  }
5487
5487
  /**
5488
5488
  * The Function selector.
@@ -5512,36 +5512,36 @@ class Yt extends ir {
5512
5512
  * Return the selector for a function with %%name%% and %%params%%.
5513
5513
  */
5514
5514
  static getSelector(t, n) {
5515
- return n = (n || []).map((s) => nt.from(s)), new Yt(ot, t, "view", n, [], null).selector;
5515
+ return n = (n || []).map((s) => nt.from(s)), new Xt(ot, t, "view", n, [], null).selector;
5516
5516
  }
5517
5517
  /**
5518
5518
  * Returns a new **FunctionFragment** for %%obj%%.
5519
5519
  */
5520
5520
  static from(t) {
5521
- if (Yt.isFragment(t))
5521
+ if (Xt.isFragment(t))
5522
5522
  return t;
5523
5523
  if (typeof t == "string")
5524
5524
  try {
5525
- return Yt.from(ve(t));
5525
+ return Xt.from(ve(t));
5526
5526
  } catch {
5527
5527
  x(!1, "invalid function fragment", "obj", t);
5528
5528
  }
5529
5529
  else if (t instanceof Wt) {
5530
- const r = sr("function", t), s = fe(t), i = bo(t);
5530
+ const r = sr("function", t), s = de(t), i = mo(t);
5531
5531
  let o = [];
5532
- de(t, Tt(["returns"])).has("returns") && (o = fe(t));
5533
- const a = mo(t);
5534
- return Ue(t), new Yt(ot, r, i, s, o, a);
5532
+ pe(t, Tt(["returns"])).has("returns") && (o = de(t));
5533
+ const a = xo(t);
5534
+ return Ue(t), new Xt(ot, r, i, s, o, a);
5535
5535
  }
5536
5536
  let n = t.stateMutability;
5537
- return n == null && (n = "payable", typeof t.constant == "boolean" ? (n = "view", t.constant || (n = "payable", typeof t.payable == "boolean" && !t.payable && (n = "nonpayable"))) : typeof t.payable == "boolean" && !t.payable && (n = "nonpayable")), new Yt(ot, t.name, n, t.inputs ? t.inputs.map(nt.from) : [], t.outputs ? t.outputs.map(nt.from) : [], t.gas != null ? t.gas : null);
5537
+ return n == null && (n = "payable", typeof t.constant == "boolean" ? (n = "view", t.constant || (n = "payable", typeof t.payable == "boolean" && !t.payable && (n = "nonpayable"))) : typeof t.payable == "boolean" && !t.payable && (n = "nonpayable")), new Xt(ot, t.name, n, t.inputs ? t.inputs.map(nt.from) : [], t.outputs ? t.outputs.map(nt.from) : [], t.gas != null ? t.gas : null);
5538
5538
  }
5539
5539
  /**
5540
5540
  * Returns ``true`` and provides a type guard if %%value%% is a
5541
5541
  * **FunctionFragment**.
5542
5542
  */
5543
5543
  static isFragment(t) {
5544
- return t && t[Ct] === Qs;
5544
+ return t && t[Ct] === ti;
5545
5545
  }
5546
5546
  }
5547
5547
  class Le extends ir {
@@ -5549,7 +5549,7 @@ class Le extends ir {
5549
5549
  * @private
5550
5550
  */
5551
5551
  constructor(t, n, r) {
5552
- super(t, "struct", n, r), Object.defineProperty(this, Ct, { value: ti });
5552
+ super(t, "struct", n, r), Object.defineProperty(this, Ct, { value: ei });
5553
5553
  }
5554
5554
  /**
5555
5555
  * Returns a string representation of this struct as %%format%%.
@@ -5568,7 +5568,7 @@ class Le extends ir {
5568
5568
  x(!1, "invalid struct fragment", "obj", t);
5569
5569
  }
5570
5570
  else if (t instanceof Wt) {
5571
- const n = sr("struct", t), r = fe(t);
5571
+ const n = sr("struct", t), r = de(t);
5572
5572
  return Ue(t), new Le(ot, n, r);
5573
5573
  }
5574
5574
  return new Le(ot, t.name, t.inputs ? t.inputs.map(nt.from) : []);
@@ -5579,22 +5579,22 @@ class Le extends ir {
5579
5579
  * **StructFragment**.
5580
5580
  */
5581
5581
  static isFragment(t) {
5582
- return t && t[Ct] === ti;
5583
- }
5584
- }
5585
- const Ht = /* @__PURE__ */ new Map();
5586
- Ht.set(0, "GENERIC_PANIC");
5587
- Ht.set(1, "ASSERT_FALSE");
5588
- Ht.set(17, "OVERFLOW");
5589
- Ht.set(18, "DIVIDE_BY_ZERO");
5590
- Ht.set(33, "ENUM_RANGE_ERROR");
5591
- Ht.set(34, "BAD_STORAGE_DATA");
5592
- Ht.set(49, "STACK_UNDERFLOW");
5593
- Ht.set(50, "ARRAY_RANGE_ERROR");
5594
- Ht.set(65, "OUT_OF_MEMORY");
5595
- Ht.set(81, "UNINITIALIZED_FUNCTION_CALL");
5582
+ return t && t[Ct] === ei;
5583
+ }
5584
+ }
5585
+ const Zt = /* @__PURE__ */ new Map();
5586
+ Zt.set(0, "GENERIC_PANIC");
5587
+ Zt.set(1, "ASSERT_FALSE");
5588
+ Zt.set(17, "OVERFLOW");
5589
+ Zt.set(18, "DIVIDE_BY_ZERO");
5590
+ Zt.set(33, "ENUM_RANGE_ERROR");
5591
+ Zt.set(34, "BAD_STORAGE_DATA");
5592
+ Zt.set(49, "STACK_UNDERFLOW");
5593
+ Zt.set(50, "ARRAY_RANGE_ERROR");
5594
+ Zt.set(65, "OUT_OF_MEMORY");
5595
+ Zt.set(81, "UNINITIALIZED_FUNCTION_CALL");
5596
5596
  const zu = new RegExp(/^bytes([0-9]*)$/), Ju = new RegExp(/^(u?int)([0-9]*)$/);
5597
- let Tr = null, ei = 1024;
5597
+ let Tr = null, ni = 1024;
5598
5598
  function ju(e, t, n, r) {
5599
5599
  let s = "missing revert data", i = null;
5600
5600
  const o = null;
@@ -5623,7 +5623,7 @@ function ju(e, t, n, r) {
5623
5623
  signature: "Panic(uint256)",
5624
5624
  name: "Panic",
5625
5625
  args: [l]
5626
- }, i = `Panic due to ${Ht.get(l) || "UNKNOWN"}(${l})`, s += `: ${i}`;
5626
+ }, i = `Panic due to ${Zt.get(l) || "UNKNOWN"}(${l})`, s += `: ${i}`;
5627
5627
  } catch {
5628
5628
  s += " (could not decode panic code)";
5629
5629
  }
@@ -5634,7 +5634,7 @@ function ju(e, t, n, r) {
5634
5634
  to: t.to ? yn(t.to) : null,
5635
5635
  data: t.data || "0x"
5636
5636
  };
5637
- return t.from && (c.from = yn(t.from)), Wi(s, "CALL_EXCEPTION", {
5637
+ return t.from && (c.from = yn(t.from)), Gi(s, "CALL_EXCEPTION", {
5638
5638
  action: e,
5639
5639
  data: n,
5640
5640
  reason: i,
@@ -5643,7 +5643,7 @@ function ju(e, t, n, r) {
5643
5643
  revert: a
5644
5644
  });
5645
5645
  }
5646
- class pe {
5646
+ class he {
5647
5647
  #t(t) {
5648
5648
  if (t.isArray())
5649
5649
  return new Bu(this.#t(t.arrayChildren), t.arrayLength, t.name);
@@ -5688,7 +5688,7 @@ class pe {
5688
5688
  * @returns DataHexstring
5689
5689
  */
5690
5690
  encode(t, n) {
5691
- Gi(n.length, t.length, "types/values length mismatch");
5691
+ Hi(n.length, t.length, "types/values length mismatch");
5692
5692
  const r = t.map((o) => this.#t(nt.from(o))), s = new Pn(r, "_"), i = new Ar();
5693
5693
  return s.encode(i, n), i.data;
5694
5694
  }
@@ -5701,10 +5701,10 @@ class pe {
5701
5701
  */
5702
5702
  decode(t, n, r) {
5703
5703
  const s = t.map((o) => this.#t(nt.from(o)));
5704
- return new Pn(s, "_").decode(new Qr(n, r, ei));
5704
+ return new Pn(s, "_").decode(new Qr(n, r, ni));
5705
5705
  }
5706
5706
  static _setDefaultMaxInflation(t) {
5707
- x(typeof t == "number" && Number.isInteger(t), "invalid defaultMaxInflation factor", "value", t), ei = t;
5707
+ x(typeof t == "number" && Number.isInteger(t), "invalid defaultMaxInflation factor", "value", t), ni = t;
5708
5708
  }
5709
5709
  /**
5710
5710
  * Returns the shared singleton instance of a default [[AbiCoder]].
@@ -5712,7 +5712,7 @@ class pe {
5712
5712
  * On the first call, the instance is created internally.
5713
5713
  */
5714
5714
  static defaultAbiCoder() {
5715
- return Tr == null && (Tr = new pe()), Tr;
5715
+ return Tr == null && (Tr = new he()), Tr;
5716
5716
  }
5717
5717
  /**
5718
5718
  * Returns an ethers-compatible [[CallExceptionError]] Error for the given
@@ -5720,7 +5720,7 @@ class pe {
5720
5720
  * the Transaction %%tx%%.
5721
5721
  */
5722
5722
  static getBuiltinCallException(t, n, r) {
5723
- return ju(t, n, r, pe.defaultAbiCoder());
5723
+ return ju(t, n, r, he.defaultAbiCoder());
5724
5724
  }
5725
5725
  }
5726
5726
  class Qu {
@@ -5833,7 +5833,7 @@ class el {
5833
5833
  });
5834
5834
  }
5835
5835
  }
5836
- class ni {
5836
+ class ri {
5837
5837
  /**
5838
5838
  * The ``keccak256`` of the value logged.
5839
5839
  */
@@ -5857,7 +5857,7 @@ class ni {
5857
5857
  st(this, { hash: t, _isIndexed: !0 });
5858
5858
  }
5859
5859
  }
5860
- const ri = {
5860
+ const si = {
5861
5861
  0: "generic panic",
5862
5862
  1: "assert(false)",
5863
5863
  17: "arithmetic overflow",
@@ -5868,7 +5868,7 @@ const ri = {
5868
5868
  50: "out-of-bounds access of an array or bytesN",
5869
5869
  65: "out of memory",
5870
5870
  81: "uninitialized function"
5871
- }, si = {
5871
+ }, ii = {
5872
5872
  "0x08c379a0": {
5873
5873
  signature: "Error(string)",
5874
5874
  name: "Error",
@@ -5881,7 +5881,7 @@ const ri = {
5881
5881
  inputs: ["uint256"],
5882
5882
  reason: (e) => {
5883
5883
  let t = "unknown panic code";
5884
- return e >= 0 && e <= 255 && ri[e.toString()] && (t = ri[e.toString()]), `reverted with panic code 0x${e.toString(16)} (${t})`;
5884
+ return e >= 0 && e <= 255 && si[e.toString()] && (t = si[e.toString()]), `reverted with panic code 0x${e.toString(16)} (${t})`;
5885
5885
  }
5886
5886
  }
5887
5887
  };
@@ -5952,7 +5952,7 @@ class me {
5952
5952
  const u = o.format();
5953
5953
  c.has(u) || c.set(u, o);
5954
5954
  }), this.deploy || st(this, {
5955
- deploy: ue.from("constructor()")
5955
+ deploy: le.from("constructor()")
5956
5956
  }), st(this, { fallback: s, receive: i });
5957
5957
  }
5958
5958
  /**
@@ -5977,7 +5977,7 @@ class me {
5977
5977
  * data.
5978
5978
  */
5979
5979
  getAbiCoder() {
5980
- return pe.defaultAbiCoder();
5980
+ return he.defaultAbiCoder();
5981
5981
  }
5982
5982
  // Find a function definition by any means necessary (unless it is ambiguous)
5983
5983
  #s(t, n, r) {
@@ -6032,7 +6032,7 @@ class me {
6032
6032
  }
6033
6033
  return i[0];
6034
6034
  }
6035
- const s = this.#n.get(Yt.from(t).format());
6035
+ const s = this.#n.get(Xt.from(t).format());
6036
6036
  return s || null;
6037
6037
  }
6038
6038
  /**
@@ -6113,7 +6113,7 @@ class me {
6113
6113
  }
6114
6114
  return i[0];
6115
6115
  }
6116
- const s = this.#e.get(Zt.from(t).format());
6116
+ const s = this.#e.get(Kt.from(t).format());
6117
6117
  return s || null;
6118
6118
  }
6119
6119
  /**
@@ -6171,8 +6171,8 @@ class me {
6171
6171
  getError(t, n) {
6172
6172
  if (fn(t)) {
6173
6173
  const s = t.toLowerCase();
6174
- if (si[s])
6175
- return Nt.from(si[s].signature);
6174
+ if (ii[s])
6175
+ return Nt.from(ii[s].signature);
6176
6176
  for (const i of this.#t.values())
6177
6177
  if (s === i.selector)
6178
6178
  return i;
@@ -6331,7 +6331,7 @@ class me {
6331
6331
  x(i, "unknown function", "fragment", t), t = i;
6332
6332
  }
6333
6333
  let r = "invalid length for result data";
6334
- const s = zt(n);
6334
+ const s = jt(n);
6335
6335
  if (s.length % 32 === 0)
6336
6336
  try {
6337
6337
  return this.#r.decode(t.outputs, s);
@@ -6344,7 +6344,7 @@ class me {
6344
6344
  });
6345
6345
  }
6346
6346
  makeError(t, n) {
6347
- const r = yt(t, "data"), s = pe.getBuiltinCallException("call", n, r);
6347
+ const r = yt(t, "data"), s = he.getBuiltinCallException("call", n, r);
6348
6348
  if (s.message.startsWith("execution reverted (unknown custom error)")) {
6349
6349
  const a = bt(r.slice(0, 4)), c = this.getError(a);
6350
6350
  if (c)
@@ -6420,7 +6420,7 @@ class me {
6420
6420
  at(n.length <= t.inputs.length, `too many arguments for ${t.format()}`, "UNEXPECTED_ARGUMENT", { count: n.length, expectedCount: t.inputs.length });
6421
6421
  const r = [];
6422
6422
  t.anonymous || r.push(t.topicHash);
6423
- const s = (i, o) => i.type === "string" ? bn(o) : i.type === "bytes" ? tt(bt(o)) : (i.type === "bool" && typeof o == "boolean" ? o = o ? "0x01" : "0x00" : i.type.match(/^u?int/) ? o = Xi(o) : i.type.match(/^bytes/) ? o = Zi(o, 32) : i.type === "address" && this.#r.encode(["address"], [o]), Un(bt(o), 32));
6423
+ const s = (i, o) => i.type === "string" ? bn(o) : i.type === "bytes" ? tt(bt(o)) : (i.type === "bool" && typeof o == "boolean" ? o = o ? "0x01" : "0x00" : i.type.match(/^u?int/) ? o = zi(o) : i.type.match(/^bytes/) ? o = Yi(o, 32) : i.type === "address" && this.#r.encode(["address"], [o]), Un(bt(o), 32));
6424
6424
  for (n.forEach((i, o) => {
6425
6425
  const a = t.inputs[o];
6426
6426
  if (!a.indexed) {
@@ -6477,9 +6477,9 @@ class me {
6477
6477
  let h = null;
6478
6478
  if (p.indexed)
6479
6479
  if (a == null)
6480
- h = new ni(null);
6480
+ h = new ri(null);
6481
6481
  else if (o[w])
6482
- h = new ni(a[d++]);
6482
+ h = new ri(a[d++]);
6483
6483
  else
6484
6484
  try {
6485
6485
  h = a[d++];
@@ -6493,7 +6493,7 @@ class me {
6493
6493
  h = g;
6494
6494
  }
6495
6495
  u.push(h), l.push(p.name || null);
6496
- }), ce.fromItems(u, l);
6496
+ }), ue.fromItems(u, l);
6497
6497
  }
6498
6498
  /**
6499
6499
  * Parses a transaction, finding the matching function and extracts
@@ -6544,16 +6544,16 @@ class me {
6544
6544
  return t instanceof me ? t : typeof t == "string" ? new me(JSON.parse(t)) : typeof t.formatJson == "function" ? new me(t.formatJson()) : typeof t.format == "function" ? new me(t.format("json")) : new me(t);
6545
6545
  }
6546
6546
  }
6547
- const xo = "The swap backend did not return a fee_policy from get_swap_info, so it is older than this wallet-kit release and swap fees cannot be computed. Upgrade the swap backend, or pin @bestinslot/wallet-kit below 0.11.0.", nl = /^0x[0-9a-f]{40}$/;
6547
+ const _o = "The swap backend did not return a fee_policy from get_swap_info, so it is older than this wallet-kit release and swap fees cannot be computed. Upgrade the swap backend, or pin @bestinslot/wallet-kit below 0.11.0.", nl = /^0x[0-9a-f]{40}$/;
6548
6548
  function Ye(e) {
6549
6549
  return new Error(`Invalid fee_policy from the swap backend: ${e}`);
6550
6550
  }
6551
- function ii(e) {
6551
+ function oi(e) {
6552
6552
  return typeof e == "number" && Number.isInteger(e) && e >= 0 && e <= 1e4;
6553
6553
  }
6554
6554
  function rl(e) {
6555
6555
  if (e == null)
6556
- throw new Error(xo);
6556
+ throw new Error(_o);
6557
6557
  if (typeof e != "object")
6558
6558
  throw Ye("not an object");
6559
6559
  const {
@@ -6562,10 +6562,10 @@ function rl(e) {
6562
6562
  priority_tokens: r,
6563
6563
  min_btc_exposure_sats: s
6564
6564
  } = e;
6565
- if (!ii(t))
6565
+ if (!oi(t))
6566
6566
  throw Ye(`swap_fee_bps must be an integer in [0, 10000] (got ${String(t)})`);
6567
6567
  const i = n === void 0 ? t : n;
6568
- if (!ii(i))
6568
+ if (!oi(i))
6569
6569
  throw Ye(
6570
6570
  `token_pair_swap_fee_bps must be an integer in [0, 10000] (got ${String(i)})`
6571
6571
  );
@@ -6599,16 +6599,16 @@ function ol(e, t, n) {
6599
6599
  const r = n.toLowerCase();
6600
6600
  return e.toLowerCase() === r ? "buy" : t.toLowerCase() === r ? "sell" : null;
6601
6601
  }
6602
- function _o(e) {
6602
+ function So(e) {
6603
6603
  const t = BigInt(Number.MAX_SAFE_INTEGER);
6604
6604
  if (e > t || e < -t)
6605
6605
  throw new RangeError("satsToBtc: amount exceeds safe-integer precision (~90,000 BTC).");
6606
6606
  return Number(e) / 1e8;
6607
6607
  }
6608
6608
  function al(e, t) {
6609
- return _o(e) * t;
6609
+ return So(e) * t;
6610
6610
  }
6611
- function So(e, t, n, r, s) {
6611
+ function Eo(e, t, n, r, s) {
6612
6612
  return {
6613
6613
  pool_fee_bps: il,
6614
6614
  token_in_fee_bps: n,
@@ -6618,7 +6618,7 @@ function So(e, t, n, r, s) {
6618
6618
  miner_fee_sats: s
6619
6619
  };
6620
6620
  }
6621
- function Eo(e, t, n, r, s, i) {
6621
+ function Bo(e, t, n, r, s, i) {
6622
6622
  const o = e.toLowerCase() === t.toLowerCase() ? n * 10n ** BigInt(i) * 100n / r : r * 10n ** BigInt(s) * 100n / n;
6623
6623
  return Number(o) / 100;
6624
6624
  }
@@ -6639,18 +6639,18 @@ function cl(e) {
6639
6639
  }
6640
6640
  function ar(e, t) {
6641
6641
  e.toLowerCase() > t.toLowerCase() && ([e, t] = [t, e]);
6642
- const n = Vs(
6642
+ const n = Zs(
6643
6643
  ["uint8", "address", "bytes32", "bytes32"],
6644
6644
  [
6645
6645
  255,
6646
6646
  ns,
6647
- tt(Vs(["address", "address"], [e, t])),
6647
+ tt(Zs(["address", "address"], [e, t])),
6648
6648
  "0xc3cb93660fbd444d3f741950f68d962ba5a881cc5e37a5eedd40ba8e2127da33"
6649
6649
  ]
6650
6650
  );
6651
6651
  return `0x${tt(n).slice(-40)}`;
6652
6652
  }
6653
- async function oi(e, t, n) {
6653
+ async function ai(e, t, n) {
6654
6654
  t = t.startsWith("0x") ? t.slice(2) : t;
6655
6655
  const r = await e.balanceOf(t, n);
6656
6656
  return r === null ? BigInt(0) : r;
@@ -6682,10 +6682,10 @@ class ll {
6682
6682
  return this.map[r];
6683
6683
  }
6684
6684
  if (n.length === 42) {
6685
- const s = await oi(this.proxy, t, n);
6685
+ const s = await ai(this.proxy, t, n);
6686
6686
  return this.map[r] = s, s;
6687
6687
  } else {
6688
- const s = `0x${n.slice(2, 42)}`, i = `0x${n.slice(44, 84)}`, o = ar(s, i), a = await oi(this.proxy, t, o);
6688
+ const s = `0x${n.slice(2, 42)}`, i = `0x${n.slice(44, 84)}`, o = ar(s, i), a = await ai(this.proxy, t, o);
6689
6689
  return this.map[r] = a, a;
6690
6690
  }
6691
6691
  }
@@ -6729,11 +6729,11 @@ class fl {
6729
6729
  }
6730
6730
  }
6731
6731
  const P = new ll(), it = new fl();
6732
- let ai = Promise.resolve();
6732
+ let ci = Promise.resolve();
6733
6733
  async function In(e) {
6734
- const t = ai;
6734
+ const t = ci;
6735
6735
  let n;
6736
- ai = new Promise((r) => {
6736
+ ci = new Promise((r) => {
6737
6737
  n = r;
6738
6738
  }), await t;
6739
6739
  try {
@@ -6745,7 +6745,7 @@ async function In(e) {
6745
6745
  }
6746
6746
  return n;
6747
6747
  }
6748
- function Bo(e, t) {
6748
+ function vo(e, t) {
6749
6749
  return e < t ? e + t : t + e;
6750
6750
  }
6751
6751
  function dl(e, t, n) {
@@ -6769,7 +6769,7 @@ async function hl(e, t) {
6769
6769
  throw new Error("Invalid path");
6770
6770
  const n = [e];
6771
6771
  for (let r = 0; r < t.length - 1; r++) {
6772
- const { reserveA: s, reserveB: i } = await jt(t[r], t[r + 1]), o = dl(n[r], s, i);
6772
+ const { reserveA: s, reserveB: i } = await Qt(t[r], t[r + 1]), o = dl(n[r], s, i);
6773
6773
  n.push(o);
6774
6774
  }
6775
6775
  return n;
@@ -6780,19 +6780,19 @@ async function wl(e, t) {
6780
6780
  const n = [];
6781
6781
  n[t.length - 1] = e;
6782
6782
  for (let r = t.length - 1; r > 0; r--) {
6783
- const { reserveA: s, reserveB: i } = await jt(t[r - 1], t[r]), o = pl(n[r], s, i);
6783
+ const { reserveA: s, reserveB: i } = await Qt(t[r - 1], t[r]), o = pl(n[r], s, i);
6784
6784
  n[r - 1] = o;
6785
6785
  }
6786
6786
  return n;
6787
6787
  }
6788
- function ci(e, t, n) {
6788
+ function ui(e, t, n) {
6789
6789
  if (e <= 0n)
6790
6790
  throw new Error("Insufficient amount");
6791
6791
  if (t <= 0n || n <= 0n)
6792
6792
  throw new Error("Insufficient liquidity");
6793
6793
  return e * n / t;
6794
6794
  }
6795
- async function jt(e, t) {
6795
+ async function Qt(e, t) {
6796
6796
  const n = await it.get(e, t);
6797
6797
  if (!n)
6798
6798
  throw new Error("Reserves not found for pair");
@@ -6812,7 +6812,7 @@ async function yl(e, t, n, r) {
6812
6812
  reserveA: s,
6813
6813
  reserveB: i,
6814
6814
  total_supply: o
6815
- } = await jt(e, t), a = s - n, c = i - r;
6815
+ } = await Qt(e, t), a = s - n, c = i - r;
6816
6816
  let u;
6817
6817
  if (o === 0n) {
6818
6818
  u = cl(n * r) - 1000n;
@@ -6840,17 +6840,17 @@ async function bl(e, t, n, r, s, i) {
6840
6840
  } catch {
6841
6841
  it.set(e, t, { reserveA: 0n, reserveB: 0n, total_supply: 0n });
6842
6842
  }
6843
- const { reserveA: c, reserveB: u } = await jt(e, t);
6843
+ const { reserveA: c, reserveB: u } = await Qt(e, t);
6844
6844
  if (c === 0n && u === 0n)
6845
6845
  o = n, a = r;
6846
6846
  else {
6847
- const l = ci(n, c, u);
6847
+ const l = ui(n, c, u);
6848
6848
  if (l <= r) {
6849
6849
  if (l < i)
6850
6850
  throw new Error("Insufficient B amount");
6851
6851
  o = n, a = l;
6852
6852
  } else {
6853
- const f = ci(r, u, c);
6853
+ const f = ui(r, u, c);
6854
6854
  if (f > n || f < s)
6855
6855
  throw new Error("Insufficient A amount");
6856
6856
  o = f, a = r;
@@ -6884,7 +6884,7 @@ async function xl(e, t, n) {
6884
6884
  reserveA: r,
6885
6885
  reserveB: s,
6886
6886
  total_supply: i
6887
- } = await jt(e, t), o = n * r / i, a = n * s / i;
6887
+ } = await Qt(e, t), o = n * r / i, a = n * s / i;
6888
6888
  if (o <= 0n || a <= 0n)
6889
6889
  throw new Error("Insufficient liquidity burned");
6890
6890
  const c = await it.get(e, t), u = c.total_supply - n;
@@ -6898,7 +6898,7 @@ async function xl(e, t, n) {
6898
6898
  async function _l(e, t, n, r, s, i, o, a) {
6899
6899
  if (s <= 0n && i <= 0n)
6900
6900
  throw new Error("Insufficient output amount");
6901
- const { reserveA: c, reserveB: u } = await jt(e, t), l = c - n, f = u - r;
6901
+ const { reserveA: c, reserveB: u } = await Qt(e, t), l = c - n, f = u - r;
6902
6902
  if (s >= l || i >= f)
6903
6903
  throw new Error("Insufficient liquidity");
6904
6904
  const d = await it.get(e, t);
@@ -6925,7 +6925,7 @@ async function _l(e, t, n, r, s, i, o, a) {
6925
6925
  if (b * m < BigInt(l) * BigInt(f) * 1000n * 1000n)
6926
6926
  throw new Error("K");
6927
6927
  }
6928
- async function vo(e, t) {
6928
+ async function Oo(e, t) {
6929
6929
  if (e.length !== t.length)
6930
6930
  throw new Error("Amounts and path length mismatch");
6931
6931
  if (e.length < 2)
@@ -6954,7 +6954,7 @@ async function Sl(e, t, n) {
6954
6954
  const r = await hl(e, n);
6955
6955
  if (r[r.length - 1] < t)
6956
6956
  throw new Error("Insufficient output amount");
6957
- return await vo(r, n), r;
6957
+ return await Oo(r, n), r;
6958
6958
  }
6959
6959
  async function El(e, t, n) {
6960
6960
  if (n.length < 2)
@@ -6962,7 +6962,7 @@ async function El(e, t, n) {
6962
6962
  const r = await wl(t, n);
6963
6963
  if (r[0] > e)
6964
6964
  throw new Error("Excessive Input Amount");
6965
- return await vo(r, n), r;
6965
+ return await Oo(r, n), r;
6966
6966
  }
6967
6967
  async function Bl(e, t, n, r, s) {
6968
6968
  const { amountA: i, amountB: o } = await xl(e, t, n);
@@ -7012,7 +7012,7 @@ async function Ol(e, t, n, r, s, i, o, a, c, u, l, f, d) {
7012
7012
  i,
7013
7013
  o,
7014
7014
  a
7015
- ), b = Bo(n, r);
7015
+ ), b = vo(n, r);
7016
7016
  return P.setCheckPositive(
7017
7017
  t,
7018
7018
  n,
@@ -7076,7 +7076,7 @@ async function Tl(e, t, n, r, s, i, o, a, c, u, l, f) {
7076
7076
  a
7077
7077
  ))
7078
7078
  throw new Error("Invalid BLS signature");
7079
- const p = Bo(n, r);
7079
+ const p = vo(n, r);
7080
7080
  if ((await P.get(t, p) || 0n) < s)
7081
7081
  throw new Error("Insufficient liquidity balance");
7082
7082
  const { amountA: w, amountB: h } = await Bl(
@@ -7150,7 +7150,7 @@ async function kl(e, t, n, r, s, i, o, a, c, u, l) {
7150
7150
  throw new Error("Invalid BLS signature");
7151
7151
  if ((await P.get(t, n) || 0n) < s)
7152
7152
  throw new Error("Insufficient input token balance");
7153
- const { reserveA: d, reserveB: p } = await jt(
7153
+ const { reserveA: d, reserveB: p } = await Qt(
7154
7154
  n,
7155
7155
  r
7156
7156
  ), w = await Sl(s, i, [n, r]);
@@ -7177,7 +7177,7 @@ async function kl(e, t, n, r, s, i, o, a, c, u, l) {
7177
7177
  r,
7178
7178
  (await P.get(t, r) || 0n) - w[1] * u / 10000n
7179
7179
  );
7180
- const { reserveA: h, reserveB: g } = await jt(
7180
+ const { reserveA: h, reserveB: g } = await Qt(
7181
7181
  n,
7182
7182
  r
7183
7183
  ), b = n === wt ? d * 1000000000000000000n * 10000n / p : p * 1000000000000000000n * 10000n / d, m = n === wt ? h * 1000000000000000000n * 10000n / g : g * 1000000000000000000n * 10000n / h, v = b > m ? b - m : m - b, T = b !== 0n ? v * 10000n / b : 0n;
@@ -7225,7 +7225,7 @@ async function Cl(e, t, n, r, s, i, o, a, c, u, l) {
7225
7225
  o
7226
7226
  ))
7227
7227
  throw new Error("Invalid BLS signature");
7228
- const { reserveA: d, reserveB: p } = await jt(
7228
+ const { reserveA: d, reserveB: p } = await Qt(
7229
7229
  n,
7230
7230
  r
7231
7231
  ), w = await El(s, i, [n, r]);
@@ -7252,7 +7252,7 @@ async function Cl(e, t, n, r, s, i, o, a, c, u, l) {
7252
7252
  r,
7253
7253
  (await P.get(t, r) || 0n) - i * u / 10000n
7254
7254
  );
7255
- const { reserveA: h, reserveB: g } = await jt(
7255
+ const { reserveA: h, reserveB: g } = await Qt(
7256
7256
  n,
7257
7257
  r
7258
7258
  ), b = n === wt ? d * 1000000000000000000n * 10000n / p : p * 1000000000000000000n * 10000n / d, m = n === wt ? h * 1000000000000000000n * 10000n / g : g * 1000000000000000000n * 10000n / h, v = b > m ? b - m : m - b, T = b !== 0n ? v * 10000n / b : 0n;
@@ -7327,7 +7327,7 @@ class cr {
7327
7327
  return (...n) => (this.next(), t(...n));
7328
7328
  }
7329
7329
  }
7330
- const Oo = [
7330
+ const Io = [
7331
7331
  {
7332
7332
  type: "function",
7333
7333
  name: "deposit",
@@ -7343,7 +7343,7 @@ const Oo = [
7343
7343
  outputs: [],
7344
7344
  stateMutability: "nonpayable"
7345
7345
  }
7346
- ], Ll = Oo, _e = 1e3, ui = 12e3, Io = 2500n, Pl = `Sign this message only on official BiS interfaces.
7346
+ ], Ll = Io, _e = 1e3, li = 12e3, To = 2500n, Pl = `Sign this message only on official BiS interfaces.
7347
7347
  This signature is required to generate your session-specific swap key.
7348
7348
  Signing this message outside official BiS interfaces may result in unauthorized access to your swap session and is at the user's own risk.
7349
7349
  By signing, you acknowledge that the BiS Terms of Service also apply: https://bestinslot.xyz/legal/terms.`, Fl = `Sign this message only on official BiS interfaces.
@@ -7352,7 +7352,7 @@ Signing this message outside official BiS interfaces may result in unauthorized
7352
7352
  By signing, you acknowledge that the BiS Terms of Service also apply: https://bestinslot.xyz/legal/terms.
7353
7353
 
7354
7354
  Current Network: Bitcoin Mainnet`;
7355
- function li() {
7355
+ function fi() {
7356
7356
  const e = Fe();
7357
7357
  if (e === "signet")
7358
7358
  return Pl;
@@ -7368,10 +7368,10 @@ function ur() {
7368
7368
  return "0x62879BB3dD949c4CF06f71BF7c281DcF24D163e7";
7369
7369
  throw new Error("Unsupported network for orderbook contract address");
7370
7370
  }
7371
- function To() {
7371
+ function Ro() {
7372
7372
  const e = Fe();
7373
7373
  if (e === "signet")
7374
- return new me(Oo);
7374
+ return new me(Io);
7375
7375
  if (e === "mainnet")
7376
7376
  return new me(Ll);
7377
7377
  throw new Error("Unsupported network for orderbook contract address");
@@ -7379,27 +7379,27 @@ function To() {
7379
7379
  async function et() {
7380
7380
  return await Ur(Lt()?.address || "");
7381
7381
  }
7382
- function Ro(e) {
7382
+ function ko(e) {
7383
7383
  const t = I.shortSignatures.getPublicKey(e);
7384
7384
  return `0x${t.x.c0.toString(16).padStart(128, "0")}${t.x.c1.toString(16).padStart(128, "0")}${t.y.c0.toString(16).padStart(128, "0")}${t.y.c1.toString(16).padStart(128, "0")}`;
7385
7385
  }
7386
- async function ko(e = {}) {
7386
+ async function No(e = {}) {
7387
7387
  const t = Lt();
7388
7388
  if (!t?.address)
7389
7389
  throw new Error("Ordinals wallet address not found.");
7390
7390
  const n = new cr(e, 2);
7391
7391
  n.next();
7392
- const r = await ds(li());
7392
+ const r = await ps(fi());
7393
7393
  await new Promise((p) => setTimeout(p, 500)), n.next();
7394
- const s = await ds(li());
7394
+ const s = await ps(fi());
7395
7395
  if (r !== s)
7396
7396
  throw new Error("Deterministic signature mismatch. Please try again.");
7397
- const i = B.from(tt(`0x${r}`).slice(2), "hex"), o = B.from("my-app/bls-keygen", "utf-8"), a = Lc(Ai, i, void 0, o, 48), c = $i(a, I.fields.Fr.ORDER), u = B.from(c), l = Ro(u), f = `0x${u.toString("hex")}`, d = {
7397
+ const i = B.from(tt(`0x${r}`).slice(2), "hex"), o = B.from("my-app/bls-keygen", "utf-8"), a = Lc(Li, i, void 0, o, 48), c = Ai(a, I.fields.Fr.ORDER), u = B.from(c), l = ko(u), f = `0x${u.toString("hex")}`, d = {
7398
7398
  bitcoinAddress: t.address,
7399
7399
  swapPubkey: l,
7400
7400
  swapPrivkey: f
7401
7401
  };
7402
- return await di(d), d;
7402
+ return await pi(d), d;
7403
7403
  }
7404
7404
  function Ul(e) {
7405
7405
  const t = e.trim(), n = t.toLowerCase().startsWith("0x") ? t.slice(2) : t;
@@ -7416,21 +7416,21 @@ async function ql(e, t = {}) {
7416
7416
  throw new Error("Ordinals wallet address not found.");
7417
7417
  const r = Ul(e), s = {
7418
7418
  bitcoinAddress: n.address,
7419
- swapPubkey: Ro(r),
7419
+ swapPubkey: ko(r),
7420
7420
  swapPrivkey: `0x${r.toString("hex")}`
7421
7421
  }, i = await Ur(n.address);
7422
7422
  if (i && i.swapPubkey !== s.swapPubkey && !t.overwrite)
7423
7423
  throw new Error(
7424
7424
  "A different swap wallet is already stored for this address. Pass { overwrite: true } to replace it."
7425
7425
  );
7426
- return await di(s), s;
7426
+ return await pi(s), s;
7427
7427
  }
7428
7428
  async function Dl(e = {}) {
7429
7429
  const t = Lt();
7430
7430
  if (!t?.address)
7431
7431
  throw new Error("Ordinals wallet address not found.");
7432
7432
  const n = await Ur(t.address);
7433
- return n ? { wallet: n, created: !1 } : { wallet: await ko(e), created: !0 };
7433
+ return n ? { wallet: n, created: !1 } : { wallet: await No(e), created: !0 };
7434
7434
  }
7435
7435
  async function Ml() {
7436
7436
  return (await et())?.swapPrivkey ?? null;
@@ -7441,7 +7441,7 @@ async function Wl() {
7441
7441
  method: "GET"
7442
7442
  });
7443
7443
  }
7444
- async function No(e) {
7444
+ async function Co(e) {
7445
7445
  const t = Lt();
7446
7446
  if (!t?.address)
7447
7447
  throw new Error("Ordinals wallet address not found.");
@@ -7457,9 +7457,9 @@ async function No(e) {
7457
7457
  });
7458
7458
  return BigInt(s.result);
7459
7459
  }
7460
- const Gl = 6e4, fi = /* @__PURE__ */ new Map(), Lr = /* @__PURE__ */ new Map();
7461
- async function Qt() {
7462
- const e = Fe(), t = fi.get(e);
7460
+ const Gl = 6e4, di = /* @__PURE__ */ new Map(), Lr = /* @__PURE__ */ new Map();
7461
+ async function te() {
7462
+ const e = Fe(), t = di.get(e);
7463
7463
  if (t && Date.now() - t.fetchedAt < Gl)
7464
7464
  return t.info;
7465
7465
  const n = await X("get_swap_info"), r = await z(n, {
@@ -7479,10 +7479,10 @@ async function Qt() {
7479
7479
  fee_policy: i,
7480
7480
  allow_token_token_pairs: r.result.allow_token_token_pairs === !0
7481
7481
  };
7482
- return o.fee_policy !== null && fi.set(e, { info: o, fetchedAt: Date.now() }), o;
7482
+ return o.fee_policy !== null && di.set(e, { info: o, fetchedAt: Date.now() }), o;
7483
7483
  }
7484
7484
  async function lr(e, t) {
7485
- const n = await Qt();
7485
+ const n = await te();
7486
7486
  or(n.wbtc_address, n.factory_address);
7487
7487
  const r = ar(e, t);
7488
7488
  let s;
@@ -7494,7 +7494,7 @@ async function lr(e, t) {
7494
7494
  if (s.reserveA === 0n || s.reserveB === 0n)
7495
7495
  throw new Error(`No swap pool with liquidity for ${e} / ${t}.`);
7496
7496
  }
7497
- async function Co(e) {
7497
+ async function $o(e) {
7498
7498
  const t = Lt();
7499
7499
  if (!t?.address)
7500
7500
  throw new Error("Ordinals wallet address not found.");
@@ -7510,7 +7510,7 @@ async function Co(e) {
7510
7510
  });
7511
7511
  return BigInt(s.result);
7512
7512
  }
7513
- async function $o(e) {
7513
+ async function Ao(e) {
7514
7514
  const t = Lt();
7515
7515
  if (!t?.address)
7516
7516
  throw new Error("Ordinals wallet address not found.");
@@ -7782,7 +7782,7 @@ async function xn(e) {
7782
7782
  })
7783
7783
  })).result;
7784
7784
  }
7785
- async function Ao(e) {
7785
+ async function Lo(e) {
7786
7786
  e.bls_pubkey = e.bls_pubkey.startsWith("0x") ? e.bls_pubkey.slice(2) : e.bls_pubkey, e.bls_pubkey = e.bls_pubkey.toLowerCase(), e.token_address = e.token_address.toLowerCase();
7787
7787
  const t = `Deposit Order:
7788
7788
  Bitcoin Address: ${e.btc_address}
@@ -7804,7 +7804,7 @@ async function fr(e) {
7804
7804
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), c = I.shortSignatures.sign(r, o).negate();
7805
7805
  return `0x${c.x.toString(16).padStart(128, "0")}${c.y.toString(16).padStart(128, "0")}`;
7806
7806
  }
7807
- async function Lo(e) {
7807
+ async function Po(e) {
7808
7808
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
7809
7809
  let t = tt(B.from(e.pubkey, "hex")).slice(2);
7810
7810
  t += "99", t += e.ordinals_script;
@@ -7816,7 +7816,7 @@ async function Lo(e) {
7816
7816
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), c = I.shortSignatures.sign(r, o).negate();
7817
7817
  return `0x${c.x.toString(16).padStart(128, "0")}${c.y.toString(16).padStart(128, "0")}`;
7818
7818
  }
7819
- async function Po(e) {
7819
+ async function Fo(e) {
7820
7820
  const t = await X("get_deposit_signature");
7821
7821
  return z(t, {
7822
7822
  method: "POST",
@@ -7836,7 +7836,7 @@ async function rf(e) {
7836
7836
  body: JSON.stringify(e)
7837
7837
  });
7838
7838
  }
7839
- function Fo(e, t) {
7839
+ function Uo(e, t) {
7840
7840
  if (e < 0n)
7841
7841
  throw new Error("Amount cannot be negative");
7842
7842
  if (t < 0 || t > 18)
@@ -7852,30 +7852,30 @@ function Fo(e, t) {
7852
7852
  }
7853
7853
  return i ? `${s}.${i}` : s;
7854
7854
  }
7855
- function Uo(e) {
7855
+ function qo(e) {
7856
7856
  return e ? e.reduce((t, n) => t + n.amount, 0n) : 0n;
7857
7857
  }
7858
7858
  async function sf(e, t, n, r = !0, s, i = {}) {
7859
7859
  const o = rn();
7860
7860
  if (!o || !o.wallets) throw new Error("Wallets not found");
7861
- const a = Jt(), c = Sn(), u = Lt();
7861
+ const a = Ht(), c = Sn(), u = Lt();
7862
7862
  if (!c) throw new Error("Payment wallet not found");
7863
7863
  if (!c.address) throw new Error("Payment wallet address not found");
7864
7864
  if (!u) throw new Error("Ordinals wallet not found");
7865
7865
  if (!u.address) throw new Error("Ordinals wallet address not found");
7866
- const l = c.address, f = c.pubkey, d = u.address, p = new xt(!1, null, l, null, f);
7866
+ const l = c.address, f = c.pubkey, d = u.address, p = new mt(!1, null, l, null, f);
7867
7867
  let w = 0n, h = 0, g = "";
7868
- const b = await Co(e);
7868
+ const b = await $o(e);
7869
7869
  if (b < t) {
7870
- const Ut = await $o(e), ne = Ut.available_balance_in_18_dec;
7870
+ const Ut = await Ao(e), re = Ut.available_balance_in_18_dec;
7871
7871
  h = Ut.decimals, g = Ut.ticker, w = t - b;
7872
- const re = Uo(s);
7873
- if (ne + re < w)
7872
+ const se = qo(s);
7873
+ if (re + se < w)
7874
7874
  throw console.error(
7875
- `Insufficient BRC-2.0 + BRC20 available balance. Current BRC-2.0: ${b}, Available in base: ${ne}, Reclaimable: ${re}, Required: ${t}`
7875
+ `Insufficient BRC-2.0 + BRC20 available balance. Current BRC-2.0: ${b}, Available in base: ${re}, Reclaimable: ${se}, Required: ${t}`
7876
7876
  ), new Error("Insufficient BRC-2.0 + BRC20 available balance");
7877
7877
  }
7878
- const m = await No(e);
7878
+ const m = await Co(e);
7879
7879
  let v = !1;
7880
7880
  if (m < BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")) {
7881
7881
  if (!r)
@@ -7887,7 +7887,7 @@ async function sf(e, t, n, r = !0, s, i = {}) {
7887
7887
  3 + (w > 0n ? 2 : 0) + (v ? 2 : 0)
7888
7888
  ), D = T.wrap(Xn(o.provider)), $ = ur(), A = `0x095ea7b3000000000000000000000000${$.slice(2).toLowerCase()}ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`, R = await Pe(A), _ = Y.str(
7889
7889
  `{"p":"brc20-prog","op":"c","c":"${e}","b":"${R}"}`
7890
- ), M = new Kt(
7890
+ ), M = new zt(
7891
7891
  Y.str("text/plain"),
7892
7892
  null,
7893
7893
  null,
@@ -7898,14 +7898,14 @@ async function sf(e, t, n, r = !0, s, i = {}) {
7898
7898
  if (!H)
7899
7899
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
7900
7900
  T.next();
7901
- const U = await Ao({
7901
+ const U = await Lo({
7902
7902
  btc_address: d,
7903
7903
  bls_pubkey: H,
7904
7904
  token_address: e
7905
- }), y = he.address.toOutputScript(d, Jt()), S = await Lo({
7905
+ }), y = Vt.address.toOutputScript(d, Ht()), S = await Po({
7906
7906
  pubkey: H,
7907
7907
  ordinals_script: y.toString("hex")
7908
- }), O = await Po({
7908
+ }), O = await Fo({
7909
7909
  btc_address: d,
7910
7910
  bls_pubkey: H,
7911
7911
  token_address: e.toLowerCase(),
@@ -7914,7 +7914,7 @@ async function sf(e, t, n, r = !0, s, i = {}) {
7914
7914
  }), k = O.edcsa_signature, F = O.pubkey_idx, L = O.token_idx, q = await fr({
7915
7915
  pubkey: H,
7916
7916
  pk_idx: BigInt(F)
7917
- }), W = To().encodeFunctionData("deposit", [
7917
+ }), W = Ro().encodeFunctionData("deposit", [
7918
7918
  e,
7919
7919
  L,
7920
7920
  t,
@@ -7924,7 +7924,7 @@ async function sf(e, t, n, r = !0, s, i = {}) {
7924
7924
  k
7925
7925
  ]), Z = await Pe(W), ct = Y.str(
7926
7926
  `{"p":"brc20-prog","op":"c","c":"${$}","b":"${Z}"}`
7927
- ), j = new Kt(
7927
+ ), j = new zt(
7928
7928
  Y.str("text/plain"),
7929
7929
  null,
7930
7930
  null,
@@ -7932,12 +7932,12 @@ async function sf(e, t, n, r = !0, s, i = {}) {
7932
7932
  null,
7933
7933
  ct
7934
7934
  );
7935
- let G = null, ut = null, gt = null, Et = null, Q = null, rt = null, te = null, Oe = null, ee = null;
7935
+ let G = null, ut = null, gt = null, Et = null, Q = null, rt = null, ee = null, Oe = null, ne = null;
7936
7936
  if (w > 0n) {
7937
- const Ut = Fo(
7937
+ const Ut = Uo(
7938
7938
  w,
7939
7939
  h
7940
- ), ne = new Kt(
7940
+ ), re = new zt(
7941
7941
  Y.str("text/plain"),
7942
7942
  null,
7943
7943
  null,
@@ -7948,15 +7948,15 @@ async function sf(e, t, n, r = !0, s, i = {}) {
7948
7948
  )
7949
7949
  );
7950
7950
  if ((s?.length ?? 0) > 0) {
7951
- const Nn = await pi(s, d), ke = await ga(
7952
- ne,
7951
+ const Nn = await hi(s, d), ke = await ga(
7952
+ re,
7953
7953
  Nn,
7954
7954
  n,
7955
7955
  null,
7956
7956
  !0,
7957
7957
  D
7958
7958
  );
7959
- ee = {
7959
+ ne = {
7960
7960
  signed_commit_tx_hex: ke.signedCommitTxHex,
7961
7961
  signed_reveal_tx_hex: ke.signedRevealTxHex,
7962
7962
  commit_txid: ke.commitTxId,
@@ -7965,8 +7965,8 @@ async function sf(e, t, n, r = !0, s, i = {}) {
7965
7965
  secret: ke.secret
7966
7966
  };
7967
7967
  } else
7968
- ee = await hs(
7969
- ne,
7968
+ ne = await ws(
7969
+ re,
7970
7970
  n,
7971
7971
  null,
7972
7972
  null,
@@ -7974,20 +7974,20 @@ async function sf(e, t, n, r = !0, s, i = {}) {
7974
7974
  !0,
7975
7975
  D
7976
7976
  );
7977
- Q = ee.signed_commit_tx_hex, rt = ee.signed_reveal_tx_hex, gt = ee.commit_txid, Et = ee.reveal_txid, G = ee.inscription_id;
7978
- const re = `${G.split("i")[0]}:0:0`;
7979
- ut = ee.secret;
7977
+ Q = ne.signed_commit_tx_hex, rt = ne.signed_reveal_tx_hex, gt = ne.commit_txid, Et = ne.reveal_txid, G = ne.inscription_id;
7978
+ const se = `${G.split("i")[0]}:0:0`;
7979
+ ut = ne.secret;
7980
7980
  let Ve = null;
7981
7981
  try {
7982
7982
  if (!Q)
7983
7983
  throw new Error("Base deposit commit tx hex is missing");
7984
7984
  _t(
7985
7985
  [Q, rt],
7986
- [G, re]
7986
+ [G, se]
7987
7987
  );
7988
- const Nn = new xt(
7988
+ const Nn = new mt(
7989
7989
  !0,
7990
- B.from(le.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
7990
+ B.from(fe.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
7991
7991
  null,
7992
7992
  null,
7993
7993
  null
@@ -8012,7 +8012,7 @@ async function sf(e, t, n, r = !0, s, i = {}) {
8012
8012
  }
8013
8013
  if (Ve == null)
8014
8014
  throw new Error("Failed to send inscription to OP_RETURN");
8015
- te = Ve.signedTxHex, Oe = Ve.txId;
8015
+ ee = Ve.signedTxHex, Oe = Ve.txId;
8016
8016
  }
8017
8017
  let lt = null, Ft = null, dt = null, Bt = null, vt = null, $t = null, Ie = null, an = null, Te = null;
8018
8018
  if (v) {
@@ -8020,10 +8020,10 @@ async function sf(e, t, n, r = !0, s, i = {}) {
8020
8020
  w > 0n && Ut.push(
8021
8021
  Q,
8022
8022
  rt,
8023
- te
8023
+ ee
8024
8024
  );
8025
8025
  try {
8026
- _t(Ut, null), Te = await hs(
8026
+ _t(Ut, null), Te = await ws(
8027
8027
  M,
8028
8028
  n,
8029
8029
  null,
@@ -8035,20 +8035,20 @@ async function sf(e, t, n, r = !0, s, i = {}) {
8035
8035
  } finally {
8036
8036
  Dt();
8037
8037
  }
8038
- const ne = `${lt.split("i")[0]}:0:0`;
8039
- let re = null;
8038
+ const re = `${lt.split("i")[0]}:0:0`;
8039
+ let se = null;
8040
8040
  try {
8041
8041
  if (!vt)
8042
8042
  throw new Error("Allowance commit tx hex is missing");
8043
- Ut.push(vt, $t), _t(Ut, [lt, ne]);
8044
- const Ve = new xt(
8043
+ Ut.push(vt, $t), _t(Ut, [lt, re]);
8044
+ const Ve = new mt(
8045
8045
  !0,
8046
- B.from(le.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
8046
+ B.from(fe.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
8047
8047
  null,
8048
8048
  null,
8049
8049
  null
8050
8050
  );
8051
- re = await pn(
8051
+ se = await pn(
8052
8052
  lt,
8053
8053
  [],
8054
8054
  Ve,
@@ -8066,18 +8066,18 @@ async function sf(e, t, n, r = !0, s, i = {}) {
8066
8066
  } finally {
8067
8067
  Dt();
8068
8068
  }
8069
- if (re == null)
8069
+ if (se == null)
8070
8070
  throw new Error("Failed to send inscription to OP_RETURN");
8071
- Ie = re.signedTxHex, an = re.txId;
8071
+ Ie = se.signedTxHex, an = se.txId;
8072
8072
  }
8073
8073
  const wr = [], He = [];
8074
8074
  if (w > 0n) {
8075
- if (!Q || !rt || !te)
8075
+ if (!Q || !rt || !ee)
8076
8076
  throw new Error("Base deposit transaction hexes are missing");
8077
8077
  He.push(
8078
8078
  Q,
8079
8079
  rt,
8080
- te
8080
+ ee
8081
8081
  ), wr.push({
8082
8082
  utxo: `${Oe}:1`,
8083
8083
  value: _e,
@@ -8095,7 +8095,7 @@ async function sf(e, t, n, r = !0, s, i = {}) {
8095
8095
  wallet: p
8096
8096
  });
8097
8097
  }
8098
- let kn = null, Re = null, cn = "", fs = "", gr = "", yr = "";
8098
+ let kn = null, Re = null, cn = "", ds = "", gr = "", yr = "";
8099
8099
  try {
8100
8100
  He.length > 0 && _t(He, null), Re = await Mr(
8101
8101
  j,
@@ -8108,10 +8108,10 @@ async function sf(e, t, n, r = !0, s, i = {}) {
8108
8108
  D
8109
8109
  ), gr = Re.signedCommitTxHex, yr = Re.signedRevealTxHex, cn = Re.inscriptionId;
8110
8110
  const Ut = `${cn.split("i")[0]}:0:0`;
8111
- fs = Re.secret, He.push(gr, yr), _t(He, [cn, Ut]);
8112
- const ne = new xt(
8111
+ ds = Re.secret, He.push(gr, yr), _t(He, [cn, Ut]);
8112
+ const re = new mt(
8113
8113
  !0,
8114
- B.from(le.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
8114
+ B.from(fe.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
8115
8115
  null,
8116
8116
  null,
8117
8117
  null
@@ -8119,7 +8119,7 @@ async function sf(e, t, n, r = !0, s, i = {}) {
8119
8119
  kn = await pn(
8120
8120
  cn,
8121
8121
  [],
8122
- ne,
8122
+ re,
8123
8123
  1,
8124
8124
  [],
8125
8125
  n,
@@ -8138,7 +8138,7 @@ async function sf(e, t, n, r = !0, s, i = {}) {
8138
8138
  reveal_txhex: yr,
8139
8139
  send_to_opreturn_txid: la,
8140
8140
  send_to_opreturn_txhex: ua,
8141
- secret: fs,
8141
+ secret: ds,
8142
8142
  inscription_id: cn,
8143
8143
  fee_rate: n,
8144
8144
  approve_details: v ? {
@@ -8158,7 +8158,7 @@ async function sf(e, t, n, r = !0, s, i = {}) {
8158
8158
  reveal_txid: Et,
8159
8159
  reveal_txhex: rt,
8160
8160
  send_to_opreturn_txid: Oe,
8161
- send_to_opreturn_txhex: te,
8161
+ send_to_opreturn_txhex: ee,
8162
8162
  secret: ut,
8163
8163
  inscription_id: G,
8164
8164
  fee_rate: n
@@ -8169,22 +8169,22 @@ async function sf(e, t, n, r = !0, s, i = {}) {
8169
8169
  async function of(e, t, n, r = !0, s) {
8170
8170
  const i = rn();
8171
8171
  if (!i || !i.wallets) throw new Error("Wallets not found");
8172
- const o = Jt(), a = Sn();
8172
+ const o = Ht(), a = Sn();
8173
8173
  if (!a) throw new Error("Payment wallet not found");
8174
8174
  if (!a.address) throw new Error("Payment wallet address not found");
8175
- const c = a.address, u = a.pubkey, l = new xt(!1, null, c, null, u);
8175
+ const c = a.address, u = a.pubkey, l = new mt(!1, null, c, null, u);
8176
8176
  let f = 0n, d = 0, p = "";
8177
- const w = await Co(e);
8177
+ const w = await $o(e);
8178
8178
  if (w < t) {
8179
- const lt = await $o(e), Ft = lt.available_balance_in_18_dec;
8179
+ const lt = await Ao(e), Ft = lt.available_balance_in_18_dec;
8180
8180
  d = lt.decimals, p = lt.ticker, f = t - w;
8181
- const dt = Uo(s);
8181
+ const dt = qo(s);
8182
8182
  if (Ft + dt < f)
8183
8183
  throw console.error(
8184
8184
  `Insufficient BRC-2.0 + BRC20 available balance. Current BRC-2.0: ${w}, Available in base: ${Ft}, Reclaimable: ${dt}, Required: ${t}`
8185
8185
  ), new Error("Insufficient BRC-2.0 + BRC20 available balance");
8186
8186
  }
8187
- const h = await No(e);
8187
+ const h = await Co(e);
8188
8188
  let g = !1;
8189
8189
  if (h < BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")) {
8190
8190
  if (!r)
@@ -8193,7 +8193,7 @@ async function of(e, t, n, r = !0, s) {
8193
8193
  }
8194
8194
  const b = ur(), m = `0x095ea7b3000000000000000000000000${b.slice(2).toLowerCase()}ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`, v = await Pe(m), T = Y.str(
8195
8195
  `{"p":"brc20-prog","op":"c","c":"${e}","b":"${v}"}`
8196
- ), D = new Kt(
8196
+ ), D = new zt(
8197
8197
  Y.str("text/plain"),
8198
8198
  null,
8199
8199
  null,
@@ -8206,7 +8206,7 @@ async function of(e, t, n, r = !0, s) {
8206
8206
  const A = `0x${"00".repeat(64)}`, R = 1, _ = 1, M = await fr({
8207
8207
  pubkey: $,
8208
8208
  pk_idx: BigInt(R)
8209
- }), U = To().encodeFunctionData("deposit", [
8209
+ }), U = Ro().encodeFunctionData("deposit", [
8210
8210
  e,
8211
8211
  _,
8212
8212
  t,
@@ -8216,7 +8216,7 @@ async function of(e, t, n, r = !0, s) {
8216
8216
  A
8217
8217
  ]), y = await Pe(U), S = Y.str(
8218
8218
  `{"p":"brc20-prog","op":"c","c":"${b}","b":"${y}"}`
8219
- ), O = new Kt(
8219
+ ), O = new zt(
8220
8220
  Y.str("text/plain"),
8221
8221
  null,
8222
8222
  null,
@@ -8226,10 +8226,10 @@ async function of(e, t, n, r = !0, s) {
8226
8226
  ), k = await qr(c);
8227
8227
  let F = null, L = null, q = null, N = null, W = null, Z = 0;
8228
8228
  if (f > 0n) {
8229
- const lt = Fo(
8229
+ const lt = Uo(
8230
8230
  f,
8231
8231
  d
8232
- ), Ft = new Kt(
8232
+ ), Ft = new zt(
8233
8233
  Y.str("text/plain"),
8234
8234
  null,
8235
8235
  null,
@@ -8244,7 +8244,7 @@ async function of(e, t, n, r = !0, s) {
8244
8244
  const $t = Lt();
8245
8245
  if (!$t) throw new Error("Ordinals wallet not found");
8246
8246
  if (!$t.address) throw new Error("Ordinals wallet address not found");
8247
- const Ie = $t.address, an = await pi(s, Ie);
8247
+ const Ie = $t.address, an = await hi(s, Ie);
8248
8248
  dt = await wa(
8249
8249
  Ft,
8250
8250
  an,
@@ -8253,7 +8253,7 @@ async function of(e, t, n, r = !0, s) {
8253
8253
  k
8254
8254
  );
8255
8255
  } else
8256
- dt = await ps(
8256
+ dt = await hs(
8257
8257
  Ft,
8258
8258
  n,
8259
8259
  null,
@@ -8271,9 +8271,9 @@ async function of(e, t, n, r = !0, s) {
8271
8271
  [L, q],
8272
8272
  [F, Bt]
8273
8273
  );
8274
- const $t = new xt(
8274
+ const $t = new mt(
8275
8275
  !0,
8276
- B.from(le.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
8276
+ B.from(fe.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
8277
8277
  null,
8278
8278
  null,
8279
8279
  null
@@ -8309,7 +8309,7 @@ async function of(e, t, n, r = !0, s) {
8309
8309
  );
8310
8310
  try {
8311
8311
  _t(lt, null);
8312
- const Bt = await ps(
8312
+ const Bt = await hs(
8313
8313
  D,
8314
8314
  n,
8315
8315
  null,
@@ -8327,9 +8327,9 @@ async function of(e, t, n, r = !0, s) {
8327
8327
  if (!j)
8328
8328
  throw new Error("Allowance commit tx hex is missing");
8329
8329
  lt.push(j, G), _t(lt, [ct, Ft]);
8330
- const Bt = new xt(
8330
+ const Bt = new mt(
8331
8331
  !0,
8332
- B.from(le.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
8332
+ B.from(fe.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
8333
8333
  null,
8334
8334
  null,
8335
8335
  null
@@ -8380,7 +8380,7 @@ async function of(e, t, n, r = !0, s) {
8380
8380
  wallet: l
8381
8381
  });
8382
8382
  }
8383
- let te = 0, Oe = null;
8383
+ let ee = 0, Oe = null;
8384
8384
  try {
8385
8385
  rt.length > 0 && _t(rt, null);
8386
8386
  const lt = await Dr(
@@ -8392,10 +8392,10 @@ async function of(e, t, n, r = !0, s) {
8392
8392
  0,
8393
8393
  k
8394
8394
  ), Ft = lt.unsigned_commit_tx_hex, dt = lt.signed_reveal_tx_hex, Bt = lt.inscription_id, vt = `${Bt.split("i")[0]}:0:0`;
8395
- te += lt.total_fee, rt.push(Ft, dt), _t(rt, [Bt, vt]);
8396
- const $t = new xt(
8395
+ ee += lt.total_fee, rt.push(Ft, dt), _t(rt, [Bt, vt]);
8396
+ const $t = new mt(
8397
8397
  !0,
8398
- B.from(le.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
8398
+ B.from(fe.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
8399
8399
  null,
8400
8400
  null,
8401
8401
  null
@@ -8414,11 +8414,11 @@ async function of(e, t, n, r = !0, s) {
8414
8414
  }
8415
8415
  if (Oe == null)
8416
8416
  throw new Error("Failed to send inscription to OP_RETURN");
8417
- return te += Oe.tx_fee, {
8417
+ return ee += Oe.tx_fee, {
8418
8418
  needs_approval: g,
8419
8419
  base_deposit_fees_total: Z,
8420
8420
  allowance_fees_total: Et,
8421
- deposit_fees_total: te,
8421
+ deposit_fees_total: ee,
8422
8422
  fee_rate: n
8423
8423
  };
8424
8424
  }
@@ -8443,7 +8443,7 @@ async function cf(e) {
8443
8443
  });
8444
8444
  }
8445
8445
  async function uf(e, t, n = {}) {
8446
- const r = await Qt(), s = rn();
8446
+ const r = await te(), s = rn();
8447
8447
  if (!s || !s.wallets) throw new Error("Wallets not found");
8448
8448
  const i = new cr(n), o = i.wrap(Xn(s.provider)), a = Sn(), c = Lt();
8449
8449
  if (!a) throw new Error("Payment wallet not found");
@@ -8454,14 +8454,14 @@ async function uf(e, t, n = {}) {
8454
8454
  if (!f)
8455
8455
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8456
8456
  i.next();
8457
- const d = await Ao({
8457
+ const d = await Lo({
8458
8458
  btc_address: u,
8459
8459
  bls_pubkey: f,
8460
8460
  token_address: r.wbtc_address
8461
- }), p = he.address.toOutputScript(u, Jt()), w = await Lo({
8461
+ }), p = Vt.address.toOutputScript(u, Ht()), w = await Po({
8462
8462
  pubkey: f,
8463
8463
  ordinals_script: p.toString("hex")
8464
- }), h = await Po({
8464
+ }), h = await Fo({
8465
8465
  btc_address: u,
8466
8466
  bls_pubkey: f,
8467
8467
  token_address: r.wbtc_address.toLowerCase(),
@@ -8470,7 +8470,7 @@ async function uf(e, t, n = {}) {
8470
8470
  }), g = h.edcsa_signature, b = h.pubkey_idx, m = h.token_idx, v = await fr({
8471
8471
  pubkey: f,
8472
8472
  pk_idx: BigInt(b)
8473
- }), T = pe.defaultAbiCoder().encode(
8473
+ }), T = he.defaultAbiCoder().encode(
8474
8474
  ["address", "uint32", "bytes", "uint64", "bytes", "bytes"],
8475
8475
  [
8476
8476
  r.wbtc_address,
@@ -8480,7 +8480,7 @@ async function uf(e, t, n = {}) {
8480
8480
  B.from(v.slice(2), "hex"),
8481
8481
  B.from(g.slice(2), "hex")
8482
8482
  ]
8483
- ), $ = `0x5608f857${pe.defaultAbiCoder().encode(
8483
+ ), $ = `0x5608f857${he.defaultAbiCoder().encode(
8484
8484
  ["address", "bytes"],
8485
8485
  [l, B.from(T.slice(2), "hex")]
8486
8486
  ).slice(2)}`, A = await Pe($), R = Y.str(
@@ -8488,9 +8488,9 @@ async function uf(e, t, n = {}) {
8488
8488
  );
8489
8489
  let _ = 0;
8490
8490
  for (let M = 0; M < 5; M++) {
8491
- const H = R.length * ui, U = _ > H ? Math.ceil((_ - H) / ui) : 0, y = Y.from(
8491
+ const H = R.length * li, U = _ > H ? Math.ceil((_ - H) / li) : 0, y = Y.from(
8492
8492
  B.concat([R, Y.str(" ".repeat(U))])
8493
- ), S = new Kt(
8493
+ ), S = new zt(
8494
8494
  Y.str("text/plain"),
8495
8495
  null,
8496
8496
  null,
@@ -8513,16 +8513,16 @@ async function uf(e, t, n = {}) {
8513
8513
  [k, F],
8514
8514
  [L, q]
8515
8515
  );
8516
- const Et = new xt(
8516
+ const Et = new mt(
8517
8517
  !0,
8518
- B.from(le.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
8518
+ B.from(fe.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
8519
8519
  null,
8520
8520
  null,
8521
8521
  null
8522
8522
  ), Q = [
8523
8523
  // send BTC to WBTC handler
8524
8524
  {
8525
- wallet: new xt(!1, null, r.wbtc_handler_address, null, null),
8525
+ wallet: new mt(!1, null, r.wbtc_handler_address, null, null),
8526
8526
  value: Number.parseInt(e.toString())
8527
8527
  }
8528
8528
  ];
@@ -8564,7 +8564,7 @@ async function uf(e, t, n = {}) {
8564
8564
  throw new Error("Failed to estimate gas for wrap order after multiple attempts");
8565
8565
  }
8566
8566
  async function lf(e, t) {
8567
- const n = await Qt(), r = rn();
8567
+ const n = await te(), r = rn();
8568
8568
  if (!r || !r.wallets) throw new Error("Wallets not found");
8569
8569
  const s = Sn();
8570
8570
  if (!s) throw new Error("Payment wallet not found");
@@ -8575,7 +8575,7 @@ async function lf(e, t) {
8575
8575
  const a = `0x${"00".repeat(64)}`, c = 1, u = 1, l = await fr({
8576
8576
  pubkey: o,
8577
8577
  pk_idx: BigInt(c)
8578
- }), f = pe.defaultAbiCoder().encode(
8578
+ }), f = he.defaultAbiCoder().encode(
8579
8579
  ["address", "uint32", "bytes", "uint64", "bytes", "bytes"],
8580
8580
  [
8581
8581
  n.wbtc_address,
@@ -8585,12 +8585,12 @@ async function lf(e, t) {
8585
8585
  B.from(l.slice(2), "hex"),
8586
8586
  B.from(a.slice(2), "hex")
8587
8587
  ]
8588
- ), p = `0x5608f857${pe.defaultAbiCoder().encode(
8588
+ ), p = `0x5608f857${he.defaultAbiCoder().encode(
8589
8589
  ["address", "bytes"],
8590
8590
  [i, B.from(f.slice(2), "hex")]
8591
8591
  ).slice(2)}`, w = await Pe(p), h = Y.str(
8592
8592
  `{"p":"brc20-prog","op":"c","c":"${n.wbtc_address}","b":"${w}"}`
8593
- ), g = new Kt(
8593
+ ), g = new zt(
8594
8594
  Y.str("text/plain"),
8595
8595
  null,
8596
8596
  null,
@@ -8615,16 +8615,16 @@ async function lf(e, t) {
8615
8615
  [T, D],
8616
8616
  [$, A]
8617
8617
  );
8618
- const M = new xt(
8618
+ const M = new mt(
8619
8619
  !0,
8620
- B.from(le.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
8620
+ B.from(fe.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
8621
8621
  null,
8622
8622
  null,
8623
8623
  null
8624
8624
  ), H = [
8625
8625
  // send BTC to WBTC handler
8626
8626
  {
8627
- wallet: new xt(!1, null, n.wbtc_handler_address, null, null),
8627
+ wallet: new mt(!1, null, n.wbtc_handler_address, null, null),
8628
8628
  value: Number.parseInt(e.toString())
8629
8629
  }
8630
8630
  ];
@@ -8648,7 +8648,7 @@ async function lf(e, t) {
8648
8648
  };
8649
8649
  }
8650
8650
  async function ff(e, t, n, r) {
8651
- const s = await Qt();
8651
+ const s = await te();
8652
8652
  or(s.wbtc_address, s.factory_address);
8653
8653
  const i = (await et())?.swapPubkey;
8654
8654
  if (!i)
@@ -8765,7 +8765,7 @@ async function wf(e, t, n, r, s) {
8765
8765
  });
8766
8766
  }
8767
8767
  async function gf(e, t, n) {
8768
- const r = await Qt();
8768
+ const r = await te();
8769
8769
  or(r.wbtc_address, r.factory_address);
8770
8770
  const s = (await et())?.swapPubkey;
8771
8771
  if (!s)
@@ -8877,15 +8877,15 @@ async function xf(e, t, n, r, s, i) {
8877
8877
  });
8878
8878
  }
8879
8879
  async function dr(e, t) {
8880
- const n = await Qt();
8880
+ const n = await te();
8881
8881
  if (n.fee_policy === null) {
8882
8882
  const r = Lr.get(Fe());
8883
- throw new Error(r ?? xo);
8883
+ throw new Error(r ?? _o);
8884
8884
  }
8885
8885
  return sl(e, t, n.fee_policy);
8886
8886
  }
8887
8887
  async function _f(e, t, n) {
8888
- const r = await Qt();
8888
+ const r = await te();
8889
8889
  await lr(e, t);
8890
8890
  const s = (await et())?.swapPubkey;
8891
8891
  if (!s)
@@ -8915,7 +8915,7 @@ async function _f(e, t, n) {
8915
8915
  throw new Error("No data returned from swap request.");
8916
8916
  if (u.amounts.length < 2)
8917
8917
  throw new Error("Invalid amounts returned from swap request.");
8918
- const l = await xn(e), f = await xn(t), d = Eo(
8918
+ const l = await xn(e), f = await xn(t), d = Bo(
8919
8919
  e,
8920
8920
  r.wbtc_address,
8921
8921
  n,
@@ -8929,7 +8929,7 @@ async function _f(e, t, n) {
8929
8929
  price_impact_bps: u.price_impact_bps,
8930
8930
  reserve_in: u.reserve_in,
8931
8931
  reserve_out: u.reserve_out,
8932
- fees: So(n, u.amounts[1], a, c, o)
8932
+ fees: Eo(n, u.amounts[1], a, c, o)
8933
8933
  };
8934
8934
  }
8935
8935
  async function Sf(e) {
@@ -8951,7 +8951,7 @@ By signing this message, you authorize the creation of a swap order with the abo
8951
8951
  async function Ef(e) {
8952
8952
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey, e.referrer_pubkey = e.referrer_pubkey?.startsWith("0x") ? e.referrer_pubkey.slice(2) : e.referrer_pubkey;
8953
8953
  let t = tt(B.from(e.pubkey, "hex")).slice(2);
8954
- t += e.nonce.toString(16).padStart(8, "0"), t += "03", t += e.token1_addr.slice(2).padStart(64, "0"), t += e.token2_addr.slice(2).padStart(64, "0"), t += e.in_amt.toString(16).padStart(64, "0"), t += e.min_out_amt.toString(16).padStart(64, "0"), t += e.token1FeeBps.toString(16).padStart(64, "0"), t += e.token2FeeBps.toString(16).padStart(64, "0"), t += e.btc_fee.toString(16).padStart(64, "0"), e.referrer_pubkey && (t += tt(B.from(e.referrer_pubkey, "hex")).slice(2), t += Io.toString(16).padStart(8, "0"), e.ref_return_bps && e.ref_return_bps > 0n && (t += e.ref_return_bps.toString(16).padStart(8, "0")));
8954
+ t += e.nonce.toString(16).padStart(8, "0"), t += "03", t += e.token1_addr.slice(2).padStart(64, "0"), t += e.token2_addr.slice(2).padStart(64, "0"), t += e.in_amt.toString(16).padStart(64, "0"), t += e.min_out_amt.toString(16).padStart(64, "0"), t += e.token1FeeBps.toString(16).padStart(64, "0"), t += e.token2FeeBps.toString(16).padStart(64, "0"), t += e.btc_fee.toString(16).padStart(64, "0"), e.referrer_pubkey && (t += tt(B.from(e.referrer_pubkey, "hex")).slice(2), t += To.toString(16).padStart(8, "0"), e.ref_return_bps && e.ref_return_bps > 0n && (t += e.ref_return_bps.toString(16).padStart(8, "0")));
8955
8955
  const n = B.from(t, "hex"), r = I.G1.hashToCurve(n, {
8956
8956
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
8957
8957
  }), s = await et();
@@ -9014,7 +9014,7 @@ async function vf(e, t, n, r, s, i) {
9014
9014
  });
9015
9015
  }
9016
9016
  async function Of(e, t, n) {
9017
- const r = await Qt();
9017
+ const r = await te();
9018
9018
  await lr(e, t);
9019
9019
  const s = (await et())?.swapPubkey;
9020
9020
  if (!s)
@@ -9044,7 +9044,7 @@ async function Of(e, t, n) {
9044
9044
  throw new Error("No data returned from swap request.");
9045
9045
  if (u.amounts.length < 2)
9046
9046
  throw new Error("Invalid data returned from swap request.");
9047
- const l = await xn(e), f = await xn(t), d = Eo(
9047
+ const l = await xn(e), f = await xn(t), d = Bo(
9048
9048
  e,
9049
9049
  r.wbtc_address,
9050
9050
  u.amounts[0],
@@ -9058,7 +9058,7 @@ async function Of(e, t, n) {
9058
9058
  price_impact_bps: u.price_impact_bps,
9059
9059
  reserve_in: u.reserve_in,
9060
9060
  reserve_out: u.reserve_out,
9061
- fees: So(u.amounts[0], n, a, c, o)
9061
+ fees: Eo(u.amounts[0], n, a, c, o)
9062
9062
  };
9063
9063
  }
9064
9064
  async function If(e) {
@@ -9080,7 +9080,7 @@ By signing this message, you authorize the creation of a swap order with the abo
9080
9080
  async function Tf(e) {
9081
9081
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey, e.referrer_pubkey = e.referrer_pubkey?.startsWith("0x") ? e.referrer_pubkey.slice(2) : e.referrer_pubkey;
9082
9082
  let t = tt(B.from(e.pubkey, "hex")).slice(2);
9083
- t += e.nonce.toString(16).padStart(8, "0"), t += "04", t += e.token1_addr.slice(2).padStart(64, "0"), t += e.token2_addr.slice(2).padStart(64, "0"), t += e.max_in_amt.toString(16).padStart(64, "0"), t += e.out_amt.toString(16).padStart(64, "0"), t += e.token1FeeBps.toString(16).padStart(64, "0"), t += e.token2FeeBps.toString(16).padStart(64, "0"), t += e.btc_fee.toString(16).padStart(64, "0"), e.referrer_pubkey && (t += tt(B.from(e.referrer_pubkey, "hex")).slice(2), t += Io.toString(16).padStart(8, "0"), e.ref_return_bps && e.ref_return_bps > 0n && (t += e.ref_return_bps.toString(16).padStart(8, "0")));
9083
+ t += e.nonce.toString(16).padStart(8, "0"), t += "04", t += e.token1_addr.slice(2).padStart(64, "0"), t += e.token2_addr.slice(2).padStart(64, "0"), t += e.max_in_amt.toString(16).padStart(64, "0"), t += e.out_amt.toString(16).padStart(64, "0"), t += e.token1FeeBps.toString(16).padStart(64, "0"), t += e.token2FeeBps.toString(16).padStart(64, "0"), t += e.btc_fee.toString(16).padStart(64, "0"), e.referrer_pubkey && (t += tt(B.from(e.referrer_pubkey, "hex")).slice(2), t += To.toString(16).padStart(8, "0"), e.ref_return_bps && e.ref_return_bps > 0n && (t += e.ref_return_bps.toString(16).padStart(8, "0")));
9084
9084
  const n = B.from(t, "hex"), r = I.G1.hashToCurve(n, {
9085
9085
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
9086
9086
  }), s = await et();
@@ -9142,11 +9142,11 @@ async function kf(e, t, n, r, s, i) {
9142
9142
  referrer_id: d ? i : void 0
9143
9143
  });
9144
9144
  }
9145
- function qo(e) {
9146
- const t = Jt();
9147
- return `0x${tt(he.address.toOutputScript(e, t)).slice(26)}`;
9145
+ function Do(e) {
9146
+ const t = Ht();
9147
+ return `0x${tt(Vt.address.toOutputScript(e, t)).slice(26)}`;
9148
9148
  }
9149
- async function Do(e) {
9149
+ async function Mo(e) {
9150
9150
  e.token_address = e.token_address.toLowerCase(), e.target_addr = e.target_addr.toLowerCase();
9151
9151
  const t = `Withdraw Order:
9152
9152
  Token Address: ${e.token_address}
@@ -9159,7 +9159,7 @@ BTC Fee: ${e.btc_fee}
9159
9159
  By signing this message, you authorize the creation of a withdraw order with the above parameters.`;
9160
9160
  return await De(t, "ordinals");
9161
9161
  }
9162
- async function Mo(e) {
9162
+ async function Wo(e) {
9163
9163
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
9164
9164
  let t = tt(B.from(e.pubkey, "hex")).slice(2);
9165
9165
  t += e.nonce.toString(16).padStart(8, "0"), t += "05", t += e.token_addr.slice(2).padStart(40, "0"), t += e.target_addr.slice(2).padStart(40, "0"), t += e.amt.toString(16).padStart(64, "0"), t += e.btc_fee.toString(16).padStart(64, "0");
@@ -9171,7 +9171,7 @@ async function Mo(e) {
9171
9171
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), a = I.shortSignatures.sign(r, o);
9172
9172
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
9173
9173
  }
9174
- async function Wo(e) {
9174
+ async function Go(e) {
9175
9175
  const t = await X("withdraw");
9176
9176
  return z(t, {
9177
9177
  method: "POST",
@@ -9185,14 +9185,14 @@ async function Nf(e, t, n) {
9185
9185
  const r = (await et())?.swapPubkey;
9186
9186
  if (!r)
9187
9187
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
9188
- const i = qo(t), o = 0n, a = 0n, c = await Ge(), u = await Pt("withdraw"), l = await Do({
9188
+ const i = Do(t), o = 0n, a = 0n, c = await Ge(), u = await Pt("withdraw"), l = await Mo({
9189
9189
  token_address: e,
9190
9190
  target_addr: i,
9191
9191
  amt: n.toString(),
9192
9192
  token1FeeBps: o.toString(),
9193
9193
  token2FeeBps: a.toString(),
9194
9194
  btc_fee: u.toString()
9195
- }), f = await Mo({
9195
+ }), f = await Wo({
9196
9196
  pubkey: r,
9197
9197
  nonce: c,
9198
9198
  token_addr: e,
@@ -9200,7 +9200,7 @@ async function Nf(e, t, n) {
9200
9200
  amt: n,
9201
9201
  btc_fee: u
9202
9202
  });
9203
- return await Wo({
9203
+ return await Go({
9204
9204
  pubkey: r,
9205
9205
  token_addr: e,
9206
9206
  target_addr: i,
@@ -9219,14 +9219,14 @@ async function Cf(e, t) {
9219
9219
  const r = Lt();
9220
9220
  if (!r || !r.address)
9221
9221
  throw new Error("Ordinals wallet not found. Please set up your ordinals wallet first.");
9222
- const s = r.address, i = qo(s), o = 0n, a = 0n, c = await Ge(), u = await Pt("withdraw"), l = await Do({
9222
+ const s = r.address, i = Do(s), o = 0n, a = 0n, c = await Ge(), u = await Pt("withdraw"), l = await Mo({
9223
9223
  token_address: e,
9224
9224
  target_addr: i,
9225
9225
  amt: t.toString(),
9226
9226
  token1FeeBps: o.toString(),
9227
9227
  token2FeeBps: a.toString(),
9228
9228
  btc_fee: u.toString()
9229
- }), f = await Mo({
9229
+ }), f = await Wo({
9230
9230
  pubkey: n,
9231
9231
  nonce: c,
9232
9232
  token_addr: e,
@@ -9234,7 +9234,7 @@ async function Cf(e, t) {
9234
9234
  amt: t,
9235
9235
  btc_fee: u
9236
9236
  });
9237
- return await Wo({
9237
+ return await Go({
9238
9238
  pubkey: n,
9239
9239
  token_addr: e,
9240
9240
  target_addr: i,
@@ -9247,7 +9247,7 @@ async function Cf(e, t) {
9247
9247
  });
9248
9248
  }
9249
9249
  async function $f(e, t) {
9250
- const n = await Qt();
9250
+ const n = await te();
9251
9251
  or(n.wbtc_address, n.factory_address);
9252
9252
  const r = (await et())?.swapPubkey;
9253
9253
  if (!r)
@@ -9411,10 +9411,10 @@ async function Yf(e, t, n) {
9411
9411
  async function Kf(e, t, n) {
9412
9412
  return n ? (await Nf(e, n, t)).success : (await Cf(e, t)).success;
9413
9413
  }
9414
- const $d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9414
+ const Ld = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9415
9415
  __proto__: null,
9416
9416
  addLiquidity: Mf,
9417
- createSwapWallet: ko,
9417
+ createSwapWallet: No,
9418
9418
  deposit: Zf,
9419
9419
  ensureSwapWallet: Dl,
9420
9420
  getActivityOfPair: qf,
@@ -9432,7 +9432,7 @@ const $d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9432
9432
  getSwapBalances: Hl,
9433
9433
  getSwapExactInputResult: _f,
9434
9434
  getSwapExactOutputResult: Of,
9435
- getSwapInfo: Qt,
9435
+ getSwapInfo: te,
9436
9436
  getSwapStatus: Wl,
9437
9437
  getSwapWalletSecurityCode: Ml,
9438
9438
  getTokenDecimals: xn,
@@ -9443,7 +9443,7 @@ const $d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9443
9443
  listPairs: Kl,
9444
9444
  listTokens: Yl,
9445
9445
  removeLiquidity: Wf,
9446
- satsToBtc: _o,
9446
+ satsToBtc: So,
9447
9447
  satsToUsd: al,
9448
9448
  swapExactInput: Gf,
9449
9449
  swapExactOutput: Hf,
@@ -9452,7 +9452,7 @@ const $d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9452
9452
  unwrapBtc: Vf,
9453
9453
  withdraw: Kf,
9454
9454
  wrapBtc: Yf
9455
- }, Symbol.toStringTag, { value: "Module" })), Xf = "text/plain", Go = /^[a-z0-9-]{6}$/i, zf = /^(?:[0-9a-f]{2})+$/i;
9455
+ }, Symbol.toStringTag, { value: "Module" })), Xf = "text/plain", Ho = /^[a-z0-9-]{6}$/i, zf = /^(?:[0-9a-f]{2})+$/i;
9456
9456
  function ss(e) {
9457
9457
  if (typeof e != "string" || e.length === 0)
9458
9458
  throw new Error("tick must be a non-empty string");
@@ -9467,7 +9467,7 @@ function Yn(e, t) {
9467
9467
  throw new Error(`${t} must be a non-empty string`);
9468
9468
  }
9469
9469
  function _n(e) {
9470
- return new Kt(
9470
+ return new zt(
9471
9471
  Y.str(Xf),
9472
9472
  null,
9473
9473
  null,
@@ -9476,7 +9476,7 @@ function _n(e) {
9476
9476
  Y.str(JSON.stringify(e))
9477
9477
  );
9478
9478
  }
9479
- function Ho(e, t, n) {
9479
+ function Vo(e, t, n) {
9480
9480
  Yn(e.max, "max"), e.lim != null && Yn(e.lim, "lim");
9481
9481
  const r = t === 5 || n != null;
9482
9482
  if (r && e.selfMint === !1)
@@ -9492,7 +9492,7 @@ function Jf(e) {
9492
9492
  throw new Error("6-byte tickers require a predeploy; use predeployInscriptions()");
9493
9493
  if (t !== 4 && t !== 5)
9494
9494
  throw new Error(`deploy ticker must be 4 or 5 bytes, got ${t}`);
9495
- return _n(Ho(e, t, null));
9495
+ return _n(Vo(e, t, null));
9496
9496
  }
9497
9497
  function jf(e) {
9498
9498
  const t = ss(e.tick);
@@ -9504,7 +9504,7 @@ function is(e) {
9504
9504
  if (t < 4 || t > 6) throw new Error(`ticker must be 4-6 bytes, got ${t}`);
9505
9505
  return Yn(e.amt, "amt"), _n({ p: "brc-20", op: "transfer", tick: e.tick, amt: e.amt });
9506
9506
  }
9507
- function Vo(e = 16) {
9507
+ function Zo(e = 16) {
9508
9508
  if (!Number.isInteger(e) || e <= 0)
9509
9509
  throw new Error("byteLength must be a positive integer");
9510
9510
  return Y.random(e).hex;
@@ -9512,10 +9512,10 @@ function Vo(e = 16) {
9512
9512
  function Qf(e) {
9513
9513
  if (typeof e != "string" || e.length === 0)
9514
9514
  throw new Error("address must be a non-empty string");
9515
- return he.address.toOutputScript(e, Jt()).toString("hex");
9515
+ return Vt.address.toOutputScript(e, Ht()).toString("hex");
9516
9516
  }
9517
- function Zo(e, t, n) {
9518
- if (typeof e != "string" || !Go.test(e))
9517
+ function Yo(e, t, n) {
9518
+ if (typeof e != "string" || !Ho.test(e))
9519
9519
  throw new Error("6-byte ticker must match /^[A-Za-z0-9-]{6}$/");
9520
9520
  Pr(t, "salt"), Pr(n, "pkscript");
9521
9521
  const r = B.concat([
@@ -9523,14 +9523,14 @@ function Zo(e, t, n) {
9523
9523
  B.from(t, "hex"),
9524
9524
  B.from(n, "hex")
9525
9525
  ]);
9526
- return he.crypto.hash256(r).toString("hex");
9526
+ return Vt.crypto.hash256(r).toString("hex");
9527
9527
  }
9528
9528
  function td(e) {
9529
- if (typeof e.tick != "string" || !Go.test(e.tick))
9529
+ if (typeof e.tick != "string" || !Ho.test(e.tick))
9530
9530
  throw new Error("6-byte ticker must match /^[A-Za-z0-9-]{6}$/");
9531
- const t = Qf(e.address), n = e.salt ?? Vo();
9531
+ const t = Qf(e.address), n = e.salt ?? Zo();
9532
9532
  Pr(n, "salt");
9533
- const r = Zo(e.tick, n, t), s = Ho(
9533
+ const r = Yo(e.tick, n, t), s = Vo(
9534
9534
  { tick: e.tick, max: e.max, lim: e.lim, dec: e.dec },
9535
9535
  6,
9536
9536
  n
@@ -9554,27 +9554,27 @@ const Rr = 12e3, ed = 1e5, os = 1e3, nd = /^\d+(?:\.\d{1,18})?$/, rd = [
9554
9554
  outputs: [{ name: "", type: "bool" }]
9555
9555
  }
9556
9556
  ];
9557
- function Yo(e, t) {
9557
+ function Ko(e, t) {
9558
9558
  if (e.maxSendInputs == null) return;
9559
- const n = he.Transaction.fromHex(t).ins.length;
9559
+ const n = Vt.Transaction.fromHex(t).ins.length;
9560
9560
  if (n > e.maxSendInputs)
9561
9561
  throw new Error(
9562
9562
  `${e.name} send spends ${n} inputs, more than the ${e.maxSendInputs} its gas covers; consolidate the wallet's UTXOs first`
9563
9563
  );
9564
9564
  }
9565
9565
  function Kn() {
9566
- return new xt(
9566
+ return new mt(
9567
9567
  !0,
9568
- B.from(le.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
9568
+ B.from(fe.encode(["OP_RETURN", Y.str("BRC20PROG")], !1)),
9569
9569
  null,
9570
9570
  null,
9571
9571
  null
9572
9572
  );
9573
9573
  }
9574
- function Ko(e) {
9575
- return new Kt(Y.str("text/plain"), null, null, null, null, e);
9576
- }
9577
9574
  function Xo(e) {
9575
+ return new zt(Y.str("text/plain"), null, null, null, null, e);
9576
+ }
9577
+ function zo(e) {
9578
9578
  return e.isOpReturn ? 1 : ba(e);
9579
9579
  }
9580
9580
  async function as(e, t, n) {
@@ -9585,9 +9585,9 @@ async function as(e, t, n) {
9585
9585
  const s = Math.ceil((n - r.length * Rr) / Rr);
9586
9586
  r = r.append("20".repeat(s));
9587
9587
  }
9588
- return Ko(r);
9588
+ return Xo(r);
9589
9589
  }
9590
- function zo(e, t, n) {
9590
+ function Jo(e, t, n) {
9591
9591
  const r = [...e.extraOutputs ?? []], s = 1 + r.length;
9592
9592
  return t || r.push({ wallet: n, value: os }), { outputs: r, linkVout: s };
9593
9593
  }
@@ -9597,11 +9597,19 @@ function Fr(e, t) {
9597
9597
  const [n, r = ""] = e.split(".");
9598
9598
  return BigInt(n) * 10n ** 18n + BigInt(r.padEnd(18, "0"));
9599
9599
  }
9600
+ function sd(e) {
9601
+ const t = e / 10n ** 18n, n = (e % 10n ** 18n).toString().padStart(18, "0").replace(/0+$/, "");
9602
+ return n ? `${t}.${n}` : `${t}`;
9603
+ }
9604
+ function id(e, t) {
9605
+ const n = Ht();
9606
+ return Vt.address.toOutputScript(e, n).equals(Vt.address.toOutputScript(t, n));
9607
+ }
9600
9608
  function cs(e) {
9601
9609
  if (typeof e != "string" || e.length === 0)
9602
9610
  throw new Error("recipient must be a Bitcoin address");
9603
9611
  try {
9604
- he.address.toOutputScript(e, Jt());
9612
+ Vt.address.toOutputScript(e, Ht());
9605
9613
  } catch {
9606
9614
  throw new Error(`recipient is not a valid address on the current network: ${e}`);
9607
9615
  }
@@ -9610,7 +9618,7 @@ function pr(e) {
9610
9618
  if (typeof e != "number" || !Number.isFinite(e) || e <= 0)
9611
9619
  throw new Error("feeRate must be a positive number");
9612
9620
  }
9613
- function Jo() {
9621
+ function us() {
9614
9622
  const e = rn();
9615
9623
  if (!e || !e.wallets) throw new Error("Wallets not found");
9616
9624
  const t = Sn(), n = Lt();
@@ -9618,13 +9626,14 @@ function Jo() {
9618
9626
  if (!n?.address) throw new Error("Ordinals wallet not found");
9619
9627
  return {
9620
9628
  provider: e.provider,
9621
- payerWallet: new xt(!1, null, t.address, null, t.pubkey)
9629
+ payerWallet: new mt(!1, null, t.address, null, t.pubkey),
9630
+ ordinalsAddress: n.address
9622
9631
  };
9623
9632
  }
9624
- async function sd(e, t, n) {
9625
- const { provider: r, payerWallet: s } = Jo(), o = new cr(n, e.length * 2).wrap(Xn(r)), a = Qe(
9633
+ async function od(e, t, n) {
9634
+ const { provider: r, payerWallet: s } = us(), o = new cr(n, e.length * 2).wrap(Xn(r)), a = Qe(
9626
9635
  s.outputScript,
9627
- Jt()
9636
+ Ht()
9628
9637
  ), c = {}, u = [];
9629
9638
  let l = null;
9630
9639
  try {
@@ -9649,17 +9658,17 @@ async function sd(e, t, n) {
9649
9658
  o
9650
9659
  );
9651
9660
  u.push(h.signedCommitTxHex, h.signedRevealTxHex), _t(u, [h.inscriptionId, `${h.revealTxId}:0:0`]);
9652
- const { outputs: g, linkVout: b } = zo(d, p, s), m = await pn(
9661
+ const { outputs: g, linkVout: b } = Jo(d, p, s), m = await pn(
9653
9662
  h.inscriptionId,
9654
9663
  [],
9655
9664
  d.target,
9656
- Xo(d.target),
9665
+ zo(d.target),
9657
9666
  g,
9658
9667
  t,
9659
9668
  !0,
9660
9669
  o
9661
9670
  );
9662
- Yo(d, m.signedTxHex), u.push(m.signedTxHex), l = { utxo: `${m.txId}:${b}` }, c[d.name] = {
9671
+ Ko(d, m.signedTxHex), u.push(m.signedTxHex), l = { utxo: `${m.txId}:${b}` }, c[d.name] = {
9663
9672
  commitTxId: h.commitTxId,
9664
9673
  revealTxId: h.revealTxId,
9665
9674
  sendTxId: m.txId,
@@ -9671,10 +9680,10 @@ async function sd(e, t, n) {
9671
9680
  }
9672
9681
  return { parts: c, txHexes: u };
9673
9682
  }
9674
- async function id(e, t) {
9675
- const { payerWallet: n } = Jo(), r = Qe(
9683
+ async function ad(e, t) {
9684
+ const { payerWallet: n } = us(), r = Qe(
9676
9685
  n.outputScript,
9677
- Jt()
9686
+ Ht()
9678
9687
  ), s = await qr(n.addr), i = [], o = [];
9679
9688
  let a = null;
9680
9689
  try {
@@ -9700,7 +9709,7 @@ async function id(e, t) {
9700
9709
  o.push(h.unsigned_commit_tx_hex, h.signed_reveal_tx_hex);
9701
9710
  const g = h.inscription_id.split("i")[0];
9702
9711
  _t(o, [h.inscription_id, `${g}:0:0`]);
9703
- const b = Xo(d.target), { outputs: m, linkVout: v } = zo(d, p, n), T = await dn(
9712
+ const b = zo(d.target), { outputs: m, linkVout: v } = Jo(d, p, n), T = await dn(
9704
9713
  h.inscription_id,
9705
9714
  [],
9706
9715
  d.target,
@@ -9709,7 +9718,7 @@ async function id(e, t) {
9709
9718
  t,
9710
9719
  s
9711
9720
  );
9712
- Yo(d, T.unsigned_tx_hex), o.push(T.unsigned_tx_hex), a = { utxo: `${T.txid}:${v}` }, i.push({
9721
+ Ko(d, T.unsigned_tx_hex), o.push(T.unsigned_tx_hex), a = { utxo: `${T.txid}:${v}` }, i.push({
9713
9722
  step: d.name,
9714
9723
  minerFeeSats: h.total_fee + T.tx_fee,
9715
9724
  postageSats: b,
@@ -9731,44 +9740,46 @@ async function id(e, t) {
9731
9740
  steps: i
9732
9741
  };
9733
9742
  }
9734
- async function us(e, t, n, r) {
9735
- if (n) return await id(e, t);
9736
- const { parts: s, txHexes: i } = await sd(e, t, r);
9743
+ async function ls(e, t, n, r) {
9744
+ if (n) return await ad(e, t);
9745
+ const { parts: s, txHexes: i } = await od(e, t, r);
9737
9746
  if (await ya(i) == null) throw new Error("Broadcast request failed");
9738
9747
  return {
9739
9748
  parts: s,
9740
- txIds: i.map((a) => he.Transaction.fromHex(a).getId())
9749
+ txIds: i.map((a) => Vt.Transaction.fromHex(a).getId())
9741
9750
  };
9742
9751
  }
9743
- async function od(e) {
9752
+ async function cd(e) {
9744
9753
  const { tick: t, fromBrc20Amount: n, fromProgAmount: r, recipient: s, feeRate: i, dryRun: o } = e;
9745
9754
  if (typeof o != "boolean") throw new Error("dryRun must be a boolean");
9746
9755
  pr(i), cs(s);
9747
9756
  const a = Fr(n, "fromBrc20Amount"), c = Fr(r, "fromProgAmount");
9748
9757
  if (a === 0n && c === 0n)
9749
9758
  throw new Error("fromBrc20Amount and fromProgAmount cannot both be 0");
9750
- const u = new xt(!1, null, s, null, null), l = [];
9751
- a > 0n && l.push({
9752
- name: "brc20Transfer",
9753
- inscription: is({ tick: t, amt: n }),
9754
- target: u
9755
- }), c > 0n && l.push({
9759
+ const { ordinalsAddress: u } = us(), l = id(s, u), f = new mt(!1, null, s, null, null), d = [];
9760
+ c > 0n && d.push({
9756
9761
  name: "progWithdraw",
9757
- inscription: Ko(
9762
+ inscription: Xo(
9758
9763
  Y.str(
9759
9764
  `{"p":"brc20-module","op":"withdraw","tick":"${t}","amt":"${r}","module":"BRC20PROG"}`
9760
9765
  )
9761
9766
  ),
9762
- target: u
9767
+ target: l ? f : new mt(!1, null, u, null, null)
9763
9768
  });
9764
- const f = await us(l, i, o, e);
9765
- return "parts" in f ? {
9766
- brc20Transfer: f.parts.brc20Transfer ?? null,
9767
- progWithdraw: f.parts.progWithdraw ?? null,
9768
- txIds: f.txIds
9769
- } : f;
9770
- }
9771
- async function ad(e) {
9769
+ const p = l ? a : a + c;
9770
+ p > 0n && d.push({
9771
+ name: "brc20Transfer",
9772
+ inscription: is({ tick: t, amt: sd(p) }),
9773
+ target: f
9774
+ });
9775
+ const w = await ls(d, i, o, e);
9776
+ return "parts" in w ? {
9777
+ brc20Transfer: w.parts.brc20Transfer ?? null,
9778
+ progWithdraw: w.parts.progWithdraw ?? null,
9779
+ txIds: w.txIds
9780
+ } : w;
9781
+ }
9782
+ async function ud(e) {
9772
9783
  const { tick: t, contractAddress: n, topUpFromBrc20: r, amount: s, recipient: i, feeRate: o, dryRun: a } = e;
9773
9784
  if (typeof a != "boolean") throw new Error("dryRun must be a boolean");
9774
9785
  if (pr(o), cs(i), typeof n != "string" || !/^0x[0-9a-fA-F]{40}$/.test(n))
@@ -9792,17 +9803,17 @@ async function ad(e) {
9792
9803
  inscription: await as(n, l, ed),
9793
9804
  target: Kn()
9794
9805
  });
9795
- const f = await us(u, o, a, e);
9806
+ const f = await ls(u, o, a, e);
9796
9807
  return "parts" in f ? {
9797
9808
  progDeposit: f.parts.progDeposit ?? null,
9798
9809
  progTransfer: f.parts.progTransfer,
9799
9810
  txIds: f.txIds
9800
9811
  } : f;
9801
9812
  }
9802
- const cd = {
9813
+ const ld = {
9803
9814
  mainnet: "0xdbb5b6a1d422fca2813cf486e5f986adb09d8337",
9804
9815
  signet: "0x1eb63d0d0e5a86146b4e1cebc79b1d6e35093288"
9805
- }, jo = 546, ud = 1, ld = 4e5, ls = 8, Qo = ld * (1 + ls) + 4e5, hr = [
9816
+ }, jo = 546, fd = 1, dd = 4e5, fs = 8, Qo = dd * (1 + fs) + 4e5, hr = [
9806
9817
  {
9807
9818
  name: "wrap",
9808
9819
  type: "function",
@@ -9837,7 +9848,7 @@ const cd = {
9837
9848
  }
9838
9849
  ];
9839
9850
  function Rn() {
9840
- const e = cd[Fe()];
9851
+ const e = ld[Fe()];
9841
9852
  if (!e) throw new Error(`frBTC is not deployed on ${Fe()}`);
9842
9853
  return e;
9843
9854
  }
@@ -9866,10 +9877,10 @@ function sa() {
9866
9877
  return e;
9867
9878
  }
9868
9879
  async function ia(e, t, n, r) {
9869
- const s = await us([e], t, n, r);
9880
+ const s = await ls([e], t, n, r);
9870
9881
  return "parts" in s ? { call: s.parts[e.name], txIds: s.txIds } : s;
9871
9882
  }
9872
- async function fd(e) {
9883
+ async function pd(e) {
9873
9884
  const { amount: t, feeRate: n, dryRun: r } = e;
9874
9885
  ra(r), pr(n), na(t, BigInt(jo)), sa();
9875
9886
  const s = await ta(), i = zn(hr, "wrap", []);
@@ -9879,24 +9890,24 @@ async function fd(e) {
9879
9890
  inscription: await as(Rn(), i, Qo),
9880
9891
  target: Kn(),
9881
9892
  extraOutputs: [
9882
- { wallet: new xt(!1, s, null, null, null), value: Number(t) }
9893
+ { wallet: new mt(!1, s, null, null, null), value: Number(t) }
9883
9894
  ],
9884
- maxSendInputs: ls
9895
+ maxSendInputs: fs
9885
9896
  },
9886
9897
  n,
9887
9898
  r,
9888
9899
  e
9889
9900
  );
9890
9901
  }
9891
- async function dd(e) {
9902
+ async function hd(e) {
9892
9903
  const { amount: t, recipient: n, feeRate: r, dryRun: s } = e;
9893
9904
  ra(s), pr(r), na(t, 1n), cs(n);
9894
9905
  const i = await ea(sa());
9895
9906
  if (i < t)
9896
9907
  throw new Error(`Insufficient BRC2.0 frBTC balance: ${i} sats, need ${t}`);
9897
- const o = he.address.toOutputScript(n, Jt()), a = await ta(), c = zn(hr, "unwrap2", [
9908
+ const o = Vt.address.toOutputScript(n, Ht()), a = await ta(), c = zn(hr, "unwrap2", [
9898
9909
  t.toString(),
9899
- ud,
9910
+ fd,
9900
9911
  `0x${o.toString("hex")}`
9901
9912
  ]);
9902
9913
  return await ia(
@@ -9906,28 +9917,28 @@ async function dd(e) {
9906
9917
  target: Kn(),
9907
9918
  extraOutputs: [
9908
9919
  {
9909
- wallet: new xt(!1, a, null, null, null),
9920
+ wallet: new mt(!1, a, null, null, null),
9910
9921
  value: jo
9911
9922
  }
9912
9923
  ],
9913
- maxSendInputs: ls
9924
+ maxSendInputs: fs
9914
9925
  },
9915
9926
  r,
9916
9927
  s,
9917
9928
  e
9918
9929
  );
9919
9930
  }
9920
- async function pd(e) {
9921
- return await od(e);
9922
- }
9923
- async function hd(e) {
9924
- return await ad(e);
9925
- }
9926
9931
  async function wd(e) {
9927
- return await fd(e);
9932
+ return await cd(e);
9928
9933
  }
9929
9934
  async function gd(e) {
9930
- return await dd(e);
9935
+ return await ud(e);
9936
+ }
9937
+ async function yd(e) {
9938
+ return await pd(e);
9939
+ }
9940
+ async function bd(e) {
9941
+ return await hd(e);
9931
9942
  }
9932
9943
  async function oa(e, t, n, r, s, i, o, a, c) {
9933
9944
  if (!c || c === "ordinals")
@@ -9956,7 +9967,7 @@ async function oa(e, t, n, r, s, i, o, a, c) {
9956
9967
  );
9957
9968
  throw new Error(`Unsupported wallet type: ${c}`);
9958
9969
  }
9959
- async function yd(e, t, n, r, s, i, o, a, c, u, l) {
9970
+ async function md(e, t, n, r, s, i, o, a, c, u, l) {
9960
9971
  if (typeof t != "object") throw new Error("abi must be an object");
9961
9972
  if (typeof n != "string") throw new Error("func_name must be a string");
9962
9973
  if (!Array.isArray(r)) throw new Error("params must be an array");
@@ -9973,7 +9984,7 @@ async function yd(e, t, n, r, s, i, o, a, c, u, l) {
9973
9984
  f
9974
9985
  );
9975
9986
  }
9976
- async function bd(e, t, n, r, s, i) {
9987
+ async function xd(e, t, n, r, s, i) {
9977
9988
  return await _a(
9978
9989
  e,
9979
9990
  t,
@@ -9984,7 +9995,7 @@ async function bd(e, t, n, r, s, i) {
9984
9995
  s
9985
9996
  );
9986
9997
  }
9987
- async function md(e, t, n, r, s, i, o) {
9998
+ async function _d(e, t, n, r, s, i, o) {
9988
9999
  return await Sa(
9989
10000
  e,
9990
10001
  t,
@@ -9996,26 +10007,26 @@ async function md(e, t, n, r, s, i, o) {
9996
10007
  i
9997
10008
  );
9998
10009
  }
9999
- const Ad = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10010
+ const Pd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10000
10011
  __proto__: null,
10001
10012
  callSmartContract: oa,
10002
- callSmartContractAbi: yd,
10003
- computeBrc20PredeployHash: Zo,
10013
+ callSmartContractAbi: md,
10014
+ computeBrc20PredeployHash: Yo,
10004
10015
  deployBrc20Inscription: Jf,
10005
- depositToBrc20Prog: bd,
10006
- generateBrc20Salt: Vo,
10016
+ depositToBrc20Prog: xd,
10017
+ generateBrc20Salt: Zo,
10007
10018
  getFrBtcAddress: Rn,
10008
10019
  mintBrc20Inscription: jf,
10009
10020
  predeployInscriptions: td,
10010
- sendAsBrc20: pd,
10011
- sendAsBrc20Prog: hd,
10021
+ sendAsBrc20: wd,
10022
+ sendAsBrc20Prog: gd,
10012
10023
  transferBrc20Inscription: is,
10013
- unwrapBtcFromBrc20Prog: gd,
10014
- withdrawFromBrc20Prog: md,
10015
- wrapBtcToBrc20Prog: wd
10024
+ unwrapBtcFromBrc20Prog: bd,
10025
+ withdrawFromBrc20Prog: _d,
10026
+ wrapBtcToBrc20Prog: yd
10016
10027
  }, Symbol.toStringTag, { value: "Module" }));
10017
- async function xd(e, t, n, r, s) {
10018
- const i = await hi(
10028
+ async function Sd(e, t, n, r, s) {
10029
+ const i = await wi(
10019
10030
  [e],
10020
10031
  t,
10021
10032
  n,
@@ -10032,10 +10043,10 @@ async function xd(e, t, n, r, s) {
10032
10043
  secret: i.secret
10033
10044
  };
10034
10045
  }
10035
- async function _d(e, t, n, r, s) {
10036
- return await hi(e, t, n, r, s);
10046
+ async function Ed(e, t, n, r, s) {
10047
+ return await wi(e, t, n, r, s);
10037
10048
  }
10038
- async function Sd(e, t, n, r, s, i) {
10049
+ async function Bd(e, t, n, r, s, i) {
10039
10050
  return await Ea(
10040
10051
  e,
10041
10052
  t,
@@ -10045,19 +10056,19 @@ async function Sd(e, t, n, r, s, i) {
10045
10056
  i
10046
10057
  );
10047
10058
  }
10048
- async function Ed(e, t, n, r) {
10049
- return await wi([e], t, n, r);
10059
+ async function vd(e, t, n, r) {
10060
+ return await gi([e], t, n, r);
10050
10061
  }
10051
- async function Bd(e, t, n, r) {
10052
- return await wi(e, t, n, r);
10062
+ async function Od(e, t, n, r) {
10063
+ return await gi(e, t, n, r);
10053
10064
  }
10054
- const Ld = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10065
+ const Fd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10055
10066
  __proto__: null,
10056
- getInscribeFee: Ed,
10057
- getInscribeMultipleFee: Bd,
10058
- inscribe: xd,
10059
- inscribeMultiple: _d,
10060
- inscribeWithParent: Sd
10067
+ getInscribeFee: vd,
10068
+ getInscribeMultipleFee: Od,
10069
+ inscribe: Sd,
10070
+ inscribeMultiple: Ed,
10071
+ inscribeWithParent: Bd
10061
10072
  }, Symbol.toStringTag, { value: "Module" })), aa = [
10062
10073
  { inputs: [], stateMutability: "nonpayable", type: "constructor" },
10063
10074
  {
@@ -10216,7 +10227,7 @@ const Ld = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10216
10227
  type: "function"
10217
10228
  }
10218
10229
  ], ca = "0xc54dd4581af2dbf18e4d90840226756e9d2b3cdb";
10219
- async function vd(e, t) {
10230
+ async function Id(e, t) {
10220
10231
  const n = await X("check_base_brc20_balance"), r = {
10221
10232
  ordinal_address: e,
10222
10233
  token_address: t.toLowerCase()
@@ -10234,7 +10245,7 @@ async function vd(e, t) {
10234
10245
  ticker: s.result.ticker
10235
10246
  };
10236
10247
  }
10237
- async function Od(e, t) {
10248
+ async function Td(e, t) {
10238
10249
  const n = await X("check_brc20_balance"), s = await z(n, {
10239
10250
  method: "POST",
10240
10251
  headers: {
@@ -10247,7 +10258,7 @@ async function Od(e, t) {
10247
10258
  });
10248
10259
  return BigInt(s.result);
10249
10260
  }
10250
- async function Id(e, t) {
10261
+ async function Rd(e, t) {
10251
10262
  const n = B.from(t, "utf-8"), r = await Jn(
10252
10263
  ca,
10253
10264
  aa,
@@ -10256,10 +10267,10 @@ async function Id(e, t) {
10256
10267
  );
10257
10268
  return BigInt(r);
10258
10269
  }
10259
- async function Td(e) {
10270
+ async function kd(e) {
10260
10271
  return await ea(e);
10261
10272
  }
10262
- async function Rd(e) {
10273
+ async function Nd(e) {
10263
10274
  const t = B.from(e, "utf-8");
10264
10275
  return `0x${(await Jn(
10265
10276
  ca,
@@ -10268,18 +10279,18 @@ async function Rd(e) {
10268
10279
  [t]
10269
10280
  )).slice(-40)}`;
10270
10281
  }
10271
- const Pd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10282
+ const Ud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10272
10283
  __proto__: null,
10273
- getBRC20ProgBalanceOfAddress: Od,
10274
- getBRC20ProgBalanceOfTicker: Id,
10275
- getBRC20ProgTokenAddressOfTicker: Rd,
10276
- getBaseBRC20BalanceOfAddress: vd,
10277
- getFrBtcBalanceOfAddress: Td
10284
+ getBRC20ProgBalanceOfAddress: Td,
10285
+ getBRC20ProgBalanceOfTicker: Rd,
10286
+ getBRC20ProgTokenAddressOfTicker: Nd,
10287
+ getBaseBRC20BalanceOfAddress: Id,
10288
+ getFrBtcBalanceOfAddress: kd
10278
10289
  }, Symbol.toStringTag, { value: "Module" }));
10279
10290
  export {
10280
- $d as a,
10281
- Ad as b,
10282
- Pd as c,
10283
- Ld as m,
10284
- Cd as s
10291
+ Ld as a,
10292
+ Pd as b,
10293
+ Ud as c,
10294
+ Fd as m,
10295
+ Ad as s
10285
10296
  };