@bestinslot/wallet-kit 0.13.5 → 0.13.7

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,6 +1,6 @@
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 Kr, Z as Ys, _ as Rr, O as ze, f as Zn, H as Ut, $ as Xe, a0 as z, a1 as ce, a2 as Ks, a3 as zs, a4 as Go, a5 as zr, 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 Ko, ak as zo, 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
- async function Mf(e, t, n, r, s, i) {
3
- const o = yn();
1
+ import { i as gn, X as Ir, Y as Do, Z as Mo, _ as Wo, I as B, f as Wt, n as Kr, $ as Ks, a0 as Rr, a1 as K, Q as Xe, h as Zn, J as Ut, a2 as ze, a3 as J, a4 as ce, a5 as Xs, a6 as zs, a7 as Go, a8 as Xr, a9 as Ft, aa as me, ab as $n, ac as Yt, ad as Pn, ae as Js, e as yn, F as bn, af as Ho, ag as zr, ah as Ln, ai as js, m as Pe, aj as Vo, ak as Zo, al as Yo, am as Ko, an as Xo, ao as Qs, ap as zo, aq as ti, ar as ei, as as ni, r as Jo } from "./mint-D4wMHU5r.js";
2
+ async function Hf(e, t, n, r, s, i) {
3
+ const o = gn();
4
4
  if (!o)
5
5
  throw new Error("No wallet connected");
6
6
  const a = Ir(o.provider);
@@ -62,7 +62,7 @@ function jo(e, t) {
62
62
  if (e.length < n)
63
63
  throw new Error('"digestInto() output" expected to be of length >=' + n);
64
64
  }
65
- function un(...e) {
65
+ function cn(...e) {
66
66
  for (let t = 0; t < e.length; t++)
67
67
  e[t].fill(0);
68
68
  }
@@ -73,7 +73,7 @@ function Ht(e, t) {
73
73
  return e << 32 - t | e >>> t;
74
74
  }
75
75
  const si = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", Qo = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
76
- function ln(e) {
76
+ function un(e) {
77
77
  if (ft(e), si)
78
78
  return e.toHex();
79
79
  let t = "";
@@ -163,10 +163,10 @@ function oi(e) {
163
163
  return e === "" ? Nr : BigInt("0x" + e);
164
164
  }
165
165
  function Kt(e) {
166
- return oi(ln(e));
166
+ return oi(un(e));
167
167
  }
168
168
  function ai(e) {
169
- return oi(ln(ui(ft(e)).reverse()));
169
+ return oi(un(ui(ft(e)).reverse()));
170
170
  }
171
171
  function mt(e, t) {
172
172
  Je(t), e = na(e);
@@ -531,7 +531,7 @@ class wa {
531
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
- n[o++] = 128, un(this.buffer.subarray(o)), this.padOffset > s - o && (this.process(r, 0), o = 0);
534
+ n[o++] = 128, cn(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);
@@ -661,10 +661,10 @@ class ya extends wa {
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);
662
662
  }
663
663
  roundClean() {
664
- un(he);
664
+ cn(he);
665
665
  }
666
666
  destroy() {
667
- this.set(0, 0, 0, 0, 0, 0, 0, 0), un(this.buffer);
667
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), cn(this.buffer);
668
668
  }
669
669
  }
670
670
  class ba extends ya {
@@ -906,8 +906,8 @@ function hr(e, t, n) {
906
906
  for (let w = 0; w < t; w++) {
907
907
  const h = new Array(i);
908
908
  for (let g = 0; g < i; g++) {
909
- const b = l * (g + w * i), v = d.subarray(b, b + l);
910
- h[g] = Pt(Ea(v), r);
909
+ const b = l * (g + w * i), S = d.subarray(b, b + l);
910
+ h[g] = Pt(Ea(S), r);
911
911
  }
912
912
  p[w] = h;
913
913
  }
@@ -982,7 +982,7 @@ class Oi {
982
982
  this.iHash.update(s), this.oHash = t.create();
983
983
  for (let i = 0; i < s.length; i++)
984
984
  s[i] ^= 106;
985
- this.oHash.update(s), un(s);
985
+ this.oHash.update(s), cn(s);
986
986
  }
987
987
  update(t) {
988
988
  return Fn(this), this.iHash.update(t), this;
@@ -1041,19 +1041,19 @@ function Ti(e, t = {}) {
1041
1041
  throw new Error("compression is not supported: Field does not have .isOdd()");
1042
1042
  }
1043
1043
  function f(U, y, x) {
1044
- const { x: B, y: R } = y.toAffine(), P = r.toBytes(B);
1044
+ const { x: v, y: R } = y.toAffine(), F = r.toBytes(v);
1045
1045
  if (jr(x, "isCompressed"), x) {
1046
1046
  l();
1047
1047
  const $ = !r.isOdd(R);
1048
- return ht(Ia($), P);
1048
+ return ht(Ia($), F);
1049
1049
  } else
1050
- return ht(Uint8Array.of(4), P, r.toBytes(R));
1050
+ return ht(Uint8Array.of(4), F, r.toBytes(R));
1051
1051
  }
1052
1052
  function d(U) {
1053
1053
  ft(U, void 0, "Point");
1054
- const { publicKey: y, publicKeyUncompressed: x } = u, B = U.length, R = U[0], P = U.subarray(1);
1055
- if (B === y && (R === 2 || R === 3)) {
1056
- const $ = r.fromBytes(P);
1054
+ const { publicKey: y, publicKeyUncompressed: x } = u, v = U.length, R = U[0], F = U.subarray(1);
1055
+ if (v === y && (R === 2 || R === 3)) {
1056
+ const $ = r.fromBytes(F);
1057
1057
  if (!r.isValid($))
1058
1058
  throw new Error("bad point: is not on curve, wrong x");
1059
1059
  const q = h($);
@@ -1067,13 +1067,13 @@ function Ti(e, t = {}) {
1067
1067
  l();
1068
1068
  const W = r.isOdd(k);
1069
1069
  return (R & 1) === 1 !== W && (k = r.neg(k)), { x: $, y: k };
1070
- } else if (B === x && R === 4) {
1071
- const $ = r.BYTES, q = r.fromBytes(P.subarray(0, $)), k = r.fromBytes(P.subarray($, $ * 2));
1070
+ } else if (v === x && R === 4) {
1071
+ const $ = r.BYTES, q = r.fromBytes(F.subarray(0, $)), k = r.fromBytes(F.subarray($, $ * 2));
1072
1072
  if (!g(q, k))
1073
1073
  throw new Error("bad point: is not on curve");
1074
1074
  return { x: q, y: k };
1075
1075
  } else
1076
- throw new Error(`bad point: got length ${B}, expected compressed=${y} or uncompressed=${x}`);
1076
+ throw new Error(`bad point: got length ${v}, expected compressed=${y} or uncompressed=${x}`);
1077
1077
  }
1078
1078
  const p = t.toBytes || f, w = t.fromBytes || d;
1079
1079
  function h(U) {
@@ -1081,20 +1081,20 @@ function Ti(e, t = {}) {
1081
1081
  return r.add(r.add(x, r.mul(U, i.a)), i.b);
1082
1082
  }
1083
1083
  function g(U, y) {
1084
- const x = r.sqr(y), B = h(U);
1085
- return r.eql(x, B);
1084
+ const x = r.sqr(y), v = h(U);
1085
+ return r.eql(x, v);
1086
1086
  }
1087
1087
  if (!g(i.Gx, i.Gy))
1088
1088
  throw new Error("bad curve params: generator point");
1089
- const b = r.mul(r.pow(i.a, He), Er), v = r.mul(r.sqr(i.b), BigInt(27));
1090
- if (r.is0(r.add(b, v)))
1089
+ const b = r.mul(r.pow(i.a, He), Er), S = r.mul(r.sqr(i.b), BigInt(27));
1090
+ if (r.is0(r.add(b, S)))
1091
1091
  throw new Error("bad curve params: a or b");
1092
1092
  function O(U, y, x = !1) {
1093
1093
  if (!r.isValid(y) || x && r.is0(y))
1094
1094
  throw new Error(`bad point coordinate ${U}`);
1095
1095
  return y;
1096
1096
  }
1097
- function F(U) {
1097
+ function A(U) {
1098
1098
  if (!(U instanceof _))
1099
1099
  throw new Error("Weierstrass Point expected");
1100
1100
  }
@@ -1103,14 +1103,14 @@ function Ti(e, t = {}) {
1103
1103
  throw new Error("no endo");
1104
1104
  return Ta(U, c.basises, s.ORDER);
1105
1105
  }
1106
- const A = xr((U, y) => {
1107
- const { X: x, Y: B, Z: R } = U;
1106
+ const P = xr((U, y) => {
1107
+ const { X: x, Y: v, Z: R } = U;
1108
1108
  if (r.eql(R, r.ONE))
1109
- return { x, y: B };
1110
- const P = U.is0();
1111
- y == null && (y = P ? r.ONE : r.inv(R));
1112
- const $ = r.mul(x, y), q = r.mul(B, y), k = r.mul(R, y);
1113
- if (P)
1109
+ return { x, y: v };
1110
+ const F = U.is0();
1111
+ y == null && (y = F ? r.ONE : r.inv(R));
1112
+ const $ = r.mul(x, y), q = r.mul(v, y), k = r.mul(R, y);
1113
+ if (F)
1114
1114
  return { x: r.ZERO, y: r.ZERO };
1115
1115
  if (!r.eql(k, r.ONE))
1116
1116
  throw new Error("invZ was invalid");
@@ -1130,8 +1130,8 @@ function Ti(e, t = {}) {
1130
1130
  throw new Error("bad point: not in prime-order subgroup");
1131
1131
  return !0;
1132
1132
  });
1133
- function I(U, y, x, B, R) {
1134
- return x = new _(r.mul(x.X, U), x.Y, x.Z), y = Wn(B, y), x = Wn(R, x), y.add(x);
1133
+ function I(U, y, x, v, R) {
1134
+ return x = new _(r.mul(x.X, U), x.Y, x.Z), y = Wn(v, y), x = Wn(R, x), y.add(x);
1135
1135
  }
1136
1136
  class _ {
1137
1137
  // base / generator point
@@ -1147,20 +1147,20 @@ function Ti(e, t = {}) {
1147
1147
  Y;
1148
1148
  Z;
1149
1149
  /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
1150
- constructor(y, x, B) {
1151
- this.X = O("x", y), this.Y = O("y", x, !0), this.Z = O("z", B), Object.freeze(this);
1150
+ constructor(y, x, v) {
1151
+ this.X = O("x", y), this.Y = O("y", x, !0), this.Z = O("z", v), Object.freeze(this);
1152
1152
  }
1153
1153
  static CURVE() {
1154
1154
  return i;
1155
1155
  }
1156
1156
  /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
1157
1157
  static fromAffine(y) {
1158
- const { x, y: B } = y || {};
1159
- if (!y || !r.isValid(x) || !r.isValid(B))
1158
+ const { x, y: v } = y || {};
1159
+ if (!y || !r.isValid(x) || !r.isValid(v))
1160
1160
  throw new Error("invalid affine point");
1161
1161
  if (y instanceof _)
1162
1162
  throw new Error("projective point not allowed");
1163
- return r.is0(x) && r.is0(B) ? _.ZERO : new _(x, B, r.ONE);
1163
+ return r.is0(x) && r.is0(v) ? _.ZERO : new _(x, v, r.ONE);
1164
1164
  }
1165
1165
  static fromBytes(y) {
1166
1166
  const x = _.fromAffine(w(ft(y, void 0, "point")));
@@ -1197,8 +1197,8 @@ function Ti(e, t = {}) {
1197
1197
  }
1198
1198
  /** Compare one point to another. */
1199
1199
  equals(y) {
1200
- F(y);
1201
- const { X: x, Y: B, Z: R } = this, { X: P, Y: $, Z: q } = y, k = r.eql(r.mul(x, q), r.mul(P, R)), W = r.eql(r.mul(B, q), r.mul($, R));
1200
+ A(y);
1201
+ const { X: x, Y: v, Z: R } = this, { X: F, Y: $, Z: q } = y, k = r.eql(r.mul(x, q), r.mul(F, R)), W = r.eql(r.mul(v, q), r.mul($, R));
1202
1202
  return k && W;
1203
1203
  }
1204
1204
  /** Flips point to one corresponding to (x, -y) in Affine coordinates. */
@@ -1210,23 +1210,23 @@ function Ti(e, t = {}) {
1210
1210
  // https://eprint.iacr.org/2015/1060, algorithm 3
1211
1211
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
1212
1212
  double() {
1213
- const { a: y, b: x } = i, B = r.mul(x, He), { X: R, Y: P, Z: $ } = this;
1214
- let q = r.ZERO, k = r.ZERO, W = r.ZERO, Z = r.mul(R, R), ct = r.mul(P, P), j = r.mul($, $), G = r.mul(R, P);
1215
- return G = r.add(G, G), W = r.mul(R, $), W = r.add(W, W), q = r.mul(y, W), k = r.mul(B, j), k = r.add(q, k), q = r.sub(ct, k), k = r.add(ct, k), k = r.mul(q, k), q = r.mul(G, q), W = r.mul(B, W), j = r.mul(y, j), G = r.sub(Z, j), G = r.mul(y, G), G = r.add(G, W), W = r.add(Z, Z), Z = r.add(W, Z), Z = r.add(Z, j), Z = r.mul(Z, G), k = r.add(k, Z), j = r.mul(P, $), j = r.add(j, j), Z = r.mul(j, G), q = r.sub(q, Z), W = r.mul(j, ct), W = r.add(W, W), W = r.add(W, W), new _(q, k, W);
1213
+ const { a: y, b: x } = i, v = r.mul(x, He), { X: R, Y: F, Z: $ } = this;
1214
+ let q = r.ZERO, k = r.ZERO, W = r.ZERO, Z = r.mul(R, R), ct = r.mul(F, F), j = r.mul($, $), G = r.mul(R, F);
1215
+ return G = r.add(G, G), W = r.mul(R, $), W = r.add(W, W), q = r.mul(y, W), k = r.mul(v, j), k = r.add(q, k), q = r.sub(ct, k), k = r.add(ct, k), k = r.mul(q, k), q = r.mul(G, q), W = r.mul(v, W), j = r.mul(y, j), G = r.sub(Z, j), G = r.mul(y, G), G = r.add(G, W), W = r.add(Z, Z), Z = r.add(W, Z), Z = r.add(Z, j), Z = r.mul(Z, G), k = r.add(k, Z), j = r.mul(F, $), j = r.add(j, j), Z = r.mul(j, G), q = r.sub(q, Z), W = r.mul(j, ct), W = r.add(W, W), W = r.add(W, W), new _(q, k, W);
1216
1216
  }
1217
1217
  // Renes-Costello-Batina exception-free addition formula.
1218
1218
  // There is 30% faster Jacobian formula, but it is not complete.
1219
1219
  // https://eprint.iacr.org/2015/1060, algorithm 1
1220
1220
  // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
1221
1221
  add(y) {
1222
- F(y);
1223
- const { X: x, Y: B, Z: R } = this, { X: P, Y: $, Z: q } = y;
1222
+ A(y);
1223
+ const { X: x, Y: v, Z: R } = this, { X: F, Y: $, Z: q } = y;
1224
1224
  let k = r.ZERO, W = r.ZERO, Z = r.ZERO;
1225
1225
  const ct = i.a, j = r.mul(i.b, He);
1226
- let G = r.mul(x, P), ut = r.mul(B, $), gt = r.mul(R, q), xt = r.add(x, B), Q = r.add(P, $);
1226
+ let G = r.mul(x, F), ut = r.mul(v, $), gt = r.mul(R, q), xt = r.add(x, v), Q = r.add(F, $);
1227
1227
  xt = r.mul(xt, Q), Q = r.add(G, ut), xt = r.sub(xt, Q), Q = r.add(x, R);
1228
- let rt = r.add(P, q);
1229
- return Q = r.mul(Q, rt), rt = r.add(G, gt), Q = r.sub(Q, rt), rt = r.add(B, R), k = r.add($, q), rt = r.mul(rt, k), k = r.add(ut, gt), rt = r.sub(rt, k), Z = r.mul(ct, Q), k = r.mul(j, gt), Z = r.add(k, Z), k = r.sub(ut, Z), Z = r.add(ut, Z), W = r.mul(k, Z), ut = r.add(G, G), ut = r.add(ut, G), gt = r.mul(ct, gt), Q = r.mul(j, Q), ut = r.add(ut, gt), gt = r.sub(G, gt), gt = r.mul(ct, gt), Q = r.add(Q, gt), G = r.mul(ut, Q), W = r.add(W, G), G = r.mul(rt, Q), k = r.mul(xt, k), k = r.sub(k, G), G = r.mul(xt, ut), Z = r.mul(rt, Z), Z = r.add(Z, G), new _(k, W, Z);
1228
+ let rt = r.add(F, q);
1229
+ return Q = r.mul(Q, rt), rt = r.add(G, gt), Q = r.sub(Q, rt), rt = r.add(v, R), k = r.add($, q), rt = r.mul(rt, k), k = r.add(ut, gt), rt = r.sub(rt, k), Z = r.mul(ct, Q), k = r.mul(j, gt), Z = r.add(k, Z), k = r.sub(ut, Z), Z = r.add(ut, Z), W = r.mul(k, Z), ut = r.add(G, G), ut = r.add(ut, G), gt = r.mul(ct, gt), Q = r.mul(j, Q), ut = r.add(ut, gt), gt = r.sub(G, gt), gt = r.mul(ct, gt), Q = r.add(Q, gt), G = r.mul(ut, Q), W = r.add(W, G), G = r.mul(rt, Q), k = r.mul(xt, k), k = r.sub(k, G), G = r.mul(xt, ut), Z = r.mul(rt, Z), Z = r.add(Z, G), new _(k, W, Z);
1230
1230
  }
1231
1231
  subtract(y) {
1232
1232
  return this.add(y.negate());
@@ -1247,16 +1247,16 @@ function Ti(e, t = {}) {
1247
1247
  const { endo: x } = t;
1248
1248
  if (!s.isValidNot0(y))
1249
1249
  throw new Error("invalid scalar: out of range");
1250
- let B, R;
1251
- const P = ($) => H.cached(this, $, (q) => Gn(_, q));
1250
+ let v, R;
1251
+ const F = ($) => H.cached(this, $, (q) => Gn(_, q));
1252
1252
  if (x) {
1253
- const { k1neg: $, k1: q, k2neg: k, k2: W } = M(y), { p: Z, f: ct } = P(q), { p: j, f: G } = P(W);
1254
- R = ct.add(G), B = I(x.beta, Z, j, $, k);
1253
+ const { k1neg: $, k1: q, k2neg: k, k2: W } = M(y), { p: Z, f: ct } = F(q), { p: j, f: G } = F(W);
1254
+ R = ct.add(G), v = I(x.beta, Z, j, $, k);
1255
1255
  } else {
1256
- const { p: $, f: q } = P(y);
1257
- B = $, R = q;
1256
+ const { p: $, f: q } = F(y);
1257
+ v = $, R = q;
1258
1258
  }
1259
- return Gn(_, [B, R])[0];
1259
+ return Gn(_, [v, R])[0];
1260
1260
  }
1261
1261
  /**
1262
1262
  * Non-constant-time multiplication. Uses double-and-add algorithm.
@@ -1264,27 +1264,27 @@ function Ti(e, t = {}) {
1264
1264
  * an exposed secret key e.g. sig verification, which works over *public* keys.
1265
1265
  */
1266
1266
  multiplyUnsafe(y) {
1267
- const { endo: x } = t, B = this;
1267
+ const { endo: x } = t, v = this;
1268
1268
  if (!s.isValid(y))
1269
1269
  throw new Error("invalid scalar: out of range");
1270
- if (y === Ce || B.is0())
1270
+ if (y === Ce || v.is0())
1271
1271
  return _.ZERO;
1272
1272
  if (y === It)
1273
- return B;
1273
+ return v;
1274
1274
  if (H.hasCache(this))
1275
1275
  return this.multiply(y);
1276
1276
  if (x) {
1277
- const { k1neg: R, k1: P, k2neg: $, k2: q } = M(y), { p1: k, p2: W } = _a(_, B, P, q);
1277
+ const { k1neg: R, k1: F, k2neg: $, k2: q } = M(y), { p1: k, p2: W } = _a(_, v, F, q);
1278
1278
  return I(x.beta, k, W, R, $);
1279
1279
  } else
1280
- return H.unsafe(B, y);
1280
+ return H.unsafe(v, y);
1281
1281
  }
1282
1282
  /**
1283
1283
  * Converts Projective point to affine (x, y) coordinates.
1284
1284
  * @param invertedZ Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch
1285
1285
  */
1286
1286
  toAffine(y) {
1287
- return A(this, y);
1287
+ return P(this, y);
1288
1288
  }
1289
1289
  /**
1290
1290
  * Checks whether Point is free of torsion elements (is in prime subgroup).
@@ -1305,7 +1305,7 @@ function Ti(e, t = {}) {
1305
1305
  return jr(y, "isCompressed"), this.assertValidity(), p(_, this, y);
1306
1306
  }
1307
1307
  toHex(y = !0) {
1308
- return ln(this.toBytes(y));
1308
+ return un(this.toBytes(y));
1309
1309
  }
1310
1310
  toString() {
1311
1311
  return `<Point ${this.is0() ? "ZERO" : this.toHex()}>`;
@@ -1324,33 +1324,33 @@ function Ra(e, t) {
1324
1324
  r += It;
1325
1325
  const s = r, i = re << s - It - It, o = i * re, a = (n - It) / o, c = (a - It) / re, u = o - It, l = i, f = e.pow(t, a), d = e.pow(t, (a + It) / re);
1326
1326
  let p = (w, h) => {
1327
- let g = f, b = e.pow(h, u), v = e.sqr(b);
1328
- v = e.mul(v, h);
1329
- let O = e.mul(w, v);
1330
- O = e.pow(O, c), O = e.mul(O, b), b = e.mul(O, h), v = e.mul(O, w);
1331
- let F = e.mul(v, b);
1332
- O = e.pow(F, l);
1327
+ let g = f, b = e.pow(h, u), S = e.sqr(b);
1328
+ S = e.mul(S, h);
1329
+ let O = e.mul(w, S);
1330
+ O = e.pow(O, c), O = e.mul(O, b), b = e.mul(O, h), S = e.mul(O, w);
1331
+ let A = e.mul(S, b);
1332
+ O = e.pow(A, l);
1333
1333
  let M = e.eql(O, e.ONE);
1334
- b = e.mul(v, d), O = e.mul(F, g), v = e.cmov(b, v, M), F = e.cmov(O, F, M);
1335
- for (let A = s; A > It; A--) {
1336
- let C = A - re;
1334
+ b = e.mul(S, d), O = e.mul(A, g), S = e.cmov(b, S, M), A = e.cmov(O, A, M);
1335
+ for (let P = s; P > It; P--) {
1336
+ let C = P - re;
1337
1337
  C = re << C - It;
1338
- let I = e.pow(F, C);
1338
+ let I = e.pow(A, C);
1339
1339
  const _ = e.eql(I, e.ONE);
1340
- b = e.mul(v, g), g = e.mul(g, g), I = e.mul(F, g), v = e.cmov(b, v, _), F = e.cmov(I, F, _);
1340
+ b = e.mul(S, g), g = e.mul(g, g), I = e.mul(A, g), S = e.cmov(b, S, _), A = e.cmov(I, A, _);
1341
1341
  }
1342
- return { isValid: M, value: v };
1342
+ return { isValid: M, value: S };
1343
1343
  };
1344
1344
  if (e.ORDER % Er === He) {
1345
1345
  const w = (e.ORDER - He) / Er, h = e.sqrt(e.neg(t));
1346
1346
  p = (g, b) => {
1347
- let v = e.sqr(b);
1347
+ let S = e.sqr(b);
1348
1348
  const O = e.mul(g, b);
1349
- v = e.mul(v, O);
1350
- let F = e.pow(v, w);
1351
- F = e.mul(F, O);
1352
- const M = e.mul(F, h), A = e.mul(e.sqr(F), b), C = e.eql(A, g);
1353
- let I = e.cmov(M, F, C);
1349
+ S = e.mul(S, O);
1350
+ let A = e.pow(S, w);
1351
+ A = e.mul(A, O);
1352
+ const M = e.mul(A, h), P = e.mul(e.sqr(A), b), C = e.eql(P, g);
1353
+ let I = e.cmov(M, A, C);
1354
1354
  return { isValid: C, value: I };
1355
1355
  };
1356
1356
  }
@@ -1371,8 +1371,8 @@ function Ii(e, t) {
1371
1371
  w = e.mul(a, o), w = e.mul(w, g), p = e.cmov(p, u, h), w = e.cmov(w, g, h);
1372
1372
  const b = e.isOdd(o) === e.isOdd(w);
1373
1373
  w = e.cmov(e.neg(w), w, b);
1374
- const v = Fe(e, [l], !0)[0];
1375
- return p = e.mul(p, v), { x: p, y: w };
1374
+ const S = Fe(e, [l], !0)[0];
1375
+ return p = e.mul(p, S), { x: p, y: w };
1376
1376
  };
1377
1377
  }
1378
1378
  function ka(e, t) {
@@ -1399,53 +1399,53 @@ function $a(e, t, n, r) {
1399
1399
  const { Fr: s, Fp2: i, Fp12: o } = e, { twistType: a, ateLoopSize: c, postPrecompute: u } = r;
1400
1400
  let l;
1401
1401
  if (a === "multiplicative")
1402
- l = (A, C, I, _, D, H) => o.mul014(_, A, i.mul(C, D), i.mul(I, H));
1402
+ l = (P, C, I, _, D, H) => o.mul014(_, P, i.mul(C, D), i.mul(I, H));
1403
1403
  else if (a === "divisive")
1404
- l = (A, C, I, _, D, H) => o.mul034(_, i.mul(I, H), i.mul(C, D), A);
1404
+ l = (P, C, I, _, D, H) => o.mul034(_, i.mul(I, H), i.mul(C, D), P);
1405
1405
  else
1406
1406
  throw new Error("bls: unknown twist type");
1407
1407
  const f = i.div(i.ONE, i.mul(i.ONE, is));
1408
- function d(A, C, I, _) {
1409
- const D = i.sqr(I), H = i.sqr(_), U = i.mulByB(i.mul(H, Ve)), y = i.mul(U, Ve), x = i.sub(i.sub(i.sqr(i.add(I, _)), H), D), B = i.sub(U, D), R = i.mul(i.sqr(C), Ve), P = i.neg(x);
1410
- return A.push([B, R, P]), C = i.mul(i.mul(i.mul(i.sub(D, y), C), I), f), I = i.sub(i.sqr(i.mul(i.add(D, y), f)), i.mul(i.sqr(U), Ve)), _ = i.mul(D, x), { Rx: C, Ry: I, Rz: _ };
1411
- }
1412
- function p(A, C, I, _, D, H) {
1413
- const U = i.sub(I, i.mul(H, _)), y = i.sub(C, i.mul(D, _)), x = i.sub(i.mul(U, D), i.mul(y, H)), B = i.neg(U), R = y;
1414
- A.push([x, B, R]);
1415
- const P = i.sqr(y), $ = i.mul(P, y), q = i.mul(P, C), k = i.add(i.sub($, i.mul(q, is)), i.mul(i.sqr(U), _));
1408
+ function d(P, C, I, _) {
1409
+ const D = i.sqr(I), H = i.sqr(_), U = i.mulByB(i.mul(H, Ve)), y = i.mul(U, Ve), x = i.sub(i.sub(i.sqr(i.add(I, _)), H), D), v = i.sub(U, D), R = i.mul(i.sqr(C), Ve), F = i.neg(x);
1410
+ return P.push([v, R, F]), C = i.mul(i.mul(i.mul(i.sub(D, y), C), I), f), I = i.sub(i.sqr(i.mul(i.add(D, y), f)), i.mul(i.sqr(U), Ve)), _ = i.mul(D, x), { Rx: C, Ry: I, Rz: _ };
1411
+ }
1412
+ function p(P, C, I, _, D, H) {
1413
+ const U = i.sub(I, i.mul(H, _)), y = i.sub(C, i.mul(D, _)), x = i.sub(i.mul(U, D), i.mul(y, H)), v = i.neg(U), R = y;
1414
+ P.push([x, v, R]);
1415
+ const F = i.sqr(y), $ = i.mul(F, y), q = i.mul(F, C), k = i.add(i.sub($, i.mul(q, is)), i.mul(i.sqr(U), _));
1416
1416
  return C = i.mul(y, k), I = i.sub(i.mul(i.sub(q, k), U), i.mul($, I)), _ = i.mul(_, $), { Rx: C, Ry: I, Rz: _ };
1417
1417
  }
1418
- const w = Ca(c), h = xr((A) => {
1419
- const C = A, { x: I, y: _ } = C.toAffine(), D = I, H = _, U = i.neg(_);
1420
- let y = D, x = H, B = i.ONE;
1418
+ const w = Ca(c), h = xr((P) => {
1419
+ const C = P, { x: I, y: _ } = C.toAffine(), D = I, H = _, U = i.neg(_);
1420
+ let y = D, x = H, v = i.ONE;
1421
1421
  const R = [];
1422
- for (const P of w) {
1422
+ for (const F of w) {
1423
1423
  const $ = [];
1424
- ({ Rx: y, Ry: x, Rz: B } = d($, y, x, B)), P && ({ Rx: y, Ry: x, Rz: B } = p($, y, x, B, D, P === -1 ? U : H)), R.push($);
1424
+ ({ Rx: y, Ry: x, Rz: v } = d($, y, x, v)), F && ({ Rx: y, Ry: x, Rz: v } = p($, y, x, v, D, F === -1 ? U : H)), R.push($);
1425
1425
  }
1426
1426
  if (u) {
1427
- const P = R[R.length - 1];
1428
- u(y, x, B, D, H, p.bind(null, P));
1427
+ const F = R[R.length - 1];
1428
+ u(y, x, v, D, H, p.bind(null, F));
1429
1429
  }
1430
1430
  return R;
1431
1431
  });
1432
- function g(A, C = !1) {
1432
+ function g(P, C = !1) {
1433
1433
  let I = o.ONE;
1434
- if (A.length) {
1435
- const _ = A[0][0].length;
1434
+ if (P.length) {
1435
+ const _ = P[0][0].length;
1436
1436
  for (let D = 0; D < _; D++) {
1437
1437
  I = o.sqr(I);
1438
- for (const [H, U, y] of A)
1439
- for (const [x, B, R] of H[D])
1440
- I = l(x, B, R, I, U, y);
1438
+ for (const [H, U, y] of P)
1439
+ for (const [x, v, R] of H[D])
1440
+ I = l(x, v, R, I, U, y);
1441
1441
  }
1442
1442
  }
1443
1443
  return I = o.conjugate(I), C ? o.finalExponentiate(I) : I;
1444
1444
  }
1445
- function b(A, C = !0) {
1445
+ function b(P, C = !0) {
1446
1446
  const I = [];
1447
- Gn(t, A.map(({ g1: _ }) => _)), Gn(n, A.map(({ g2: _ }) => _));
1448
- for (const { g1: _, g2: D } of A) {
1447
+ Gn(t, P.map(({ g1: _ }) => _)), Gn(n, P.map(({ g2: _ }) => _));
1448
+ for (const { g1: _, g2: D } of P) {
1449
1449
  if (_.is0() || D.is0())
1450
1450
  throw new Error("pairing is not available for ZERO point");
1451
1451
  _.assertValidity(), D.assertValidity();
@@ -1454,22 +1454,22 @@ function $a(e, t, n, r) {
1454
1454
  }
1455
1455
  return g(I, C);
1456
1456
  }
1457
- function v(A, C, I = !0) {
1458
- return b([{ g1: A, g2: C }], I);
1457
+ function S(P, C, I = !0) {
1458
+ return b([{ g1: P, g2: C }], I);
1459
1459
  }
1460
1460
  const O = {
1461
1461
  seed: mi(s.ORDER)
1462
- }, F = r.randomBytes || ii;
1462
+ }, A = r.randomBytes || ii;
1463
1463
  return {
1464
1464
  lengths: O,
1465
1465
  Fr: s,
1466
1466
  Fp12: o,
1467
1467
  // NOTE: we re-export Fp12 here because pairing results are Fp12!
1468
1468
  millerLoopBatch: g,
1469
- pairing: v,
1469
+ pairing: S,
1470
1470
  pairingBatch: b,
1471
1471
  calcPairingPrecomputes: h,
1472
- randomSecretKey: (A = F(O.seed)) => (ft(A, O.seed, "seed"), _i(A, s.ORDER))
1472
+ randomSecretKey: (P = A(O.seed)) => (ft(P, O.seed, "seed"), _i(P, s.ORDER))
1473
1473
  };
1474
1474
  }
1475
1475
  function os(e, t, n, r, s, i) {
@@ -1512,19 +1512,19 @@ function os(e, t, n, r, s, i) {
1512
1512
  sign(h, g, b) {
1513
1513
  if (b != null)
1514
1514
  throw new Error("sign() expects 2 arguments");
1515
- const v = t.Fn.fromBytes(g);
1516
- return p(h).assertValidity(), h.multiply(v);
1515
+ const S = t.Fn.fromBytes(g);
1516
+ return p(h).assertValidity(), h.multiply(S);
1517
1517
  },
1518
1518
  // Checks if pairing of public key & hash is equal to pairing of generator & signature.
1519
1519
  // e(P, H(m)) == e(G, S)
1520
1520
  // e(S, G) == e(H(m), P)
1521
- verify(h, g, b, v) {
1522
- if (v != null)
1521
+ verify(h, g, b, S) {
1522
+ if (S != null)
1523
1523
  throw new Error("verify() expects 3 arguments");
1524
1524
  h = d(h), b = f(b);
1525
- const O = b.negate(), F = t.BASE, M = p(g), A = h;
1525
+ const O = b.negate(), A = t.BASE, M = p(g), P = h;
1526
1526
  try {
1527
- const C = c([w(O, M), w(F, A)]);
1527
+ const C = c([w(O, M), w(A, P)]);
1528
1528
  return a.eql(C, a.ONE);
1529
1529
  } catch {
1530
1530
  return !1;
@@ -1535,19 +1535,19 @@ function os(e, t, n, r, s, i) {
1535
1535
  // TODO: maybe `{message: G2Hex, publicKey: G1Hex}[]` instead?
1536
1536
  verifyBatch(h, g) {
1537
1537
  wr(g);
1538
- const b = d(h), v = g.map((C) => C.message), O = g.map((C) => f(C.publicKey)), F = /* @__PURE__ */ new Map();
1538
+ const b = d(h), S = g.map((C) => C.message), O = g.map((C) => f(C.publicKey)), A = /* @__PURE__ */ new Map();
1539
1539
  for (let C = 0; C < O.length; C++) {
1540
- const I = O[C], _ = v[C];
1541
- let D = F.get(_);
1542
- D === void 0 && (D = [], F.set(_, D)), D.push(I);
1540
+ const I = O[C], _ = S[C];
1541
+ let D = A.get(_);
1542
+ D === void 0 && (D = [], A.set(_, D)), D.push(I);
1543
1543
  }
1544
- const M = [], A = t.BASE;
1544
+ const M = [], P = t.BASE;
1545
1545
  try {
1546
- for (const [C, I] of F) {
1546
+ for (const [C, I] of A) {
1547
1547
  const _ = I.reduce((D, H) => D.add(H));
1548
1548
  M.push(w(_, C));
1549
1549
  }
1550
- return M.push(w(A.negate(), b)), a.eql(c(M), a.ONE);
1550
+ return M.push(w(P.negate(), b)), a.eql(c(M), a.ONE);
1551
1551
  } catch {
1552
1552
  return !1;
1553
1553
  }
@@ -1556,14 +1556,14 @@ function os(e, t, n, r, s, i) {
1556
1556
  // pk1 + pk2 + pk3 = pkA
1557
1557
  aggregatePublicKeys(h) {
1558
1558
  wr(h), h = h.map((b) => f(b));
1559
- const g = h.reduce((b, v) => b.add(v), t.ZERO);
1559
+ const g = h.reduce((b, S) => b.add(S), 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
1565
  wr(h), h = h.map((b) => d(b));
1566
- const g = h.reduce((b, v) => b.add(v), n.ZERO);
1566
+ const g = h.reduce((b, S) => b.add(S), n.ZERO);
1567
1567
  return g.assertValidity(), g;
1568
1568
  },
1569
1569
  hash(h, g) {
@@ -2213,24 +2213,24 @@ function Ma(e) {
2213
2213
  const t = _n(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 _t = BigInt(0), Hn = BigInt(1), qt = BigInt(2), zn = BigInt(3), fn = BigInt(4), _e = BigInt("0xd201000000010000"), Wa = Dn(_e), en = {
2216
+ const _t = BigInt(0), Hn = BigInt(1), qt = BigInt(2), Xn = BigInt(3), ln = BigInt(4), _e = BigInt("0xd201000000010000"), Wa = Dn(_e), tn = {
2217
2217
  p: BigInt("0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab"),
2218
2218
  n: BigInt("0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001"),
2219
2219
  h: BigInt("0x396c8c005555e1568c00aaab0000aaab"),
2220
2220
  a: _t,
2221
- b: fn,
2221
+ b: ln,
2222
2222
  Gx: BigInt("0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb"),
2223
2223
  Gy: BigInt("0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1")
2224
- }, Pr = _n(en.n, {
2224
+ }, Pr = _n(tn.n, {
2225
2225
  modFromBytes: !0
2226
2226
  }), { Fp: N, Fp2: V, Fp6: Ga, Fp12: Y } = Ma({
2227
- ORDER: en.p,
2227
+ ORDER: tn.p,
2228
2228
  X_LEN: Wa,
2229
2229
  // Finite extension field over irreducible polynominal.
2230
2230
  // Fp(u) / (u² - β) where β = -1
2231
2231
  FP2_NONRESIDUE: [Hn, Hn],
2232
2232
  Fp2mulByB: ({ c0: e, c1: t }) => {
2233
- const n = N.mul(e, fn), r = N.mul(t, fn);
2233
+ const n = N.mul(e, ln), r = N.mul(t, ln);
2234
2234
  return { c0: N.sub(n, r), c1: N.add(n, r) };
2235
2235
  },
2236
2236
  Fp12finalExponentiate: (e) => {
@@ -2247,10 +2247,10 @@ const _t = BigInt(0), Hn = BigInt(1), qt = BigInt(2), zn = BigInt(3), fn = BigIn
2247
2247
  hash: xi
2248
2248
  }), Fr = {
2249
2249
  p: V.ORDER,
2250
- n: en.n,
2250
+ n: tn.n,
2251
2251
  h: BigInt("0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5"),
2252
2252
  a: V.ZERO,
2253
- b: V.fromBigTuple([fn, fn]),
2253
+ b: V.fromBigTuple([ln, ln]),
2254
2254
  Gx: V.fromBigTuple([
2255
2255
  BigInt("0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8"),
2256
2256
  BigInt("0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e")
@@ -2259,7 +2259,7 @@ const _t = BigInt(0), Hn = BigInt(1), qt = BigInt(2), zn = BigInt(3), fn = BigIn
2259
2259
  BigInt("0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801"),
2260
2260
  BigInt("0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be")
2261
2261
  ])
2262
- }, Xn = xn(N.toBytes(_t), { infinity: !0, compressed: !0 });
2262
+ }, zn = xn(N.toBytes(_t), { infinity: !0, compressed: !0 });
2263
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);
@@ -2274,7 +2274,7 @@ 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 Xn.slice();
2277
+ return zn.slice();
2278
2278
  const c = !!(a * qt / s);
2279
2279
  return xn(mt(o, r), { compressed: !0, sort: c });
2280
2280
  } else
@@ -2284,7 +2284,7 @@ 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 Xn.slice();
2287
+ return zn.slice();
2288
2288
  const i = !!(s * qt / n);
2289
2289
  return xn(mt(r, t), { compressed: !0, sort: i });
2290
2290
  }
@@ -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: _t, y: _t };
2299
2299
  }
2300
- const u = N.add(N.pow(c, zn), N.create(en.b));
2300
+ const u = N.add(N.pow(c, Xn), N.create(tn.b));
2301
2301
  let l = N.sqrt(u);
2302
2302
  if (!l)
2303
2303
  throw new Error("invalid G1 point: compressed point");
@@ -2317,7 +2317,7 @@ function fs(e) {
2317
2317
  const { infinity: t, sort: n, value: r } = Jn(ft(e, 48, "signature")), s = N.ORDER, i = T.G1.Point, o = Kt(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, Xn), N.create(tn.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(Xn, mt(_t, r));
2333
+ return ht(zn, mt(_t, r));
2334
2334
  const c = !!(a.c1 === _t ? a.c0 * qt / s : a.c1 * qt / s);
2335
2335
  return ht(xn(mt(o.c1, r), { compressed: !0, sort: c }), mt(o.c0, r));
2336
2336
  } else {
@@ -2344,7 +2344,7 @@ function br(e) {
2344
2344
  e.assertValidity();
2345
2345
  const { BYTES: t } = N;
2346
2346
  if (e.is0())
2347
- return ht(Xn, mt(_t, t));
2347
+ return ht(zn, mt(_t, 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 > _t ? a * qt : o * qt) / N.ORDER & Hn), l = s;
2349
2349
  return ht(xn(mt(i, t), { sort: u, compressed: !0 }), mt(l, t));
2350
2350
  }
@@ -2361,7 +2361,7 @@ function Ka(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, Xn), Fr.b);
2365
2365
  let d = V.sqrt(f);
2366
2366
  const p = d.c1 === _t ? d.c0 * qt / n : d.c1 * qt / n ? Hn : _t;
2367
2367
  return d = i && p > 0 ? d : V.neg(d), { x: l, y: d };
@@ -2383,16 +2383,16 @@ function ds(e) {
2383
2383
  const a = Kt(s.slice(0, o)), c = Kt(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, Xn), Fr.b);
2387
2387
  let p = V.sqrt(d);
2388
2388
  if (!p)
2389
2389
  throw new Error("Failed to find a square root");
2390
- const { re: w, im: h } = V.reim(p), g = BigInt(r), b = h > _t && h * qt / t !== g, v = h === _t && w * qt / t !== g;
2391
- (b || v) && (p = V.neg(p));
2390
+ const { re: w, im: h } = V.reim(p), g = BigInt(r), b = h > _t && h * qt / t !== g, S = h === _t && w * qt / t !== g;
2391
+ (b || S) && (p = V.neg(p));
2392
2392
  const O = i.fromAffine({ x: f, y: p });
2393
2393
  return O.assertValidity(), O;
2394
2394
  }
2395
- const za = {
2395
+ const Xa = {
2396
2396
  ShortSignature: {
2397
2397
  fromBytes(e) {
2398
2398
  return fs(ft(e));
@@ -2407,7 +2407,7 @@ const za = {
2407
2407
  return yr(e);
2408
2408
  },
2409
2409
  toHex(e) {
2410
- return ln(yr(e));
2410
+ return un(yr(e));
2411
2411
  }
2412
2412
  },
2413
2413
  LongSignature: {
@@ -2424,16 +2424,16 @@ const za = {
2424
2424
  return br(e);
2425
2425
  },
2426
2426
  toHex(e) {
2427
- return ln(br(e));
2427
+ return un(br(e));
2428
2428
  }
2429
2429
  }
2430
- }, Xa = {
2430
+ }, za = {
2431
2431
  Fp: N,
2432
2432
  Fp2: V,
2433
2433
  Fp6: Ga,
2434
2434
  Fp12: Y,
2435
2435
  Fr: Pr
2436
- }, Ja = Ti(en, {
2436
+ }, Ja = Ti(tn, {
2437
2437
  allowInfinityPoint: !0,
2438
2438
  Fn: Pr,
2439
2439
  fromBytes: Za,
@@ -2477,7 +2477,7 @@ const za = {
2477
2477
  // The BLS parameter x for BLS12-381
2478
2478
  twistType: "multiplicative",
2479
2479
  randomBytes: ii
2480
- }, T = Pa(Xa, Ja, ja, tc, Qa, za), ec = vi(V, [
2480
+ }, T = Pa(za, Ja, ja, tc, Qa, Xa), ec = vi(V, [
2481
2481
  // xNum
2482
2482
  [
2483
2483
  [
@@ -2650,7 +2650,7 @@ function cc(e, t, n, r = 32) {
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
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);
2653
+ return a.destroy(), c.destroy(), cn(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) {
@@ -2794,10 +2794,10 @@ function Ni(e, t, n) {
2794
2794
  function yt(e, t) {
2795
2795
  return Ni(e, t, !1);
2796
2796
  }
2797
- function zt(e, t) {
2797
+ function Xt(e, t) {
2798
2798
  return Ni(e, t, !0);
2799
2799
  }
2800
- function cn(e, t) {
2800
+ function an(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
2803
  const ws = "0123456789abcdef";
@@ -2814,7 +2814,7 @@ function xe(e) {
2814
2814
  return "0x" + e.map((t) => bt(t).substring(2)).join("");
2815
2815
  }
2816
2816
  function dc(e) {
2817
- return cn(e, !0) ? (e.length - 2) / 2 : yt(e).length;
2817
+ return an(e, !0) ? (e.length - 2) / 2 : yt(e).length;
2818
2818
  }
2819
2819
  function We(e, t, n) {
2820
2820
  const r = yt(e);
@@ -2854,7 +2854,7 @@ function pc(e, t) {
2854
2854
  return n;
2855
2855
  }
2856
2856
  function Li(e, t) {
2857
- let n = nn(e, "value");
2857
+ let n = en(e, "value");
2858
2858
  const r = BigInt(Ee(t, "width")), s = Mt << r - Mt;
2859
2859
  if (n < En) {
2860
2860
  n = -n, at(n <= s, "too low", "NUMERIC_FAULT", {
@@ -2876,7 +2876,7 @@ function In(e, t) {
2876
2876
  const n = jn(e, "value"), r = BigInt(Ee(t, "bits"));
2877
2877
  return n & (Mt << r) - Mt;
2878
2878
  }
2879
- function nn(e, t) {
2879
+ function en(e, t) {
2880
2880
  switch (typeof e) {
2881
2881
  case "bigint":
2882
2882
  return e;
@@ -2894,7 +2894,7 @@ function nn(e, t) {
2894
2894
  m(!1, "invalid BigNumberish value", t || "value", e);
2895
2895
  }
2896
2896
  function jn(e, t) {
2897
- const n = nn(e, t);
2897
+ const n = en(e, t);
2898
2898
  return at(n >= En, "unsigned value cannot be negative", "NUMERIC_FAULT", {
2899
2899
  fault: "overflow",
2900
2900
  operation: "getUint",
@@ -2909,7 +2909,7 @@ function Ai(e) {
2909
2909
  t += gs[n >> 4], t += gs[n & 15];
2910
2910
  return BigInt(t);
2911
2911
  }
2912
- return nn(e);
2912
+ return en(e);
2913
2913
  }
2914
2914
  function Ee(e, t) {
2915
2915
  switch (typeof e) {
@@ -3067,7 +3067,7 @@ function Re(e) {
3067
3067
  function ys(e, t) {
3068
3068
  qi.set(e, t);
3069
3069
  }
3070
- function on(e, t) {
3070
+ function sn(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
  }
@@ -3106,7 +3106,7 @@ class oe extends Array {
3106
3106
  if (d < 0 || d >= this.length)
3107
3107
  throw new RangeError("out of result range");
3108
3108
  const p = c[d];
3109
- return p instanceof Error && on(`index ${d}`, p), p;
3109
+ return p instanceof Error && sn(`index ${d}`, p), p;
3110
3110
  }
3111
3111
  if (xc.indexOf(u) >= 0)
3112
3112
  return Reflect.get(c, u, l);
@@ -3133,7 +3133,7 @@ class oe extends Array {
3133
3133
  toArray(t) {
3134
3134
  const n = [];
3135
3135
  return this.forEach((r, s) => {
3136
- r instanceof Error && on(`index ${s}`, r), t && r instanceof oe && (r = r.toArray(t)), n.push(r);
3136
+ r instanceof Error && sn(`index ${s}`, r), t && r instanceof oe && (r = r.toArray(t)), n.push(r);
3137
3137
  }), n;
3138
3138
  }
3139
3139
  /**
@@ -3167,7 +3167,7 @@ class oe extends Array {
3167
3167
  const r = Re(this), s = [], i = [];
3168
3168
  for (let o = 0; o < this.length; o++) {
3169
3169
  const a = this[o];
3170
- a instanceof Error && on(`index ${o}`, a), t.call(n, a, o, this) && (s.push(a), i.push(r[o]));
3170
+ a instanceof Error && sn(`index ${o}`, a), t.call(n, a, o, this) && (s.push(a), i.push(r[o]));
3171
3171
  }
3172
3172
  return new oe(Rn, s, i);
3173
3173
  }
@@ -3178,7 +3178,7 @@ class oe extends Array {
3178
3178
  const r = [];
3179
3179
  for (let s = 0; s < this.length; s++) {
3180
3180
  const i = this[s];
3181
- i instanceof Error && on(`index ${s}`, i), r.push(t.call(n, i, s, this));
3181
+ i instanceof Error && sn(`index ${s}`, i), r.push(t.call(n, i, s, this));
3182
3182
  }
3183
3183
  return r;
3184
3184
  }
@@ -3195,7 +3195,7 @@ class oe extends Array {
3195
3195
  if (n === -1)
3196
3196
  return;
3197
3197
  const r = this[n];
3198
- return r instanceof Error && on(`property ${JSON.stringify(t)}`, r.error), r;
3198
+ return r instanceof Error && sn(`property ${JSON.stringify(t)}`, r.error), r;
3199
3199
  }
3200
3200
  /**
3201
3201
  * Creates a new [[Result]] for %%items%% with each entry
@@ -3207,7 +3207,7 @@ class oe extends Array {
3207
3207
  }
3208
3208
  function bs(e) {
3209
3209
  let t = Fi(e);
3210
- return at(t.length <= vt, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: t, length: vt, offset: t.length }), t.length !== vt && (t = zt(xe([Sr.slice(t.length % vt), t]))), t;
3210
+ return at(t.length <= vt, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: t, length: vt, offset: t.length }), t.length !== vt && (t = Xt(xe([Sr.slice(t.length % vt), t]))), t;
3211
3211
  }
3212
3212
  class de {
3213
3213
  // The coder name:
@@ -3252,13 +3252,13 @@ class vr {
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(Xt(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 = Xt(t);
3260
3260
  const r = n.length % vt;
3261
- return r && (n = zt(xe([n, Sr.slice(r)]))), this.#n(n);
3261
+ return r && (n = Xt(xe([n, Sr.slice(r)]))), this.#n(n);
3262
3262
  }
3263
3263
  // Numeric item; pad on the left *to* WordSize
3264
3264
  writeValue(t) {
@@ -3285,7 +3285,7 @@ class Dr {
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 = Xt(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 Dr {
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: Xt(this.#t),
3307
3307
  offset: this.#e,
3308
3308
  length: t,
3309
3309
  info: {
@@ -3315,7 +3315,7 @@ class Dr {
3315
3315
  #o(t, n, r) {
3316
3316
  let s = Math.ceil(n / vt) * vt;
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: Xt(this.#t),
3319
3319
  length: this.#t.length,
3320
3320
  offset: this.#e + s
3321
3321
  })), this.#t.slice(this.#e, this.#e + s);
@@ -3395,12 +3395,12 @@ function kc(e, t = !1) {
3395
3395
  }
3396
3396
  return [n, r];
3397
3397
  }
3398
- const Nc = (e, t, n) => e << n | t >>> 32 - n, Cc = (e, t, n) => t << n | e >>> 32 - n, $c = (e, t, n) => t << n - 32 | e >>> 64 - n, Lc = (e, t, n) => e << n - 32 | t >>> 64 - n, [Wi, Gi, Hi] = [[], [], []], Ac = /* @__PURE__ */ BigInt(0), an = /* @__PURE__ */ BigInt(1), Pc = /* @__PURE__ */ BigInt(2), Fc = /* @__PURE__ */ BigInt(7), Uc = /* @__PURE__ */ BigInt(256), qc = /* @__PURE__ */ BigInt(113);
3399
- for (let e = 0, t = an, n = 1, r = 0; e < 24; e++) {
3398
+ const Nc = (e, t, n) => e << n | t >>> 32 - n, Cc = (e, t, n) => t << n | e >>> 32 - n, $c = (e, t, n) => t << n - 32 | e >>> 64 - n, Lc = (e, t, n) => e << n - 32 | t >>> 64 - n, [Wi, Gi, Hi] = [[], [], []], Ac = /* @__PURE__ */ BigInt(0), on = /* @__PURE__ */ BigInt(1), Pc = /* @__PURE__ */ BigInt(2), Fc = /* @__PURE__ */ BigInt(7), Uc = /* @__PURE__ */ BigInt(256), qc = /* @__PURE__ */ BigInt(113);
3399
+ for (let e = 0, t = on, n = 1, r = 0; e < 24; e++) {
3400
3400
  [n, r] = [r, (2 * n + 3 * r) % 5], Wi.push(2 * (5 * r + n)), Gi.push((e + 1) * (e + 2) / 2 % 64);
3401
3401
  let s = Ac;
3402
3402
  for (let i = 0; i < 7; i++)
3403
- t = (t << an ^ (t >> Fc) * qc) % Uc, t & Pc && (s ^= an << (an << /* @__PURE__ */ BigInt(i)) - an);
3403
+ t = (t << on ^ (t >> Fc) * qc) % Uc, t & Pc && (s ^= on << (on << /* @__PURE__ */ BigInt(i)) - on);
3404
3404
  Hi.push(s);
3405
3405
  }
3406
3406
  const [Dc, Mc] = /* @__PURE__ */ kc(Hi, !0), Es = (e, t, n) => n > 32 ? $c(e, t, n) : Nc(e, t, n), Ss = (e, t, n) => n > 32 ? Lc(e, t, n) : Cc(e, t, n);
@@ -3550,14 +3550,14 @@ const Kc = (function() {
3550
3550
  }
3551
3551
  return e;
3552
3552
  })();
3553
- function zc(e) {
3553
+ function Xc(e) {
3554
3554
  e = e.toLowerCase();
3555
3555
  let t = Vc;
3556
3556
  for (let n = 0; n < e.length; n++)
3557
3557
  t = t * Zc + Kc[e[n]];
3558
3558
  return t;
3559
3559
  }
3560
- function dn(e) {
3560
+ function fn(e) {
3561
3561
  if (m(typeof e == "string", "invalid address", "address", e), e.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
3562
3562
  e.startsWith("0x") || (e = "0x" + e);
3563
3563
  const t = Bs(e);
@@ -3565,7 +3565,7 @@ function dn(e) {
3565
3565
  }
3566
3566
  if (e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
3567
3567
  m(e.substring(2, 4) === Yc(e), "bad icap checksum", "address", e);
3568
- let t = zc(e.substring(4)).toString(16);
3568
+ let t = Xc(e.substring(4)).toString(16);
3569
3569
  for (; t.length < 40; )
3570
3570
  t = "0" + t;
3571
3571
  return Bs("0x" + t);
@@ -3577,7 +3577,7 @@ function E(e, t) {
3577
3577
  let n = !1;
3578
3578
  return t < 0 && (n = !0, t *= -1), new pt(se, `${n ? "" : "u"}int${t}`, e, { signed: n, width: t });
3579
3579
  }
3580
- function K(e, t) {
3580
+ function X(e, t) {
3581
3581
  return new pt(se, `bytes${t || ""}`, e, { size: t });
3582
3582
  }
3583
3583
  const Os = /* @__PURE__ */ Symbol.for("_ethers_typed");
@@ -4075,193 +4075,193 @@ class pt {
4075
4075
  * Return a new ``bytes1`` type for %%v%%.
4076
4076
  */
4077
4077
  static bytes1(t) {
4078
- return K(t, 1);
4078
+ return X(t, 1);
4079
4079
  }
4080
4080
  /**
4081
4081
  * Return a new ``bytes2`` type for %%v%%.
4082
4082
  */
4083
4083
  static bytes2(t) {
4084
- return K(t, 2);
4084
+ return X(t, 2);
4085
4085
  }
4086
4086
  /**
4087
4087
  * Return a new ``bytes3`` type for %%v%%.
4088
4088
  */
4089
4089
  static bytes3(t) {
4090
- return K(t, 3);
4090
+ return X(t, 3);
4091
4091
  }
4092
4092
  /**
4093
4093
  * Return a new ``bytes4`` type for %%v%%.
4094
4094
  */
4095
4095
  static bytes4(t) {
4096
- return K(t, 4);
4096
+ return X(t, 4);
4097
4097
  }
4098
4098
  /**
4099
4099
  * Return a new ``bytes5`` type for %%v%%.
4100
4100
  */
4101
4101
  static bytes5(t) {
4102
- return K(t, 5);
4102
+ return X(t, 5);
4103
4103
  }
4104
4104
  /**
4105
4105
  * Return a new ``bytes6`` type for %%v%%.
4106
4106
  */
4107
4107
  static bytes6(t) {
4108
- return K(t, 6);
4108
+ return X(t, 6);
4109
4109
  }
4110
4110
  /**
4111
4111
  * Return a new ``bytes7`` type for %%v%%.
4112
4112
  */
4113
4113
  static bytes7(t) {
4114
- return K(t, 7);
4114
+ return X(t, 7);
4115
4115
  }
4116
4116
  /**
4117
4117
  * Return a new ``bytes8`` type for %%v%%.
4118
4118
  */
4119
4119
  static bytes8(t) {
4120
- return K(t, 8);
4120
+ return X(t, 8);
4121
4121
  }
4122
4122
  /**
4123
4123
  * Return a new ``bytes9`` type for %%v%%.
4124
4124
  */
4125
4125
  static bytes9(t) {
4126
- return K(t, 9);
4126
+ return X(t, 9);
4127
4127
  }
4128
4128
  /**
4129
4129
  * Return a new ``bytes10`` type for %%v%%.
4130
4130
  */
4131
4131
  static bytes10(t) {
4132
- return K(t, 10);
4132
+ return X(t, 10);
4133
4133
  }
4134
4134
  /**
4135
4135
  * Return a new ``bytes11`` type for %%v%%.
4136
4136
  */
4137
4137
  static bytes11(t) {
4138
- return K(t, 11);
4138
+ return X(t, 11);
4139
4139
  }
4140
4140
  /**
4141
4141
  * Return a new ``bytes12`` type for %%v%%.
4142
4142
  */
4143
4143
  static bytes12(t) {
4144
- return K(t, 12);
4144
+ return X(t, 12);
4145
4145
  }
4146
4146
  /**
4147
4147
  * Return a new ``bytes13`` type for %%v%%.
4148
4148
  */
4149
4149
  static bytes13(t) {
4150
- return K(t, 13);
4150
+ return X(t, 13);
4151
4151
  }
4152
4152
  /**
4153
4153
  * Return a new ``bytes14`` type for %%v%%.
4154
4154
  */
4155
4155
  static bytes14(t) {
4156
- return K(t, 14);
4156
+ return X(t, 14);
4157
4157
  }
4158
4158
  /**
4159
4159
  * Return a new ``bytes15`` type for %%v%%.
4160
4160
  */
4161
4161
  static bytes15(t) {
4162
- return K(t, 15);
4162
+ return X(t, 15);
4163
4163
  }
4164
4164
  /**
4165
4165
  * Return a new ``bytes16`` type for %%v%%.
4166
4166
  */
4167
4167
  static bytes16(t) {
4168
- return K(t, 16);
4168
+ return X(t, 16);
4169
4169
  }
4170
4170
  /**
4171
4171
  * Return a new ``bytes17`` type for %%v%%.
4172
4172
  */
4173
4173
  static bytes17(t) {
4174
- return K(t, 17);
4174
+ return X(t, 17);
4175
4175
  }
4176
4176
  /**
4177
4177
  * Return a new ``bytes18`` type for %%v%%.
4178
4178
  */
4179
4179
  static bytes18(t) {
4180
- return K(t, 18);
4180
+ return X(t, 18);
4181
4181
  }
4182
4182
  /**
4183
4183
  * Return a new ``bytes19`` type for %%v%%.
4184
4184
  */
4185
4185
  static bytes19(t) {
4186
- return K(t, 19);
4186
+ return X(t, 19);
4187
4187
  }
4188
4188
  /**
4189
4189
  * Return a new ``bytes20`` type for %%v%%.
4190
4190
  */
4191
4191
  static bytes20(t) {
4192
- return K(t, 20);
4192
+ return X(t, 20);
4193
4193
  }
4194
4194
  /**
4195
4195
  * Return a new ``bytes21`` type for %%v%%.
4196
4196
  */
4197
4197
  static bytes21(t) {
4198
- return K(t, 21);
4198
+ return X(t, 21);
4199
4199
  }
4200
4200
  /**
4201
4201
  * Return a new ``bytes22`` type for %%v%%.
4202
4202
  */
4203
4203
  static bytes22(t) {
4204
- return K(t, 22);
4204
+ return X(t, 22);
4205
4205
  }
4206
4206
  /**
4207
4207
  * Return a new ``bytes23`` type for %%v%%.
4208
4208
  */
4209
4209
  static bytes23(t) {
4210
- return K(t, 23);
4210
+ return X(t, 23);
4211
4211
  }
4212
4212
  /**
4213
4213
  * Return a new ``bytes24`` type for %%v%%.
4214
4214
  */
4215
4215
  static bytes24(t) {
4216
- return K(t, 24);
4216
+ return X(t, 24);
4217
4217
  }
4218
4218
  /**
4219
4219
  * Return a new ``bytes25`` type for %%v%%.
4220
4220
  */
4221
4221
  static bytes25(t) {
4222
- return K(t, 25);
4222
+ return X(t, 25);
4223
4223
  }
4224
4224
  /**
4225
4225
  * Return a new ``bytes26`` type for %%v%%.
4226
4226
  */
4227
4227
  static bytes26(t) {
4228
- return K(t, 26);
4228
+ return X(t, 26);
4229
4229
  }
4230
4230
  /**
4231
4231
  * Return a new ``bytes27`` type for %%v%%.
4232
4232
  */
4233
4233
  static bytes27(t) {
4234
- return K(t, 27);
4234
+ return X(t, 27);
4235
4235
  }
4236
4236
  /**
4237
4237
  * Return a new ``bytes28`` type for %%v%%.
4238
4238
  */
4239
4239
  static bytes28(t) {
4240
- return K(t, 28);
4240
+ return X(t, 28);
4241
4241
  }
4242
4242
  /**
4243
4243
  * Return a new ``bytes29`` type for %%v%%.
4244
4244
  */
4245
4245
  static bytes29(t) {
4246
- return K(t, 29);
4246
+ return X(t, 29);
4247
4247
  }
4248
4248
  /**
4249
4249
  * Return a new ``bytes30`` type for %%v%%.
4250
4250
  */
4251
4251
  static bytes30(t) {
4252
- return K(t, 30);
4252
+ return X(t, 30);
4253
4253
  }
4254
4254
  /**
4255
4255
  * Return a new ``bytes31`` type for %%v%%.
4256
4256
  */
4257
4257
  static bytes31(t) {
4258
- return K(t, 31);
4258
+ return X(t, 31);
4259
4259
  }
4260
4260
  /**
4261
4261
  * Return a new ``bytes32`` type for %%v%%.
4262
4262
  */
4263
4263
  static bytes32(t) {
4264
- return K(t, 32);
4264
+ return X(t, 32);
4265
4265
  }
4266
4266
  /**
4267
4267
  * Return a new ``address`` type for %%v%%.
@@ -4327,7 +4327,7 @@ class pt {
4327
4327
  return t;
4328
4328
  }
4329
4329
  }
4330
- class Xc extends de {
4330
+ class zc extends de {
4331
4331
  constructor(t) {
4332
4332
  super("address", "address", t, !1);
4333
4333
  }
@@ -4337,14 +4337,14 @@ class Xc extends de {
4337
4337
  encode(t, n) {
4338
4338
  let r = pt.dereference(n, "string");
4339
4339
  try {
4340
- r = dn(r);
4340
+ r = fn(r);
4341
4341
  } catch (s) {
4342
4342
  return this._throwError(s.message, n);
4343
4343
  }
4344
4344
  return t.writeValue(r);
4345
4345
  }
4346
4346
  decode(t) {
4347
- return dn(Pi(t.readValue(), 20));
4347
+ return fn(Pi(t.readValue(), 20));
4348
4348
  }
4349
4349
  }
4350
4350
  class Jc extends de {
@@ -4393,7 +4393,7 @@ function Ki(e, t, n) {
4393
4393
  let a = e.appendWriter(s);
4394
4394
  return a += e.appendWriter(i), a;
4395
4395
  }
4396
- function zi(e, t) {
4396
+ function Xi(e, t) {
4397
4397
  let n = [], r = [], s = e.subReader(0);
4398
4398
  return t.forEach((i) => {
4399
4399
  let o = null;
@@ -4448,7 +4448,7 @@ class jc extends de {
4448
4448
  let r = [];
4449
4449
  for (let s = 0; s < n; s++)
4450
4450
  r.push(new Jc(this.coder));
4451
- return zi(t, r);
4451
+ return Xi(t, r);
4452
4452
  }
4453
4453
  }
4454
4454
  class Qc extends de {
@@ -4466,7 +4466,7 @@ class Qc extends de {
4466
4466
  return !!t.readValue();
4467
4467
  }
4468
4468
  }
4469
- class Xi extends de {
4469
+ class zi extends de {
4470
4470
  constructor(t, n) {
4471
4471
  super(t, t, n, !0);
4472
4472
  }
@@ -4474,7 +4474,7 @@ class Xi extends de {
4474
4474
  return "0x";
4475
4475
  }
4476
4476
  encode(t, n) {
4477
- n = zt(n);
4477
+ n = Xt(n);
4478
4478
  let r = t.writeValue(n.length);
4479
4479
  return r += t.writeBytes(n), r;
4480
4480
  }
@@ -4482,7 +4482,7 @@ class Xi extends de {
4482
4482
  return t.readBytes(t.readIndex(), !0);
4483
4483
  }
4484
4484
  }
4485
- class tu extends Xi {
4485
+ class tu extends zi {
4486
4486
  constructor(t) {
4487
4487
  super("bytes", t);
4488
4488
  }
@@ -4500,7 +4500,7 @@ class eu extends de {
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 = Xt(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) {
@@ -4534,7 +4534,7 @@ class au extends de {
4534
4534
  return 0;
4535
4535
  }
4536
4536
  encode(t, n) {
4537
- let r = nn(pt.dereference(n, this.type)), s = In(ou, vt * 8);
4537
+ let r = en(pt.dereference(n, this.type)), s = In(ou, vt * 8);
4538
4538
  if (this.signed) {
4539
4539
  let i = In(s, this.size * 8 - 1);
4540
4540
  (r > i || r < -(i + iu)) && this._throwError("value out-of-bounds", n), r = Li(r, 8 * vt);
@@ -4546,7 +4546,7 @@ class au extends de {
4546
4546
  return this.signed && (n = pc(n, this.size * 8)), n;
4547
4547
  }
4548
4548
  }
4549
- class cu extends Xi {
4549
+ class cu extends zi {
4550
4550
  constructor(t) {
4551
4551
  super("string", t);
4552
4552
  }
@@ -4590,17 +4590,17 @@ class Nn extends de {
4590
4590
  return Ki(t, this.coders, r);
4591
4591
  }
4592
4592
  decode(t) {
4593
- return zi(t, this.coders);
4593
+ return Xi(t, this.coders);
4594
4594
  }
4595
4595
  }
4596
- function pn(e) {
4596
+ function dn(e) {
4597
4597
  return tt(qr(e));
4598
4598
  }
4599
4599
  const uu = new RegExp("^bytes([0-9]+)$"), lu = new RegExp("^(u?int)([0-9]*)$"), fu = new RegExp("^(.*)\\[([0-9]*)\\]$");
4600
4600
  function Ji(e, t, n) {
4601
4601
  switch (e) {
4602
4602
  case "address":
4603
- return yt(n ? An(t, 32) : dn(t));
4603
+ return yt(n ? An(t, 32) : fn(t));
4604
4604
  case "string":
4605
4605
  return qr(t);
4606
4606
  case "bytes":
@@ -4828,7 +4828,7 @@ function ue(e, t) {
4828
4828
  function io(e) {
4829
4829
  if (e.peekType("AT")) {
4830
4830
  if (e.pop(), e.peekType("NUMBER"))
4831
- return nn(e.pop().text);
4831
+ return en(e.pop().text);
4832
4832
  throw new Error("invalid gas");
4833
4833
  }
4834
4834
  return null;
@@ -5223,7 +5223,7 @@ class tr extends Ae {
5223
5223
  super(t, n, s), m(typeof r == "string" && r.match(no), "invalid identifier", "name", r), s = Object.freeze(s.slice()), st(this, { name: r });
5224
5224
  }
5225
5225
  }
5226
- function hn(e, t) {
5226
+ function pn(e, t) {
5227
5227
  return "(" + t.map((n) => n.format(e)).join(e === "full" ? ", " : ",") + ")";
5228
5228
  }
5229
5229
  class Rt extends tr {
@@ -5237,7 +5237,7 @@ class Rt extends tr {
5237
5237
  * The Custom Error selector.
5238
5238
  */
5239
5239
  get selector() {
5240
- return pn(this.format("sighash")).substring(0, 10);
5240
+ return dn(this.format("sighash")).substring(0, 10);
5241
5241
  }
5242
5242
  /**
5243
5243
  * Returns a string representation of this fragment as %%format%%.
@@ -5250,7 +5250,7 @@ class Rt extends tr {
5250
5250
  inputs: this.inputs.map((r) => JSON.parse(r.format(t)))
5251
5251
  });
5252
5252
  const n = [];
5253
- return t !== "sighash" && n.push("error"), n.push(this.name + hn(t, this.inputs)), n.join(" ");
5253
+ return t !== "sighash" && n.push("error"), n.push(this.name + pn(t, this.inputs)), n.join(" ");
5254
5254
  }
5255
5255
  /**
5256
5256
  * Returns a new **ErrorFragment** for %%obj%%.
@@ -5289,7 +5289,7 @@ class Vt extends tr {
5289
5289
  * The Event topic hash.
5290
5290
  */
5291
5291
  get topicHash() {
5292
- return pn(this.format("sighash"));
5292
+ return dn(this.format("sighash"));
5293
5293
  }
5294
5294
  /**
5295
5295
  * Returns a string representation of this event as %%format%%.
@@ -5303,7 +5303,7 @@ class Vt extends tr {
5303
5303
  inputs: this.inputs.map((r) => JSON.parse(r.format(t)))
5304
5304
  });
5305
5305
  const n = [];
5306
- return t !== "sighash" && n.push("event"), n.push(this.name + hn(t, this.inputs)), t !== "sighash" && this.anonymous && n.push("anonymous"), n.join(" ");
5306
+ return t !== "sighash" && n.push("event"), n.push(this.name + pn(t, this.inputs)), t !== "sighash" && this.anonymous && n.push("anonymous"), n.join(" ");
5307
5307
  }
5308
5308
  /**
5309
5309
  * Return the topic hash for an event with %%name%% and %%params%%.
@@ -5364,7 +5364,7 @@ class ae extends Ae {
5364
5364
  gas: this.gas != null ? this.gas : void 0,
5365
5365
  inputs: this.inputs.map((r) => JSON.parse(r.format(t)))
5366
5366
  });
5367
- const n = [`constructor${hn(t, this.inputs)}`];
5367
+ const n = [`constructor${pn(t, this.inputs)}`];
5368
5368
  return this.payable && n.push("payable"), this.gas != null && n.push(`@${this.gas.toString()}`), n.join(" ");
5369
5369
  }
5370
5370
  /**
@@ -5488,7 +5488,7 @@ class Zt extends tr {
5488
5488
  * The Function selector.
5489
5489
  */
5490
5490
  get selector() {
5491
- return pn(this.format("sighash")).substring(0, 10);
5491
+ return dn(this.format("sighash")).substring(0, 10);
5492
5492
  }
5493
5493
  /**
5494
5494
  * Returns a string representation of this function as %%format%%.
@@ -5506,7 +5506,7 @@ class Zt extends tr {
5506
5506
  outputs: this.outputs.map((r) => JSON.parse(r.format(t)))
5507
5507
  });
5508
5508
  const n = [];
5509
- return t !== "sighash" && n.push("function"), n.push(this.name + hn(t, this.inputs)), t !== "sighash" && (this.stateMutability !== "nonpayable" && n.push(this.stateMutability), this.outputs && this.outputs.length && (n.push("returns"), n.push(hn(t, this.outputs))), this.gas != null && n.push(`@${this.gas.toString()}`)), n.join(" ");
5509
+ return t !== "sighash" && n.push("function"), n.push(this.name + pn(t, this.inputs)), t !== "sighash" && (this.stateMutability !== "nonpayable" && n.push(this.stateMutability), this.outputs && this.outputs.length && (n.push("returns"), n.push(pn(t, this.outputs))), this.gas != null && n.push(`@${this.gas.toString()}`)), n.join(" ");
5510
5510
  }
5511
5511
  /**
5512
5512
  * Return the selector for a function with %%name%% and %%params%%.
@@ -5631,10 +5631,10 @@ function Ou(e, t, n, r) {
5631
5631
  s += " (unknown custom error)";
5632
5632
  }
5633
5633
  const c = {
5634
- to: t.to ? dn(t.to) : null,
5634
+ to: t.to ? fn(t.to) : null,
5635
5635
  data: t.data || "0x"
5636
5636
  };
5637
- return t.from && (c.from = dn(t.from)), Ri(s, "CALL_EXCEPTION", {
5637
+ return t.from && (c.from = fn(t.from)), Ri(s, "CALL_EXCEPTION", {
5638
5638
  action: e,
5639
5639
  data: n,
5640
5640
  reason: i,
@@ -5651,7 +5651,7 @@ class fe {
5651
5651
  return new Nn(t.components.map((r) => this.#t(r)), t.name);
5652
5652
  switch (t.baseType) {
5653
5653
  case "address":
5654
- return new Xc(t.name);
5654
+ return new zc(t.name);
5655
5655
  case "bool":
5656
5656
  return new Qc(t.name);
5657
5657
  case "string":
@@ -5981,7 +5981,7 @@ class ge {
5981
5981
  }
5982
5982
  // Find a function definition by any means necessary (unless it is ambiguous)
5983
5983
  #s(t, n, r) {
5984
- if (cn(t)) {
5984
+ if (an(t)) {
5985
5985
  const i = t.toLowerCase();
5986
5986
  for (const o of this.#n.values())
5987
5987
  if (i === o.selector)
@@ -6079,7 +6079,7 @@ class ge {
6079
6079
  }
6080
6080
  // Find an event definition by any means necessary (unless it is ambiguous)
6081
6081
  #i(t, n, r) {
6082
- if (cn(t)) {
6082
+ if (an(t)) {
6083
6083
  const i = t.toLowerCase();
6084
6084
  for (const o of this.#e.values())
6085
6085
  if (i === o.topicHash)
@@ -6169,7 +6169,7 @@ class ge {
6169
6169
  * the ABI, this will throw.
6170
6170
  */
6171
6171
  getError(t, n) {
6172
- if (cn(t)) {
6172
+ if (an(t)) {
6173
6173
  const s = t.toLowerCase();
6174
6174
  if (Ds[s])
6175
6175
  return Rt.from(Ds[s].signature);
@@ -6331,7 +6331,7 @@ class ge {
6331
6331
  m(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 = Xt(n);
6335
6335
  if (s.length % 32 === 0)
6336
6336
  try {
6337
6337
  return this.#r.decode(t.outputs, s);
@@ -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]), An(bt(o), 32));
6423
+ const s = (i, o) => i.type === "string" ? dn(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) {
@@ -6442,7 +6442,7 @@ class ge {
6442
6442
  const c = n[a];
6443
6443
  if (o.indexed)
6444
6444
  if (o.type === "string")
6445
- r.push(pn(c));
6445
+ r.push(dn(c));
6446
6446
  else if (o.type === "bytes")
6447
6447
  r.push(tt(c));
6448
6448
  else {
@@ -6465,7 +6465,7 @@ class ge {
6465
6465
  }
6466
6466
  if (r != null && !t.anonymous) {
6467
6467
  const p = t.topicHash;
6468
- m(cn(r[0], 32) && r[0].toLowerCase() === p, "fragment/topic mismatch", "topics[0]", r[0]), r = r.slice(1);
6468
+ m(an(r[0], 32) && r[0].toLowerCase() === p, "fragment/topic mismatch", "topics[0]", r[0]), r = r.slice(1);
6469
6469
  }
6470
6470
  const s = [], i = [], o = [];
6471
6471
  t.inputs.forEach((p, w) => {
@@ -6502,7 +6502,7 @@ class ge {
6502
6502
  * If the matching function cannot be found, return null.
6503
6503
  */
6504
6504
  parseTransaction(t) {
6505
- const n = yt(t.data, "tx.data"), r = nn(t.value != null ? t.value : 0, "tx.value"), s = this.getFunction(bt(n.slice(0, 4)));
6505
+ const n = yt(t.data, "tx.data"), r = en(t.value != null ? t.value : 0, "tx.value"), s = this.getFunction(bt(n.slice(0, 4)));
6506
6506
  if (!s)
6507
6507
  return null;
6508
6508
  const i = this.#r.decode(s.inputs, n.slice(4));
@@ -6729,10 +6729,21 @@ class qu {
6729
6729
  }
6730
6730
  }
6731
6731
  const L = new Uu(), it = new qu();
6732
- function Sn(e) {
6733
- if (wt === "" || Gr === "")
6734
- throw new Error("Uniswap info not set");
6735
- L.clear(e), it.clear(e);
6732
+ let Gs = Promise.resolve();
6733
+ async function Sn(e) {
6734
+ const t = Gs;
6735
+ let n;
6736
+ Gs = new Promise((r) => {
6737
+ n = r;
6738
+ }), await t;
6739
+ try {
6740
+ if (wt === "" || Gr === "")
6741
+ throw new Error("Uniswap info not set");
6742
+ L.clear(e), it.clear(e);
6743
+ } catch (r) {
6744
+ throw n(), r;
6745
+ }
6746
+ return n;
6736
6747
  }
6737
6748
  function lo(e, t) {
6738
6749
  return e < t ? e + t : t + e;
@@ -6758,7 +6769,7 @@ async function Wu(e, t) {
6758
6769
  throw new Error("Invalid path");
6759
6770
  const n = [e];
6760
6771
  for (let r = 0; r < t.length - 1; r++) {
6761
- const { reserveA: s, reserveB: i } = await Xt(t[r], t[r + 1]), o = Du(n[r], s, i);
6772
+ const { reserveA: s, reserveB: i } = await zt(t[r], t[r + 1]), o = Du(n[r], s, i);
6762
6773
  n.push(o);
6763
6774
  }
6764
6775
  return n;
@@ -6769,19 +6780,19 @@ async function Gu(e, t) {
6769
6780
  const n = [];
6770
6781
  n[t.length - 1] = e;
6771
6782
  for (let r = t.length - 1; r > 0; r--) {
6772
- const { reserveA: s, reserveB: i } = await Xt(t[r - 1], t[r]), o = Mu(n[r], s, i);
6783
+ const { reserveA: s, reserveB: i } = await zt(t[r - 1], t[r]), o = Mu(n[r], s, i);
6773
6784
  n[r - 1] = o;
6774
6785
  }
6775
6786
  return n;
6776
6787
  }
6777
- function Gs(e, t, n) {
6788
+ function Hs(e, t, n) {
6778
6789
  if (e <= 0n)
6779
6790
  throw new Error("Insufficient amount");
6780
6791
  if (t <= 0n || n <= 0n)
6781
6792
  throw new Error("Insufficient liquidity");
6782
6793
  return e * n / t;
6783
6794
  }
6784
- async function Xt(e, t) {
6795
+ async function zt(e, t) {
6785
6796
  const n = await it.get(e, t);
6786
6797
  if (!n)
6787
6798
  throw new Error("Reserves not found for pair");
@@ -6801,7 +6812,7 @@ async function Vu(e, t, n, r) {
6801
6812
  reserveA: s,
6802
6813
  reserveB: i,
6803
6814
  total_supply: o
6804
- } = await Xt(e, t), a = s - n, c = i - r;
6815
+ } = await zt(e, t), a = s - n, c = i - r;
6805
6816
  let u;
6806
6817
  if (o === 0n) {
6807
6818
  u = Pu(n * r) - 1000n;
@@ -6829,17 +6840,17 @@ async function Zu(e, t, n, r, s, i) {
6829
6840
  } catch {
6830
6841
  it.set(e, t, { reserveA: 0n, reserveB: 0n, total_supply: 0n });
6831
6842
  }
6832
- const { reserveA: c, reserveB: u } = await Xt(e, t);
6843
+ const { reserveA: c, reserveB: u } = await zt(e, t);
6833
6844
  if (c === 0n && u === 0n)
6834
6845
  o = n, a = r;
6835
6846
  else {
6836
- const l = Gs(n, c, u);
6847
+ const l = Hs(n, c, u);
6837
6848
  if (l <= r) {
6838
6849
  if (l < i)
6839
6850
  throw new Error("Insufficient B amount");
6840
6851
  o = n, a = l;
6841
6852
  } else {
6842
- const f = Gs(r, u, c);
6853
+ const f = Hs(r, u, c);
6843
6854
  if (f > n || f < s)
6844
6855
  throw new Error("Insufficient A amount");
6845
6856
  o = f, a = r;
@@ -6873,7 +6884,7 @@ async function Ku(e, t, n) {
6873
6884
  reserveA: r,
6874
6885
  reserveB: s,
6875
6886
  total_supply: i
6876
- } = await Xt(e, t), o = n * r / i, a = n * s / i;
6887
+ } = await zt(e, t), o = n * r / i, a = n * s / i;
6877
6888
  if (o <= 0n || a <= 0n)
6878
6889
  throw new Error("Insufficient liquidity burned");
6879
6890
  const c = await it.get(e, t), u = c.total_supply - n;
@@ -6884,10 +6895,10 @@ async function Ku(e, t, n) {
6884
6895
  total_supply: u
6885
6896
  }), { amountA: o, amountB: a };
6886
6897
  }
6887
- async function zu(e, t, n, r, s, i, o, a) {
6898
+ async function Xu(e, t, n, r, s, i, o, a) {
6888
6899
  if (s <= 0n && i <= 0n)
6889
6900
  throw new Error("Insufficient output amount");
6890
- const { reserveA: c, reserveB: u } = await Xt(e, t), l = c - n, f = u - r;
6901
+ const { reserveA: c, reserveB: u } = await zt(e, t), l = c - n, f = u - r;
6891
6902
  if (s >= l || i >= f)
6892
6903
  throw new Error("Insufficient liquidity");
6893
6904
  const d = await it.get(e, t);
@@ -6896,12 +6907,12 @@ async function zu(e, t, n, r, s, i, o, a) {
6896
6907
  reserveB: d.reserveB - i,
6897
6908
  total_supply: d.total_supply
6898
6909
  }), o !== null) {
6899
- const O = o[0], F = o[1], M = await it.get(O, F);
6900
- a ? it.set(O, F, {
6910
+ const O = o[0], A = o[1], M = await it.get(O, A);
6911
+ a ? it.set(O, A, {
6901
6912
  reserveA: M.reserveA + i,
6902
6913
  reserveB: M.reserveB + s,
6903
6914
  total_supply: M.total_supply
6904
- }) : it.set(O, F, {
6915
+ }) : it.set(O, A, {
6905
6916
  reserveA: M.reserveA + s,
6906
6917
  reserveB: M.reserveB + i,
6907
6918
  total_supply: M.total_supply
@@ -6910,8 +6921,8 @@ async function zu(e, t, n, r, s, i, o, a) {
6910
6921
  const p = (await it.get(e, t)).reserveA, w = (await it.get(e, t)).reserveB, h = p > l - s ? p - (l - s) : 0n, g = w > f - i ? w - (f - i) : 0n;
6911
6922
  if (h <= 0n && g <= 0n)
6912
6923
  throw new Error("Insufficient input amount");
6913
- const b = p * 1000n - h * 3n, v = w * 1000n - g * 3n;
6914
- if (b * v < BigInt(l) * BigInt(f) * 1000n * 1000n)
6924
+ const b = p * 1000n - h * 3n, S = w * 1000n - g * 3n;
6925
+ if (b * S < BigInt(l) * BigInt(f) * 1000n * 1000n)
6915
6926
  throw new Error("K");
6916
6927
  }
6917
6928
  async function fo(e, t) {
@@ -6934,10 +6945,10 @@ async function fo(e, t) {
6934
6945
  if (s === void 0 || i === void 0 || o === void 0 || a === void 0)
6935
6946
  throw new Error("Undefined value in swap path or amounts");
6936
6947
  const c = s < i ? o : 0n, u = s < i ? 0n : o, l = s < i ? 0n : a, f = s < i ? a : 0n, d = s < i ? s : i, p = s < i ? i : s, w = r < t.length - 2 ? [i, t[r + 2]] : null, h = w === null ? null : i >= t[r + 2];
6937
- await zu(d, p, c, u, l, f, w, h);
6948
+ await Xu(d, p, c, u, l, f, w, h);
6938
6949
  }
6939
6950
  }
6940
- async function Xu(e, t, n) {
6951
+ async function zu(e, t, n) {
6941
6952
  if (n.length < 2)
6942
6953
  throw new Error("Invalid path");
6943
6954
  const r = await Wu(e, n);
@@ -6964,19 +6975,20 @@ async function ju(e, t, n, r, s) {
6964
6975
  function Qu(e, t, n, r, s, i, o, a, c, u, l, f) {
6965
6976
  if (f === "")
6966
6977
  return !0;
6967
- let d = tt(S.from(e, "hex")).slice(2);
6978
+ let d = tt(B.from(e, "hex")).slice(2);
6968
6979
  d += t.toString(16).padStart(8, "0"), d += "01", d += n.slice(2).padStart(40, "0"), d += r.slice(2).padStart(40, "0"), d += s.toString(16).padStart(64, "0"), d += i.toString(16).padStart(64, "0"), d += o.toString(16).padStart(64, "0"), d += a.toString(16).padStart(64, "0"), d += c.toString(16).padStart(64, "0"), d += u.toString(16).padStart(64, "0"), d += l.toString(16).padStart(64, "0");
6969
- const p = S.from(d, "hex"), w = T.G1.hashToCurve(p, {
6980
+ const p = B.from(d, "hex"), w = T.G1.hashToCurve(p, {
6970
6981
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
6971
- }), h = BigInt(`0x${f.slice(0, 128)}`), g = BigInt(`0x${f.slice(128, 256)}`), b = new T.G1.Point(h, g, BigInt(1)), v = BigInt(`0x${e.slice(0, 128)}`), O = BigInt(`0x${e.slice(128, 256)}`), F = BigInt(`0x${e.slice(256, 384)}`), M = BigInt(`0x${e.slice(384, 512)}`), A = new T.G2.Point(
6972
- T.fields.Fp2.create({ c0: v, c1: O }),
6973
- T.fields.Fp2.create({ c0: F, c1: M }),
6982
+ }), h = BigInt(`0x${f.slice(0, 128)}`), g = BigInt(`0x${f.slice(128, 256)}`), b = new T.G1.Point(h, g, BigInt(1)), S = BigInt(`0x${e.slice(0, 128)}`), O = BigInt(`0x${e.slice(128, 256)}`), A = BigInt(`0x${e.slice(256, 384)}`), M = BigInt(`0x${e.slice(384, 512)}`), P = new T.G2.Point(
6983
+ T.fields.Fp2.create({ c0: S, c1: O }),
6984
+ T.fields.Fp2.create({ c0: A, c1: M }),
6974
6985
  T.fields.Fp2.ONE
6975
6986
  );
6976
- return T.shortSignatures.verify(b, w, A);
6987
+ return T.shortSignatures.verify(b, w, P);
6977
6988
  }
6978
6989
  async function tl(e, t, n, r, s, i, o, a, c, u, l, f, d) {
6979
- n = n.toLowerCase(), r = r.toLowerCase(), t = t.startsWith("0x") ? t.slice(2) : t, c = c.startsWith("0x") ? c.slice(2) : c, Sn(e);
6990
+ n = n.toLowerCase(), r = r.toLowerCase(), t = t.startsWith("0x") ? t.slice(2) : t, c = c.startsWith("0x") ? c.slice(2) : c;
6991
+ const p = await Sn(e);
6980
6992
  try {
6981
6993
  if (!Qu(
6982
6994
  t,
@@ -6993,26 +7005,26 @@ async function tl(e, t, n, r, s, i, o, a, c, u, l, f, d) {
6993
7005
  c
6994
7006
  ))
6995
7007
  throw new Error("Invalid BLS signature");
6996
- const { amountA: p, amountB: w, liquidity: h } = await Yu(
7008
+ const { amountA: w, amountB: h, liquidity: g } = await Yu(
6997
7009
  n,
6998
7010
  r,
6999
7011
  s,
7000
7012
  i,
7001
7013
  o,
7002
7014
  a
7003
- ), g = lo(n, r);
7015
+ ), b = lo(n, r);
7004
7016
  return L.setCheckPositive(
7005
7017
  t,
7006
7018
  n,
7007
- (await L.get(t, n) || 0n) - p
7019
+ (await L.get(t, n) || 0n) - w
7008
7020
  ), L.setCheckPositive(
7009
7021
  t,
7010
7022
  r,
7011
- (await L.get(t, r) || 0n) - w
7023
+ (await L.get(t, r) || 0n) - h
7012
7024
  ), L.setCheckPositive(
7013
7025
  t,
7014
- g,
7015
- (await L.get(t, g) || 0n) + h
7026
+ b,
7027
+ (await L.get(t, b) || 0n) + g
7016
7028
  ), L.setCheckPositive(
7017
7029
  t,
7018
7030
  wt,
@@ -7020,32 +7032,35 @@ async function tl(e, t, n, r, s, i, o, a, c, u, l, f, d) {
7020
7032
  ), L.setCheckPositive(
7021
7033
  t,
7022
7034
  n,
7023
- (await L.get(t, n) || 0n) - p * l / 10000n
7035
+ (await L.get(t, n) || 0n) - w * l / 10000n
7024
7036
  ), L.setCheckPositive(
7025
7037
  t,
7026
7038
  r,
7027
- (await L.get(t, r) || 0n) - w * f / 10000n
7028
- ), { success: !0, data: { amountA: p, amountB: w, liquidity: h } };
7029
- } catch (p) {
7030
- return console.error("Error in add_liquidity_request:", p), { success: !1, error_message: p.message };
7039
+ (await L.get(t, r) || 0n) - h * f / 10000n
7040
+ ), { success: !0, data: { amountA: w, amountB: h, liquidity: g } };
7041
+ } catch (w) {
7042
+ return console.error("Error in add_liquidity_request:", w), { success: !1, error_message: w.message };
7043
+ } finally {
7044
+ p();
7031
7045
  }
7032
7046
  }
7033
7047
  function el(e, t, n, r, s, i, o, a, c, u, l) {
7034
7048
  if (l === "")
7035
7049
  return !0;
7036
- let f = tt(S.from(e, "hex")).slice(2);
7050
+ let f = tt(B.from(e, "hex")).slice(2);
7037
7051
  f += t.toString(16).padStart(8, "0"), f += "02", f += n.slice(2).padStart(40, "0"), f += r.slice(2).padStart(40, "0"), f += s.toString(16).padStart(64, "0"), f += i.toString(16).padStart(64, "0"), f += o.toString(16).padStart(64, "0"), f += a.toString(16).padStart(64, "0"), f += c.toString(16).padStart(64, "0"), f += u.toString(16).padStart(64, "0");
7038
- const d = S.from(f, "hex"), p = T.G1.hashToCurve(d, {
7052
+ const d = B.from(f, "hex"), p = T.G1.hashToCurve(d, {
7039
7053
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
7040
- }), w = BigInt(`0x${l.slice(0, 128)}`), h = BigInt(`0x${l.slice(128, 256)}`), g = new T.G1.Point(w, h, BigInt(1)), b = BigInt(`0x${e.slice(0, 128)}`), v = BigInt(`0x${e.slice(128, 256)}`), O = BigInt(`0x${e.slice(256, 384)}`), F = BigInt(`0x${e.slice(384, 512)}`), M = new T.G2.Point(
7041
- T.fields.Fp2.create({ c0: b, c1: v }),
7042
- T.fields.Fp2.create({ c0: O, c1: F }),
7054
+ }), w = BigInt(`0x${l.slice(0, 128)}`), h = BigInt(`0x${l.slice(128, 256)}`), g = new T.G1.Point(w, h, BigInt(1)), b = BigInt(`0x${e.slice(0, 128)}`), S = BigInt(`0x${e.slice(128, 256)}`), O = BigInt(`0x${e.slice(256, 384)}`), A = BigInt(`0x${e.slice(384, 512)}`), M = new T.G2.Point(
7055
+ T.fields.Fp2.create({ c0: b, c1: S }),
7056
+ T.fields.Fp2.create({ c0: O, c1: A }),
7043
7057
  T.fields.Fp2.ONE
7044
7058
  );
7045
7059
  return T.shortSignatures.verify(g, p, M);
7046
7060
  }
7047
7061
  async function nl(e, t, n, r, s, i, o, a, c, u, l, f) {
7048
- n = n.toLowerCase(), r = r.toLowerCase(), t = t.startsWith("0x") ? t.slice(2) : t, a = a.startsWith("0x") ? a.slice(2) : a, Sn(e);
7062
+ n = n.toLowerCase(), r = r.toLowerCase(), t = t.startsWith("0x") ? t.slice(2) : t, a = a.startsWith("0x") ? a.slice(2) : a;
7063
+ const d = await Sn(e);
7049
7064
  try {
7050
7065
  if (!el(
7051
7066
  t,
@@ -7061,10 +7076,10 @@ async function nl(e, t, n, r, s, i, o, a, c, u, l, f) {
7061
7076
  a
7062
7077
  ))
7063
7078
  throw new Error("Invalid BLS signature");
7064
- const d = lo(n, r);
7065
- if ((await L.get(t, d) || 0n) < s)
7079
+ const p = lo(n, r);
7080
+ if ((await L.get(t, p) || 0n) < s)
7066
7081
  throw new Error("Insufficient liquidity balance");
7067
- const { amountA: p, amountB: w } = await ju(
7082
+ const { amountA: w, amountB: h } = await ju(
7068
7083
  n,
7069
7084
  r,
7070
7085
  s,
@@ -7073,16 +7088,16 @@ async function nl(e, t, n, r, s, i, o, a, c, u, l, f) {
7073
7088
  );
7074
7089
  return L.setCheckPositive(
7075
7090
  t,
7076
- d,
7077
- (await L.get(t, d) || 0n) - s
7091
+ p,
7092
+ (await L.get(t, p) || 0n) - s
7078
7093
  ), L.setCheckPositive(
7079
7094
  t,
7080
7095
  n,
7081
- (await L.get(t, n) || 0n) + p
7096
+ (await L.get(t, n) || 0n) + w
7082
7097
  ), L.setCheckPositive(
7083
7098
  t,
7084
7099
  r,
7085
- (await L.get(t, r) || 0n) + w
7100
+ (await L.get(t, r) || 0n) + h
7086
7101
  ), L.setCheckPositive(
7087
7102
  t,
7088
7103
  wt,
@@ -7090,32 +7105,35 @@ async function nl(e, t, n, r, s, i, o, a, c, u, l, f) {
7090
7105
  ), L.setCheckPositive(
7091
7106
  t,
7092
7107
  n,
7093
- (await L.get(t, n) || 0n) - p * u / 10000n
7108
+ (await L.get(t, n) || 0n) - w * u / 10000n
7094
7109
  ), L.setCheckPositive(
7095
7110
  t,
7096
7111
  r,
7097
- (await L.get(t, r) || 0n) - w * l / 10000n
7098
- ), { success: !0, data: { amountA: p, amountB: w, liquidity: s } };
7099
- } catch (d) {
7100
- return console.error("Error in remove_liquidity_request:", d), { success: !1, error_message: d.message };
7112
+ (await L.get(t, r) || 0n) - h * l / 10000n
7113
+ ), { success: !0, data: { amountA: w, amountB: h, liquidity: s } };
7114
+ } catch (p) {
7115
+ return console.error("Error in remove_liquidity_request:", p), { success: !1, error_message: p.message };
7116
+ } finally {
7117
+ d();
7101
7118
  }
7102
7119
  }
7103
7120
  function rl(e, t, n, r, s, i, o, a, c, u) {
7104
7121
  if (u === "")
7105
7122
  return !0;
7106
- let l = tt(S.from(e, "hex")).slice(2);
7123
+ let l = tt(B.from(e, "hex")).slice(2);
7107
7124
  l += t.toString(16).padStart(8, "0"), l += "03", l += n.slice(2).padStart(64, "0"), l += r.slice(2).padStart(64, "0"), l += s.toString(16).padStart(64, "0"), l += i.toString(16).padStart(64, "0"), l += o.toString(16).padStart(64, "0"), l += a.toString(16).padStart(64, "0"), l += c.toString(16).padStart(64, "0");
7108
- const f = S.from(l, "hex"), d = T.G1.hashToCurve(f, {
7125
+ const f = B.from(l, "hex"), d = T.G1.hashToCurve(f, {
7109
7126
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
7110
- }), p = BigInt(`0x${u.slice(0, 128)}`), w = BigInt(`0x${u.slice(128, 256)}`), h = new T.G1.Point(p, w, BigInt(1)), g = BigInt(`0x${e.slice(0, 128)}`), b = BigInt(`0x${e.slice(128, 256)}`), v = BigInt(`0x${e.slice(256, 384)}`), O = BigInt(`0x${e.slice(384, 512)}`), F = new T.G2.Point(
7127
+ }), p = BigInt(`0x${u.slice(0, 128)}`), w = BigInt(`0x${u.slice(128, 256)}`), h = new T.G1.Point(p, w, BigInt(1)), g = BigInt(`0x${e.slice(0, 128)}`), b = BigInt(`0x${e.slice(128, 256)}`), S = BigInt(`0x${e.slice(256, 384)}`), O = BigInt(`0x${e.slice(384, 512)}`), A = new T.G2.Point(
7111
7128
  T.fields.Fp2.create({ c0: g, c1: b }),
7112
- T.fields.Fp2.create({ c0: v, c1: O }),
7129
+ T.fields.Fp2.create({ c0: S, c1: O }),
7113
7130
  T.fields.Fp2.ONE
7114
7131
  );
7115
- return T.shortSignatures.verify(h, d, F);
7132
+ return T.shortSignatures.verify(h, d, A);
7116
7133
  }
7117
7134
  async function sl(e, t, n, r, s, i, o, a, c, u, l) {
7118
- n = n.toLowerCase(), r = r.toLowerCase(), t = t.startsWith("0x") ? t.slice(2) : t, o = o.startsWith("0x") ? o.slice(2) : o, Sn(e);
7135
+ n = n.toLowerCase(), r = r.toLowerCase(), t = t.startsWith("0x") ? t.slice(2) : t, o = o.startsWith("0x") ? o.slice(2) : o;
7136
+ const f = await Sn(e);
7119
7137
  try {
7120
7138
  if (!rl(
7121
7139
  t,
@@ -7132,11 +7150,11 @@ async function sl(e, t, n, r, s, i, o, a, c, u, l) {
7132
7150
  throw new Error("Invalid BLS signature");
7133
7151
  if ((await L.get(t, n) || 0n) < s)
7134
7152
  throw new Error("Insufficient input token balance");
7135
- const { reserveA: f, reserveB: d } = await Xt(
7153
+ const { reserveA: d, reserveB: p } = await zt(
7136
7154
  n,
7137
7155
  r
7138
- ), p = await Xu(s, i, [n, r]);
7139
- if (p.length !== 2)
7156
+ ), w = await zu(s, i, [n, r]);
7157
+ if (w.length !== 2)
7140
7158
  throw new Error("Invalid swap output amounts");
7141
7159
  L.setCheckPositive(
7142
7160
  t,
@@ -7145,7 +7163,7 @@ async function sl(e, t, n, r, s, i, o, a, c, u, l) {
7145
7163
  ), L.setCheckPositive(
7146
7164
  t,
7147
7165
  r,
7148
- (await L.get(t, r) || 0n) + p[1]
7166
+ (await L.get(t, r) || 0n) + w[1]
7149
7167
  ), L.setCheckPositive(
7150
7168
  t,
7151
7169
  wt,
@@ -7157,39 +7175,42 @@ async function sl(e, t, n, r, s, i, o, a, c, u, l) {
7157
7175
  ), L.setCheckPositive(
7158
7176
  t,
7159
7177
  r,
7160
- (await L.get(t, r) || 0n) - p[1] * u / 10000n
7178
+ (await L.get(t, r) || 0n) - w[1] * u / 10000n
7161
7179
  );
7162
- const { reserveA: w, reserveB: h } = await Xt(
7180
+ const { reserveA: h, reserveB: g } = await zt(
7163
7181
  n,
7164
7182
  r
7165
- ), g = n === wt ? f * 1000000000000000000n * 10000n / d : d * 1000000000000000000n * 10000n / f, b = n === wt ? w * 1000000000000000000n * 10000n / h : h * 1000000000000000000n * 10000n / w, v = g > b ? g - b : b - g, O = g !== 0n ? v * 10000n / g : 0n;
7183
+ ), b = n === wt ? d * 1000000000000000000n * 10000n / p : p * 1000000000000000000n * 10000n / d, S = n === wt ? h * 1000000000000000000n * 10000n / g : g * 1000000000000000000n * 10000n / h, O = b > S ? b - S : S - b, A = b !== 0n ? O * 10000n / b : 0n;
7166
7184
  return {
7167
7185
  success: !0,
7168
- amounts: p,
7169
- price_impact_bps: O,
7170
- reserve_in: f,
7171
- reserve_out: d
7186
+ amounts: w,
7187
+ price_impact_bps: A,
7188
+ reserve_in: d,
7189
+ reserve_out: p
7172
7190
  };
7173
- } catch (f) {
7174
- return console.error("Error in swap_request:", f), { success: !1, error_message: f.message };
7191
+ } catch (d) {
7192
+ return console.error("Error in swap_request:", d), { success: !1, error_message: d.message };
7193
+ } finally {
7194
+ f();
7175
7195
  }
7176
7196
  }
7177
7197
  function il(e, t, n, r, s, i, o, a, c, u) {
7178
7198
  if (u === "")
7179
7199
  return !0;
7180
- let l = tt(S.from(e, "hex")).slice(2);
7200
+ let l = tt(B.from(e, "hex")).slice(2);
7181
7201
  l += t.toString(16).padStart(8, "0"), l += "03", l += n.slice(2).padStart(64, "0"), l += r.slice(2).padStart(64, "0"), l += s.toString(16).padStart(64, "0"), l += i.toString(16).padStart(64, "0"), l += o.toString(16).padStart(64, "0"), l += a.toString(16).padStart(64, "0"), l += c.toString(16).padStart(64, "0");
7182
- const f = S.from(l, "hex"), d = T.G1.hashToCurve(f, {
7202
+ const f = B.from(l, "hex"), d = T.G1.hashToCurve(f, {
7183
7203
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
7184
- }), p = BigInt(`0x${u.slice(0, 128)}`), w = BigInt(`0x${u.slice(128, 256)}`), h = new T.G1.Point(p, w, BigInt(1)), g = BigInt(`0x${e.slice(0, 128)}`), b = BigInt(`0x${e.slice(128, 256)}`), v = BigInt(`0x${e.slice(256, 384)}`), O = BigInt(`0x${e.slice(384, 512)}`), F = new T.G2.Point(
7204
+ }), p = BigInt(`0x${u.slice(0, 128)}`), w = BigInt(`0x${u.slice(128, 256)}`), h = new T.G1.Point(p, w, BigInt(1)), g = BigInt(`0x${e.slice(0, 128)}`), b = BigInt(`0x${e.slice(128, 256)}`), S = BigInt(`0x${e.slice(256, 384)}`), O = BigInt(`0x${e.slice(384, 512)}`), A = new T.G2.Point(
7185
7205
  T.fields.Fp2.create({ c0: g, c1: b }),
7186
- T.fields.Fp2.create({ c0: v, c1: O }),
7206
+ T.fields.Fp2.create({ c0: S, c1: O }),
7187
7207
  T.fields.Fp2.ONE
7188
7208
  );
7189
- return T.shortSignatures.verify(h, d, F);
7209
+ return T.shortSignatures.verify(h, d, A);
7190
7210
  }
7191
7211
  async function ol(e, t, n, r, s, i, o, a, c, u, l) {
7192
- n = n.toLowerCase(), r = r.toLowerCase(), t = t.startsWith("0x") ? t.slice(2) : t, o = o.startsWith("0x") ? o.slice(2) : o, Sn(e);
7212
+ n = n.toLowerCase(), r = r.toLowerCase(), t = t.startsWith("0x") ? t.slice(2) : t, o = o.startsWith("0x") ? o.slice(2) : o;
7213
+ const f = await Sn(e);
7193
7214
  try {
7194
7215
  if (!il(
7195
7216
  t,
@@ -7204,16 +7225,16 @@ async function ol(e, t, n, r, s, i, o, a, c, u, l) {
7204
7225
  o
7205
7226
  ))
7206
7227
  throw new Error("Invalid BLS signature");
7207
- const { reserveA: f, reserveB: d } = await Xt(
7228
+ const { reserveA: d, reserveB: p } = await zt(
7208
7229
  n,
7209
7230
  r
7210
- ), p = await Ju(s, i, [n, r]);
7211
- if (p.length !== 2)
7231
+ ), w = await Ju(s, i, [n, r]);
7232
+ if (w.length !== 2)
7212
7233
  throw new Error("Invalid swap output amounts");
7213
7234
  L.setCheckPositive(
7214
7235
  t,
7215
7236
  n,
7216
- (await L.get(t, n) || 0n) - p[0]
7237
+ (await L.get(t, n) || 0n) - w[0]
7217
7238
  ), L.setCheckPositive(
7218
7239
  t,
7219
7240
  r,
@@ -7225,33 +7246,35 @@ async function ol(e, t, n, r, s, i, o, a, c, u, l) {
7225
7246
  ), L.setCheckPositive(
7226
7247
  t,
7227
7248
  n,
7228
- (await L.get(t, n) || 0n) - p[0] * c / 10000n
7249
+ (await L.get(t, n) || 0n) - w[0] * c / 10000n
7229
7250
  ), L.setCheckPositive(
7230
7251
  t,
7231
7252
  r,
7232
7253
  (await L.get(t, r) || 0n) - i * u / 10000n
7233
7254
  );
7234
- const { reserveA: w, reserveB: h } = await Xt(
7255
+ const { reserveA: h, reserveB: g } = await zt(
7235
7256
  n,
7236
7257
  r
7237
- ), g = n === wt ? f * 1000000000000000000n * 10000n / d : d * 1000000000000000000n * 10000n / f, b = n === wt ? w * 1000000000000000000n * 10000n / h : h * 1000000000000000000n * 10000n / w, v = g > b ? g - b : b - g, O = g !== 0n ? v * 10000n / g : 0n;
7258
+ ), b = n === wt ? d * 1000000000000000000n * 10000n / p : p * 1000000000000000000n * 10000n / d, S = n === wt ? h * 1000000000000000000n * 10000n / g : g * 1000000000000000000n * 10000n / h, O = b > S ? b - S : S - b, A = b !== 0n ? O * 10000n / b : 0n;
7238
7259
  return {
7239
7260
  success: !0,
7240
- amounts: p,
7241
- price_impact_bps: O,
7242
- reserve_in: f,
7243
- reserve_out: d
7261
+ amounts: w,
7262
+ price_impact_bps: A,
7263
+ reserve_in: d,
7264
+ reserve_out: p
7244
7265
  };
7245
- } catch (f) {
7246
- return console.error("Error in swap2_request:", f), { success: !1, error_message: f.message };
7266
+ } catch (d) {
7267
+ return console.error("Error in swap2_request:", d), { success: !1, error_message: d.message };
7268
+ } finally {
7269
+ f();
7247
7270
  }
7248
7271
  }
7249
7272
  function al(e, t, n, r, s, i) {
7250
7273
  if (i === "")
7251
7274
  return !0;
7252
- let o = tt(S.from(e, "hex")).slice(2);
7253
- o += t.toString(16).padStart(8, "0"), o += "06", o += tt(S.from(n, "hex")).slice(2), o += r.toString(16).padStart(64, "0"), o += s.toString(16).padStart(64, "0");
7254
- const a = S.from(o, "hex"), c = T.G1.hashToCurve(a, {
7275
+ let o = tt(B.from(e, "hex")).slice(2);
7276
+ o += t.toString(16).padStart(8, "0"), o += "06", o += tt(B.from(n, "hex")).slice(2), o += r.toString(16).padStart(64, "0"), o += s.toString(16).padStart(64, "0");
7277
+ const a = B.from(o, "hex"), c = T.G1.hashToCurve(a, {
7255
7278
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
7256
7279
  }), u = BigInt(`0x${i.slice(0, 128)}`), l = BigInt(`0x${i.slice(128, 256)}`), f = new T.G1.Point(u, l, BigInt(1)), d = BigInt(`0x${e.slice(0, 128)}`), p = BigInt(`0x${e.slice(128, 256)}`), w = BigInt(`0x${e.slice(256, 384)}`), h = BigInt(`0x${e.slice(384, 512)}`), g = new T.G2.Point(
7257
7280
  T.fields.Fp2.create({ c0: d, c1: p }),
@@ -7263,7 +7286,8 @@ function al(e, t, n, r, s, i) {
7263
7286
  async function cl(e, t, n, r, s, i, o) {
7264
7287
  if (n = n.toLowerCase(), n = n.startsWith("0x") ? n.slice(2) : n, n.length > 126)
7265
7288
  throw new Error("Pkscript too long");
7266
- t = t.startsWith("0x") ? t.slice(2) : t, s = s.startsWith("0x") ? s.slice(2) : s, Sn(e);
7289
+ t = t.startsWith("0x") ? t.slice(2) : t, s = s.startsWith("0x") ? s.slice(2) : s;
7290
+ const a = await Sn(e);
7267
7291
  try {
7268
7292
  if (!al(t, i, n, r, o, s))
7269
7293
  throw new Error("Invalid BLS signature");
@@ -7278,8 +7302,10 @@ async function cl(e, t, n, r, s, i, o) {
7278
7302
  wt,
7279
7303
  (await L.get(t, wt) || 0n) - o
7280
7304
  ), { success: !0, data: { amt: r } };
7281
- } catch (a) {
7282
- return console.error("Error in withdraw_request:", a), { success: !1, error_message: a.message };
7305
+ } catch (c) {
7306
+ return console.error("Error in withdraw_request:", c), { success: !1, error_message: c.message };
7307
+ } finally {
7308
+ a();
7283
7309
  }
7284
7310
  }
7285
7311
  class Hr {
@@ -7317,7 +7343,7 @@ const po = [
7317
7343
  outputs: [],
7318
7344
  stateMutability: "nonpayable"
7319
7345
  }
7320
- ], ul = po, be = 1e3, Hs = 12e3, ho = 2500n, ll = `Sign this message only on official BiS interfaces.
7346
+ ], ul = po, be = 1e3, Vs = 12e3, ho = 2500n, ll = `Sign this message only on official BiS interfaces.
7321
7347
  This signature is required to generate your session-specific swap key.
7322
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.
7323
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.
@@ -7326,7 +7352,7 @@ Signing this message outside official BiS interfaces may result in unauthorized
7326
7352
  By signing, you acknowledge that the BiS Terms of Service also apply: https://bestinslot.xyz/legal/terms.
7327
7353
 
7328
7354
  Current Network: Bitcoin Mainnet`;
7329
- async function X(e, t) {
7355
+ async function z(e, t) {
7330
7356
  try {
7331
7357
  const n = await fetch(e, t);
7332
7358
  if (!n.ok) {
@@ -7347,24 +7373,16 @@ async function X(e, t) {
7347
7373
  throw new Error(`API Request Failed: ${r}`);
7348
7374
  }
7349
7375
  }
7350
- function Vs() {
7351
- const e = tn();
7376
+ function Zs() {
7377
+ const e = yn();
7352
7378
  if (e === "signet")
7353
7379
  return ll;
7354
7380
  if (e === "mainnet")
7355
7381
  return fl;
7356
7382
  throw new Error("Unsupported network for swap signature request text");
7357
7383
  }
7358
- function J(e) {
7359
- const t = tn();
7360
- if (t === "signet")
7361
- return `https://sas-proxy.bestinslot.xyz/${e}`;
7362
- if (t === "mainnet")
7363
- return `https://sa-proxy.bestinslot.xyz/${e}`;
7364
- throw new Error("Unsupported network for orderbook backend URL");
7365
- }
7366
7384
  function rr() {
7367
- const e = tn();
7385
+ const e = yn();
7368
7386
  if (e === "signet")
7369
7387
  return "0xf41B09041DC546F0466D6F74cda81971012B589D";
7370
7388
  if (e === "mainnet")
@@ -7372,7 +7390,7 @@ function rr() {
7372
7390
  throw new Error("Unsupported network for orderbook contract address");
7373
7391
  }
7374
7392
  function wo() {
7375
- const e = tn();
7393
+ const e = yn();
7376
7394
  if (e === "signet")
7377
7395
  return new ge(po);
7378
7396
  if (e === "mainnet")
@@ -7392,17 +7410,17 @@ async function yo(e = {}) {
7392
7410
  throw new Error("Ordinals wallet address not found.");
7393
7411
  const n = new Hr(e, 2);
7394
7412
  n.next();
7395
- const r = await Kr(Vs());
7413
+ const r = await Kr(Zs());
7396
7414
  await new Promise((p) => setTimeout(p, 500)), n.next();
7397
- const s = await Kr(Vs());
7415
+ const s = await Kr(Zs());
7398
7416
  if (r !== s)
7399
7417
  throw new Error("Deterministic signature mismatch. Please try again.");
7400
- const i = S.from(tt(`0x${r}`).slice(2), "hex"), o = S.from("my-app/bls-keygen", "utf-8"), a = uc(xi, i, void 0, o, 48), c = _i(a, T.fields.Fr.ORDER), u = S.from(c), l = go(u), f = `0x${u.toString("hex")}`, d = {
7418
+ const i = B.from(tt(`0x${r}`).slice(2), "hex"), o = B.from("my-app/bls-keygen", "utf-8"), a = uc(xi, i, void 0, o, 48), c = _i(a, T.fields.Fr.ORDER), u = B.from(c), l = go(u), f = `0x${u.toString("hex")}`, d = {
7401
7419
  bitcoinAddress: t.address,
7402
7420
  swapPubkey: l,
7403
7421
  swapPrivkey: f
7404
7422
  };
7405
- return await Ys(d), d;
7423
+ return await Ks(d), d;
7406
7424
  }
7407
7425
  function dl(e) {
7408
7426
  const t = e.trim(), n = t.toLowerCase().startsWith("0x") ? t.slice(2) : t;
@@ -7411,7 +7429,7 @@ function dl(e) {
7411
7429
  const r = BigInt(`0x${n}`);
7412
7430
  if (r === 0n || r >= T.fields.Fr.ORDER)
7413
7431
  throw new Error("Invalid security code. Not a valid swap key.");
7414
- return S.from(n, "hex");
7432
+ return B.from(n, "hex");
7415
7433
  }
7416
7434
  async function pl(e, t = {}) {
7417
7435
  const n = Wt();
@@ -7426,7 +7444,7 @@ async function pl(e, t = {}) {
7426
7444
  throw new Error(
7427
7445
  "A different swap wallet is already stored for this address. Pass { overwrite: true } to replace it."
7428
7446
  );
7429
- return await Ys(s), s;
7447
+ return await Ks(s), s;
7430
7448
  }
7431
7449
  async function hl(e = {}) {
7432
7450
  const t = Wt();
@@ -7439,8 +7457,8 @@ async function wl() {
7439
7457
  return (await et())?.swapPrivkey ?? null;
7440
7458
  }
7441
7459
  async function gl() {
7442
- const e = J("status");
7443
- return await X(e, {
7460
+ const e = await K("status");
7461
+ return await z(e, {
7444
7462
  method: "GET"
7445
7463
  });
7446
7464
  }
@@ -7448,10 +7466,10 @@ async function bo(e) {
7448
7466
  const t = Wt();
7449
7467
  if (!t?.address)
7450
7468
  throw new Error("Ordinals wallet address not found.");
7451
- const n = J("check_swap_allowance"), r = {
7469
+ const n = await K("check_swap_allowance"), r = {
7452
7470
  ordinal_address: t.address,
7453
7471
  token_address: e
7454
- }, s = await X(n, {
7472
+ }, s = await z(n, {
7455
7473
  method: "POST",
7456
7474
  headers: {
7457
7475
  "Content-Type": "application/json"
@@ -7460,12 +7478,12 @@ async function bo(e) {
7460
7478
  });
7461
7479
  return BigInt(s.result);
7462
7480
  }
7463
- const yl = 6e4, Zs = /* @__PURE__ */ new Map(), Or = /* @__PURE__ */ new Map();
7481
+ const yl = 6e4, Ys = /* @__PURE__ */ new Map(), Or = /* @__PURE__ */ new Map();
7464
7482
  async function Jt() {
7465
- const e = tn(), t = Zs.get(e);
7483
+ const e = yn(), t = Ys.get(e);
7466
7484
  if (t && Date.now() - t.fetchedAt < yl)
7467
7485
  return t.info;
7468
- const n = J("get_swap_info"), r = await X(n, {
7486
+ const n = await K("get_swap_info"), r = await z(n, {
7469
7487
  method: "GET"
7470
7488
  }), s = r.result.fee_policy;
7471
7489
  let i = null;
@@ -7482,7 +7500,7 @@ async function Jt() {
7482
7500
  fee_policy: i,
7483
7501
  allow_token_token_pairs: r.result.allow_token_token_pairs === !0
7484
7502
  };
7485
- return o.fee_policy !== null && Zs.set(e, { info: o, fetchedAt: Date.now() }), o;
7503
+ return o.fee_policy !== null && Ys.set(e, { info: o, fetchedAt: Date.now() }), o;
7486
7504
  }
7487
7505
  async function sr(e, t) {
7488
7506
  const n = await Jt();
@@ -7501,10 +7519,10 @@ async function mo(e) {
7501
7519
  const t = Wt();
7502
7520
  if (!t?.address)
7503
7521
  throw new Error("Ordinals wallet address not found.");
7504
- const n = J("check_brc20_balance"), r = {
7522
+ const n = await K("check_brc20_balance"), r = {
7505
7523
  ordinal_address: t.address,
7506
7524
  token_address: e
7507
- }, s = await X(n, {
7525
+ }, s = await z(n, {
7508
7526
  method: "POST",
7509
7527
  headers: {
7510
7528
  "Content-Type": "application/json"
@@ -7517,10 +7535,10 @@ async function _o(e) {
7517
7535
  const t = Wt();
7518
7536
  if (!t?.address)
7519
7537
  throw new Error("Ordinals wallet address not found.");
7520
- const n = J("check_base_brc20_balance"), r = {
7538
+ const n = await K("check_base_brc20_balance"), r = {
7521
7539
  ordinal_address: t.address,
7522
7540
  token_address: e
7523
- }, s = await X(n, {
7541
+ }, s = await z(n, {
7524
7542
  method: "POST",
7525
7543
  headers: {
7526
7544
  "Content-Type": "application/json"
@@ -7535,8 +7553,8 @@ async function _o(e) {
7535
7553
  };
7536
7554
  }
7537
7555
  async function bl(e) {
7538
- const t = J("get_all_balances");
7539
- return (await X(t, {
7556
+ const t = await K("get_all_balances");
7557
+ return (await z(t, {
7540
7558
  method: "POST",
7541
7559
  headers: {
7542
7560
  "Content-Type": "application/json"
@@ -7550,7 +7568,7 @@ async function ml(e) {
7550
7568
  const t = await et();
7551
7569
  if (!t?.swapPubkey)
7552
7570
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
7553
- const n = t.swapPubkey, r = J("get_balance"), i = await X(r, {
7571
+ const n = t.swapPubkey, r = await K("get_balance"), i = await z(r, {
7554
7572
  method: "POST",
7555
7573
  headers: {
7556
7574
  "Content-Type": "application/json"
@@ -7563,7 +7581,7 @@ async function ml(e) {
7563
7581
  return BigInt(i.result);
7564
7582
  }
7565
7583
  async function Bn(e, t) {
7566
- const n = J("get_balance"), s = await X(n, {
7584
+ const n = await K("get_balance"), s = await z(n, {
7567
7585
  method: "POST",
7568
7586
  headers: {
7569
7587
  "Content-Type": "application/json"
@@ -7576,7 +7594,7 @@ async function Bn(e, t) {
7576
7594
  return BigInt(s.result);
7577
7595
  }
7578
7596
  async function Ue(e) {
7579
- const t = J("get_pair_reserves"), r = await X(t, {
7597
+ const t = await K("get_pair_reserves"), r = await z(t, {
7580
7598
  method: "POST",
7581
7599
  headers: {
7582
7600
  "Content-Type": "application/json"
@@ -7595,7 +7613,7 @@ async function qe() {
7595
7613
  const e = (await et())?.swapPubkey;
7596
7614
  if (!e)
7597
7615
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
7598
- const t = J("get_swap_wallet_nonce"), r = await X(t, {
7616
+ const t = await K("get_swap_wallet_nonce"), r = await z(t, {
7599
7617
  method: "POST",
7600
7618
  headers: {
7601
7619
  "Content-Type": "application/json"
@@ -7607,7 +7625,7 @@ async function qe() {
7607
7625
  return BigInt(r.result);
7608
7626
  }
7609
7627
  async function _l(e, t) {
7610
- const n = J("get_swap_referrer_info"), s = await X(n, {
7628
+ const n = await K("get_swap_referrer_info"), s = await z(n, {
7611
7629
  method: "POST",
7612
7630
  headers: {
7613
7631
  "Content-Type": "application/json"
@@ -7629,7 +7647,7 @@ async function Vr(e, t) {
7629
7647
  }
7630
7648
  }
7631
7649
  async function $t(e) {
7632
- const t = J("get_miner_fee"), r = await X(t, {
7650
+ const t = await K("get_miner_fee"), r = await z(t, {
7633
7651
  method: "POST",
7634
7652
  headers: {
7635
7653
  "Content-Type": "application/json"
@@ -7641,8 +7659,8 @@ async function $t(e) {
7641
7659
  return BigInt(r.result);
7642
7660
  }
7643
7661
  async function xl() {
7644
- const e = J("get_tokens");
7645
- return (await X(e, {
7662
+ const e = await K("get_tokens");
7663
+ return (await z(e, {
7646
7664
  method: "GET"
7647
7665
  })).tokens;
7648
7666
  }
@@ -7657,7 +7675,7 @@ async function El(e = {}) {
7657
7675
  order_by: t,
7658
7676
  page: String(n),
7659
7677
  count: String(r)
7660
- }), i = J(`get_table_data?${s}`), o = await X(i, {
7678
+ }), i = await K(`get_table_data?${s}`), o = await z(i, {
7661
7679
  method: "GET"
7662
7680
  });
7663
7681
  return {
@@ -7675,54 +7693,72 @@ async function El(e = {}) {
7675
7693
  };
7676
7694
  }
7677
7695
  async function Sl(e) {
7678
- const t = J(`volume/${e.pair_address}?days=${e.days}`);
7679
- return await X(t, {
7680
- method: "GET",
7681
- headers: {
7682
- "Content-Type": "application/json"
7683
- }
7696
+ const t = await K(`volume/${e.pair_address}?days=${e.days}`);
7697
+ return await z(t, {
7698
+ method: "GET"
7684
7699
  });
7685
7700
  }
7686
7701
  async function Bl(e) {
7687
7702
  if (e.limit > 1e3)
7688
7703
  throw new Error("Limit cannot exceed 1000");
7689
- let t = J(
7704
+ let t = await K(
7690
7705
  `klines/${e.pair_address}?interval=${e.interval}&limit=${e.limit}`
7691
7706
  );
7692
- return e.startTime !== null && (t += `&startTime=${e.startTime}`), e.endTime !== null && (t += `&endTime=${e.endTime}`), await X(t, {
7693
- method: "GET",
7694
- headers: {
7695
- "Content-Type": "application/json"
7696
- }
7707
+ return e.startTime !== null && (t += `&startTime=${e.startTime}`), e.endTime !== null && (t += `&endTime=${e.endTime}`), await z(t, {
7708
+ method: "GET"
7697
7709
  });
7698
7710
  }
7699
7711
  async function vl(e) {
7700
- const t = J(
7712
+ const t = await K(
7701
7713
  `tvl/${encodeURIComponent(e.pair_address)}?${new URLSearchParams({
7702
7714
  days: String(e.days)
7703
7715
  })}`
7704
7716
  );
7705
- return await X(t, {
7706
- method: "GET",
7707
- headers: {
7708
- "Content-Type": "application/json"
7709
- }
7717
+ return await z(t, {
7718
+ method: "GET"
7710
7719
  });
7711
7720
  }
7712
7721
  async function Ol(e) {
7713
7722
  if (e.limit > 200)
7714
7723
  throw new Error("Limit cannot exceed 200");
7715
- const t = J(
7724
+ const t = await K(
7716
7725
  `pair-activity/${e.pair_address}?limit=${e.limit}&offset=${e.offset}`
7717
7726
  );
7718
- return await X(t, {
7719
- method: "GET",
7720
- headers: {
7721
- "Content-Type": "application/json"
7722
- }
7727
+ return await z(t, {
7728
+ method: "GET"
7723
7729
  });
7724
7730
  }
7725
7731
  const Tl = [
7732
+ "swap",
7733
+ "add_liq",
7734
+ "remove_liq",
7735
+ "withdraw",
7736
+ "unwrap"
7737
+ ];
7738
+ async function Il(e = {}) {
7739
+ if (e.limit !== void 0) {
7740
+ if (e.limit > 100)
7741
+ throw new Error("Limit cannot exceed 100");
7742
+ if (!Number.isInteger(e.limit) || e.limit < 1)
7743
+ throw new Error("Limit must be an integer of at least 1");
7744
+ }
7745
+ if (e.before !== void 0 && !(/^\d+$/.test(e.before) && BigInt(e.before) > 0n))
7746
+ throw new Error("Before must be a positive integer id");
7747
+ if (e.kinds !== void 0) {
7748
+ if (e.kinds.length === 0)
7749
+ throw new Error("Kinds must name at least one kind");
7750
+ const s = e.kinds.find((i) => !Tl.includes(i));
7751
+ if (s !== void 0)
7752
+ throw new Error(`Unknown activity kind: ${s}`);
7753
+ }
7754
+ const t = new URLSearchParams();
7755
+ e.limit !== void 0 && t.set("limit", String(e.limit)), e.before !== void 0 && t.set("before", e.before), e.kinds !== void 0 && t.set("kinds", e.kinds.join(","));
7756
+ const n = t.toString(), r = await K(`recent-activity${n ? `?${n}` : ""}`);
7757
+ return await z(r, {
7758
+ method: "GET"
7759
+ });
7760
+ }
7761
+ const Rl = [
7726
7762
  "swap",
7727
7763
  "add_liq",
7728
7764
  "remove_liq",
@@ -7730,7 +7766,7 @@ const Tl = [
7730
7766
  "withdraw",
7731
7767
  "unwrap"
7732
7768
  ];
7733
- async function Il(e) {
7769
+ async function kl(e) {
7734
7770
  if (e.limit !== void 0) {
7735
7771
  if (e.limit > 200)
7736
7772
  throw new Error("Limit cannot exceed 200");
@@ -7742,23 +7778,22 @@ async function Il(e) {
7742
7778
  if (e.kinds !== void 0) {
7743
7779
  if (e.kinds.length === 0)
7744
7780
  throw new Error("Kinds must name at least one kind");
7745
- const s = e.kinds.find((i) => !Tl.includes(i));
7781
+ const s = e.kinds.find((i) => !Rl.includes(i));
7746
7782
  if (s !== void 0)
7747
7783
  throw new Error(`Unknown activity kind: ${s}`);
7748
7784
  }
7749
7785
  const t = new URLSearchParams();
7750
7786
  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)), e.kinds !== void 0 && t.set("kinds", e.kinds.join(","));
7751
- const n = J(`wallet-activity/${encodeURIComponent(e.pubkey)}?${t}`);
7752
- return await X(n, {
7753
- method: "GET",
7754
- headers: {
7755
- "Content-Type": "application/json"
7756
- }
7787
+ const n = await K(
7788
+ `wallet-activity/${encodeURIComponent(e.pubkey)}?${t}`
7789
+ );
7790
+ return await z(n, {
7791
+ method: "GET"
7757
7792
  });
7758
7793
  }
7759
- async function wn(e) {
7760
- const t = J("get_token_decimals");
7761
- return (await X(t, {
7794
+ async function hn(e) {
7795
+ const t = await K("get_token_decimals");
7796
+ return (await z(t, {
7762
7797
  method: "POST",
7763
7798
  headers: {
7764
7799
  "Content-Type": "application/json"
@@ -7782,29 +7817,29 @@ async function ir(e) {
7782
7817
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
7783
7818
  let t = e.pk_idx.toString(16).padStart(16, "0");
7784
7819
  t += e.pubkey;
7785
- const n = S.from(t, "hex"), r = T.G1.hashToCurve(n, {
7820
+ const n = B.from(t, "hex"), r = T.G1.hashToCurve(n, {
7786
7821
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
7787
7822
  }), s = await et();
7788
7823
  if (!s?.swapPrivkey)
7789
7824
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
7790
- const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = S.from(i, "hex"), c = T.shortSignatures.sign(r, o).negate();
7825
+ const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), c = T.shortSignatures.sign(r, o).negate();
7791
7826
  return `0x${c.x.toString(16).padStart(128, "0")}${c.y.toString(16).padStart(128, "0")}`;
7792
7827
  }
7793
7828
  async function Eo(e) {
7794
7829
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
7795
- let t = tt(S.from(e.pubkey, "hex")).slice(2);
7830
+ let t = tt(B.from(e.pubkey, "hex")).slice(2);
7796
7831
  t += "99", t += e.ordinals_script;
7797
- const n = S.from(t, "hex"), r = T.G1.hashToCurve(n, {
7832
+ const n = B.from(t, "hex"), r = T.G1.hashToCurve(n, {
7798
7833
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
7799
7834
  }), s = await et();
7800
7835
  if (!s?.swapPrivkey)
7801
7836
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
7802
- const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = S.from(i, "hex"), c = T.shortSignatures.sign(r, o).negate();
7837
+ const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), c = T.shortSignatures.sign(r, o).negate();
7803
7838
  return `0x${c.x.toString(16).padStart(128, "0")}${c.y.toString(16).padStart(128, "0")}`;
7804
7839
  }
7805
7840
  async function So(e) {
7806
- const t = J("get_deposit_signature");
7807
- return X(t, {
7841
+ const t = await K("get_deposit_signature");
7842
+ return z(t, {
7808
7843
  method: "POST",
7809
7844
  headers: {
7810
7845
  "Content-Type": "application/json"
@@ -7812,9 +7847,9 @@ async function So(e) {
7812
7847
  body: JSON.stringify(e)
7813
7848
  });
7814
7849
  }
7815
- async function Rl(e) {
7816
- const t = J("deposit");
7817
- return X(t, {
7850
+ async function Nl(e) {
7851
+ const t = await K("deposit");
7852
+ return z(t, {
7818
7853
  method: "POST",
7819
7854
  headers: {
7820
7855
  "Content-Type": "application/json"
@@ -7841,10 +7876,10 @@ function Bo(e, t) {
7841
7876
  function vo(e) {
7842
7877
  return e ? e.reduce((t, n) => t + n.amount, 0n) : 0n;
7843
7878
  }
7844
- async function kl(e, t, n, r = !0, s, i = {}) {
7845
- const o = yn();
7879
+ async function Cl(e, t, n, r = !0, s, i = {}) {
7880
+ const o = gn();
7846
7881
  if (!o || !o.wallets) throw new Error("Wallets not found");
7847
- const a = ze(), c = Zn(), u = Wt();
7882
+ const a = Xe(), c = Zn(), u = Wt();
7848
7883
  if (!c) throw new Error("Payment wallet not found");
7849
7884
  if (!c.address) throw new Error("Payment wallet address not found");
7850
7885
  if (!u) throw new Error("Ordinals wallet not found");
@@ -7861,20 +7896,20 @@ async function kl(e, t, n, r = !0, s, i = {}) {
7861
7896
  `Insufficient BRC-2.0 + BRC20 available balance. Current BRC-2.0: ${b}, Available in base: ${te}, Reclaimable: ${ee}, Required: ${t}`
7862
7897
  ), new Error("Insufficient BRC-2.0 + BRC20 available balance");
7863
7898
  }
7864
- const v = await bo(e);
7899
+ const S = await bo(e);
7865
7900
  let O = !1;
7866
- if (v < BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")) {
7901
+ if (S < BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")) {
7867
7902
  if (!r)
7868
7903
  throw console.error("Insufficient allowance for BRC-2.0 token transfer."), new Error("Insufficient allowance for BRC-2.0 token transfer.");
7869
7904
  O = !0;
7870
7905
  }
7871
- const F = new Hr(
7906
+ const A = new Hr(
7872
7907
  i,
7873
7908
  3 + (w > 0n ? 2 : 0) + (O ? 2 : 0)
7874
- ), M = F.wrap(Ir(o.provider)), A = rr(), C = `0x095ea7b3000000000000000000000000${A.slice(2).toLowerCase()}ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`, I = await Xe(C), _ = z.str(
7909
+ ), M = A.wrap(Ir(o.provider)), P = rr(), C = `0x095ea7b3000000000000000000000000${P.slice(2).toLowerCase()}ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`, I = await ze(C), _ = J.str(
7875
7910
  `{"p":"brc20-prog","op":"c","c":"${e}","b":"${I}"}`
7876
7911
  ), D = new ce(
7877
- z.str("text/plain"),
7912
+ J.str("text/plain"),
7878
7913
  null,
7879
7914
  null,
7880
7915
  null,
@@ -7883,35 +7918,35 @@ async function kl(e, t, n, r = !0, s, i = {}) {
7883
7918
  ), H = (await et())?.swapPubkey;
7884
7919
  if (!H)
7885
7920
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
7886
- F.next();
7921
+ A.next();
7887
7922
  const U = await xo({
7888
7923
  btc_address: d,
7889
7924
  bls_pubkey: H,
7890
7925
  token_address: e
7891
- }), y = bn.address.toOutputScript(d, ze()), x = await Eo({
7926
+ }), y = bn.address.toOutputScript(d, Xe()), x = await Eo({
7892
7927
  pubkey: H,
7893
7928
  ordinals_script: y.toString("hex")
7894
- }), B = await So({
7929
+ }), v = await So({
7895
7930
  btc_address: d,
7896
7931
  bls_pubkey: H,
7897
7932
  token_address: e.toLowerCase(),
7898
7933
  bip322_signature: U,
7899
7934
  bls12_signature: x
7900
- }), R = B.edcsa_signature, P = B.pubkey_idx, $ = B.token_idx, q = await ir({
7935
+ }), R = v.edcsa_signature, F = v.pubkey_idx, $ = v.token_idx, q = await ir({
7901
7936
  pubkey: H,
7902
- pk_idx: BigInt(P)
7937
+ pk_idx: BigInt(F)
7903
7938
  }), W = wo().encodeFunctionData("deposit", [
7904
7939
  e,
7905
7940
  $,
7906
7941
  t,
7907
7942
  H,
7908
- BigInt(P),
7943
+ BigInt(F),
7909
7944
  q,
7910
7945
  R
7911
- ]), Z = await Xe(W), ct = z.str(
7912
- `{"p":"brc20-prog","op":"c","c":"${A}","b":"${Z}"}`
7946
+ ]), Z = await ze(W), ct = J.str(
7947
+ `{"p":"brc20-prog","op":"c","c":"${P}","b":"${Z}"}`
7913
7948
  ), j = new ce(
7914
- z.str("text/plain"),
7949
+ J.str("text/plain"),
7915
7950
  null,
7916
7951
  null,
7917
7952
  null,
@@ -7924,12 +7959,12 @@ async function kl(e, t, n, r = !0, s, i = {}) {
7924
7959
  w,
7925
7960
  h
7926
7961
  ), te = new ce(
7927
- z.str("text/plain"),
7962
+ J.str("text/plain"),
7928
7963
  null,
7929
7964
  null,
7930
7965
  null,
7931
7966
  null,
7932
- z.str(
7967
+ J.str(
7933
7968
  `{"p":"brc-20","op":"transfer","tick":"${g}","amt":"${At}"}`
7934
7969
  )
7935
7970
  );
@@ -7951,7 +7986,7 @@ async function kl(e, t, n, r = !0, s, i = {}) {
7951
7986
  secret: Ie.secret
7952
7987
  };
7953
7988
  } else
7954
- Qt = await Xr(
7989
+ Qt = await zr(
7955
7990
  te,
7956
7991
  n,
7957
7992
  null,
@@ -7973,7 +8008,7 @@ async function kl(e, t, n, r = !0, s, i = {}) {
7973
8008
  );
7974
8009
  const On = new Ut(
7975
8010
  !0,
7976
- S.from(me.encode(["OP_RETURN", z.str("BRC20PROG")], !1)),
8011
+ B.from(me.encode(["OP_RETURN", J.str("BRC20PROG")], !1)),
7977
8012
  null,
7978
8013
  null,
7979
8014
  null
@@ -8000,7 +8035,7 @@ async function kl(e, t, n, r = !0, s, i = {}) {
8000
8035
  throw new Error("Failed to send inscription to OP_RETURN");
8001
8036
  jt = Me.signedTxHex, Be = Me.txId;
8002
8037
  }
8003
- let lt = null, Lt = null, dt = null, Et = null, St = null, Nt = null, ve = null, rn = null, Oe = null;
8038
+ let lt = null, Lt = null, dt = null, Et = null, St = null, Nt = null, ve = null, nn = null, Oe = null;
8004
8039
  if (O) {
8005
8040
  const At = [];
8006
8041
  w > 0n && At.push(
@@ -8009,7 +8044,7 @@ async function kl(e, t, n, r = !0, s, i = {}) {
8009
8044
  jt
8010
8045
  );
8011
8046
  try {
8012
- Ft(At, null), Oe = await Xr(
8047
+ Ft(At, null), Oe = await zr(
8013
8048
  D,
8014
8049
  n,
8015
8050
  null,
@@ -8029,7 +8064,7 @@ async function kl(e, t, n, r = !0, s, i = {}) {
8029
8064
  At.push(St, Nt), Ft(At, [lt, te]);
8030
8065
  const Me = new Ut(
8031
8066
  !0,
8032
- S.from(me.encode(["OP_RETURN", z.str("BRC20PROG")], !1)),
8067
+ B.from(me.encode(["OP_RETURN", J.str("BRC20PROG")], !1)),
8033
8068
  null,
8034
8069
  null,
8035
8070
  null
@@ -8054,7 +8089,7 @@ async function kl(e, t, n, r = !0, s, i = {}) {
8054
8089
  }
8055
8090
  if (ee == null)
8056
8091
  throw new Error("Failed to send inscription to OP_RETURN");
8057
- ve = ee.signedTxHex, rn = ee.txId;
8092
+ ve = ee.signedTxHex, nn = ee.txId;
8058
8093
  }
8059
8094
  const ar = [], De = [];
8060
8095
  if (w > 0n) {
@@ -8075,15 +8110,15 @@ async function kl(e, t, n, r = !0, s, i = {}) {
8075
8110
  if (!St || !Nt || !ve)
8076
8111
  throw new Error("Allowance transaction hexes are missing");
8077
8112
  De.push(St, Nt, ve), ar.push({
8078
- utxo: `${rn}:1`,
8113
+ utxo: `${nn}:1`,
8079
8114
  value: be,
8080
8115
  script_type: Pn(p.outputScript, a),
8081
8116
  wallet: p
8082
8117
  });
8083
8118
  }
8084
- let vn = null, Te = null, sn = "", Yr = "", cr = "", ur = "";
8119
+ let vn = null, Te = null, rn = "", Yr = "", cr = "", ur = "";
8085
8120
  try {
8086
- De.length > 0 && Ft(De, null), Te = await Js(
8121
+ De.length > 0 && Ft(De, null), Te = await js(
8087
8122
  j,
8088
8123
  ar,
8089
8124
  n,
@@ -8092,18 +8127,18 @@ async function kl(e, t, n, r = !0, s, i = {}) {
8092
8127
  0,
8093
8128
  !0,
8094
8129
  M
8095
- ), cr = Te.signedCommitTxHex, ur = Te.signedRevealTxHex, sn = Te.inscriptionId;
8096
- const At = `${sn.split("i")[0]}:0:0`;
8097
- Yr = Te.secret, De.push(cr, ur), Ft(De, [sn, At]);
8130
+ ), cr = Te.signedCommitTxHex, ur = Te.signedRevealTxHex, rn = Te.inscriptionId;
8131
+ const At = `${rn.split("i")[0]}:0:0`;
8132
+ Yr = Te.secret, De.push(cr, ur), Ft(De, [rn, At]);
8098
8133
  const te = new Ut(
8099
8134
  !0,
8100
- S.from(me.encode(["OP_RETURN", z.str("BRC20PROG")], !1)),
8135
+ B.from(me.encode(["OP_RETURN", J.str("BRC20PROG")], !1)),
8101
8136
  null,
8102
8137
  null,
8103
8138
  null
8104
8139
  );
8105
8140
  vn = await Ln(
8106
- sn,
8141
+ rn,
8107
8142
  [],
8108
8143
  te,
8109
8144
  1,
@@ -8125,14 +8160,14 @@ async function kl(e, t, n, r = !0, s, i = {}) {
8125
8160
  send_to_opreturn_txid: Uo,
8126
8161
  send_to_opreturn_txhex: Fo,
8127
8162
  secret: Yr,
8128
- inscription_id: sn,
8163
+ inscription_id: rn,
8129
8164
  fee_rate: n,
8130
8165
  approve_details: O ? {
8131
8166
  commit_txid: dt,
8132
8167
  commit_txhex: St,
8133
8168
  reveal_txid: Et,
8134
8169
  reveal_txhex: Nt,
8135
- send_to_opreturn_txid: rn,
8170
+ send_to_opreturn_txid: nn,
8136
8171
  send_to_opreturn_txhex: ve,
8137
8172
  secret: Lt,
8138
8173
  inscription_id: lt,
@@ -8150,12 +8185,12 @@ async function kl(e, t, n, r = !0, s, i = {}) {
8150
8185
  fee_rate: n
8151
8186
  } : null
8152
8187
  };
8153
- return (await Rl(qo)).result;
8188
+ return (await Nl(qo)).result;
8154
8189
  }
8155
- async function Nl(e, t, n, r = !0, s) {
8156
- const i = yn();
8190
+ async function $l(e, t, n, r = !0, s) {
8191
+ const i = gn();
8157
8192
  if (!i || !i.wallets) throw new Error("Wallets not found");
8158
- const o = ze(), a = Zn();
8193
+ const o = Xe(), a = Zn();
8159
8194
  if (!a) throw new Error("Payment wallet not found");
8160
8195
  if (!a.address) throw new Error("Payment wallet address not found");
8161
8196
  const c = a.address, u = a.pubkey, l = new Ut(!1, null, c, null, u);
@@ -8177,51 +8212,51 @@ async function Nl(e, t, n, r = !0, s) {
8177
8212
  throw console.error("Insufficient allowance for BRC-2.0 token transfer."), new Error("Insufficient allowance for BRC-2.0 token transfer.");
8178
8213
  g = !0;
8179
8214
  }
8180
- const b = rr(), v = `0x095ea7b3000000000000000000000000${b.slice(2).toLowerCase()}ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`, O = await Xe(v), F = z.str(
8215
+ const b = rr(), S = `0x095ea7b3000000000000000000000000${b.slice(2).toLowerCase()}ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`, O = await ze(S), A = J.str(
8181
8216
  `{"p":"brc20-prog","op":"c","c":"${e}","b":"${O}"}`
8182
8217
  ), M = new ce(
8183
- z.str("text/plain"),
8218
+ J.str("text/plain"),
8184
8219
  null,
8185
8220
  null,
8186
8221
  null,
8187
8222
  null,
8188
- F
8189
- ), A = (await et())?.swapPubkey;
8190
- if (!A)
8223
+ A
8224
+ ), P = (await et())?.swapPubkey;
8225
+ if (!P)
8191
8226
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8192
8227
  const C = `0x${"00".repeat(64)}`, I = 1, _ = 1, D = await ir({
8193
- pubkey: A,
8228
+ pubkey: P,
8194
8229
  pk_idx: BigInt(I)
8195
8230
  }), U = wo().encodeFunctionData("deposit", [
8196
8231
  e,
8197
8232
  _,
8198
8233
  t,
8199
- A,
8234
+ P,
8200
8235
  BigInt(I),
8201
8236
  D,
8202
8237
  C
8203
- ]), y = await Xe(U), x = z.str(
8238
+ ]), y = await ze(U), x = J.str(
8204
8239
  `{"p":"brc20-prog","op":"c","c":"${b}","b":"${y}"}`
8205
- ), B = new ce(
8206
- z.str("text/plain"),
8240
+ ), v = new ce(
8241
+ J.str("text/plain"),
8207
8242
  null,
8208
8243
  null,
8209
8244
  null,
8210
8245
  null,
8211
8246
  x
8212
- ), R = await Ks(c);
8213
- let P = null, $ = null, q = null, k = null, W = null, Z = 0;
8247
+ ), R = await Xs(c);
8248
+ let F = null, $ = null, q = null, k = null, W = null, Z = 0;
8214
8249
  if (f > 0n) {
8215
8250
  const lt = Bo(
8216
8251
  f,
8217
8252
  d
8218
8253
  ), Lt = new ce(
8219
- z.str("text/plain"),
8254
+ J.str("text/plain"),
8220
8255
  null,
8221
8256
  null,
8222
8257
  null,
8223
8258
  null,
8224
- z.str(
8259
+ J.str(
8225
8260
  `{"p":"brc-20","op":"transfer","tick":"${p}","amt":"${lt}"}`
8226
8261
  )
8227
8262
  );
@@ -8230,16 +8265,16 @@ async function Nl(e, t, n, r = !0, s) {
8230
8265
  const Nt = Wt();
8231
8266
  if (!Nt) throw new Error("Ordinals wallet not found");
8232
8267
  if (!Nt.address) throw new Error("Ordinals wallet address not found");
8233
- const ve = Nt.address, rn = await zs(s, ve);
8268
+ const ve = Nt.address, nn = await zs(s, ve);
8234
8269
  dt = await Go(
8235
8270
  Lt,
8236
- rn,
8271
+ nn,
8237
8272
  n,
8238
8273
  null,
8239
8274
  R
8240
8275
  );
8241
8276
  } else
8242
- dt = await zr(
8277
+ dt = await Xr(
8243
8278
  Lt,
8244
8279
  n,
8245
8280
  null,
@@ -8247,25 +8282,25 @@ async function Nl(e, t, n, r = !0, s) {
8247
8282
  0,
8248
8283
  R
8249
8284
  );
8250
- $ = dt.unsigned_commit_tx_hex, q = dt.signed_reveal_tx_hex, P = dt.inscription_id, Z += dt.total_fee;
8251
- const Et = `${P.split("i")[0]}:0:0`;
8285
+ $ = dt.unsigned_commit_tx_hex, q = dt.signed_reveal_tx_hex, F = dt.inscription_id, Z += dt.total_fee;
8286
+ const Et = `${F.split("i")[0]}:0:0`;
8252
8287
  let St = null;
8253
8288
  try {
8254
8289
  if (!$)
8255
8290
  throw new Error("Base deposit commit tx hex is missing");
8256
8291
  Ft(
8257
8292
  [$, q],
8258
- [P, Et]
8293
+ [F, Et]
8259
8294
  );
8260
8295
  const Nt = new Ut(
8261
8296
  !0,
8262
- S.from(me.encode(["OP_RETURN", z.str("BRC20PROG")], !1)),
8297
+ B.from(me.encode(["OP_RETURN", J.str("BRC20PROG")], !1)),
8263
8298
  null,
8264
8299
  null,
8265
8300
  null
8266
8301
  );
8267
8302
  St = await $n(
8268
- P,
8303
+ F,
8269
8304
  [],
8270
8305
  Nt,
8271
8306
  1,
@@ -8295,7 +8330,7 @@ async function Nl(e, t, n, r = !0, s) {
8295
8330
  );
8296
8331
  try {
8297
8332
  Ft(lt, null);
8298
- const Et = await zr(
8333
+ const Et = await Xr(
8299
8334
  M,
8300
8335
  n,
8301
8336
  null,
@@ -8315,7 +8350,7 @@ async function Nl(e, t, n, r = !0, s) {
8315
8350
  lt.push(j, G), Ft(lt, [ct, Lt]);
8316
8351
  const Et = new Ut(
8317
8352
  !0,
8318
- S.from(me.encode(["OP_RETURN", z.str("BRC20PROG")], !1)),
8353
+ B.from(me.encode(["OP_RETURN", J.str("BRC20PROG")], !1)),
8319
8354
  null,
8320
8355
  null,
8321
8356
  null
@@ -8369,8 +8404,8 @@ async function Nl(e, t, n, r = !0, s) {
8369
8404
  let jt = 0, Be = null;
8370
8405
  try {
8371
8406
  rt.length > 0 && Ft(rt, null);
8372
- const lt = await Xs(
8373
- B,
8407
+ const lt = await Js(
8408
+ v,
8374
8409
  Q,
8375
8410
  n,
8376
8411
  null,
@@ -8381,7 +8416,7 @@ async function Nl(e, t, n, r = !0, s) {
8381
8416
  jt += lt.total_fee, rt.push(Lt, dt), Ft(rt, [Et, St]);
8382
8417
  const Nt = new Ut(
8383
8418
  !0,
8384
- S.from(me.encode(["OP_RETURN", z.str("BRC20PROG")], !1)),
8419
+ B.from(me.encode(["OP_RETURN", J.str("BRC20PROG")], !1)),
8385
8420
  null,
8386
8421
  null,
8387
8422
  null
@@ -8408,9 +8443,9 @@ async function Nl(e, t, n, r = !0, s) {
8408
8443
  fee_rate: n
8409
8444
  };
8410
8445
  }
8411
- async function Cl(e) {
8412
- const t = J("wrap");
8413
- return X(t, {
8446
+ async function Ll(e) {
8447
+ const t = await K("wrap");
8448
+ return z(t, {
8414
8449
  method: "POST",
8415
8450
  headers: {
8416
8451
  "Content-Type": "application/json"
@@ -8418,9 +8453,9 @@ async function Cl(e) {
8418
8453
  body: JSON.stringify(e)
8419
8454
  });
8420
8455
  }
8421
- async function $l(e) {
8422
- const t = J("estimate_wrap_gas");
8423
- return X(t, {
8456
+ async function Al(e) {
8457
+ const t = await K("estimate_wrap_gas");
8458
+ return z(t, {
8424
8459
  method: "POST",
8425
8460
  headers: {
8426
8461
  "Content-Type": "application/json"
@@ -8428,8 +8463,8 @@ async function $l(e) {
8428
8463
  body: JSON.stringify(e)
8429
8464
  });
8430
8465
  }
8431
- async function Ll(e, t, n = {}) {
8432
- const r = await Jt(), s = yn();
8466
+ async function Pl(e, t, n = {}) {
8467
+ const r = await Jt(), s = gn();
8433
8468
  if (!s || !s.wallets) throw new Error("Wallets not found");
8434
8469
  const i = new Hr(n), o = i.wrap(Ir(s.provider)), a = Zn(), c = Wt();
8435
8470
  if (!a) throw new Error("Payment wallet not found");
@@ -8444,7 +8479,7 @@ async function Ll(e, t, n = {}) {
8444
8479
  btc_address: u,
8445
8480
  bls_pubkey: f,
8446
8481
  token_address: r.wbtc_address
8447
- }), p = bn.address.toOutputScript(u, ze()), w = await Eo({
8482
+ }), p = bn.address.toOutputScript(u, Xe()), w = await Eo({
8448
8483
  pubkey: f,
8449
8484
  ordinals_script: p.toString("hex")
8450
8485
  }), h = await So({
@@ -8453,37 +8488,37 @@ async function Ll(e, t, n = {}) {
8453
8488
  token_address: r.wbtc_address.toLowerCase(),
8454
8489
  bip322_signature: d,
8455
8490
  bls12_signature: w
8456
- }), g = h.edcsa_signature, b = h.pubkey_idx, v = h.token_idx, O = await ir({
8491
+ }), g = h.edcsa_signature, b = h.pubkey_idx, S = h.token_idx, O = await ir({
8457
8492
  pubkey: f,
8458
8493
  pk_idx: BigInt(b)
8459
- }), F = fe.defaultAbiCoder().encode(
8494
+ }), A = fe.defaultAbiCoder().encode(
8460
8495
  ["address", "uint32", "bytes", "uint64", "bytes", "bytes"],
8461
8496
  [
8462
8497
  r.wbtc_address,
8463
- v,
8464
- S.from(f.slice(2), "hex"),
8498
+ S,
8499
+ B.from(f.slice(2), "hex"),
8465
8500
  b,
8466
- S.from(O.slice(2), "hex"),
8467
- S.from(g.slice(2), "hex")
8501
+ B.from(O.slice(2), "hex"),
8502
+ B.from(g.slice(2), "hex")
8468
8503
  ]
8469
- ), A = `0x5608f857${fe.defaultAbiCoder().encode(
8504
+ ), P = `0x5608f857${fe.defaultAbiCoder().encode(
8470
8505
  ["address", "bytes"],
8471
- [l, S.from(F.slice(2), "hex")]
8472
- ).slice(2)}`, C = await Xe(A), I = z.str(
8506
+ [l, B.from(A.slice(2), "hex")]
8507
+ ).slice(2)}`, C = await ze(P), I = J.str(
8473
8508
  `{"p":"brc20-prog","op":"c","c":"${r.wbtc_address}","b":"${C}"}`
8474
8509
  );
8475
8510
  let _ = 0;
8476
8511
  for (let D = 0; D < 5; D++) {
8477
- const H = I.length * Hs, U = _ > H ? Math.ceil((_ - H) / Hs) : 0, y = z.from(
8478
- S.concat([I, z.str(" ".repeat(U))])
8512
+ const H = I.length * Vs, U = _ > H ? Math.ceil((_ - H) / Vs) : 0, y = J.from(
8513
+ B.concat([I, J.str(" ".repeat(U))])
8479
8514
  ), x = new ce(
8480
- z.str("text/plain"),
8515
+ J.str("text/plain"),
8481
8516
  null,
8482
8517
  null,
8483
8518
  null,
8484
8519
  null,
8485
8520
  y
8486
- ), B = await Js(
8521
+ ), v = await js(
8487
8522
  x,
8488
8523
  [],
8489
8524
  t,
@@ -8492,16 +8527,16 @@ async function Ll(e, t, n = {}) {
8492
8527
  0,
8493
8528
  !0,
8494
8529
  o
8495
- ), R = B.signedCommitTxHex, P = B.signedRevealTxHex, $ = B.inscriptionId, q = `${$.split("i")[0]}:0:0`, k = B.secret;
8530
+ ), R = v.signedCommitTxHex, F = v.signedRevealTxHex, $ = v.inscriptionId, q = `${$.split("i")[0]}:0:0`, k = v.secret;
8496
8531
  let W = null;
8497
8532
  try {
8498
8533
  Ft(
8499
- [R, P],
8534
+ [R, F],
8500
8535
  [$, q]
8501
8536
  );
8502
8537
  const xt = new Ut(
8503
8538
  !0,
8504
- S.from(me.encode(["OP_RETURN", z.str("BRC20PROG")], !1)),
8539
+ B.from(me.encode(["OP_RETURN", J.str("BRC20PROG")], !1)),
8505
8540
  null,
8506
8541
  null,
8507
8542
  null
@@ -8528,16 +8563,16 @@ async function Ll(e, t, n = {}) {
8528
8563
  if (W == null)
8529
8564
  throw new Error("Failed to send inscription to OP_RETURN");
8530
8565
  const Z = W.signedTxHex, ct = W.txId, j = {
8531
- commit_txid: B.commitTxId,
8566
+ commit_txid: v.commitTxId,
8532
8567
  commit_txhex: R,
8533
- reveal_txid: B.revealTxId,
8534
- reveal_txhex: P,
8568
+ reveal_txid: v.revealTxId,
8569
+ reveal_txhex: F,
8535
8570
  send_to_opreturn_txid: ct,
8536
8571
  send_to_opreturn_txhex: Z,
8537
8572
  secret: k,
8538
8573
  inscription_id: $,
8539
8574
  fee_rate: t
8540
- }, G = await $l(j), ut = Math.max(
8575
+ }, G = await Al(j), ut = Math.max(
8541
8576
  G.estimated_gas + 1e5,
8542
8577
  G.estimated_gas * 1.2
8543
8578
  );
@@ -8545,12 +8580,12 @@ async function Ll(e, t, n = {}) {
8545
8580
  _ = ut + 5e4;
8546
8581
  continue;
8547
8582
  }
8548
- return (await Cl(j)).result;
8583
+ return (await Ll(j)).result;
8549
8584
  }
8550
8585
  throw new Error("Failed to estimate gas for wrap order after multiple attempts");
8551
8586
  }
8552
- async function Al(e, t) {
8553
- const n = await Jt(), r = yn();
8587
+ async function Fl(e, t) {
8588
+ const n = await Jt(), r = gn();
8554
8589
  if (!r || !r.wallets) throw new Error("Wallets not found");
8555
8590
  const s = Zn();
8556
8591
  if (!s) throw new Error("Payment wallet not found");
@@ -8566,26 +8601,26 @@ async function Al(e, t) {
8566
8601
  [
8567
8602
  n.wbtc_address,
8568
8603
  u,
8569
- S.from(o.slice(2), "hex"),
8604
+ B.from(o.slice(2), "hex"),
8570
8605
  c,
8571
- S.from(l.slice(2), "hex"),
8572
- S.from(a.slice(2), "hex")
8606
+ B.from(l.slice(2), "hex"),
8607
+ B.from(a.slice(2), "hex")
8573
8608
  ]
8574
8609
  ), p = `0x5608f857${fe.defaultAbiCoder().encode(
8575
8610
  ["address", "bytes"],
8576
- [i, S.from(f.slice(2), "hex")]
8577
- ).slice(2)}`, w = await Xe(p), h = z.str(
8611
+ [i, B.from(f.slice(2), "hex")]
8612
+ ).slice(2)}`, w = await ze(p), h = J.str(
8578
8613
  `{"p":"brc20-prog","op":"c","c":"${n.wbtc_address}","b":"${w}"}`
8579
8614
  ), g = new ce(
8580
- z.str("text/plain"),
8615
+ J.str("text/plain"),
8581
8616
  null,
8582
8617
  null,
8583
8618
  null,
8584
8619
  null,
8585
8620
  h
8586
- ), b = await Ks(s.address);
8587
- let v = 0;
8588
- const O = await Xs(
8621
+ ), b = await Xs(s.address);
8622
+ let S = 0;
8623
+ const O = await Js(
8589
8624
  g,
8590
8625
  [],
8591
8626
  t,
@@ -8593,17 +8628,17 @@ async function Al(e, t) {
8593
8628
  null,
8594
8629
  0,
8595
8630
  b
8596
- ), F = O.unsigned_commit_tx_hex, M = O.signed_reveal_tx_hex, A = O.inscription_id, C = `${A.split("i")[0]}:0:0`;
8597
- v += O.total_fee;
8631
+ ), A = O.unsigned_commit_tx_hex, M = O.signed_reveal_tx_hex, P = O.inscription_id, C = `${P.split("i")[0]}:0:0`;
8632
+ S += O.total_fee;
8598
8633
  let I = null;
8599
8634
  try {
8600
8635
  Ft(
8601
- [F, M],
8602
- [A, C]
8636
+ [A, M],
8637
+ [P, C]
8603
8638
  );
8604
8639
  const D = new Ut(
8605
8640
  !0,
8606
- S.from(me.encode(["OP_RETURN", z.str("BRC20PROG")], !1)),
8641
+ B.from(me.encode(["OP_RETURN", J.str("BRC20PROG")], !1)),
8607
8642
  null,
8608
8643
  null,
8609
8644
  null
@@ -8615,7 +8650,7 @@ async function Al(e, t) {
8615
8650
  }
8616
8651
  ];
8617
8652
  I = await $n(
8618
- A,
8653
+ P,
8619
8654
  [],
8620
8655
  D,
8621
8656
  1,
@@ -8628,12 +8663,12 @@ async function Al(e, t) {
8628
8663
  }
8629
8664
  if (I == null)
8630
8665
  throw new Error("Failed to send inscription to OP_RETURN");
8631
- return v += I.tx_fee, {
8632
- total_fee: v,
8666
+ return S += I.tx_fee, {
8667
+ total_fee: S,
8633
8668
  fee_rate: t
8634
8669
  };
8635
8670
  }
8636
- async function Pl(e, t, n, r) {
8671
+ async function Ul(e, t, n, r) {
8637
8672
  const s = await Jt();
8638
8673
  er(s.wbtc_address, s.factory_address);
8639
8674
  const i = (await et())?.swapPubkey;
@@ -8670,7 +8705,7 @@ async function Pl(e, t, n, r) {
8670
8705
  throw new Error("No data returned from add liquidity request.");
8671
8706
  return c.data;
8672
8707
  }
8673
- async function Fl(e) {
8708
+ async function ql(e) {
8674
8709
  e.token1_addr = e.token1_addr.toLowerCase(), e.token2_addr = e.token2_addr.toLowerCase();
8675
8710
  const t = `Add Liquidity Order:
8676
8711
  Token 1 Address: ${e.token1_addr}
@@ -8686,21 +8721,21 @@ BTC Fee: ${e.btc_fee}
8686
8721
  By signing this message, you authorize the creation of an add liquidity order with the above parameters.`;
8687
8722
  return await Pe(t, "ordinals");
8688
8723
  }
8689
- async function Ul(e) {
8724
+ async function Dl(e) {
8690
8725
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
8691
- let t = tt(S.from(e.pubkey, "hex")).slice(2);
8726
+ let t = tt(B.from(e.pubkey, "hex")).slice(2);
8692
8727
  t += e.nonce.toString(16).padStart(8, "0"), t += "01", t += e.token1_addr.slice(2).padStart(40, "0"), t += e.token2_addr.slice(2).padStart(40, "0"), t += e.amt1.toString(16).padStart(64, "0"), t += e.amt2.toString(16).padStart(64, "0"), t += e.minamt1.toString(16).padStart(64, "0"), t += e.minamt2.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");
8693
- const n = S.from(t, "hex"), r = T.G1.hashToCurve(n, {
8728
+ const n = B.from(t, "hex"), r = T.G1.hashToCurve(n, {
8694
8729
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
8695
8730
  }), s = await et();
8696
8731
  if (!s?.swapPrivkey)
8697
8732
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8698
- const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = S.from(i, "hex"), a = T.shortSignatures.sign(r, o);
8733
+ const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), a = T.shortSignatures.sign(r, o);
8699
8734
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
8700
8735
  }
8701
- async function ql(e) {
8702
- const t = J("add_liq_req");
8703
- return X(t, {
8736
+ async function Ml(e) {
8737
+ const t = await K("add_liq_req");
8738
+ return z(t, {
8704
8739
  method: "POST",
8705
8740
  headers: {
8706
8741
  "Content-Type": "application/json"
@@ -8708,11 +8743,11 @@ async function ql(e) {
8708
8743
  body: JSON.stringify(e)
8709
8744
  });
8710
8745
  }
8711
- async function Dl(e, t, n, r, s) {
8746
+ async function Wl(e, t, n, r, s) {
8712
8747
  const i = (await et())?.swapPubkey;
8713
8748
  if (!i)
8714
8749
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8715
- const o = n * (10000n - s) / 10000n, a = r * (10000n - s) / 10000n, c = 0n, u = 0n, l = await qe(), f = await $t("add_liquidity"), d = await Fl({
8750
+ const o = n * (10000n - s) / 10000n, a = r * (10000n - s) / 10000n, c = 0n, u = 0n, l = await qe(), f = await $t("add_liquidity"), d = await ql({
8716
8751
  token1_addr: e,
8717
8752
  token2_addr: t,
8718
8753
  amt1: n.toString(),
@@ -8722,7 +8757,7 @@ async function Dl(e, t, n, r, s) {
8722
8757
  token1FeeBps: c.toString(),
8723
8758
  token2FeeBps: u.toString(),
8724
8759
  btc_fee: f.toString()
8725
- }), p = await Ul({
8760
+ }), p = await Dl({
8726
8761
  pubkey: i,
8727
8762
  nonce: l,
8728
8763
  token1_addr: e,
@@ -8735,7 +8770,7 @@ async function Dl(e, t, n, r, s) {
8735
8770
  token2FeeBps: u,
8736
8771
  btc_fee: f
8737
8772
  });
8738
- return await ql({
8773
+ return await Ml({
8739
8774
  pubkey: i,
8740
8775
  token1_addr: e,
8741
8776
  token2_addr: t,
@@ -8750,7 +8785,7 @@ async function Dl(e, t, n, r, s) {
8750
8785
  bip322_signature: d
8751
8786
  });
8752
8787
  }
8753
- async function Ml(e, t, n) {
8788
+ async function Gl(e, t, n) {
8754
8789
  const r = await Jt();
8755
8790
  er(r.wbtc_address, r.factory_address);
8756
8791
  const s = (await et())?.swapPubkey;
@@ -8786,7 +8821,7 @@ async function Ml(e, t, n) {
8786
8821
  throw new Error("No data returned from remove liquidity request.");
8787
8822
  return a.data;
8788
8823
  }
8789
- async function Wl(e) {
8824
+ async function Hl(e) {
8790
8825
  e.token1_addr = e.token1_addr.toLowerCase(), e.token2_addr = e.token2_addr.toLowerCase();
8791
8826
  const t = `Remove Liquidity Order:
8792
8827
  Token 1 Address: ${e.token1_addr}
@@ -8801,21 +8836,21 @@ BTC Fee: ${e.btc_fee}
8801
8836
  By signing this message, you authorize the creation of a remove liquidity order with the above parameters.`;
8802
8837
  return await Pe(t, "ordinals");
8803
8838
  }
8804
- async function Gl(e) {
8839
+ async function Vl(e) {
8805
8840
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
8806
- let t = tt(S.from(e.pubkey, "hex")).slice(2);
8841
+ let t = tt(B.from(e.pubkey, "hex")).slice(2);
8807
8842
  t += e.nonce.toString(16).padStart(8, "0"), t += "02", t += e.token1_addr.slice(2).padStart(40, "0"), t += e.token2_addr.slice(2).padStart(40, "0"), t += e.lp_amt.toString(16).padStart(64, "0"), t += e.minamt1.toString(16).padStart(64, "0"), t += e.minamt2.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");
8808
- const n = S.from(t, "hex"), r = T.G1.hashToCurve(n, {
8843
+ const n = B.from(t, "hex"), r = T.G1.hashToCurve(n, {
8809
8844
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
8810
8845
  }), s = await et();
8811
8846
  if (!s?.swapPrivkey)
8812
8847
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8813
- const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = S.from(i, "hex"), a = T.shortSignatures.sign(r, o);
8848
+ const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), a = T.shortSignatures.sign(r, o);
8814
8849
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
8815
8850
  }
8816
- async function Hl(e) {
8817
- const t = J("remove_liq_req");
8818
- return X(t, {
8851
+ async function Zl(e) {
8852
+ const t = await K("remove_liq_req");
8853
+ return z(t, {
8819
8854
  method: "POST",
8820
8855
  headers: {
8821
8856
  "Content-Type": "application/json"
@@ -8823,11 +8858,11 @@ async function Hl(e) {
8823
8858
  body: JSON.stringify(e)
8824
8859
  });
8825
8860
  }
8826
- async function Vl(e, t, n, r, s, i) {
8861
+ async function Yl(e, t, n, r, s, i) {
8827
8862
  const o = (await et())?.swapPubkey;
8828
8863
  if (!o)
8829
8864
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8830
- const a = r * (10000n - i) / 10000n, c = s * (10000n - i) / 10000n, u = 0n, l = 0n, f = await qe(), d = await $t("remove_liquidity"), p = await Wl({
8865
+ const a = r * (10000n - i) / 10000n, c = s * (10000n - i) / 10000n, u = 0n, l = 0n, f = await qe(), d = await $t("remove_liquidity"), p = await Hl({
8831
8866
  token1_addr: e,
8832
8867
  token2_addr: t,
8833
8868
  lp_amt: n.toString(),
@@ -8836,7 +8871,7 @@ async function Vl(e, t, n, r, s, i) {
8836
8871
  token1FeeBps: u.toString(),
8837
8872
  token2FeeBps: l.toString(),
8838
8873
  btc_fee: d.toString()
8839
- }), w = await Gl({
8874
+ }), w = await Vl({
8840
8875
  pubkey: o,
8841
8876
  nonce: f,
8842
8877
  token1_addr: e,
@@ -8848,7 +8883,7 @@ async function Vl(e, t, n, r, s, i) {
8848
8883
  token2FeeBps: l,
8849
8884
  btc_fee: d
8850
8885
  });
8851
- return await Hl({
8886
+ return await Zl({
8852
8887
  pubkey: o,
8853
8888
  token1_addr: e,
8854
8889
  token2_addr: t,
@@ -8865,12 +8900,12 @@ async function Vl(e, t, n, r, s, i) {
8865
8900
  async function or(e, t) {
8866
8901
  const n = await Jt();
8867
8902
  if (n.fee_policy === null) {
8868
- const r = Or.get(tn());
8903
+ const r = Or.get(yn());
8869
8904
  throw new Error(r ?? oo);
8870
8905
  }
8871
8906
  return Cu(e, t, n.fee_policy);
8872
8907
  }
8873
- async function Zl(e, t, n) {
8908
+ async function Kl(e, t, n) {
8874
8909
  const r = await Jt();
8875
8910
  await sr(e, t);
8876
8911
  const s = (await et())?.swapPubkey;
@@ -8901,7 +8936,7 @@ async function Zl(e, t, n) {
8901
8936
  throw new Error("No data returned from swap request.");
8902
8937
  if (u.amounts.length < 2)
8903
8938
  throw new Error("Invalid amounts returned from swap request.");
8904
- const l = await wn(e), f = await wn(t), d = uo(
8939
+ const l = await hn(e), f = await hn(t), d = uo(
8905
8940
  e,
8906
8941
  r.wbtc_address,
8907
8942
  n,
@@ -8918,7 +8953,7 @@ async function Zl(e, t, n) {
8918
8953
  fees: co(n, u.amounts[1], a, c, o)
8919
8954
  };
8920
8955
  }
8921
- async function Yl(e) {
8956
+ async function Xl(e) {
8922
8957
  e.token1_addr = e.token1_addr.toLowerCase(), e.token2_addr = e.token2_addr.toLowerCase(), e.referrer_pubkey = e.referrer_pubkey?.startsWith("0x") ? e.referrer_pubkey.slice(2) : e.referrer_pubkey;
8923
8958
  const t = `Swap Order:
8924
8959
  Token 1 Address: ${e.token1_addr}
@@ -8934,21 +8969,21 @@ ${e.referrer_pubkey ? `Referrer Pubkey: ${e.referrer_pubkey}
8934
8969
  By signing this message, you authorize the creation of a swap order with the above parameters.`;
8935
8970
  return await Pe(t, "ordinals");
8936
8971
  }
8937
- async function Kl(e) {
8972
+ async function zl(e) {
8938
8973
  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;
8939
- let t = tt(S.from(e.pubkey, "hex")).slice(2);
8940
- 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(S.from(e.referrer_pubkey, "hex")).slice(2), t += ho.toString(16).padStart(8, "0"), e.ref_return_bps && e.ref_return_bps > 0n && (t += e.ref_return_bps.toString(16).padStart(8, "0")));
8941
- const n = S.from(t, "hex"), r = T.G1.hashToCurve(n, {
8974
+ let t = tt(B.from(e.pubkey, "hex")).slice(2);
8975
+ 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 += ho.toString(16).padStart(8, "0"), e.ref_return_bps && e.ref_return_bps > 0n && (t += e.ref_return_bps.toString(16).padStart(8, "0")));
8976
+ const n = B.from(t, "hex"), r = T.G1.hashToCurve(n, {
8942
8977
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
8943
8978
  }), s = await et();
8944
8979
  if (!s?.swapPrivkey)
8945
8980
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8946
- const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = S.from(i, "hex"), a = T.shortSignatures.sign(r, o);
8981
+ const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), a = T.shortSignatures.sign(r, o);
8947
8982
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
8948
8983
  }
8949
- async function zl(e) {
8950
- const t = J("swap");
8951
- return X(t, {
8984
+ async function Jl(e) {
8985
+ const t = await K("swap");
8986
+ return z(t, {
8952
8987
  method: "POST",
8953
8988
  headers: {
8954
8989
  "Content-Type": "application/json"
@@ -8956,12 +8991,12 @@ async function zl(e) {
8956
8991
  body: JSON.stringify(e)
8957
8992
  });
8958
8993
  }
8959
- async function Xl(e, t, n, r, s, i) {
8994
+ async function jl(e, t, n, r, s, i) {
8960
8995
  const o = (await et())?.swapPubkey;
8961
8996
  if (!o)
8962
8997
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8963
8998
  await sr(e, t);
8964
- 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 Yl({
8999
+ 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 Xl({
8965
9000
  token1_addr: e,
8966
9001
  token2_addr: t,
8967
9002
  in_amt: n.toString(),
@@ -8971,7 +9006,7 @@ async function Xl(e, t, n, r, s, i) {
8971
9006
  btc_fee: u.toString(),
8972
9007
  referrer_pubkey: d,
8973
9008
  ref_return_bps: p ? p.toString() : void 0
8974
- }), h = await Kl({
9009
+ }), h = await zl({
8975
9010
  pubkey: o,
8976
9011
  nonce: c,
8977
9012
  token1_addr: e,
@@ -8984,7 +9019,7 @@ async function Xl(e, t, n, r, s, i) {
8984
9019
  referrer_pubkey: d,
8985
9020
  ref_return_bps: p
8986
9021
  });
8987
- return await zl({
9022
+ return await Jl({
8988
9023
  pubkey: o,
8989
9024
  token1_addr: e,
8990
9025
  token2_addr: t,
@@ -8999,7 +9034,7 @@ async function Xl(e, t, n, r, s, i) {
8999
9034
  referrer_id: d ? i : void 0
9000
9035
  });
9001
9036
  }
9002
- async function Jl(e, t, n) {
9037
+ async function Ql(e, t, n) {
9003
9038
  const r = await Jt();
9004
9039
  await sr(e, t);
9005
9040
  const s = (await et())?.swapPubkey;
@@ -9030,7 +9065,7 @@ async function Jl(e, t, n) {
9030
9065
  throw new Error("No data returned from swap request.");
9031
9066
  if (u.amounts.length < 2)
9032
9067
  throw new Error("Invalid data returned from swap request.");
9033
- const l = await wn(e), f = await wn(t), d = uo(
9068
+ const l = await hn(e), f = await hn(t), d = uo(
9034
9069
  e,
9035
9070
  r.wbtc_address,
9036
9071
  u.amounts[0],
@@ -9047,7 +9082,7 @@ async function Jl(e, t, n) {
9047
9082
  fees: co(u.amounts[0], n, a, c, o)
9048
9083
  };
9049
9084
  }
9050
- async function jl(e) {
9085
+ async function tf(e) {
9051
9086
  e.token1_addr = e.token1_addr.toLowerCase(), e.token2_addr = e.token2_addr.toLowerCase(), e.referrer_pubkey = e.referrer_pubkey?.startsWith("0x") ? e.referrer_pubkey.slice(2) : e.referrer_pubkey;
9052
9087
  const t = `Swap Order:
9053
9088
  Token 1 Address: ${e.token1_addr}
@@ -9063,21 +9098,21 @@ ${e.referrer_pubkey ? `Referrer Pubkey: ${e.referrer_pubkey}
9063
9098
  By signing this message, you authorize the creation of a swap order with the above parameters.`;
9064
9099
  return await Pe(t, "ordinals");
9065
9100
  }
9066
- async function Ql(e) {
9101
+ async function ef(e) {
9067
9102
  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;
9068
- let t = tt(S.from(e.pubkey, "hex")).slice(2);
9069
- 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(S.from(e.referrer_pubkey, "hex")).slice(2), t += ho.toString(16).padStart(8, "0"), e.ref_return_bps && e.ref_return_bps > 0n && (t += e.ref_return_bps.toString(16).padStart(8, "0")));
9070
- const n = S.from(t, "hex"), r = T.G1.hashToCurve(n, {
9103
+ let t = tt(B.from(e.pubkey, "hex")).slice(2);
9104
+ 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 += ho.toString(16).padStart(8, "0"), e.ref_return_bps && e.ref_return_bps > 0n && (t += e.ref_return_bps.toString(16).padStart(8, "0")));
9105
+ const n = B.from(t, "hex"), r = T.G1.hashToCurve(n, {
9071
9106
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
9072
9107
  }), s = await et();
9073
9108
  if (!s?.swapPrivkey)
9074
9109
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
9075
- const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = S.from(i, "hex"), a = T.shortSignatures.sign(r, o);
9110
+ const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), a = T.shortSignatures.sign(r, o);
9076
9111
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
9077
9112
  }
9078
- async function tf(e) {
9079
- const t = J("swap2");
9080
- return X(t, {
9113
+ async function nf(e) {
9114
+ const t = await K("swap2");
9115
+ return z(t, {
9081
9116
  method: "POST",
9082
9117
  headers: {
9083
9118
  "Content-Type": "application/json"
@@ -9085,12 +9120,12 @@ async function tf(e) {
9085
9120
  body: JSON.stringify(e)
9086
9121
  });
9087
9122
  }
9088
- async function ef(e, t, n, r, s, i) {
9123
+ async function rf(e, t, n, r, s, i) {
9089
9124
  const o = (await et())?.swapPubkey;
9090
9125
  if (!o)
9091
9126
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
9092
9127
  await sr(e, t);
9093
- 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({
9128
+ 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 tf({
9094
9129
  token1_addr: e,
9095
9130
  token2_addr: t,
9096
9131
  max_in_amt: a.toString(),
@@ -9100,7 +9135,7 @@ async function ef(e, t, n, r, s, i) {
9100
9135
  btc_fee: u.toString(),
9101
9136
  referrer_pubkey: d,
9102
9137
  ref_return_bps: p ? p.toString() : void 0
9103
- }), h = await Ql({
9138
+ }), h = await ef({
9104
9139
  pubkey: o,
9105
9140
  nonce: c,
9106
9141
  token1_addr: e,
@@ -9113,7 +9148,7 @@ async function ef(e, t, n, r, s, i) {
9113
9148
  referrer_pubkey: d,
9114
9149
  ref_return_bps: p
9115
9150
  });
9116
- return await tf({
9151
+ return await nf({
9117
9152
  pubkey: o,
9118
9153
  token1_addr: e,
9119
9154
  token2_addr: t,
@@ -9129,7 +9164,7 @@ async function ef(e, t, n, r, s, i) {
9129
9164
  });
9130
9165
  }
9131
9166
  function Oo(e) {
9132
- const t = ze();
9167
+ const t = Xe();
9133
9168
  return `0x${tt(bn.address.toOutputScript(e, t)).slice(26)}`;
9134
9169
  }
9135
9170
  async function To(e) {
@@ -9147,19 +9182,19 @@ By signing this message, you authorize the creation of a withdraw order with the
9147
9182
  }
9148
9183
  async function Io(e) {
9149
9184
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
9150
- let t = tt(S.from(e.pubkey, "hex")).slice(2);
9185
+ let t = tt(B.from(e.pubkey, "hex")).slice(2);
9151
9186
  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");
9152
- const n = S.from(t, "hex"), r = T.G1.hashToCurve(n, {
9187
+ const n = B.from(t, "hex"), r = T.G1.hashToCurve(n, {
9153
9188
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
9154
9189
  }), s = await et();
9155
9190
  if (!s?.swapPrivkey)
9156
9191
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
9157
- const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = S.from(i, "hex"), a = T.shortSignatures.sign(r, o);
9192
+ const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), a = T.shortSignatures.sign(r, o);
9158
9193
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
9159
9194
  }
9160
9195
  async function Ro(e) {
9161
- const t = J("withdraw");
9162
- return X(t, {
9196
+ const t = await K("withdraw");
9197
+ return z(t, {
9163
9198
  method: "POST",
9164
9199
  headers: {
9165
9200
  "Content-Type": "application/json"
@@ -9167,7 +9202,7 @@ async function Ro(e) {
9167
9202
  body: JSON.stringify(e)
9168
9203
  });
9169
9204
  }
9170
- async function nf(e, t, n) {
9205
+ async function sf(e, t, n) {
9171
9206
  const r = (await et())?.swapPubkey;
9172
9207
  if (!r)
9173
9208
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
@@ -9198,7 +9233,7 @@ async function nf(e, t, n) {
9198
9233
  bip322_signature: l
9199
9234
  });
9200
9235
  }
9201
- async function rf(e, t) {
9236
+ async function of(e, t) {
9202
9237
  const n = (await et())?.swapPubkey;
9203
9238
  if (!n)
9204
9239
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
@@ -9232,7 +9267,7 @@ async function rf(e, t) {
9232
9267
  bip322_signature: l
9233
9268
  });
9234
9269
  }
9235
- async function sf(e, t) {
9270
+ async function af(e, t) {
9236
9271
  const n = await Jt();
9237
9272
  er(n.wbtc_address, n.factory_address);
9238
9273
  const r = (await et())?.swapPubkey;
@@ -9258,7 +9293,7 @@ async function sf(e, t) {
9258
9293
  throw new Error("No data returned from unwrap request.");
9259
9294
  return { amt: o.data.amt };
9260
9295
  }
9261
- async function of(e) {
9296
+ async function cf(e) {
9262
9297
  e.pkscript = e.pkscript.toLowerCase();
9263
9298
  const t = `Unwrap Order:
9264
9299
  Pkscript: ${e.pkscript}
@@ -9270,21 +9305,21 @@ BTC Fee: ${e.btc_fee}
9270
9305
  By signing this message, you authorize the creation of a withdraw order with the above parameters.`;
9271
9306
  return await Pe(t, "ordinals");
9272
9307
  }
9273
- async function af(e) {
9308
+ async function uf(e) {
9274
9309
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
9275
- let t = tt(S.from(e.pubkey, "hex")).slice(2);
9276
- t += e.nonce.toString(16).padStart(8, "0"), t += "06", t += tt(S.from(e.pkscript, "hex")).slice(2), t += e.amt.toString(16).padStart(64, "0"), t += e.btc_fee.toString(16).padStart(64, "0");
9277
- const n = S.from(t, "hex"), r = T.G1.hashToCurve(n, {
9310
+ let t = tt(B.from(e.pubkey, "hex")).slice(2);
9311
+ t += e.nonce.toString(16).padStart(8, "0"), t += "06", t += tt(B.from(e.pkscript, "hex")).slice(2), t += e.amt.toString(16).padStart(64, "0"), t += e.btc_fee.toString(16).padStart(64, "0");
9312
+ const n = B.from(t, "hex"), r = T.G1.hashToCurve(n, {
9278
9313
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
9279
9314
  }), s = await et();
9280
9315
  if (!s?.swapPrivkey)
9281
9316
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
9282
- const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = S.from(i, "hex"), a = T.shortSignatures.sign(r, o);
9317
+ const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), a = T.shortSignatures.sign(r, o);
9283
9318
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
9284
9319
  }
9285
- async function cf(e) {
9286
- const t = J("unwrap");
9287
- return X(t, {
9320
+ async function lf(e) {
9321
+ const t = await K("unwrap");
9322
+ return z(t, {
9288
9323
  method: "POST",
9289
9324
  headers: {
9290
9325
  "Content-Type": "application/json"
@@ -9292,24 +9327,24 @@ async function cf(e) {
9292
9327
  body: JSON.stringify(e)
9293
9328
  });
9294
9329
  }
9295
- async function uf(e, t) {
9330
+ async function ff(e, t) {
9296
9331
  const n = (await et())?.swapPubkey;
9297
9332
  if (!n)
9298
9333
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
9299
- const r = 0n, s = 0n, i = await qe(), o = await $t("unwrap"), a = await of({
9334
+ const r = 0n, s = 0n, i = await qe(), o = await $t("unwrap"), a = await cf({
9300
9335
  pkscript: e,
9301
9336
  amt: t.toString(),
9302
9337
  token1FeeBps: r.toString(),
9303
9338
  token2FeeBps: s.toString(),
9304
9339
  btc_fee: o.toString()
9305
- }), c = await af({
9340
+ }), c = await uf({
9306
9341
  pubkey: n,
9307
9342
  nonce: i,
9308
9343
  pkscript: e,
9309
9344
  amt: t,
9310
9345
  btc_fee: o
9311
9346
  });
9312
- return await cf({
9347
+ return await lf({
9313
9348
  pubkey: n,
9314
9349
  pkscript: e,
9315
9350
  amt: t.toString(),
@@ -9320,8 +9355,8 @@ async function uf(e, t) {
9320
9355
  bip322_signature: a
9321
9356
  });
9322
9357
  }
9323
- async function lf(e, t, n, r, s) {
9324
- return await Il({
9358
+ async function df(e, t, n, r, s) {
9359
+ return await kl({
9325
9360
  pubkey: e,
9326
9361
  pairAddress: t,
9327
9362
  limit: n,
@@ -9329,15 +9364,18 @@ async function lf(e, t, n, r, s) {
9329
9364
  kinds: s
9330
9365
  });
9331
9366
  }
9332
- async function ff(e, t, n) {
9367
+ async function pf(e, t, n) {
9333
9368
  return await Ol({
9334
9369
  pair_address: e,
9335
9370
  limit: t || 20,
9336
9371
  offset: n || 0
9337
9372
  });
9338
9373
  }
9339
- async function df(e, t, n, r, s) {
9340
- return (await Dl(
9374
+ async function hf(e) {
9375
+ return await Il(e);
9376
+ }
9377
+ async function wf(e, t, n, r, s) {
9378
+ return (await Wl(
9341
9379
  e,
9342
9380
  t,
9343
9381
  n,
@@ -9345,8 +9383,8 @@ async function df(e, t, n, r, s) {
9345
9383
  s
9346
9384
  )).success;
9347
9385
  }
9348
- async function pf(e, t, n, r, s, i) {
9349
- return (await Vl(
9386
+ async function gf(e, t, n, r, s, i) {
9387
+ return (await Yl(
9350
9388
  e,
9351
9389
  t,
9352
9390
  n,
@@ -9355,8 +9393,8 @@ async function pf(e, t, n, r, s, i) {
9355
9393
  i
9356
9394
  )).success;
9357
9395
  }
9358
- async function hf(e, t, n, r, s, i) {
9359
- return (await Xl(
9396
+ async function yf(e, t, n, r, s, i) {
9397
+ return (await jl(
9360
9398
  e,
9361
9399
  t,
9362
9400
  n,
@@ -9365,8 +9403,8 @@ async function hf(e, t, n, r, s, i) {
9365
9403
  i
9366
9404
  )).success;
9367
9405
  }
9368
- async function wf(e, t, n, r, s, i) {
9369
- return (await ef(
9406
+ async function bf(e, t, n, r, s, i) {
9407
+ return (await rf(
9370
9408
  e,
9371
9409
  t,
9372
9410
  n,
@@ -9375,11 +9413,11 @@ async function wf(e, t, n, r, s, i) {
9375
9413
  i
9376
9414
  )).success;
9377
9415
  }
9378
- async function gf(e, t) {
9379
- return (await uf(e, t)).success;
9416
+ async function mf(e, t) {
9417
+ return (await ff(e, t)).success;
9380
9418
  }
9381
- async function yf(e, t, n, r = !0, s, i) {
9382
- return await kl(
9419
+ async function _f(e, t, n, r = !0, s, i) {
9420
+ return await Cl(
9383
9421
  e,
9384
9422
  t,
9385
9423
  n,
@@ -9388,74 +9426,75 @@ async function yf(e, t, n, r = !0, s, i) {
9388
9426
  i
9389
9427
  );
9390
9428
  }
9391
- async function bf(e, t, n) {
9392
- return await Ll(e, t, n);
9429
+ async function xf(e, t, n) {
9430
+ return await Pl(e, t, n);
9393
9431
  }
9394
- async function mf(e, t, n) {
9395
- return n ? (await nf(e, n, t)).success : (await rf(e, t)).success;
9432
+ async function Ef(e, t, n) {
9433
+ return n ? (await sf(e, n, t)).success : (await of(e, t)).success;
9396
9434
  }
9397
- const Wf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9435
+ const Vf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9398
9436
  __proto__: null,
9399
- addLiquidity: df,
9437
+ addLiquidity: wf,
9400
9438
  createSwapWallet: yo,
9401
- deposit: yf,
9439
+ deposit: _f,
9402
9440
  ensureSwapWallet: hl,
9403
- getActivityOfPair: ff,
9404
- getAddLiquidityResult: Pl,
9441
+ getActivityOfPair: pf,
9442
+ getAddLiquidityResult: Ul,
9405
9443
  getKlines: Bl,
9406
9444
  getMinerFee: $t,
9407
- getMinerFeesOfDepositOrder: Nl,
9408
- getMinerFeesOfWrapOrder: Al,
9445
+ getMinerFeesOfDepositOrder: $l,
9446
+ getMinerFeesOfWrapOrder: Fl,
9409
9447
  getPairAddress: nr,
9410
9448
  getPairReserves: Ue,
9411
9449
  getPairVolumeOverDays: Sl,
9412
- getRemoveLiquidityResult: Ml,
9450
+ getRecentActivity: hf,
9451
+ getRemoveLiquidityResult: Gl,
9413
9452
  getSwapBalance: ml,
9414
9453
  getSwapBalances: bl,
9415
- getSwapExactInputResult: Zl,
9416
- getSwapExactOutputResult: Jl,
9454
+ getSwapExactInputResult: Kl,
9455
+ getSwapExactOutputResult: Ql,
9417
9456
  getSwapInfo: Jt,
9418
9457
  getSwapStatus: gl,
9419
9458
  getSwapWalletSecurityCode: wl,
9420
- getTokenDecimals: wn,
9459
+ getTokenDecimals: hn,
9421
9460
  getTvlHistory: vl,
9422
- getUnwrapBtcResult: sf,
9423
- getWalletActivities: lf,
9461
+ getUnwrapBtcResult: af,
9462
+ getWalletActivities: df,
9424
9463
  importSwapWallet: pl,
9425
9464
  listPairs: El,
9426
9465
  listTokens: xl,
9427
- removeLiquidity: pf,
9466
+ removeLiquidity: gf,
9428
9467
  satsToBtc: ao,
9429
9468
  satsToUsd: Au,
9430
- swapExactInput: hf,
9431
- swapExactOutput: wf,
9469
+ swapExactInput: yf,
9470
+ swapExactOutput: bf,
9432
9471
  swapSide: Lu,
9433
9472
  tryGetSwapReferrerInfo: Vr,
9434
- unwrapBtc: gf,
9435
- withdraw: mf,
9436
- wrapBtc: bf
9437
- }, Symbol.toStringTag, { value: "Module" })), _f = "text/plain", ko = /^[a-z0-9-]{6}$/i, xf = /^(?:[0-9a-f]{2})+$/i;
9473
+ unwrapBtc: mf,
9474
+ withdraw: Ef,
9475
+ wrapBtc: xf
9476
+ }, Symbol.toStringTag, { value: "Module" })), Sf = "text/plain", ko = /^[a-z0-9-]{6}$/i, Bf = /^(?:[0-9a-f]{2})+$/i;
9438
9477
  function Zr(e) {
9439
9478
  if (typeof e != "string" || e.length === 0)
9440
9479
  throw new Error("tick must be a non-empty string");
9441
- return z.str(e).length;
9480
+ return J.str(e).length;
9442
9481
  }
9443
9482
  function Tr(e, t) {
9444
- if (typeof e != "string" || !xf.test(e))
9483
+ if (typeof e != "string" || !Bf.test(e))
9445
9484
  throw new Error(`${t} must be a non-empty hex string`);
9446
9485
  }
9447
9486
  function Vn(e, t) {
9448
9487
  if (typeof e != "string" || e.length === 0)
9449
9488
  throw new Error(`${t} must be a non-empty string`);
9450
9489
  }
9451
- function gn(e) {
9490
+ function wn(e) {
9452
9491
  return new ce(
9453
- z.str(_f),
9492
+ J.str(Sf),
9454
9493
  null,
9455
9494
  null,
9456
9495
  null,
9457
9496
  null,
9458
- z.str(JSON.stringify(e))
9497
+ J.str(JSON.stringify(e))
9459
9498
  );
9460
9499
  }
9461
9500
  function No(e, t, n) {
@@ -9468,49 +9507,49 @@ function No(e, t, n) {
9468
9507
  const s = r || e.selfMint === !0, i = { p: "brc-20", op: "deploy", tick: e.tick };
9469
9508
  return n != null && (i.salt = n), i.max = e.max, e.lim != null && (i.lim = e.lim), e.dec != null && (i.dec = String(e.dec)), s && (i.self_mint = "true"), i;
9470
9509
  }
9471
- function Ef(e) {
9510
+ function vf(e) {
9472
9511
  const t = Zr(e.tick);
9473
9512
  if (t === 6)
9474
9513
  throw new Error("6-byte tickers require a predeploy; use predeployInscriptions()");
9475
9514
  if (t !== 4 && t !== 5)
9476
9515
  throw new Error(`deploy ticker must be 4 or 5 bytes, got ${t}`);
9477
- return gn(No(e, t, null));
9516
+ return wn(No(e, t, null));
9478
9517
  }
9479
- function Sf(e) {
9518
+ function Of(e) {
9480
9519
  const t = Zr(e.tick);
9481
9520
  if (t < 4 || t > 6) throw new Error(`ticker must be 4-6 bytes, got ${t}`);
9482
- return Vn(e.amt, "amt"), gn({ p: "brc-20", op: "mint", tick: e.tick, amt: e.amt });
9521
+ return Vn(e.amt, "amt"), wn({ p: "brc-20", op: "mint", tick: e.tick, amt: e.amt });
9483
9522
  }
9484
- function Bf(e) {
9523
+ function Tf(e) {
9485
9524
  const t = Zr(e.tick);
9486
9525
  if (t < 4 || t > 6) throw new Error(`ticker must be 4-6 bytes, got ${t}`);
9487
- return Vn(e.amt, "amt"), gn({ p: "brc-20", op: "transfer", tick: e.tick, amt: e.amt });
9526
+ return Vn(e.amt, "amt"), wn({ p: "brc-20", op: "transfer", tick: e.tick, amt: e.amt });
9488
9527
  }
9489
9528
  function Co(e = 16) {
9490
9529
  if (!Number.isInteger(e) || e <= 0)
9491
9530
  throw new Error("byteLength must be a positive integer");
9492
- return z.random(e).hex;
9531
+ return J.random(e).hex;
9493
9532
  }
9494
- function vf(e) {
9533
+ function If(e) {
9495
9534
  if (typeof e != "string" || e.length === 0)
9496
9535
  throw new Error("address must be a non-empty string");
9497
- return bn.address.toOutputScript(e, ze()).toString("hex");
9536
+ return bn.address.toOutputScript(e, Xe()).toString("hex");
9498
9537
  }
9499
9538
  function $o(e, t, n) {
9500
9539
  if (typeof e != "string" || !ko.test(e))
9501
9540
  throw new Error("6-byte ticker must match /^[A-Za-z0-9-]{6}$/");
9502
9541
  Tr(t, "salt"), Tr(n, "pkscript");
9503
- const r = S.concat([
9504
- S.from(e, "utf8"),
9505
- S.from(t, "hex"),
9506
- S.from(n, "hex")
9542
+ const r = B.concat([
9543
+ B.from(e, "utf8"),
9544
+ B.from(t, "hex"),
9545
+ B.from(n, "hex")
9507
9546
  ]);
9508
9547
  return bn.crypto.hash256(r).toString("hex");
9509
9548
  }
9510
- function Of(e) {
9549
+ function Rf(e) {
9511
9550
  if (typeof e.tick != "string" || !ko.test(e.tick))
9512
9551
  throw new Error("6-byte ticker must match /^[A-Za-z0-9-]{6}$/");
9513
- const t = vf(e.address), n = e.salt ?? Co();
9552
+ const t = If(e.address), n = e.salt ?? Co();
9514
9553
  Tr(n, "salt");
9515
9554
  const r = $o(e.tick, n, t), s = No(
9516
9555
  { tick: e.tick, max: e.max, lim: e.lim, dec: e.dec },
@@ -9520,8 +9559,8 @@ function Of(e) {
9520
9559
  return {
9521
9560
  salt: n,
9522
9561
  hash: r,
9523
- predeploy: gn({ p: "brc-20", op: "predeploy", hash: r }),
9524
- deploy: gn(s)
9562
+ predeploy: wn({ p: "brc-20", op: "predeploy", hash: r }),
9563
+ deploy: wn(s)
9525
9564
  };
9526
9565
  }
9527
9566
  async function Lo(e, t, n, r, s, i, o, a, c) {
@@ -9551,7 +9590,7 @@ async function Lo(e, t, n, r, s, i, o, a, c) {
9551
9590
  );
9552
9591
  throw new Error(`Unsupported wallet type: ${c}`);
9553
9592
  }
9554
- async function Tf(e, t, n, r, s, i, o, a, c, u, l) {
9593
+ async function kf(e, t, n, r, s, i, o, a, c, u, l) {
9555
9594
  if (typeof t != "object") throw new Error("abi must be an object");
9556
9595
  if (typeof n != "string") throw new Error("func_name must be a string");
9557
9596
  if (!Array.isArray(r)) throw new Error("params must be an array");
@@ -9568,7 +9607,7 @@ async function Tf(e, t, n, r, s, i, o, a, c, u, l) {
9568
9607
  f
9569
9608
  );
9570
9609
  }
9571
- async function If(e, t, n, r, s, i) {
9610
+ async function Nf(e, t, n, r, s, i) {
9572
9611
  return await Ko(
9573
9612
  e,
9574
9613
  t,
@@ -9579,8 +9618,8 @@ async function If(e, t, n, r, s, i) {
9579
9618
  s
9580
9619
  );
9581
9620
  }
9582
- async function Rf(e, t, n, r, s, i, o) {
9583
- return await zo(
9621
+ async function Cf(e, t, n, r, s, i, o) {
9622
+ return await Xo(
9584
9623
  e,
9585
9624
  t,
9586
9625
  n,
@@ -9591,21 +9630,21 @@ async function Rf(e, t, n, r, s, i, o) {
9591
9630
  i
9592
9631
  );
9593
9632
  }
9594
- const Gf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9633
+ const Zf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9595
9634
  __proto__: null,
9596
9635
  callSmartContract: Lo,
9597
- callSmartContractAbi: Tf,
9636
+ callSmartContractAbi: kf,
9598
9637
  computeBrc20PredeployHash: $o,
9599
- deployBrc20Inscription: Ef,
9600
- depositToBrc20Prog: If,
9638
+ deployBrc20Inscription: vf,
9639
+ depositToBrc20Prog: Nf,
9601
9640
  generateBrc20Salt: Co,
9602
- mintBrc20Inscription: Sf,
9603
- predeployInscriptions: Of,
9604
- transferBrc20Inscription: Bf,
9605
- withdrawFromBrc20Prog: Rf
9641
+ mintBrc20Inscription: Of,
9642
+ predeployInscriptions: Rf,
9643
+ transferBrc20Inscription: Tf,
9644
+ withdrawFromBrc20Prog: Cf
9606
9645
  }, Symbol.toStringTag, { value: "Module" }));
9607
- async function kf(e, t, n, r, s) {
9608
- const i = await js(
9646
+ async function $f(e, t, n, r, s) {
9647
+ const i = await Qs(
9609
9648
  [e],
9610
9649
  t,
9611
9650
  n,
@@ -9622,11 +9661,11 @@ async function kf(e, t, n, r, s) {
9622
9661
  secret: i.secret
9623
9662
  };
9624
9663
  }
9625
- async function Nf(e, t, n, r, s) {
9626
- return await js(e, t, n, r, s);
9664
+ async function Lf(e, t, n, r, s) {
9665
+ return await Qs(e, t, n, r, s);
9627
9666
  }
9628
- async function Cf(e, t, n, r, s, i) {
9629
- return await Xo(
9667
+ async function Af(e, t, n, r, s, i) {
9668
+ return await zo(
9630
9669
  e,
9631
9670
  t,
9632
9671
  n,
@@ -9635,19 +9674,19 @@ async function Cf(e, t, n, r, s, i) {
9635
9674
  i
9636
9675
  );
9637
9676
  }
9638
- async function $f(e, t, n, r) {
9639
- return await Qs([e], t, n, r);
9677
+ async function Pf(e, t, n, r) {
9678
+ return await ti([e], t, n, r);
9640
9679
  }
9641
- async function Lf(e, t, n, r) {
9642
- return await Qs(e, t, n, r);
9680
+ async function Ff(e, t, n, r) {
9681
+ return await ti(e, t, n, r);
9643
9682
  }
9644
- const Hf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9683
+ const Yf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9645
9684
  __proto__: null,
9646
- getInscribeFee: $f,
9647
- getInscribeMultipleFee: Lf,
9648
- inscribe: kf,
9649
- inscribeMultiple: Nf,
9650
- inscribeWithParent: Cf
9685
+ getInscribeFee: Pf,
9686
+ getInscribeMultipleFee: Ff,
9687
+ inscribe: $f,
9688
+ inscribeMultiple: Lf,
9689
+ inscribeWithParent: Af
9651
9690
  }, Symbol.toStringTag, { value: "Module" })), Ao = [
9652
9691
  { inputs: [], stateMutability: "nonpayable", type: "constructor" },
9653
9692
  {
@@ -9806,8 +9845,8 @@ const Hf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9806
9845
  type: "function"
9807
9846
  }
9808
9847
  ], Po = "0xc54dd4581af2dbf18e4d90840226756e9d2b3cdb";
9809
- async function Af(e, t) {
9810
- const n = t.toUpperCase(), r = ti("check_base_brc20_balance"), i = await ei(r, {
9848
+ async function Uf(e, t) {
9849
+ const n = t.toUpperCase(), r = await K("check_base_brc20_balance"), i = await ei(r, {
9811
9850
  method: "POST",
9812
9851
  headers: {
9813
9852
  "Content-Type": "application/json"
@@ -9824,8 +9863,8 @@ async function Af(e, t) {
9824
9863
  ticker: i.result.ticker
9825
9864
  };
9826
9865
  }
9827
- async function Pf(e, t) {
9828
- const n = ti("check_brc20_balance"), s = await ei(n, {
9866
+ async function qf(e, t) {
9867
+ const n = await K("check_brc20_balance"), s = await ei(n, {
9829
9868
  method: "POST",
9830
9869
  headers: {
9831
9870
  "Content-Type": "application/json"
@@ -9837,8 +9876,8 @@ async function Pf(e, t) {
9837
9876
  });
9838
9877
  return BigInt(s.result);
9839
9878
  }
9840
- async function Ff(e, t) {
9841
- const n = S.from(t, "utf-8"), r = await ni(
9879
+ async function Df(e, t) {
9880
+ const n = B.from(t, "utf-8"), r = await ni(
9842
9881
  Po,
9843
9882
  Ao,
9844
9883
  "balanceOf",
@@ -9846,8 +9885,8 @@ async function Ff(e, t) {
9846
9885
  );
9847
9886
  return BigInt(r);
9848
9887
  }
9849
- async function Uf(e) {
9850
- const t = S.from(e, "utf-8");
9888
+ async function Mf(e) {
9889
+ const t = B.from(e, "utf-8");
9851
9890
  return `0x${(await ni(
9852
9891
  Po,
9853
9892
  Ao,
@@ -9855,17 +9894,17 @@ async function Uf(e) {
9855
9894
  [t]
9856
9895
  )).slice(-40)}`;
9857
9896
  }
9858
- const Vf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9897
+ const Kf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9859
9898
  __proto__: null,
9860
- getBRC20ProgBalanceOfAddress: Pf,
9861
- getBRC20ProgBalanceOfTicker: Ff,
9862
- getBRC20ProgTokenAddressOfTicker: Uf,
9863
- getBaseBRC20BalanceOfAddress: Af
9899
+ getBRC20ProgBalanceOfAddress: qf,
9900
+ getBRC20ProgBalanceOfTicker: Df,
9901
+ getBRC20ProgTokenAddressOfTicker: Mf,
9902
+ getBaseBRC20BalanceOfAddress: Uf
9864
9903
  }, Symbol.toStringTag, { value: "Module" }));
9865
9904
  export {
9866
- Wf as a,
9867
- Gf as b,
9868
- Vf as c,
9869
- Hf as m,
9870
- Mf as s
9905
+ Vf as a,
9906
+ Zf as b,
9907
+ Kf as c,
9908
+ Yf as m,
9909
+ Hf as s
9871
9910
  };