@bestinslot/wallet-kit 0.13.2 → 0.13.4

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,4 +1,4 @@
1
- import { h as yn, U as Ir, V as Do, X as Mo, Y as Wo, G as S, e as Wt, l as zr, Z as Ys, _ as Rr, O as Ke, f as Vn, H as Ut, $ as Xe, a0 as K, a1 as ce, a2 as zs, a3 as Ks, a4 as Go, a5 as Kr, a6 as Ft, a7 as me, a8 as Cn, a9 as Yt, aa as An, ab as Xs, d as tn, D as bn, ac as Ho, ad as Xr, ae as $n, af as Js, k as Pe, ag as Vo, ah as Zo, ai as Yo, aj as zo, ak as Ko, al as js, am as Xo, an as Qs, ao as ti, ap as ei, aq as ni, p as Jo } from "./mint-C_wN10-d.js";
1
+ import { h as yn, U as Ir, V as Do, X as Mo, Y as Wo, G as S, e as Wt, l as zr, Z as Ys, _ as Rr, O as Ke, f as Zn, H as Ut, $ as Xe, a0 as K, a1 as ce, a2 as zs, a3 as Ks, a4 as Go, a5 as Kr, a6 as Ft, a7 as me, a8 as $n, a9 as Yt, aa as Pn, ab as Xs, d as tn, D as bn, ac as Ho, ad as Xr, ae as Ln, af as Js, k as Pe, ag as Vo, ah as Zo, ai as Yo, aj as zo, ak as Ko, al as js, am as Xo, an as Qs, ao as ti, ap as ei, aq as ni, p as Jo } from "./mint-C_wN10-d.js";
2
2
  async function Df(e, t, n, r, s, i) {
3
3
  const o = yn();
4
4
  if (!o)
@@ -50,7 +50,7 @@ function kr(e) {
50
50
  throw new Error("Hash must wrapped by utils.createHasher");
51
51
  Je(e.outputLen), Je(e.blockLen);
52
52
  }
53
- function Pn(e, t = !0) {
53
+ function Fn(e, t = !0) {
54
54
  if (e.destroyed)
55
55
  throw new Error("Hash instance has been destroyed");
56
56
  if (t && e.finished)
@@ -66,7 +66,7 @@ function un(...e) {
66
66
  for (let t = 0; t < e.length; t++)
67
67
  e[t].fill(0);
68
68
  }
69
- function ur(e) {
69
+ function lr(e) {
70
70
  return new DataView(e.buffer, e.byteOffset, e.byteLength);
71
71
  }
72
72
  function Ht(e, t) {
@@ -90,7 +90,7 @@ function Jr(e) {
90
90
  if (e >= ne.a && e <= ne.f)
91
91
  return e - (ne.a - 10);
92
92
  }
93
- function Fn(e) {
93
+ function Un(e) {
94
94
  if (typeof e != "string")
95
95
  throw new Error("hex string expected, got " + typeof e);
96
96
  if (si)
@@ -135,7 +135,7 @@ function ii(e = 32) {
135
135
  const ea = (e) => ({
136
136
  oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, e])
137
137
  });
138
- const Nr = /* @__PURE__ */ BigInt(0), Un = /* @__PURE__ */ BigInt(1);
138
+ const Nr = /* @__PURE__ */ BigInt(0), qn = /* @__PURE__ */ BigInt(1);
139
139
  function jr(e, t = "") {
140
140
  if (typeof e != "boolean") {
141
141
  const n = t && `"${t}" `;
@@ -170,7 +170,7 @@ function ai(e) {
170
170
  }
171
171
  function mt(e, t) {
172
172
  Je(t), e = na(e);
173
- const n = Fn(e.toString(16).padStart(t * 2, "0"));
173
+ const n = Un(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;
@@ -181,7 +181,7 @@ function ci(e, t) {
181
181
  function ui(e) {
182
182
  return Uint8Array.from(e);
183
183
  }
184
- function Zn(e) {
184
+ function Yn(e) {
185
185
  return Uint8Array.from(e, (t, n) => {
186
186
  const r = t.charCodeAt(0);
187
187
  if (t.length !== 1 || r > 127)
@@ -190,16 +190,16 @@ function Zn(e) {
190
190
  });
191
191
  }
192
192
  const ra = (e) => typeof e == "bigint" && Nr <= e;
193
- function qn(e) {
193
+ function Dn(e) {
194
194
  let t;
195
- for (t = 0; e > Nr; e >>= Un, t += 1)
195
+ for (t = 0; e > Nr; e >>= qn, t += 1)
196
196
  ;
197
197
  return t;
198
198
  }
199
199
  function sa(e, t) {
200
- return e >> BigInt(t) & Un;
200
+ return e >> BigInt(t) & qn;
201
201
  }
202
- const mn = (e) => (Un << BigInt(e)) - Un;
202
+ const mn = (e) => (qn << BigInt(e)) - qn;
203
203
  function Cr(e, t = {}, n = {}) {
204
204
  if (!e || typeof e != "object")
205
205
  throw new Error("expected valid options object");
@@ -276,7 +276,7 @@ function gi(e) {
276
276
  t /= ke, n++;
277
277
  let r = ke;
278
278
  const s = xn(e);
279
- for (; Dn(s, r) === 1; )
279
+ for (; Mn(s, r) === 1; )
280
280
  if (r++ > 1e3)
281
281
  throw new Error("Cannot find square root: probably non-prime P");
282
282
  if (n === 1)
@@ -286,7 +286,7 @@ function gi(e) {
286
286
  return function(c, u) {
287
287
  if (c.is0(u))
288
288
  return u;
289
- if (Dn(c, u) !== 1)
289
+ if (Mn(c, u) !== 1)
290
290
  throw new Error("Cannot find square root");
291
291
  let l = n, f = c.mul(c.ONE, i), d = c.pow(u, t), p = c.pow(u, o);
292
292
  for (; !c.eql(d, c.ONE); ) {
@@ -332,7 +332,7 @@ function yi(e) {
332
332
  }, n = la.reduce((r, s) => (r[s] = "function", r), t);
333
333
  return Cr(e, n), e;
334
334
  }
335
- function Yn(e, t, n) {
335
+ function zn(e, t, n) {
336
336
  if (n < Ct)
337
337
  throw new Error("invalid exponent, negatives unsupported");
338
338
  if (n === Ct)
@@ -348,7 +348,7 @@ function Fe(e, t, n = !1) {
348
348
  const r = new Array(t.length).fill(n ? e.ZERO : void 0), s = t.reduce((o, a, c) => e.is0(a) ? o : (r[c] = o, e.mul(o, a)), e.ONE), i = e.inv(s);
349
349
  return t.reduceRight((o, a, c) => e.is0(a) ? o : (r[c] = e.mul(o, r[c]), e.mul(o, a)), i), r;
350
350
  }
351
- function Dn(e, t) {
351
+ function Mn(e, t) {
352
352
  const n = (e.ORDER - Tt) / ke, r = e.pow(t, n), s = e.eql(r, e.ONE), i = e.eql(r, e.ZERO), o = e.eql(r, e.neg(e.ONE));
353
353
  if (!s && !i && !o)
354
354
  throw new Error("invalid Legendre symbol result");
@@ -417,7 +417,7 @@ class da {
417
417
  return Pt(t * n, this.ORDER);
418
418
  }
419
419
  pow(t, n) {
420
- return Yn(this, t, n);
420
+ return zn(this, t, n);
421
421
  }
422
422
  div(t, n) {
423
423
  return Pt(t * Qr(n, this.ORDER), this.ORDER);
@@ -510,15 +510,15 @@ class wa {
510
510
  pos = 0;
511
511
  destroyed = !1;
512
512
  constructor(t, n, r, s) {
513
- this.blockLen = t, this.outputLen = n, this.padOffset = r, this.isLE = s, this.buffer = new Uint8Array(t), this.view = ur(this.buffer);
513
+ this.blockLen = t, this.outputLen = n, this.padOffset = r, this.isLE = s, this.buffer = new Uint8Array(t), this.view = lr(this.buffer);
514
514
  }
515
515
  update(t) {
516
- Pn(this), ft(t);
516
+ Fn(this), ft(t);
517
517
  const { view: n, buffer: r, blockLen: s } = this, i = t.length;
518
518
  for (let o = 0; o < i; ) {
519
519
  const a = Math.min(s - this.pos, i - o);
520
520
  if (a === s) {
521
- const c = ur(t);
521
+ const c = lr(t);
522
522
  for (; s <= i - o; o += s)
523
523
  this.process(c, o);
524
524
  continue;
@@ -528,14 +528,14 @@ class wa {
528
528
  return this.length += t.length, this.roundClean(), this;
529
529
  }
530
530
  digestInto(t) {
531
- Pn(this), jo(t, this), this.finished = !0;
531
+ Fn(this), jo(t, this), this.finished = !0;
532
532
  const { buffer: n, view: r, blockLen: s, isLE: i } = this;
533
533
  let { pos: o } = this;
534
534
  n[o++] = 128, un(this.buffer.subarray(o)), this.padOffset > s - o && (this.process(r, 0), o = 0);
535
535
  for (let f = o; f < s; f++)
536
536
  n[f] = 0;
537
537
  r.setBigUint64(s - 8, BigInt(this.length * 8), i), this.process(r, 0);
538
- const a = ur(t), c = this.outputLen;
538
+ const a = lr(t), c = this.outputLen;
539
539
  if (c % 4)
540
540
  throw new Error("_sha2: outputLen must be aligned to 32bit");
541
541
  const u = c / 4, l = this.get();
@@ -687,11 +687,11 @@ const _i = /* @__PURE__ */ ta(
687
687
  /* @__PURE__ */ ea(1)
688
688
  );
689
689
  const Qe = /* @__PURE__ */ BigInt(0), Ne = /* @__PURE__ */ BigInt(1);
690
- function Mn(e, t) {
690
+ function Wn(e, t) {
691
691
  const n = t.negate();
692
692
  return e ? n : t;
693
693
  }
694
- function Wn(e, t) {
694
+ function Gn(e, t) {
695
695
  const n = Fe(e.Fp, t.map((r) => r.Z));
696
696
  return t.map((r, s) => e.fromAffine(r.toAffine(n[s])));
697
697
  }
@@ -699,7 +699,7 @@ function Ei(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
- function lr(e, t) {
702
+ function fr(e, t) {
703
703
  Ei(e, t);
704
704
  const n = Math.ceil(t / e) + 1, r = 2 ** (e - 1), s = 2 ** e, i = mn(e), o = BigInt(e);
705
705
  return { windows: n, windowSize: r, mask: i, maxNumber: s, shiftBy: o };
@@ -711,8 +711,8 @@ function ts(e, t, n) {
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 fr = /* @__PURE__ */ new WeakMap(), Si = /* @__PURE__ */ new WeakMap();
715
- function dr(e) {
714
+ const dr = /* @__PURE__ */ new WeakMap(), Si = /* @__PURE__ */ new WeakMap();
715
+ function pr(e) {
716
716
  return Si.get(e) || 1;
717
717
  }
718
718
  function es(e) {
@@ -748,7 +748,7 @@ class ma {
748
748
  * @returns precomputed point tables flattened to a single array
749
749
  */
750
750
  precomputeWindow(t, n) {
751
- const { windows: r, windowSize: s } = lr(n, this.bits), i = [];
751
+ const { windows: r, windowSize: s } = fr(n, this.bits), i = [];
752
752
  let o = t, a = o;
753
753
  for (let c = 0; c < r; c++) {
754
754
  a = o, i.push(a);
@@ -768,10 +768,10 @@ class ma {
768
768
  if (!this.Fn.isValid(r))
769
769
  throw new Error("invalid scalar");
770
770
  let s = this.ZERO, i = this.BASE;
771
- const o = lr(t, this.bits);
771
+ const o = fr(t, this.bits);
772
772
  for (let a = 0; a < o.windows; a++) {
773
773
  const { nextN: c, offset: u, isZero: l, isNeg: f, isNegF: d, offsetF: p } = ts(r, a, o);
774
- r = c, l ? i = i.add(Mn(d, n[p])) : s = s.add(Mn(f, n[u]));
774
+ r = c, l ? i = i.add(Wn(d, n[p])) : s = s.add(Wn(f, n[u]));
775
775
  }
776
776
  return es(r), { p: s, f: i };
777
777
  }
@@ -781,7 +781,7 @@ class ma {
781
781
  * @returns point
782
782
  */
783
783
  wNAFUnsafe(t, n, r, s = this.ZERO) {
784
- const i = lr(t, this.bits);
784
+ const i = fr(t, this.bits);
785
785
  for (let o = 0; o < i.windows && r !== Qe; o++) {
786
786
  const { nextN: a, offset: c, isZero: u, isNeg: l } = ts(r, o, i);
787
787
  if (r = a, !u) {
@@ -792,25 +792,25 @@ class ma {
792
792
  return es(r), s;
793
793
  }
794
794
  getPrecomputes(t, n, r) {
795
- let s = fr.get(n);
796
- return s || (s = this.precomputeWindow(n, t), t !== 1 && (typeof r == "function" && (s = r(s)), fr.set(n, s))), s;
795
+ let s = dr.get(n);
796
+ return s || (s = this.precomputeWindow(n, t), t !== 1 && (typeof r == "function" && (s = r(s)), dr.set(n, s))), s;
797
797
  }
798
798
  cached(t, n, r) {
799
- const s = dr(t);
799
+ const s = pr(t);
800
800
  return this.wNAF(s, this.getPrecomputes(s, t, r), n);
801
801
  }
802
802
  unsafe(t, n, r, s) {
803
- const i = dr(t);
803
+ const i = pr(t);
804
804
  return i === 1 ? this._unsafeLadder(t, n, s) : this.wNAFUnsafe(i, this.getPrecomputes(i, t, r), n, s);
805
805
  }
806
806
  // We calculate precomputes for elliptic curve point multiplication
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
- Ei(n, this.bits), Si.set(t, n), fr.delete(t);
810
+ Ei(n, this.bits), Si.set(t, n), dr.delete(t);
811
811
  }
812
812
  hasCache(t) {
813
- return dr(t) !== 1;
813
+ return pr(t) !== 1;
814
814
  }
815
815
  }
816
816
  function xa(e, t, n, r) {
@@ -859,10 +859,10 @@ function Sa(e, t) {
859
859
  function Bi(e) {
860
860
  if (!ri(e) && typeof e != "string")
861
861
  throw new Error("DST must be Uint8Array or ascii string");
862
- return typeof e == "string" ? Zn(e) : e;
862
+ return typeof e == "string" ? Yn(e) : e;
863
863
  }
864
864
  function Ba(e, t, n, r) {
865
- ft(e), je(n), t = Bi(t), t.length > 255 && (t = r(ht(Zn("H2C-OVERSIZE-DST-"), t)));
865
+ ft(e), je(n), t = Bi(t), t.length > 255 && (t = r(ht(Yn("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");
@@ -877,13 +877,13 @@ function Ba(e, t, n, r) {
877
877
  function va(e, t, n, r, s) {
878
878
  if (ft(e), je(n), t = Bi(t), t.length > 255) {
879
879
  const i = Math.ceil(2 * r / 8);
880
- t = s.create({ dkLen: i }).update(Zn("H2C-OVERSIZE-DST-")).update(t).digest();
880
+ t = s.create({ dkLen: i }).update(Yn("H2C-OVERSIZE-DST-")).update(t).digest();
881
881
  }
882
882
  if (n > 65535 || t.length > 255)
883
883
  throw new Error("expand_message_xof: invalid lenInBytes");
884
884
  return s.create({ dkLen: n }).update(e).update(we(n, 2)).update(t).update(we(t.length, 1)).digest();
885
885
  }
886
- function pr(e, t, n) {
886
+ function hr(e, t, n) {
887
887
  Cr(n, {
888
888
  p: "bigint",
889
889
  m: "number",
@@ -920,7 +920,7 @@ function vi(e, t) {
920
920
  return r = e.mul(i, u), s = e.mul(s, e.mul(a, l)), { x: r, y: s };
921
921
  };
922
922
  }
923
- const Oa = Zn("HashToScalar-");
923
+ const Oa = Yn("HashToScalar-");
924
924
  function rs(e, t, n) {
925
925
  if (typeof t != "function")
926
926
  throw new Error("mapToCurve() must be defined");
@@ -935,11 +935,11 @@ function rs(e, t, n) {
935
935
  defaults: Object.freeze(n),
936
936
  Point: e,
937
937
  hashToCurve(i, o) {
938
- const a = Object.assign({}, n, o), c = pr(i, 2, a), u = r(c[0]), l = r(c[1]);
938
+ const a = Object.assign({}, n, o), c = hr(i, 2, a), u = r(c[0]), l = r(c[1]);
939
939
  return s(u.add(l));
940
940
  },
941
941
  encodeToCurve(i, o) {
942
- const a = n.encodeDST ? { DST: n.encodeDST } : {}, c = Object.assign({}, n, a, o), u = pr(i, 1, c), l = r(u[0]);
942
+ const a = n.encodeDST ? { DST: n.encodeDST } : {}, c = Object.assign({}, n, a, o), u = hr(i, 1, c), l = r(u[0]);
943
943
  return s(l);
944
944
  },
945
945
  /** See {@link H2CHasher} */
@@ -960,7 +960,7 @@ function rs(e, t, n) {
960
960
  // RFC 9380, draft-irtf-cfrg-bbs-signatures-08
961
961
  hashToScalar(i, o) {
962
962
  const a = e.Fn.ORDER, c = Object.assign({}, n, { p: a, m: 1, DST: Oa }, o);
963
- return pr(i, 1, c)[0][0];
963
+ return hr(i, 1, c)[0][0];
964
964
  }
965
965
  };
966
966
  }
@@ -985,10 +985,10 @@ class Oi {
985
985
  this.oHash.update(s), un(s);
986
986
  }
987
987
  update(t) {
988
- return Pn(this), this.iHash.update(t), this;
988
+ return Fn(this), this.iHash.update(t), this;
989
989
  }
990
990
  digestInto(t) {
991
- Pn(this), ft(t, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(t), this.oHash.update(t), this.oHash.digestInto(t), this.destroy();
991
+ Fn(this), ft(t, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(t), this.oHash.update(t), this.oHash.digestInto(t), this.destroy();
992
992
  }
993
993
  digest() {
994
994
  const t = new Uint8Array(this.oHash.outputLen);
@@ -1014,7 +1014,7 @@ function Ta(e, t, n) {
1014
1014
  let u = e - a * r - c * i, l = -a * s - c * o;
1015
1015
  const f = u < Ce, d = l < Ce;
1016
1016
  f && (u = -u), d && (l = -l);
1017
- const p = mn(Math.ceil(qn(n) / 2)) + It;
1017
+ const p = mn(Math.ceil(Dn(n) / 2)) + It;
1018
1018
  if (u < Ce || u >= p || l < Ce || l >= p)
1019
1019
  throw new Error("splitScalar (endomorphism): failed, k=" + e);
1020
1020
  return { k1neg: f, k1: u, k2neg: d, k2: l };
@@ -1131,7 +1131,7 @@ function Ti(e, t = {}) {
1131
1131
  return !0;
1132
1132
  });
1133
1133
  function I(U, y, _, B, R) {
1134
- return _ = new x(r.mul(_.X, U), _.Y, _.Z), y = Mn(B, y), _ = Mn(R, _), y.add(_);
1134
+ return _ = new x(r.mul(_.X, U), _.Y, _.Z), y = Wn(B, y), _ = Wn(R, _), y.add(_);
1135
1135
  }
1136
1136
  class x {
1137
1137
  // base / generator point
@@ -1167,7 +1167,7 @@ function Ti(e, t = {}) {
1167
1167
  return _.assertValidity(), _;
1168
1168
  }
1169
1169
  static fromHex(y) {
1170
- return x.fromBytes(Fn(y));
1170
+ return x.fromBytes(Un(y));
1171
1171
  }
1172
1172
  get x() {
1173
1173
  return this.toAffine().x;
@@ -1248,7 +1248,7 @@ function Ti(e, t = {}) {
1248
1248
  if (!s.isValidNot0(y))
1249
1249
  throw new Error("invalid scalar: out of range");
1250
1250
  let B, R;
1251
- const P = ($) => H.cached(this, $, (q) => Wn(x, q));
1251
+ const P = ($) => H.cached(this, $, (q) => Gn(x, q));
1252
1252
  if (_) {
1253
1253
  const { k1neg: $, k1: q, k2neg: k, k2: W } = M(y), { p: Z, f: ct } = P(q), { p: j, f: G } = P(W);
1254
1254
  R = ct.add(G), B = I(_.beta, Z, j, $, k);
@@ -1256,7 +1256,7 @@ function Ti(e, t = {}) {
1256
1256
  const { p: $, f: q } = P(y);
1257
1257
  B = $, R = q;
1258
1258
  }
1259
- return Wn(x, [B, R])[0];
1259
+ return Gn(x, [B, R])[0];
1260
1260
  }
1261
1261
  /**
1262
1262
  * Non-constant-time multiplication. Uses double-and-add algorithm.
@@ -1391,7 +1391,7 @@ function Ca(e) {
1391
1391
  (e & Tn) === Na ? t.unshift(0) : (e & Ve) === Ve ? (t.unshift(-1), e += Tn) : t.unshift(1);
1392
1392
  return t;
1393
1393
  }
1394
- function hr(e) {
1394
+ function wr(e) {
1395
1395
  if (!Array.isArray(e) || e.length === 0)
1396
1396
  throw new Error("expected non-empty array");
1397
1397
  }
@@ -1444,7 +1444,7 @@ function $a(e, t, n, r) {
1444
1444
  }
1445
1445
  function b(A, C = !0) {
1446
1446
  const I = [];
1447
- Wn(t, A.map(({ g1: x }) => x)), Wn(n, A.map(({ g2: x }) => x));
1447
+ Gn(t, A.map(({ g1: x }) => x)), Gn(n, A.map(({ g2: x }) => x));
1448
1448
  for (const { g1: x, g2: D } of A) {
1449
1449
  if (x.is0() || D.is0())
1450
1450
  throw new Error("pairing is not available for ZERO point");
@@ -1534,7 +1534,7 @@ function os(e, t, n, r, s, i) {
1534
1534
  // e(G, S) = e(G, SUM(n)(Si)) = MUL(n)(e(G, Si))
1535
1535
  // TODO: maybe `{message: G2Hex, publicKey: G1Hex}[]` instead?
1536
1536
  verifyBatch(h, g) {
1537
- hr(g);
1537
+ wr(g);
1538
1538
  const b = d(h), v = g.map((C) => C.message), O = g.map((C) => f(C.publicKey)), F = /* @__PURE__ */ new Map();
1539
1539
  for (let C = 0; C < O.length; C++) {
1540
1540
  const I = O[C], x = v[C];
@@ -1555,14 +1555,14 @@ function os(e, t, n, r, s, i) {
1555
1555
  // Adds a bunch of public key points together.
1556
1556
  // pk1 + pk2 + pk3 = pkA
1557
1557
  aggregatePublicKeys(h) {
1558
- hr(h), h = h.map((b) => f(b));
1558
+ wr(h), h = h.map((b) => f(b));
1559
1559
  const g = h.reduce((b, v) => b.add(v), t.ZERO);
1560
1560
  return g.assertValidity(), g;
1561
1561
  },
1562
1562
  // Adds a bunch of signature points together.
1563
1563
  // pk1 + pk2 + pk3 = pkA
1564
1564
  aggregateSignatures(h) {
1565
- hr(h), h = h.map((b) => d(b));
1565
+ wr(h), h = h.map((b) => d(b));
1566
1566
  const g = h.reduce((b, v) => b.add(v), n.ZERO);
1567
1567
  return g.assertValidity(), g;
1568
1568
  },
@@ -1664,7 +1664,7 @@ class Ua {
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 = qn(s), this.BYTES = Math.ceil(qn(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, Bt), this.NONRESIDUE = us(t, n.FP2_NONRESIDUE), this.FROBENIUS_COEFFICIENTS = Ar(t, this.Fp_NONRESIDUE, t.ORDER, 2)[0], this.mulByB = n.Fp2mulByB, Object.seal(this);
1667
+ this.Fp = t, this.ORDER = s, this.BITS = Dn(s), this.BYTES = Math.ceil(Dn(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, Bt), this.NONRESIDUE = us(t, n.FP2_NONRESIDUE), this.FROBENIUS_COEFFICIENTS = Ar(t, this.Fp_NONRESIDUE, t.ORDER, 2)[0], this.mulByB = n.Fp2mulByB, Object.seal(this);
1668
1668
  }
1669
1669
  fromBigTuple(t) {
1670
1670
  return us(this.Fp, t);
@@ -1691,7 +1691,7 @@ class Ua {
1691
1691
  return { c0: this.Fp.neg(t), c1: this.Fp.neg(n) };
1692
1692
  }
1693
1693
  pow(t, n) {
1694
- return Yn(this, t, n);
1694
+ return zn(this, t, n);
1695
1695
  }
1696
1696
  invertBatch(t) {
1697
1697
  return Fe(this, t);
@@ -1748,10 +1748,10 @@ class Ua {
1748
1748
  sqrt(t) {
1749
1749
  const { Fp: n } = this, r = this, { c0: s, c1: i } = t;
1750
1750
  if (n.is0(i))
1751
- return Dn(n, s) === 1 ? r.create({ c0: n.sqrt(s), c1: n.ZERO }) : r.create({ c0: n.ZERO, c1: n.sqrt(n.div(s, this.Fp_NONRESIDUE)) });
1751
+ return Mn(n, s) === 1 ? r.create({ c0: n.sqrt(s), c1: n.ZERO }) : r.create({ c0: n.ZERO, c1: n.sqrt(n.div(s, this.Fp_NONRESIDUE)) });
1752
1752
  const o = n.sqrt(n.sub(n.sqr(s), n.mul(n.sqr(i), this.Fp_NONRESIDUE)));
1753
1753
  let a = n.mul(n.add(o, s), this.Fp_div2);
1754
- Dn(n, a) === -1 && (a = n.sub(a, o));
1754
+ Mn(n, a) === -1 && (a = n.sub(a, o));
1755
1755
  const u = n.sqrt(a), l = r.create({ c0: u, c1: n.div(n.mul(i, this.Fp_div2), u) });
1756
1756
  if (!r.eql(r.sqr(l), t))
1757
1757
  throw new Error("Cannot find square root");
@@ -1906,7 +1906,7 @@ class qa {
1906
1906
  return this.mul(t, typeof n == "bigint" ? s.inv(s.create(n)) : this.inv(n));
1907
1907
  }
1908
1908
  pow(t, n) {
1909
- return Yn(this, t, n);
1909
+ return zn(this, t, n);
1910
1910
  }
1911
1911
  invertBatch(t) {
1912
1912
  return Fe(this, t);
@@ -2043,7 +2043,7 @@ class Da {
2043
2043
  return this.mul(t, typeof n == "bigint" ? i.inv(i.create(n)) : this.inv(n));
2044
2044
  }
2045
2045
  pow(t, n) {
2046
- return Yn(this, t, n);
2046
+ return zn(this, t, n);
2047
2047
  }
2048
2048
  invertBatch(t) {
2049
2049
  return Fe(this, t);
@@ -2213,7 +2213,7 @@ function Ma(e) {
2213
2213
  const t = xn(e.ORDER), n = new Ua(t, e), r = new qa(n), s = new Da(r, e);
2214
2214
  return { Fp: t, Fp2: n, Fp6: r, Fp12: s };
2215
2215
  }
2216
- const xt = BigInt(0), Gn = BigInt(1), qt = BigInt(2), zn = BigInt(3), fn = BigInt(4), xe = BigInt("0xd201000000010000"), Wa = qn(xe), en = {
2216
+ const xt = BigInt(0), Hn = BigInt(1), qt = BigInt(2), Kn = BigInt(3), fn = BigInt(4), xe = BigInt("0xd201000000010000"), Wa = Dn(xe), en = {
2217
2217
  p: BigInt("0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab"),
2218
2218
  n: BigInt("0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001"),
2219
2219
  h: BigInt("0x396c8c005555e1568c00aaab0000aaab"),
@@ -2228,7 +2228,7 @@ const xt = BigInt(0), Gn = BigInt(1), qt = BigInt(2), zn = BigInt(3), fn = BigIn
2228
2228
  X_LEN: Wa,
2229
2229
  // Finite extension field over irreducible polynominal.
2230
2230
  // Fp(u) / (u² - β) where β = -1
2231
- FP2_NONRESIDUE: [Gn, Gn],
2231
+ FP2_NONRESIDUE: [Hn, Hn],
2232
2232
  Fp2mulByB: ({ c0: e, c1: t }) => {
2233
2233
  const n = N.mul(e, fn), r = N.mul(t, fn);
2234
2234
  return { c0: N.sub(n, r), c1: N.add(n, r) };
@@ -2237,7 +2237,7 @@ const xt = BigInt(0), Gn = BigInt(1), qt = BigInt(2), zn = BigInt(3), fn = BigIn
2237
2237
  const t = xe, n = Y.div(Y.frobeniusMap(e, 6), e), r = Y.mul(Y.frobeniusMap(n, 2), n), s = Y.conjugate(Y._cyclotomicExp(r, t)), i = Y.mul(Y.conjugate(Y._cyclotomicSquare(r)), s), o = Y.conjugate(Y._cyclotomicExp(i, t)), a = Y.conjugate(Y._cyclotomicExp(o, t)), c = Y.mul(Y.conjugate(Y._cyclotomicExp(a, t)), Y._cyclotomicSquare(s)), u = Y.conjugate(Y._cyclotomicExp(c, t)), l = Y.frobeniusMap(Y.mul(s, a), 2), f = Y.frobeniusMap(Y.mul(o, r), 3), d = Y.frobeniusMap(Y.mul(c, Y.conjugate(r)), 1), p = Y.mul(Y.mul(u, Y.conjugate(i)), r);
2238
2238
  return Y.mul(Y.mul(Y.mul(l, f), d), p);
2239
2239
  }
2240
- }), { G2psi: ls, G2psi2: Ha } = Fa(N, V, V.div(V.ONE, V.NONRESIDUE)), wr = Object.freeze({
2240
+ }), { G2psi: ls, G2psi2: Ha } = Fa(N, V, V.div(V.ONE, V.NONRESIDUE)), gr = 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: N.ORDER,
@@ -2259,8 +2259,8 @@ const xt = BigInt(0), Gn = BigInt(1), qt = BigInt(2), zn = BigInt(3), fn = BigIn
2259
2259
  BigInt("0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801"),
2260
2260
  BigInt("0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be")
2261
2261
  ])
2262
- }, Kn = _n(N.toBytes(xt), { infinity: !0, compressed: !0 });
2263
- function Xn(e) {
2262
+ }, Xn = _n(N.toBytes(xt), { infinity: !0, compressed: !0 });
2263
+ function Jn(e) {
2264
2264
  e = ui(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 };
@@ -2274,22 +2274,22 @@ function Va(e, t, n) {
2274
2274
  const { BYTES: r, ORDER: s } = N, i = t.is0(), { x: o, y: a } = t.toAffine();
2275
2275
  if (n) {
2276
2276
  if (i)
2277
- return Kn.slice();
2277
+ return Xn.slice();
2278
2278
  const c = !!(a * qt / s);
2279
2279
  return _n(mt(o, r), { compressed: !0, sort: c });
2280
2280
  } else
2281
2281
  return i ? ht(Uint8Array.of(64), new Uint8Array(2 * r - 1)) : ht(mt(o, r), mt(a, r));
2282
2282
  }
2283
- function gr(e) {
2283
+ function yr(e) {
2284
2284
  e.assertValidity();
2285
2285
  const { BYTES: t, ORDER: n } = N, { x: r, y: s } = e.toAffine();
2286
2286
  if (e.is0())
2287
- return Kn.slice();
2287
+ return Xn.slice();
2288
2288
  const i = !!(s * qt / n);
2289
2289
  return _n(mt(r, t), { compressed: !0, sort: i });
2290
2290
  }
2291
2291
  function Za(e) {
2292
- const { compressed: t, infinity: n, sort: r, value: s } = Xn(e), { BYTES: i, ORDER: o } = N;
2292
+ const { compressed: t, infinity: n, sort: r, value: s } = Jn(e), { BYTES: i, ORDER: o } = N;
2293
2293
  if (s.length === 48 && t) {
2294
2294
  const a = zt(s), c = N.create(a & mn(N.BITS));
2295
2295
  if (n) {
@@ -2297,7 +2297,7 @@ function Za(e) {
2297
2297
  throw new Error("invalid G1 point: non-empty, at infinity, with compression");
2298
2298
  return { x: xt, y: xt };
2299
2299
  }
2300
- const u = N.add(N.pow(c, zn), N.create(en.b));
2300
+ const u = N.add(N.pow(c, Kn), N.create(en.b));
2301
2301
  let l = N.sqrt(u);
2302
2302
  if (!l)
2303
2303
  throw new Error("invalid G1 point: compressed point");
@@ -2314,10 +2314,10 @@ function Za(e) {
2314
2314
  throw new Error("invalid G1 point: expected 48/96 bytes");
2315
2315
  }
2316
2316
  function fs(e) {
2317
- const { infinity: t, sort: n, value: r } = Xn(ft(e, 48, "signature")), s = N.ORDER, i = T.G1.Point, o = zt(r);
2317
+ const { infinity: t, sort: n, value: r } = Jn(ft(e, 48, "signature")), s = N.ORDER, i = T.G1.Point, o = zt(r);
2318
2318
  if (t)
2319
2319
  return i.ZERO;
2320
- const a = N.create(o & mn(N.BITS)), c = N.add(N.pow(a, zn), N.create(en.b));
2320
+ const a = N.create(o & mn(N.BITS)), c = N.add(N.pow(a, Kn), N.create(en.b));
2321
2321
  let u = N.sqrt(c);
2322
2322
  if (!u)
2323
2323
  throw new Error("invalid G1 point: compressed");
@@ -2330,7 +2330,7 @@ function Ya(e, t, n) {
2330
2330
  const { BYTES: r, ORDER: s } = N, i = t.is0(), { x: o, y: a } = t.toAffine();
2331
2331
  if (n) {
2332
2332
  if (i)
2333
- return ht(Kn, mt(xt, r));
2333
+ return ht(Xn, mt(xt, r));
2334
2334
  const c = !!(a.c1 === xt ? a.c0 * qt / s : a.c1 * qt / s);
2335
2335
  return ht(_n(mt(o.c1, r), { compressed: !0, sort: c }), mt(o.c0, r));
2336
2336
  } else {
@@ -2340,16 +2340,16 @@ function Ya(e, t, n) {
2340
2340
  return ht(mt(u, r), mt(c, r), mt(f, r), mt(l, r));
2341
2341
  }
2342
2342
  }
2343
- function yr(e) {
2343
+ function br(e) {
2344
2344
  e.assertValidity();
2345
2345
  const { BYTES: t } = N;
2346
2346
  if (e.is0())
2347
- return ht(Kn, mt(xt, t));
2348
- const { x: n, y: r } = e.toAffine(), { re: s, im: i } = V.reim(n), { re: o, im: a } = V.reim(r), u = !!((a > xt ? a * qt : o * qt) / N.ORDER & Gn), l = s;
2347
+ return ht(Xn, mt(xt, t));
2348
+ const { x: n, y: r } = e.toAffine(), { re: s, im: i } = V.reim(n), { re: o, im: a } = V.reim(r), u = !!((a > xt ? a * qt : o * qt) / N.ORDER & Hn), l = s;
2349
2349
  return ht(_n(mt(i, t), { sort: u, compressed: !0 }), mt(l, t));
2350
2350
  }
2351
2351
  function za(e) {
2352
- const { BYTES: t, ORDER: n } = N, { compressed: r, infinity: s, sort: i, value: o } = Xn(e);
2352
+ const { BYTES: t, ORDER: n } = N, { compressed: r, infinity: s, sort: i, value: o } = Jn(e);
2353
2353
  if (!r && !s && i || // 00100000
2354
2354
  !r && s && i || // 01100000
2355
2355
  i && s && r)
@@ -2361,9 +2361,9 @@ function za(e) {
2361
2361
  throw new Error("invalid G2 point: compressed");
2362
2362
  return { x: V.ZERO, y: V.ZERO };
2363
2363
  }
2364
- const c = a(o, 0, t), u = a(o, t, 2 * t), l = V.create({ c0: N.create(u), c1: N.create(c) }), f = V.add(V.pow(l, zn), Fr.b);
2364
+ const c = a(o, 0, t), u = a(o, t, 2 * t), l = V.create({ c0: N.create(u), c1: N.create(c) }), f = V.add(V.pow(l, Kn), Fr.b);
2365
2365
  let d = V.sqrt(f);
2366
- const p = d.c1 === xt ? d.c0 * qt / n : d.c1 * qt / n ? Gn : xt;
2366
+ const p = d.c1 === xt ? d.c0 * qt / n : d.c1 * qt / n ? Hn : xt;
2367
2367
  return d = i && p > 0 ? d : V.neg(d), { x: l, y: d };
2368
2368
  } else if (o.length === 192 && !r) {
2369
2369
  if (s) {
@@ -2377,13 +2377,13 @@ function za(e) {
2377
2377
  throw new Error("invalid G2 point: expected 96/192 bytes");
2378
2378
  }
2379
2379
  function ds(e) {
2380
- const { ORDER: t } = N, { infinity: n, sort: r, value: s } = Xn(ft(e)), i = T.G2.Point, o = s.length / 2;
2380
+ const { ORDER: t } = N, { infinity: n, sort: r, value: s } = Jn(ft(e)), i = T.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
2383
  const a = zt(s.slice(0, o)), c = zt(s.slice(o));
2384
2384
  if (n)
2385
2385
  return i.ZERO;
2386
- const u = N.create(a & mn(N.BITS)), l = N.create(c), f = V.create({ c0: l, c1: u }), d = V.add(V.pow(f, zn), Fr.b);
2386
+ const u = N.create(a & mn(N.BITS)), l = N.create(c), f = V.create({ c0: l, c1: u }), d = V.add(V.pow(f, Kn), Fr.b);
2387
2387
  let p = V.sqrt(d);
2388
2388
  if (!p)
2389
2389
  throw new Error("Failed to find a square root");
@@ -2398,16 +2398,16 @@ const Ka = {
2398
2398
  return fs(ft(e));
2399
2399
  },
2400
2400
  fromHex(e) {
2401
- return fs(Fn(e));
2401
+ return fs(Un(e));
2402
2402
  },
2403
2403
  toBytes(e) {
2404
- return gr(e);
2404
+ return yr(e);
2405
2405
  },
2406
2406
  toRawBytes(e) {
2407
- return gr(e);
2407
+ return yr(e);
2408
2408
  },
2409
2409
  toHex(e) {
2410
- return ln(gr(e));
2410
+ return ln(yr(e));
2411
2411
  }
2412
2412
  },
2413
2413
  LongSignature: {
@@ -2415,16 +2415,16 @@ const Ka = {
2415
2415
  return ds(ft(e));
2416
2416
  },
2417
2417
  fromHex(e) {
2418
- return ds(Fn(e));
2418
+ return ds(Un(e));
2419
2419
  },
2420
2420
  toBytes(e) {
2421
- return yr(e);
2421
+ return br(e);
2422
2422
  },
2423
2423
  toRawBytes(e) {
2424
- return yr(e);
2424
+ return br(e);
2425
2425
  },
2426
2426
  toHex(e) {
2427
- return ln(yr(e));
2427
+ return ln(br(e));
2428
2428
  }
2429
2429
  }
2430
2430
  }, Xa = {
@@ -2469,9 +2469,9 @@ const Ka = {
2469
2469
  }), Qa = {
2470
2470
  mapToG1: ic,
2471
2471
  mapToG2: oc,
2472
- hasherOpts: wr,
2473
- hasherOptsG1: { ...wr, m: 1, DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_" },
2474
- hasherOptsG2: { ...wr }
2472
+ hasherOpts: gr,
2473
+ hasherOptsG1: { ...gr, m: 1, DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_" },
2474
+ hasherOptsG2: { ...gr }
2475
2475
  }, tc = {
2476
2476
  ateLoopSize: xe,
2477
2477
  // The BLS parameter x for BLS12-381
@@ -2639,7 +2639,7 @@ function oc(e) {
2639
2639
  function ac(e, t, n) {
2640
2640
  return kr(e), n === void 0 && (n = new Uint8Array(e.outputLen)), Lr(e, n, t);
2641
2641
  }
2642
- const br = /* @__PURE__ */ Uint8Array.of(0), ps = /* @__PURE__ */ Uint8Array.of();
2642
+ const mr = /* @__PURE__ */ Uint8Array.of(0), ps = /* @__PURE__ */ Uint8Array.of();
2643
2643
  function cc(e, t, n, r = 32) {
2644
2644
  kr(e), Je(r, "length");
2645
2645
  const s = e.outputLen;
@@ -2649,8 +2649,8 @@ function cc(e, t, n, r = 32) {
2649
2649
  n === void 0 ? n = ps : ft(n, void 0, "info");
2650
2650
  const o = new Uint8Array(i * s), a = Lr.create(e, t), c = a._cloneInto(), u = new Uint8Array(a.outputLen);
2651
2651
  for (let l = 0; l < i; l++)
2652
- br[0] = l + 1, c.update(l === 0 ? ps : u).update(n).update(br).digestInto(u), o.set(u, s * l), a._cloneInto(c);
2653
- return a.destroy(), c.destroy(), un(u, br), o.slice(0, r);
2652
+ mr[0] = l + 1, c.update(l === 0 ? ps : u).update(n).update(mr).digestInto(u), o.set(u, s * l), a._cloneInto(c);
2653
+ return a.destroy(), c.destroy(), un(u, mr), o.slice(0, r);
2654
2654
  }
2655
2655
  const uc = (e, t, n, r, s) => cc(e, ac(e, t, n), r, s), lc = "6.16.0";
2656
2656
  function fc(e, t, n) {
@@ -2834,7 +2834,7 @@ function Ci(e, t, n) {
2834
2834
  const s = new Uint8Array(t);
2835
2835
  return s.fill(0), n ? s.set(r, t - r.length) : s.set(r, 0), bt(s);
2836
2836
  }
2837
- function Ln(e, t) {
2837
+ function An(e, t) {
2838
2838
  return Ci(e, t, !0);
2839
2839
  }
2840
2840
  function $i(e, t) {
@@ -2842,7 +2842,7 @@ function $i(e, t) {
2842
2842
  }
2843
2843
  const En = BigInt(0), Mt = BigInt(1), ze = 9007199254740991;
2844
2844
  function pc(e, t) {
2845
- const n = Jn(e, "value"), r = BigInt(Ee(t, "width"));
2845
+ const n = jn(e, "value"), r = BigInt(Ee(t, "width"));
2846
2846
  if (at(n >> r === En, "overflow", "NUMERIC_FAULT", {
2847
2847
  operation: "fromTwos",
2848
2848
  fault: "overflow",
@@ -2873,7 +2873,7 @@ function Li(e, t) {
2873
2873
  return n;
2874
2874
  }
2875
2875
  function In(e, t) {
2876
- const n = Jn(e, "value"), r = BigInt(Ee(t, "bits"));
2876
+ const n = jn(e, "value"), r = BigInt(Ee(t, "bits"));
2877
2877
  return n & (Mt << r) - Mt;
2878
2878
  }
2879
2879
  function nn(e, t) {
@@ -2893,7 +2893,7 @@ function nn(e, t) {
2893
2893
  }
2894
2894
  m(!1, "invalid BigNumberish value", t || "value", e);
2895
2895
  }
2896
- function Jn(e, t) {
2896
+ function jn(e, t) {
2897
2897
  const n = nn(e, t);
2898
2898
  return at(n >= En, "unsigned value cannot be negative", "NUMERIC_FAULT", {
2899
2899
  fault: "overflow",
@@ -2932,7 +2932,7 @@ function hc(e) {
2932
2932
  return Ee(Ai(e));
2933
2933
  }
2934
2934
  function Pi(e, t) {
2935
- const n = Jn(e, "value");
2935
+ const n = jn(e, "value");
2936
2936
  let r = n.toString(16);
2937
2937
  if (t == null)
2938
2938
  r.length % 2 && (r = "0" + r);
@@ -2950,7 +2950,7 @@ function Pi(e, t) {
2950
2950
  return "0x" + r;
2951
2951
  }
2952
2952
  function Fi(e, t) {
2953
- const n = Jn(e, "value");
2953
+ const n = jn(e, "value");
2954
2954
  if (n === En)
2955
2955
  return new Uint8Array(0);
2956
2956
  let r = n.toString(16);
@@ -4600,18 +4600,18 @@ const uu = new RegExp("^bytes([0-9]+)$"), lu = new RegExp("^(u?int)([0-9]*)$"),
4600
4600
  function Ji(e, t, n) {
4601
4601
  switch (e) {
4602
4602
  case "address":
4603
- return yt(n ? Ln(t, 32) : dn(t));
4603
+ return yt(n ? An(t, 32) : dn(t));
4604
4604
  case "string":
4605
4605
  return qr(t);
4606
4606
  case "bytes":
4607
4607
  return yt(t);
4608
4608
  case "bool":
4609
- return t = t ? "0x01" : "0x00", yt(n ? Ln(t, 32) : t);
4609
+ return t = t ? "0x01" : "0x00", yt(n ? An(t, 32) : t);
4610
4610
  }
4611
4611
  let r = e.match(lu);
4612
4612
  if (r) {
4613
4613
  let s = r[1] === "int", i = parseInt(r[2] || "256");
4614
- return m((!r[2] || r[2] === String(i)) && i % 8 === 0 && i !== 0 && i <= 256, "invalid number type", "type", e), n && (i = 256), s && (t = Li(t, i)), yt(Ln(Fi(t), i / 8));
4614
+ return m((!r[2] || r[2] === String(i)) && i % 8 === 0 && i !== 0 && i <= 256, "invalid number type", "type", e), n && (i = 256), s && (t = Li(t, i)), yt(An(Fi(t), i / 8));
4615
4615
  }
4616
4616
  if (r = e.match(uu), r) {
4617
4617
  const s = parseInt(r[1]);
@@ -4798,7 +4798,7 @@ function Is(e, t) {
4798
4798
  if (n.length > 1)
4799
4799
  throw new Error(`conflicting types: ${n.join(", ")}`);
4800
4800
  }
4801
- function jn(e, t) {
4801
+ function Qn(e, t) {
4802
4802
  if (t.peekKeyword(to)) {
4803
4803
  const n = t.pop().text;
4804
4804
  if (n !== e)
@@ -5211,7 +5211,7 @@ class Ae {
5211
5211
  return $e.isFragment(t);
5212
5212
  }
5213
5213
  }
5214
- class Qn extends Ae {
5214
+ class tr extends Ae {
5215
5215
  /**
5216
5216
  * The name of the fragment.
5217
5217
  */
@@ -5226,7 +5226,7 @@ class Qn extends Ae {
5226
5226
  function hn(e, t) {
5227
5227
  return "(" + t.map((n) => n.format(e)).join(e === "full" ? ", " : ",") + ")";
5228
5228
  }
5229
- class Rt extends Qn {
5229
+ class Rt extends tr {
5230
5230
  /**
5231
5231
  * @private
5232
5232
  */
@@ -5261,7 +5261,7 @@ class Rt extends Qn {
5261
5261
  if (typeof t == "string")
5262
5262
  return Rt.from(Se(t));
5263
5263
  if (t instanceof Dt) {
5264
- const n = jn("error", t), r = ue(t);
5264
+ const n = Qn("error", t), r = ue(t);
5265
5265
  return Le(t), new Rt(ot, n, r);
5266
5266
  }
5267
5267
  return new Rt(ot, t.name, t.inputs ? t.inputs.map(nt.from) : []);
@@ -5274,7 +5274,7 @@ class Rt extends Qn {
5274
5274
  return t && t[kt] === Ns;
5275
5275
  }
5276
5276
  }
5277
- class Vt extends Qn {
5277
+ class Vt extends tr {
5278
5278
  /**
5279
5279
  * Whether this event is anonymous.
5280
5280
  */
@@ -5324,7 +5324,7 @@ class Vt extends Qn {
5324
5324
  m(!1, "invalid event fragment", "obj", t);
5325
5325
  }
5326
5326
  else if (t instanceof Dt) {
5327
- const n = jn("event", t), r = ue(t, !0), s = !!le(t, Ot(["anonymous"])).has("anonymous");
5327
+ const n = Qn("event", t), r = ue(t, !0), s = !!le(t, Ot(["anonymous"])).has("anonymous");
5328
5328
  return Le(t), new Vt(ot, n, r, s);
5329
5329
  }
5330
5330
  return new Vt(ot, t.name, t.inputs ? t.inputs.map((n) => nt.from(n, !0)) : [], !!t.anonymous);
@@ -5456,7 +5456,7 @@ class ie extends Ae {
5456
5456
  return t && t[kt] === Ls;
5457
5457
  }
5458
5458
  }
5459
- class Zt extends Qn {
5459
+ class Zt extends tr {
5460
5460
  /**
5461
5461
  * If the function is constant (e.g. ``pure`` or ``view`` functions).
5462
5462
  */
@@ -5527,7 +5527,7 @@ class Zt extends Qn {
5527
5527
  m(!1, "invalid function fragment", "obj", t);
5528
5528
  }
5529
5529
  else if (t instanceof Dt) {
5530
- const r = jn("function", t), s = ue(t), i = so(t);
5530
+ const r = Qn("function", t), s = ue(t), i = so(t);
5531
5531
  let o = [];
5532
5532
  le(t, Ot(["returns"])).has("returns") && (o = ue(t));
5533
5533
  const a = io(t);
@@ -5544,7 +5544,7 @@ class Zt extends Qn {
5544
5544
  return t && t[kt] === As;
5545
5545
  }
5546
5546
  }
5547
- class $e extends Qn {
5547
+ class $e extends tr {
5548
5548
  /**
5549
5549
  * @private
5550
5550
  */
@@ -5568,7 +5568,7 @@ class $e extends Qn {
5568
5568
  m(!1, "invalid struct fragment", "obj", t);
5569
5569
  }
5570
5570
  else if (t instanceof Dt) {
5571
- const n = jn("struct", t), r = ue(t);
5571
+ const n = Qn("struct", t), r = ue(t);
5572
5572
  return Le(t), new $e(ot, n, r);
5573
5573
  }
5574
5574
  return new $e(ot, t.name, t.inputs ? t.inputs.map(nt.from) : []);
@@ -5594,7 +5594,7 @@ Gt.set(50, "ARRAY_RANGE_ERROR");
5594
5594
  Gt.set(65, "OUT_OF_MEMORY");
5595
5595
  Gt.set(81, "UNINITIALIZED_FUNCTION_CALL");
5596
5596
  const Bu = new RegExp(/^bytes([0-9]*)$/), vu = new RegExp(/^(u?int)([0-9]*)$/);
5597
- let mr = null, Fs = 1024;
5597
+ let xr = null, Fs = 1024;
5598
5598
  function Ou(e, t, n, r) {
5599
5599
  let s = "missing revert data", i = null;
5600
5600
  const o = null;
@@ -5712,7 +5712,7 @@ class fe {
5712
5712
  * On the first call, the instance is created internally.
5713
5713
  */
5714
5714
  static defaultAbiCoder() {
5715
- return mr == null && (mr = new fe()), mr;
5715
+ return xr == null && (xr = new fe()), xr;
5716
5716
  }
5717
5717
  /**
5718
5718
  * Returns an ethers-compatible [[CallExceptionError]] Error for the given
@@ -6420,7 +6420,7 @@ class ge {
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" ? pn(o) : i.type === "bytes" ? tt(bt(o)) : (i.type === "bool" && typeof o == "boolean" ? o = o ? "0x01" : "0x00" : i.type.match(/^u?int/) ? o = Pi(o) : i.type.match(/^bytes/) ? o = $i(o, 32) : i.type === "address" && this.#r.encode(["address"], [o]), Ln(bt(o), 32));
6423
+ const s = (i, o) => i.type === "string" ? pn(o) : i.type === "bytes" ? tt(bt(o)) : (i.type === "bool" && typeof o == "boolean" ? o = o ? "0x01" : "0x00" : i.type.match(/^u?int/) ? o = Pi(o) : i.type.match(/^bytes/) ? o = $i(o, 32) : i.type === "address" && this.#r.encode(["address"], [o]), An(bt(o), 32));
6424
6424
  for (n.forEach((i, o) => {
6425
6425
  const a = t.inputs[o];
6426
6426
  if (!a.indexed) {
@@ -6623,7 +6623,7 @@ function uo(e, t, n, r, s, i) {
6623
6623
  return Number(o) / 100;
6624
6624
  }
6625
6625
  let wt = "", Gr = "";
6626
- function tr(e, t) {
6626
+ function er(e, t) {
6627
6627
  wt = e.toLowerCase(), Gr = t.toLowerCase();
6628
6628
  }
6629
6629
  function Pu(e) {
@@ -6637,7 +6637,7 @@ function Pu(e) {
6637
6637
  }
6638
6638
  return t(e, 1n);
6639
6639
  }
6640
- function er(e, t) {
6640
+ function nr(e, t) {
6641
6641
  e.toLowerCase() > t.toLowerCase() && ([e, t] = [t, e]);
6642
6642
  const n = Ts(
6643
6643
  ["uint8", "address", "bytes32", "bytes32"],
@@ -6657,7 +6657,7 @@ async function Ws(e, t, n) {
6657
6657
  }
6658
6658
  async function Fu(e, t, n) {
6659
6659
  t.toLowerCase() > n.toLowerCase() && ([t, n] = [n, t]);
6660
- const r = await e.reservesOf(er(t, n));
6660
+ const r = await e.reservesOf(nr(t, n));
6661
6661
  if (r === null)
6662
6662
  throw new Error("Token pair does not exist");
6663
6663
  return r;
@@ -6685,7 +6685,7 @@ class Uu {
6685
6685
  const s = await Ws(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 = er(s, i), a = await Ws(this.proxy, t, o);
6688
+ const s = `0x${n.slice(2, 42)}`, i = `0x${n.slice(44, 84)}`, o = nr(s, i), a = await Ws(this.proxy, t, o);
6689
6689
  return this.map[r] = a, a;
6690
6690
  }
6691
6691
  }
@@ -7363,7 +7363,7 @@ function J(e) {
7363
7363
  return `https://sa-proxy.bestinslot.xyz/${e}`;
7364
7364
  throw new Error("Unsupported network for orderbook backend URL");
7365
7365
  }
7366
- function nr() {
7366
+ function rr() {
7367
7367
  const e = tn();
7368
7368
  if (e === "signet")
7369
7369
  return "0xf41B09041DC546F0466D6F74cda81971012B589D";
@@ -7484,10 +7484,10 @@ async function Jt() {
7484
7484
  };
7485
7485
  return o.fee_policy !== null && Zs.set(e, { info: o, fetchedAt: Date.now() }), o;
7486
7486
  }
7487
- async function rr(e, t) {
7487
+ async function sr(e, t) {
7488
7488
  const n = await Jt();
7489
- tr(n.wbtc_address, n.factory_address);
7490
- const r = er(e, t);
7489
+ er(n.wbtc_address, n.factory_address);
7490
+ const r = nr(e, t);
7491
7491
  let s;
7492
7492
  try {
7493
7493
  s = await Ue(r);
@@ -7646,7 +7646,7 @@ async function _l() {
7646
7646
  method: "GET"
7647
7647
  })).tokens;
7648
7648
  }
7649
- function xr(e) {
7649
+ function Cn(e) {
7650
7650
  return e === null ? null : BigInt(e);
7651
7651
  }
7652
7652
  async function El(e = {}) {
@@ -7666,10 +7666,11 @@ async function El(e = {}) {
7666
7666
  total: o.total,
7667
7667
  data: o.data.map((a) => ({
7668
7668
  ...a,
7669
- volume_24h: xr(a.volume_24h),
7670
- volume_7d: xr(a.volume_7d),
7671
- tvl: xr(a.tvl),
7672
- exposure_sats: BigInt(a.exposure_sats)
7669
+ volume_24h: Cn(a.volume_24h),
7670
+ volume_7d: Cn(a.volume_7d),
7671
+ tvl: Cn(a.tvl),
7672
+ exposure_sats: BigInt(a.exposure_sats),
7673
+ market_cap: Cn(a.market_cap ?? null)
7673
7674
  }))
7674
7675
  };
7675
7676
  }
@@ -7730,8 +7731,8 @@ async function Tl(e) {
7730
7731
  }
7731
7732
  if (e.offset !== void 0 && (!Number.isInteger(e.offset) || e.offset < 0))
7732
7733
  throw new Error("Offset must be a non-negative integer");
7733
- const t = new URLSearchParams({ pairAddress: e.pairAddress });
7734
- e.limit !== void 0 && t.set("limit", String(e.limit)), e.offset !== void 0 && t.set("offset", String(e.offset));
7734
+ const t = new URLSearchParams();
7735
+ e.pairAddress !== void 0 && t.set("pairAddress", e.pairAddress), e.limit !== void 0 && t.set("limit", String(e.limit)), e.offset !== void 0 && t.set("offset", String(e.offset));
7735
7736
  const n = J(`wallet-activity/${encodeURIComponent(e.pubkey)}?${t}`);
7736
7737
  return await X(n, {
7737
7738
  method: "GET",
@@ -7762,7 +7763,7 @@ Token Address: ${e.token_address}
7762
7763
  By signing this message, you authorize the creation of a deposit order with the above parameters.`;
7763
7764
  return await Pe(t, "ordinals");
7764
7765
  }
7765
- async function sr(e) {
7766
+ async function ir(e) {
7766
7767
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
7767
7768
  let t = e.pk_idx.toString(16).padStart(16, "0");
7768
7769
  t += e.pubkey;
@@ -7828,7 +7829,7 @@ function vo(e) {
7828
7829
  async function Rl(e, t, n, r = !0, s, i = {}) {
7829
7830
  const o = yn();
7830
7831
  if (!o || !o.wallets) throw new Error("Wallets not found");
7831
- const a = Ke(), c = Vn(), u = Wt();
7832
+ const a = Ke(), c = Zn(), u = Wt();
7832
7833
  if (!c) throw new Error("Payment wallet not found");
7833
7834
  if (!c.address) throw new Error("Payment wallet address not found");
7834
7835
  if (!u) throw new Error("Ordinals wallet not found");
@@ -7855,7 +7856,7 @@ async function Rl(e, t, n, r = !0, s, i = {}) {
7855
7856
  const F = new Hr(
7856
7857
  i,
7857
7858
  3 + (w > 0n ? 2 : 0) + (O ? 2 : 0)
7858
- ), M = F.wrap(Ir(o.provider)), A = nr(), C = `0x095ea7b3000000000000000000000000${A.slice(2).toLowerCase()}ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`, I = await Xe(C), x = K.str(
7859
+ ), M = F.wrap(Ir(o.provider)), A = rr(), C = `0x095ea7b3000000000000000000000000${A.slice(2).toLowerCase()}ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`, I = await Xe(C), x = K.str(
7859
7860
  `{"p":"brc20-prog","op":"c","c":"${e}","b":"${I}"}`
7860
7861
  ), D = new ce(
7861
7862
  K.str("text/plain"),
@@ -7881,7 +7882,7 @@ async function Rl(e, t, n, r = !0, s, i = {}) {
7881
7882
  token_address: e.toLowerCase(),
7882
7883
  bip322_signature: U,
7883
7884
  bls12_signature: _
7884
- }), R = B.edcsa_signature, P = B.pubkey_idx, $ = B.token_idx, q = await sr({
7885
+ }), R = B.edcsa_signature, P = B.pubkey_idx, $ = B.token_idx, q = await ir({
7885
7886
  pubkey: H,
7886
7887
  pk_idx: BigInt(P)
7887
7888
  }), W = wo().encodeFunctionData("deposit", [
@@ -7962,7 +7963,7 @@ async function Rl(e, t, n, r = !0, s, i = {}) {
7962
7963
  null,
7963
7964
  null
7964
7965
  );
7965
- Me = await $n(
7966
+ Me = await Ln(
7966
7967
  G,
7967
7968
  [],
7968
7969
  On,
@@ -8018,7 +8019,7 @@ async function Rl(e, t, n, r = !0, s, i = {}) {
8018
8019
  null,
8019
8020
  null
8020
8021
  );
8021
- ee = await $n(
8022
+ ee = await Ln(
8022
8023
  lt,
8023
8024
  [],
8024
8025
  Me,
@@ -8040,7 +8041,7 @@ async function Rl(e, t, n, r = !0, s, i = {}) {
8040
8041
  throw new Error("Failed to send inscription to OP_RETURN");
8041
8042
  ve = ee.signedTxHex, rn = ee.txId;
8042
8043
  }
8043
- const or = [], De = [];
8044
+ const ar = [], De = [];
8044
8045
  if (w > 0n) {
8045
8046
  if (!Q || !rt || !jt)
8046
8047
  throw new Error("Base deposit transaction hexes are missing");
@@ -8048,37 +8049,37 @@ async function Rl(e, t, n, r = !0, s, i = {}) {
8048
8049
  Q,
8049
8050
  rt,
8050
8051
  jt
8051
- ), or.push({
8052
+ ), ar.push({
8052
8053
  utxo: `${Be}:1`,
8053
8054
  value: be,
8054
- script_type: An(p.outputScript, a),
8055
+ script_type: Pn(p.outputScript, a),
8055
8056
  wallet: p
8056
8057
  });
8057
8058
  }
8058
8059
  if (O) {
8059
8060
  if (!St || !Nt || !ve)
8060
8061
  throw new Error("Allowance transaction hexes are missing");
8061
- De.push(St, Nt, ve), or.push({
8062
+ De.push(St, Nt, ve), ar.push({
8062
8063
  utxo: `${rn}:1`,
8063
8064
  value: be,
8064
- script_type: An(p.outputScript, a),
8065
+ script_type: Pn(p.outputScript, a),
8065
8066
  wallet: p
8066
8067
  });
8067
8068
  }
8068
- let vn = null, Te = null, sn = "", Yr = "", ar = "", cr = "";
8069
+ let vn = null, Te = null, sn = "", Yr = "", cr = "", ur = "";
8069
8070
  try {
8070
8071
  De.length > 0 && Ft(De, null), Te = await Js(
8071
8072
  j,
8072
- or,
8073
+ ar,
8073
8074
  n,
8074
8075
  null,
8075
8076
  null,
8076
8077
  0,
8077
8078
  !0,
8078
8079
  M
8079
- ), ar = Te.signedCommitTxHex, cr = Te.signedRevealTxHex, sn = Te.inscriptionId;
8080
+ ), cr = Te.signedCommitTxHex, ur = Te.signedRevealTxHex, sn = Te.inscriptionId;
8080
8081
  const At = `${sn.split("i")[0]}:0:0`;
8081
- Yr = Te.secret, De.push(ar, cr), Ft(De, [sn, At]);
8082
+ Yr = Te.secret, De.push(cr, ur), Ft(De, [sn, At]);
8082
8083
  const te = new Ut(
8083
8084
  !0,
8084
8085
  S.from(me.encode(["OP_RETURN", K.str("BRC20PROG")], !1)),
@@ -8086,7 +8087,7 @@ async function Rl(e, t, n, r = !0, s, i = {}) {
8086
8087
  null,
8087
8088
  null
8088
8089
  );
8089
- vn = await $n(
8090
+ vn = await Ln(
8090
8091
  sn,
8091
8092
  [],
8092
8093
  te,
@@ -8103,9 +8104,9 @@ async function Rl(e, t, n, r = !0, s, i = {}) {
8103
8104
  throw new Error("Failed to send inscription to OP_RETURN");
8104
8105
  const Fo = vn.signedTxHex, Uo = vn.txId, qo = {
8105
8106
  commit_txid: Te.commitTxId,
8106
- commit_txhex: ar,
8107
+ commit_txhex: cr,
8107
8108
  reveal_txid: Te.revealTxId,
8108
- reveal_txhex: cr,
8109
+ reveal_txhex: ur,
8109
8110
  send_to_opreturn_txid: Uo,
8110
8111
  send_to_opreturn_txhex: Fo,
8111
8112
  secret: Yr,
@@ -8139,7 +8140,7 @@ async function Rl(e, t, n, r = !0, s, i = {}) {
8139
8140
  async function kl(e, t, n, r = !0, s) {
8140
8141
  const i = yn();
8141
8142
  if (!i || !i.wallets) throw new Error("Wallets not found");
8142
- const o = Ke(), a = Vn();
8143
+ const o = Ke(), a = Zn();
8143
8144
  if (!a) throw new Error("Payment wallet not found");
8144
8145
  if (!a.address) throw new Error("Payment wallet address not found");
8145
8146
  const c = a.address, u = a.pubkey, l = new Ut(!1, null, c, null, u);
@@ -8161,7 +8162,7 @@ async function kl(e, t, n, r = !0, s) {
8161
8162
  throw console.error("Insufficient allowance for BRC-2.0 token transfer."), new Error("Insufficient allowance for BRC-2.0 token transfer.");
8162
8163
  g = !0;
8163
8164
  }
8164
- const b = nr(), v = `0x095ea7b3000000000000000000000000${b.slice(2).toLowerCase()}ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`, O = await Xe(v), F = K.str(
8165
+ const b = rr(), v = `0x095ea7b3000000000000000000000000${b.slice(2).toLowerCase()}ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`, O = await Xe(v), F = K.str(
8165
8166
  `{"p":"brc20-prog","op":"c","c":"${e}","b":"${O}"}`
8166
8167
  ), M = new ce(
8167
8168
  K.str("text/plain"),
@@ -8173,7 +8174,7 @@ async function kl(e, t, n, r = !0, s) {
8173
8174
  ), A = (await et())?.swapPubkey;
8174
8175
  if (!A)
8175
8176
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8176
- const C = `0x${"00".repeat(64)}`, I = 1, x = 1, D = await sr({
8177
+ const C = `0x${"00".repeat(64)}`, I = 1, x = 1, D = await ir({
8177
8178
  pubkey: A,
8178
8179
  pk_idx: BigInt(I)
8179
8180
  }), U = wo().encodeFunctionData("deposit", [
@@ -8248,7 +8249,7 @@ async function kl(e, t, n, r = !0, s) {
8248
8249
  null,
8249
8250
  null
8250
8251
  );
8251
- St = await Cn(
8252
+ St = await $n(
8252
8253
  P,
8253
8254
  [],
8254
8255
  Nt,
@@ -8304,7 +8305,7 @@ async function kl(e, t, n, r = !0, s) {
8304
8305
  null,
8305
8306
  null
8306
8307
  );
8307
- dt = await Cn(
8308
+ dt = await $n(
8308
8309
  ct,
8309
8310
  [],
8310
8311
  Et,
@@ -8336,7 +8337,7 @@ async function kl(e, t, n, r = !0, s) {
8336
8337
  ), Q.push({
8337
8338
  utxo: `${W}:1`,
8338
8339
  value: be,
8339
- script_type: An(l.outputScript, o),
8340
+ script_type: Pn(l.outputScript, o),
8340
8341
  wallet: l
8341
8342
  });
8342
8343
  }
@@ -8346,7 +8347,7 @@ async function kl(e, t, n, r = !0, s) {
8346
8347
  rt.push(j, G, ut), Q.push({
8347
8348
  utxo: `${gt}:1`,
8348
8349
  value: be,
8349
- script_type: An(l.outputScript, o),
8350
+ script_type: Pn(l.outputScript, o),
8350
8351
  wallet: l
8351
8352
  });
8352
8353
  }
@@ -8370,7 +8371,7 @@ async function kl(e, t, n, r = !0, s) {
8370
8371
  null,
8371
8372
  null
8372
8373
  );
8373
- Be = await Cn(
8374
+ Be = await $n(
8374
8375
  Et,
8375
8376
  [],
8376
8377
  Nt,
@@ -8415,12 +8416,12 @@ async function Cl(e) {
8415
8416
  async function $l(e, t, n = {}) {
8416
8417
  const r = await Jt(), s = yn();
8417
8418
  if (!s || !s.wallets) throw new Error("Wallets not found");
8418
- const i = new Hr(n), o = i.wrap(Ir(s.provider)), a = Vn(), c = Wt();
8419
+ const i = new Hr(n), o = i.wrap(Ir(s.provider)), a = Zn(), c = Wt();
8419
8420
  if (!a) throw new Error("Payment wallet not found");
8420
8421
  if (!a.address) throw new Error("Payment wallet address not found");
8421
8422
  if (!c) throw new Error("Ordinals wallet not found");
8422
8423
  if (!c.address) throw new Error("Ordinals wallet address not found");
8423
- const u = c.address, l = nr(), f = (await et())?.swapPubkey;
8424
+ const u = c.address, l = rr(), f = (await et())?.swapPubkey;
8424
8425
  if (!f)
8425
8426
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8426
8427
  i.next();
@@ -8437,7 +8438,7 @@ async function $l(e, t, n = {}) {
8437
8438
  token_address: r.wbtc_address.toLowerCase(),
8438
8439
  bip322_signature: d,
8439
8440
  bls12_signature: w
8440
- }), g = h.edcsa_signature, b = h.pubkey_idx, v = h.token_idx, O = await sr({
8441
+ }), g = h.edcsa_signature, b = h.pubkey_idx, v = h.token_idx, O = await ir({
8441
8442
  pubkey: f,
8442
8443
  pk_idx: BigInt(b)
8443
8444
  }), F = fe.defaultAbiCoder().encode(
@@ -8496,7 +8497,7 @@ async function $l(e, t, n = {}) {
8496
8497
  value: Number.parseInt(e.toString())
8497
8498
  }
8498
8499
  ];
8499
- W = await $n(
8500
+ W = await Ln(
8500
8501
  $,
8501
8502
  [],
8502
8503
  _t,
@@ -8536,13 +8537,13 @@ async function $l(e, t, n = {}) {
8536
8537
  async function Ll(e, t) {
8537
8538
  const n = await Jt(), r = yn();
8538
8539
  if (!r || !r.wallets) throw new Error("Wallets not found");
8539
- const s = Vn();
8540
+ const s = Zn();
8540
8541
  if (!s) throw new Error("Payment wallet not found");
8541
8542
  if (!s.address) throw new Error("Payment wallet address not found");
8542
- const i = nr(), o = (await et())?.swapPubkey;
8543
+ const i = rr(), o = (await et())?.swapPubkey;
8543
8544
  if (!o)
8544
8545
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8545
- const a = `0x${"00".repeat(64)}`, c = 1, u = 1, l = await sr({
8546
+ const a = `0x${"00".repeat(64)}`, c = 1, u = 1, l = await ir({
8546
8547
  pubkey: o,
8547
8548
  pk_idx: BigInt(c)
8548
8549
  }), f = fe.defaultAbiCoder().encode(
@@ -8598,7 +8599,7 @@ async function Ll(e, t) {
8598
8599
  value: Number.parseInt(e.toString())
8599
8600
  }
8600
8601
  ];
8601
- I = await Cn(
8602
+ I = await $n(
8602
8603
  A,
8603
8604
  [],
8604
8605
  D,
@@ -8619,7 +8620,7 @@ async function Ll(e, t) {
8619
8620
  }
8620
8621
  async function Al(e, t, n, r) {
8621
8622
  const s = await Jt();
8622
- tr(s.wbtc_address, s.factory_address);
8623
+ er(s.wbtc_address, s.factory_address);
8623
8624
  const i = (await et())?.swapPubkey;
8624
8625
  if (!i)
8625
8626
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
@@ -8736,7 +8737,7 @@ async function ql(e, t, n, r, s) {
8736
8737
  }
8737
8738
  async function Dl(e, t, n) {
8738
8739
  const r = await Jt();
8739
- tr(r.wbtc_address, r.factory_address);
8740
+ er(r.wbtc_address, r.factory_address);
8740
8741
  const s = (await et())?.swapPubkey;
8741
8742
  if (!s)
8742
8743
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
@@ -8846,7 +8847,7 @@ async function Hl(e, t, n, r, s, i) {
8846
8847
  bip322_signature: p
8847
8848
  });
8848
8849
  }
8849
- async function ir(e, t) {
8850
+ async function or(e, t) {
8850
8851
  const n = await Jt();
8851
8852
  if (n.fee_policy === null) {
8852
8853
  const r = Or.get(tn());
@@ -8856,14 +8857,14 @@ async function ir(e, t) {
8856
8857
  }
8857
8858
  async function Vl(e, t, n) {
8858
8859
  const r = await Jt();
8859
- await rr(e, t);
8860
+ await sr(e, t);
8860
8861
  const s = (await et())?.swapPubkey;
8861
8862
  if (!s)
8862
8863
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8863
8864
  const i = {
8864
8865
  balanceOf: Bn,
8865
8866
  reservesOf: Ue
8866
- }, o = await $t("swap"), { token1FeeBps: a, token2FeeBps: c } = await ir(e, t), u = await sl(
8867
+ }, o = await $t("swap"), { token1FeeBps: a, token2FeeBps: c } = await or(e, t), u = await sl(
8867
8868
  i,
8868
8869
  s,
8869
8870
  e,
@@ -8944,8 +8945,8 @@ async function Kl(e, t, n, r, s, i) {
8944
8945
  const o = (await et())?.swapPubkey;
8945
8946
  if (!o)
8946
8947
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8947
- await rr(e, t);
8948
- const a = r * (10000n - s) / 10000n, c = await qe(), u = await $t("swap"), { token1FeeBps: l, token2FeeBps: f } = await ir(e, t), { referrerPubkey: d, refReturnBps: p } = i ? await Vr(o, i) : { referrerPubkey: void 0, refReturnBps: void 0 }, w = await Zl({
8948
+ await sr(e, t);
8949
+ const a = r * (10000n - s) / 10000n, c = await qe(), u = await $t("swap"), { token1FeeBps: l, token2FeeBps: f } = await or(e, t), { referrerPubkey: d, refReturnBps: p } = i ? await Vr(o, i) : { referrerPubkey: void 0, refReturnBps: void 0 }, w = await Zl({
8949
8950
  token1_addr: e,
8950
8951
  token2_addr: t,
8951
8952
  in_amt: n.toString(),
@@ -8985,14 +8986,14 @@ async function Kl(e, t, n, r, s, i) {
8985
8986
  }
8986
8987
  async function Xl(e, t, n) {
8987
8988
  const r = await Jt();
8988
- await rr(e, t);
8989
+ await sr(e, t);
8989
8990
  const s = (await et())?.swapPubkey;
8990
8991
  if (!s)
8991
8992
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8992
8993
  const i = {
8993
8994
  balanceOf: Bn,
8994
8995
  reservesOf: Ue
8995
- }, o = await $t("swap"), { token1FeeBps: a, token2FeeBps: c } = await ir(e, t), u = await ol(
8996
+ }, o = await $t("swap"), { token1FeeBps: a, token2FeeBps: c } = await or(e, t), u = await ol(
8996
8997
  i,
8997
8998
  s,
8998
8999
  e,
@@ -9073,8 +9074,8 @@ async function tf(e, t, n, r, s, i) {
9073
9074
  const o = (await et())?.swapPubkey;
9074
9075
  if (!o)
9075
9076
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
9076
- await rr(e, t);
9077
- const a = n * (10000n + s) / 10000n, c = await qe(), u = await $t("swap"), { token1FeeBps: l, token2FeeBps: f } = await ir(e, t), { referrerPubkey: d, refReturnBps: p } = i ? await Vr(o, i) : { referrerPubkey: void 0, refReturnBps: void 0 }, w = await Jl({
9077
+ await sr(e, t);
9078
+ const a = n * (10000n + s) / 10000n, c = await qe(), u = await $t("swap"), { token1FeeBps: l, token2FeeBps: f } = await or(e, t), { referrerPubkey: d, refReturnBps: p } = i ? await Vr(o, i) : { referrerPubkey: void 0, refReturnBps: void 0 }, w = await Jl({
9078
9079
  token1_addr: e,
9079
9080
  token2_addr: t,
9080
9081
  max_in_amt: a.toString(),
@@ -9218,7 +9219,7 @@ async function nf(e, t) {
9218
9219
  }
9219
9220
  async function rf(e, t) {
9220
9221
  const n = await Jt();
9221
- tr(n.wbtc_address, n.factory_address);
9222
+ er(n.wbtc_address, n.factory_address);
9222
9223
  const r = (await et())?.swapPubkey;
9223
9224
  if (!r)
9224
9225
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
@@ -9389,7 +9390,7 @@ const Mf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9389
9390
  getMinerFee: $t,
9390
9391
  getMinerFeesOfDepositOrder: kl,
9391
9392
  getMinerFeesOfWrapOrder: Ll,
9392
- getPairAddress: er,
9393
+ getPairAddress: nr,
9393
9394
  getPairReserves: Ue,
9394
9395
  getPairVolumeOverDays: Sl,
9395
9396
  getRemoveLiquidityResult: Dl,
@@ -9427,7 +9428,7 @@ function Tr(e, t) {
9427
9428
  if (typeof e != "string" || !xf.test(e))
9428
9429
  throw new Error(`${t} must be a non-empty hex string`);
9429
9430
  }
9430
- function Hn(e, t) {
9431
+ function Vn(e, t) {
9431
9432
  if (typeof e != "string" || e.length === 0)
9432
9433
  throw new Error(`${t} must be a non-empty string`);
9433
9434
  }
@@ -9442,7 +9443,7 @@ function gn(e) {
9442
9443
  );
9443
9444
  }
9444
9445
  function No(e, t, n) {
9445
- Hn(e.max, "max"), e.lim != null && Hn(e.lim, "lim");
9446
+ Vn(e.max, "max"), e.lim != null && Vn(e.lim, "lim");
9446
9447
  const r = t === 5 || n != null;
9447
9448
  if (r && e.selfMint === !1)
9448
9449
  throw new Error(
@@ -9462,12 +9463,12 @@ function _f(e) {
9462
9463
  function Ef(e) {
9463
9464
  const t = Zr(e.tick);
9464
9465
  if (t < 4 || t > 6) throw new Error(`ticker must be 4-6 bytes, got ${t}`);
9465
- return Hn(e.amt, "amt"), gn({ p: "brc-20", op: "mint", tick: e.tick, amt: e.amt });
9466
+ return Vn(e.amt, "amt"), gn({ p: "brc-20", op: "mint", tick: e.tick, amt: e.amt });
9466
9467
  }
9467
9468
  function Sf(e) {
9468
9469
  const t = Zr(e.tick);
9469
9470
  if (t < 4 || t > 6) throw new Error(`ticker must be 4-6 bytes, got ${t}`);
9470
- return Hn(e.amt, "amt"), gn({ p: "brc-20", op: "transfer", tick: e.tick, amt: e.amt });
9471
+ return Vn(e.amt, "amt"), gn({ p: "brc-20", op: "transfer", tick: e.tick, amt: e.amt });
9471
9472
  }
9472
9473
  function Co(e = 16) {
9473
9474
  if (!Number.isInteger(e) || e <= 0)