@bestinslot/wallet-kit 0.14.0 → 0.14.1

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,12 +1,12 @@
1
- import { i as rn, X as Xn, Y as pa, Z as ha, _ as wa, I as B, f as Lt, n as ds, $ as di, a0 as Ur, a1 as X, Q as Jt, h as Sn, J as xt, a2 as Pe, a3 as Y, a4 as Kt, a5 as qr, a6 as pi, a7 as ga, a8 as ps, a9 as _t, aa as le, ab as dn, ac as Dt, ad as Qe, ae as Dr, e as Fe, F as he, af as ya, ag as hs, ah as pn, ai as Mr, m as De, aj as zn, r as Wr, H as ba, ak as ma, al as Jn, am as xa, an as _a, ao as Sa, ap as Ea, aq as hi, ar as Ba, as as wi, at as gi } from "./mint-Cyl31b8y.js";
2
- async function $d(e, t, n, r, s, i) {
1
+ import { i as rn, Y as Xn, Z as da, _ as pa, $ as ha, J as B, f as Lt, n as ds, a0 as di, a1 as Ur, a2 as X, a3 as z, R as Jt, h as Sn, K as xt, a4 as Pe, a5 as Y, a6 as Kt, a7 as qr, a8 as pi, a9 as wa, aa as ps, ab as _t, ac as le, ad as dn, ae as Dt, af as Qe, ag as Dr, e as Fe, G as he, ah as ga, ai as hs, aj as pn, ak as Mr, m as De, al as zn, r as Wr, I as ya, am as ba, an as Jn, ao as ma, ap as xa, aq as _a, ar as Sa, as as hi, at as Ea, au as wi } from "./mint-CSk_3TfL.js";
2
+ async function Cd(e, t, n, r, s, i) {
3
3
  const o = rn();
4
4
  if (!o)
5
5
  throw new Error("No wallet connected");
6
6
  const a = Xn(o.provider);
7
7
  if (t.isOpReturn) {
8
8
  if (!i || i === "ordinals")
9
- return await pa(
9
+ return await da(
10
10
  e,
11
11
  t,
12
12
  r,
@@ -15,7 +15,7 @@ async function $d(e, t, n, r, s, i) {
15
15
  a
16
16
  );
17
17
  if (i === "payment")
18
- return await ha(
18
+ return await pa(
19
19
  e,
20
20
  t,
21
21
  r,
@@ -25,10 +25,10 @@ async function $d(e, t, n, r, s, i) {
25
25
  );
26
26
  }
27
27
  if (!i || i === "ordinals")
28
- return await wa(e, t, r, n, s, a);
28
+ return await ha(e, t, r, n, s, a);
29
29
  throw new Error(`Unsupported wallet type: ${i}`);
30
30
  }
31
- function yi(e) {
31
+ function gi(e) {
32
32
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
33
33
  }
34
34
  function tn(e, t = "") {
@@ -38,7 +38,7 @@ function tn(e, t = "") {
38
38
  }
39
39
  }
40
40
  function ft(e, t, n = "") {
41
- const r = yi(e), s = e?.length, i = t !== void 0;
41
+ const r = gi(e), s = e?.length, i = t !== void 0;
42
42
  if (!r || i && s !== t) {
43
43
  const o = n && `"${n}" `, a = i ? ` of length ${t}` : "", c = r ? `length=${s}` : `type=${typeof e}`;
44
44
  throw new Error(o + "expected Uint8Array" + a + ", got " + c);
@@ -56,7 +56,7 @@ function qn(e, t = !0) {
56
56
  if (t && e.finished)
57
57
  throw new Error("Hash#digest() has already been called");
58
58
  }
59
- function va(e, t) {
59
+ function Ba(e, t) {
60
60
  ft(e, void 0, "digestInto() output");
61
61
  const n = t.outputLen;
62
62
  if (e.length < n)
@@ -72,13 +72,13 @@ function br(e) {
72
72
  function Vt(e, t) {
73
73
  return e << 32 - t | e >>> t;
74
74
  }
75
- const bi = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", Oa = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
75
+ const yi = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", va = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
76
76
  function wn(e) {
77
- if (ft(e), bi)
77
+ if (ft(e), yi)
78
78
  return e.toHex();
79
79
  let t = "";
80
80
  for (let n = 0; n < e.length; n++)
81
- t += Oa[e[n]];
81
+ t += va[e[n]];
82
82
  return t;
83
83
  }
84
84
  const se = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
@@ -93,7 +93,7 @@ function ws(e) {
93
93
  function Dn(e) {
94
94
  if (typeof e != "string")
95
95
  throw new Error("hex string expected, got " + typeof e);
96
- if (bi)
96
+ if (yi)
97
97
  return Uint8Array.fromHex(e);
98
98
  const t = e.length, n = t / 2;
99
99
  if (t % 2)
@@ -122,17 +122,17 @@ function ht(...e) {
122
122
  }
123
123
  return n;
124
124
  }
125
- function Ia(e, t = {}) {
125
+ function Oa(e, t = {}) {
126
126
  const n = (s, i) => e(i).update(s).digest(), r = e(void 0);
127
127
  return n.outputLen = r.outputLen, n.blockLen = r.blockLen, n.create = (s) => e(s), Object.assign(n, t), Object.freeze(n);
128
128
  }
129
- function mi(e = 32) {
129
+ function bi(e = 32) {
130
130
  const t = typeof globalThis == "object" ? globalThis.crypto : null;
131
131
  if (typeof t?.getRandomValues != "function")
132
132
  throw new Error("crypto.getRandomValues must be defined");
133
133
  return t.getRandomValues(new Uint8Array(e));
134
134
  }
135
- const Ta = (e) => ({
135
+ const Ia = (e) => ({
136
136
  oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, e])
137
137
  });
138
138
  const Hr = /* @__PURE__ */ BigInt(0), Mn = /* @__PURE__ */ BigInt(1);
@@ -143,9 +143,9 @@ function gs(e, t = "") {
143
143
  }
144
144
  return e;
145
145
  }
146
- function Ra(e) {
146
+ function Ta(e) {
147
147
  if (typeof e == "bigint") {
148
- if (!ka(e))
148
+ if (!Ra(e))
149
149
  throw new Error("positive bigint expected, got " + e);
150
150
  } else
151
151
  tn(e);
@@ -157,28 +157,28 @@ function en(e, t = "") {
157
157
  throw new Error(n + "expected safe integer, got type=" + typeof e);
158
158
  }
159
159
  }
160
- function xi(e) {
160
+ function mi(e) {
161
161
  if (typeof e != "string")
162
162
  throw new Error("hex string expected, got " + typeof e);
163
163
  return e === "" ? Hr : BigInt("0x" + e);
164
164
  }
165
165
  function Xt(e) {
166
- return xi(wn(e));
166
+ return mi(wn(e));
167
167
  }
168
- function _i(e) {
169
- return xi(wn(Ei(ft(e)).reverse()));
168
+ function xi(e) {
169
+ return mi(wn(Si(ft(e)).reverse()));
170
170
  }
171
171
  function mt(e, t) {
172
- tn(t), e = Ra(e);
172
+ tn(t), e = Ta(e);
173
173
  const n = Dn(e.toString(16).padStart(t * 2, "0"));
174
174
  if (n.length !== t)
175
175
  throw new Error("number too large");
176
176
  return n;
177
177
  }
178
- function Si(e, t) {
178
+ function _i(e, t) {
179
179
  return mt(e, t).reverse();
180
180
  }
181
- function Ei(e) {
181
+ function Si(e) {
182
182
  return Uint8Array.from(e);
183
183
  }
184
184
  function jn(e) {
@@ -189,14 +189,14 @@ function jn(e) {
189
189
  return r;
190
190
  });
191
191
  }
192
- const ka = (e) => typeof e == "bigint" && Hr <= e;
192
+ const Ra = (e) => typeof e == "bigint" && Hr <= e;
193
193
  function Wn(e) {
194
194
  let t;
195
195
  for (t = 0; e > Hr; e >>= Mn, t += 1)
196
196
  ;
197
197
  return t;
198
198
  }
199
- function Na(e, t) {
199
+ function ka(e, t) {
200
200
  return e >> BigInt(t) & Mn;
201
201
  }
202
202
  const En = (e) => (Mn << BigInt(e)) - Mn;
@@ -227,7 +227,7 @@ function kr(e) {
227
227
  return t.set(n, i), i;
228
228
  };
229
229
  }
230
- const At = /* @__PURE__ */ BigInt(0), Rt = /* @__PURE__ */ BigInt(1), Ce = /* @__PURE__ */ BigInt(2), Bi = /* @__PURE__ */ BigInt(3), vi = /* @__PURE__ */ BigInt(4), Oi = /* @__PURE__ */ BigInt(5), Ca = /* @__PURE__ */ BigInt(7), Ii = /* @__PURE__ */ BigInt(8), $a = /* @__PURE__ */ BigInt(9), Ti = /* @__PURE__ */ BigInt(16);
230
+ const At = /* @__PURE__ */ BigInt(0), Rt = /* @__PURE__ */ BigInt(1), Ce = /* @__PURE__ */ BigInt(2), Ei = /* @__PURE__ */ BigInt(3), Bi = /* @__PURE__ */ BigInt(4), vi = /* @__PURE__ */ BigInt(5), Na = /* @__PURE__ */ BigInt(7), Oi = /* @__PURE__ */ BigInt(8), Ca = /* @__PURE__ */ BigInt(9), Ii = /* @__PURE__ */ BigInt(16);
231
231
  function qt(e, t) {
232
232
  const n = e % t;
233
233
  return n >= At ? n : t + n;
@@ -250,16 +250,16 @@ function Zr(e, t, n) {
250
250
  if (!e.eql(e.sqr(t), n))
251
251
  throw new Error("Cannot find square root");
252
252
  }
253
- function Ri(e, t) {
254
- const n = (e.ORDER + Rt) / vi, r = e.pow(t, n);
253
+ function Ti(e, t) {
254
+ const n = (e.ORDER + Rt) / Bi, r = e.pow(t, n);
255
255
  return Zr(e, r, t), r;
256
256
  }
257
- function Aa(e, t) {
258
- const n = (e.ORDER - Oi) / Ii, r = e.mul(t, Ce), s = e.pow(r, n), i = e.mul(t, s), o = e.mul(e.mul(i, Ce), s), a = e.mul(i, e.sub(o, e.ONE));
257
+ function $a(e, t) {
258
+ const n = (e.ORDER - vi) / Oi, r = e.mul(t, Ce), s = e.pow(r, n), i = e.mul(t, s), o = e.mul(e.mul(i, Ce), s), a = e.mul(i, e.sub(o, e.ONE));
259
259
  return Zr(e, a, t), a;
260
260
  }
261
- function La(e) {
262
- const t = Bn(e), n = ki(e), r = n(t, t.neg(t.ONE)), s = n(t, r), i = n(t, t.neg(r)), o = (e + Ca) / Ti;
261
+ function Aa(e) {
262
+ const t = Bn(e), n = Ri(e), r = n(t, t.neg(t.ONE)), s = n(t, r), i = n(t, t.neg(r)), o = (e + Na) / Ii;
263
263
  return (a, c) => {
264
264
  let u = a.pow(c, o), l = a.mul(u, r);
265
265
  const f = a.mul(u, s), d = a.mul(u, i), p = a.eql(a.sqr(l), c), w = a.eql(a.sqr(f), c);
@@ -268,8 +268,8 @@ function La(e) {
268
268
  return Zr(a, g, c), g;
269
269
  };
270
270
  }
271
- function ki(e) {
272
- if (e < Bi)
271
+ function Ri(e) {
272
+ if (e < Ei)
273
273
  throw new Error("sqrt is not defined for small field");
274
274
  let t = e - Rt, n = 0;
275
275
  for (; t % Ce === At; )
@@ -280,7 +280,7 @@ function ki(e) {
280
280
  if (r++ > 1e3)
281
281
  throw new Error("Cannot find square root: probably non-prime P");
282
282
  if (n === 1)
283
- return Ri;
283
+ return Ti;
284
284
  let i = s.pow(r, t);
285
285
  const o = (t + Rt) / Ce;
286
286
  return function(c, u) {
@@ -302,10 +302,10 @@ function ki(e) {
302
302
  return p;
303
303
  };
304
304
  }
305
- function Pa(e) {
306
- return e % vi === Bi ? Ri : e % Ii === Oi ? Aa : e % Ti === $a ? La(e) : ki(e);
305
+ function La(e) {
306
+ return e % Bi === Ei ? Ti : e % Oi === vi ? $a : e % Ii === Ca ? Aa(e) : Ri(e);
307
307
  }
308
- const Fa = [
308
+ const Pa = [
309
309
  "create",
310
310
  "isValid",
311
311
  "is0",
@@ -324,12 +324,12 @@ const Fa = [
324
324
  "mulN",
325
325
  "sqrN"
326
326
  ];
327
- function Ni(e) {
327
+ function ki(e) {
328
328
  const t = {
329
329
  ORDER: "bigint",
330
330
  BYTES: "number",
331
331
  BITS: "number"
332
- }, n = Fa.reduce((r, s) => (r[s] = "function", r), t);
332
+ }, n = Pa.reduce((r, s) => (r[s] = "function", r), t);
333
333
  return Vr(e, n), e;
334
334
  }
335
335
  function Qn(e, t, n) {
@@ -354,12 +354,12 @@ function Gn(e, t) {
354
354
  throw new Error("invalid Legendre symbol result");
355
355
  return s ? 1 : i ? 0 : -1;
356
356
  }
357
- function Ua(e, t) {
357
+ function Fa(e, t) {
358
358
  t !== void 0 && tn(t);
359
359
  const n = t !== void 0 ? t : e.toString(2).length, r = Math.ceil(n / 8);
360
360
  return { nBitLength: n, nByteLength: r };
361
361
  }
362
- class qa {
362
+ class Ua {
363
363
  ORDER;
364
364
  BITS;
365
365
  BYTES;
@@ -375,7 +375,7 @@ class qa {
375
375
  throw new Error("invalid field: expected ORDER > 0, got " + t);
376
376
  let r;
377
377
  this.isLE = !1, n != null && typeof n == "object" && (typeof n.BITS == "number" && (r = n.BITS), typeof n.sqrt == "function" && (this.sqrt = n.sqrt), typeof n.isLE == "boolean" && (this.isLE = n.isLE), n.allowedLengths && (this._lengths = n.allowedLengths?.slice()), typeof n.modFromBytes == "boolean" && (this._mod = n.modFromBytes));
378
- const { nBitLength: s, nByteLength: i } = Ua(t, r);
378
+ const { nBitLength: s, nByteLength: i } = Fa(t, r);
379
379
  if (i > 2048)
380
380
  throw new Error("invalid field: expected ORDER of <= 2048 bytes");
381
381
  this.ORDER = t, this.BITS = s, this.BYTES = i, this._sqrt = void 0, Object.preventExtensions(this);
@@ -439,10 +439,10 @@ class qa {
439
439
  return ys(t, this.ORDER);
440
440
  }
441
441
  sqrt(t) {
442
- return this._sqrt || (this._sqrt = Pa(this.ORDER)), this._sqrt(this, t);
442
+ return this._sqrt || (this._sqrt = La(this.ORDER)), this._sqrt(this, t);
443
443
  }
444
444
  toBytes(t) {
445
- return this.isLE ? Si(t, this.BYTES) : mt(t, this.BYTES);
445
+ return this.isLE ? _i(t, this.BYTES) : mt(t, this.BYTES);
446
446
  }
447
447
  fromBytes(t, n = !1) {
448
448
  ft(t);
@@ -455,7 +455,7 @@ class qa {
455
455
  }
456
456
  if (t.length !== s)
457
457
  throw new Error("Field.fromBytes: expected " + s + " bytes, got " + t.length);
458
- let c = i ? _i(t) : Xt(t);
458
+ let c = i ? xi(t) : Xt(t);
459
459
  if (a && (c = qt(c, o)), !n && !this.isValid(c))
460
460
  throw new Error("invalid field element: outside of range 0..ORDER");
461
461
  return c;
@@ -471,33 +471,33 @@ class qa {
471
471
  }
472
472
  }
473
473
  function Bn(e, t = {}) {
474
- return new qa(e, t);
474
+ return new Ua(e, t);
475
475
  }
476
- function Ci(e) {
476
+ function Ni(e) {
477
477
  if (typeof e != "bigint")
478
478
  throw new Error("field order must be bigint");
479
479
  const t = e.toString(2).length;
480
480
  return Math.ceil(t / 8);
481
481
  }
482
- function $i(e) {
483
- const t = Ci(e);
482
+ function Ci(e) {
483
+ const t = Ni(e);
484
484
  return t + Math.ceil(t / 2);
485
485
  }
486
- function Ai(e, t, n = !1) {
486
+ function $i(e, t, n = !1) {
487
487
  ft(e);
488
- const r = e.length, s = Ci(t), i = $i(t);
488
+ const r = e.length, s = Ni(t), i = Ci(t);
489
489
  if (r < 16 || r < i || r > 1024)
490
490
  throw new Error("expected " + i + "-1024 bytes of input, got " + r);
491
- const o = n ? _i(e) : Xt(e), a = qt(o, t - Rt) + Rt;
492
- return n ? Si(a, s) : mt(a, s);
491
+ const o = n ? xi(e) : Xt(e), a = qt(o, t - Rt) + Rt;
492
+ return n ? _i(a, s) : mt(a, s);
493
493
  }
494
- function Da(e, t, n) {
494
+ function qa(e, t, n) {
495
495
  return e & t ^ ~e & n;
496
496
  }
497
- function Ma(e, t, n) {
497
+ function Da(e, t, n) {
498
498
  return e & t ^ e & n ^ t & n;
499
499
  }
500
- class Wa {
500
+ class Ma {
501
501
  blockLen;
502
502
  outputLen;
503
503
  padOffset;
@@ -528,7 +528,7 @@ class Wa {
528
528
  return this.length += t.length, this.roundClean(), this;
529
529
  }
530
530
  digestInto(t) {
531
- qn(this), va(t, this), this.finished = !0;
531
+ qn(this), Ba(t, this), this.finished = !0;
532
532
  const { buffer: n, view: r, blockLen: s, isLE: i } = this;
533
533
  let { pos: o } = this;
534
534
  n[o++] = 128, hn(this.buffer.subarray(o)), this.padOffset > s - o && (this.process(r, 0), o = 0);
@@ -568,7 +568,7 @@ const ge = /* @__PURE__ */ Uint32Array.from([
568
568
  2600822924,
569
569
  528734635,
570
570
  1541459225
571
- ]), Ga = /* @__PURE__ */ Uint32Array.from([
571
+ ]), Wa = /* @__PURE__ */ Uint32Array.from([
572
572
  1116352408,
573
573
  1899447441,
574
574
  3049323471,
@@ -634,7 +634,7 @@ const ge = /* @__PURE__ */ Uint32Array.from([
634
634
  3204031479,
635
635
  3329325298
636
636
  ]), ye = /* @__PURE__ */ new Uint32Array(64);
637
- class Ha extends Wa {
637
+ class Ga extends Ma {
638
638
  constructor(t) {
639
639
  super(64, t, 8, !1);
640
640
  }
@@ -655,7 +655,7 @@ class Ha extends Wa {
655
655
  }
656
656
  let { A: r, B: s, C: i, D: o, E: a, F: c, G: u, H: l } = this;
657
657
  for (let f = 0; f < 64; f++) {
658
- const d = Vt(a, 6) ^ Vt(a, 11) ^ Vt(a, 25), p = l + d + Da(a, c, u) + Ga[f] + ye[f] | 0, h = (Vt(r, 2) ^ Vt(r, 13) ^ Vt(r, 22)) + Ma(r, s, i) | 0;
658
+ const d = Vt(a, 6) ^ Vt(a, 11) ^ Vt(a, 25), p = l + d + qa(a, c, u) + Wa[f] + ye[f] | 0, h = (Vt(r, 2) ^ Vt(r, 13) ^ Vt(r, 22)) + Da(r, s, i) | 0;
659
659
  l = u, u = c, c = a, a = o + p | 0, o = i, i = s, s = r, r = p + h | 0;
660
660
  }
661
661
  r = r + this.A | 0, s = s + this.B | 0, i = i + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, u = u + this.G | 0, l = l + this.H | 0, this.set(r, s, i, o, a, c, u, l);
@@ -667,7 +667,7 @@ class Ha extends Wa {
667
667
  this.set(0, 0, 0, 0, 0, 0, 0, 0), hn(this.buffer);
668
668
  }
669
669
  }
670
- class Va extends Ha {
670
+ class Ha extends Ga {
671
671
  // We cannot use array here since array allows indexing by variable
672
672
  // which means optimizer/compiler cannot use registers.
673
673
  A = ge[0] | 0;
@@ -682,9 +682,9 @@ class Va extends Ha {
682
682
  super(32);
683
683
  }
684
684
  }
685
- const Li = /* @__PURE__ */ Ia(
686
- () => new Va(),
687
- /* @__PURE__ */ Ta(1)
685
+ const Ai = /* @__PURE__ */ Oa(
686
+ () => new Ha(),
687
+ /* @__PURE__ */ Ia(1)
688
688
  );
689
689
  const nn = /* @__PURE__ */ BigInt(0), $e = /* @__PURE__ */ BigInt(1);
690
690
  function Hn(e, t) {
@@ -695,12 +695,12 @@ function Vn(e, t) {
695
695
  const n = Me(e.Fp, t.map((r) => r.Z));
696
696
  return t.map((r, s) => e.fromAffine(r.toAffine(n[s])));
697
697
  }
698
- function Pi(e, t) {
698
+ function Li(e, t) {
699
699
  if (!Number.isSafeInteger(e) || e <= 0 || e > t)
700
700
  throw new Error("invalid window size, expected [1.." + t + "], got W=" + e);
701
701
  }
702
702
  function mr(e, t) {
703
- Pi(e, t);
703
+ Li(e, t);
704
704
  const n = Math.ceil(t / e) + 1, r = 2 ** (e - 1), s = 2 ** e, i = En(e), o = BigInt(e);
705
705
  return { windows: n, windowSize: r, mask: i, maxNumber: s, shiftBy: o };
706
706
  }
@@ -711,15 +711,15 @@ function bs(e, t, n) {
711
711
  const u = t * r, l = u + Math.abs(a) - 1, f = a === 0, d = a < 0, p = t % 2 !== 0;
712
712
  return { nextN: c, offset: l, isZero: f, isNeg: d, isNegF: p, offsetF: u };
713
713
  }
714
- const xr = /* @__PURE__ */ new WeakMap(), Fi = /* @__PURE__ */ new WeakMap();
714
+ const xr = /* @__PURE__ */ new WeakMap(), Pi = /* @__PURE__ */ new WeakMap();
715
715
  function _r(e) {
716
- return Fi.get(e) || 1;
716
+ return Pi.get(e) || 1;
717
717
  }
718
718
  function ms(e) {
719
719
  if (e !== nn)
720
720
  throw new Error("invalid wNAF");
721
721
  }
722
- class Za {
722
+ class Va {
723
723
  BASE;
724
724
  ZERO;
725
725
  Fn;
@@ -807,13 +807,13 @@ class Za {
807
807
  // using windowed method. This specifies window size and
808
808
  // stores precomputed values. Usually only base point would be precomputed.
809
809
  createCache(t, n) {
810
- Pi(n, this.bits), Fi.set(t, n), xr.delete(t);
810
+ Li(n, this.bits), Pi.set(t, n), xr.delete(t);
811
811
  }
812
812
  hasCache(t) {
813
813
  return _r(t) !== 1;
814
814
  }
815
815
  }
816
- function Ya(e, t, n, r) {
816
+ function Za(e, t, n, r) {
817
817
  let s = t, i = e.ZERO, o = e.ZERO;
818
818
  for (; n > nn || r > nn; )
819
819
  n & $e && (i = i.add(s)), r & $e && (o = o.add(s)), s = s.double(), n >>= $e, r >>= $e;
@@ -823,11 +823,11 @@ function xs(e, t, n) {
823
823
  if (t) {
824
824
  if (t.ORDER !== e)
825
825
  throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
826
- return Ni(t), t;
826
+ return ki(t), t;
827
827
  } else
828
828
  return Bn(e, { isLE: n });
829
829
  }
830
- function Ka(e, t, n = {}, r) {
830
+ function Ya(e, t, n = {}, r) {
831
831
  if (r === void 0 && (r = e === "edwards"), !t || typeof t != "object")
832
832
  throw new Error(`expected valid ${e} CURVE object`);
833
833
  for (const c of ["p", "n", "h"]) {
@@ -841,7 +841,7 @@ function Ka(e, t, n = {}, r) {
841
841
  throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);
842
842
  return t = Object.freeze(Object.assign({}, t)), { CURVE: t, Fp: s, Fn: i };
843
843
  }
844
- const Xa = Xt;
844
+ const Ka = Xt;
845
845
  function be(e, t) {
846
846
  if (en(e), en(t), e < 0 || e >= 1 << 8 * t)
847
847
  throw new Error("invalid I2OSP input: " + e);
@@ -850,32 +850,32 @@ function be(e, t) {
850
850
  n[r] = e & 255, e >>>= 8;
851
851
  return new Uint8Array(n);
852
852
  }
853
- function za(e, t) {
853
+ function Xa(e, t) {
854
854
  const n = new Uint8Array(e.length);
855
855
  for (let r = 0; r < e.length; r++)
856
856
  n[r] = e[r] ^ t[r];
857
857
  return n;
858
858
  }
859
- function Ui(e) {
860
- if (!yi(e) && typeof e != "string")
859
+ function Fi(e) {
860
+ if (!gi(e) && typeof e != "string")
861
861
  throw new Error("DST must be Uint8Array or ascii string");
862
862
  return typeof e == "string" ? jn(e) : e;
863
863
  }
864
- function Ja(e, t, n, r) {
865
- ft(e), en(n), t = Ui(t), t.length > 255 && (t = r(ht(jn("H2C-OVERSIZE-DST-"), t)));
864
+ function za(e, t, n, r) {
865
+ ft(e), en(n), t = Fi(t), t.length > 255 && (t = r(ht(jn("H2C-OVERSIZE-DST-"), t)));
866
866
  const { outputLen: s, blockLen: i } = r, o = Math.ceil(n / s);
867
867
  if (n > 65535 || o > 255)
868
868
  throw new Error("expand_message_xmd: invalid lenInBytes");
869
869
  const a = ht(t, be(t.length, 1)), c = be(0, i), u = be(n, 2), l = new Array(o), f = r(ht(c, e, u, be(0, 1), a));
870
870
  l[0] = r(ht(f, be(1, 1), a));
871
871
  for (let p = 1; p <= o; p++) {
872
- const w = [za(f, l[p - 1]), be(p + 1, 1), a];
872
+ const w = [Xa(f, l[p - 1]), be(p + 1, 1), a];
873
873
  l[p] = r(ht(...w));
874
874
  }
875
875
  return ht(...l).slice(0, n);
876
876
  }
877
- function ja(e, t, n, r, s) {
878
- if (ft(e), en(n), t = Ui(t), t.length > 255) {
877
+ function Ja(e, t, n, r, s) {
878
+ if (ft(e), en(n), t = Fi(t), t.length > 255) {
879
879
  const i = Math.ceil(2 * r / 8);
880
880
  t = s.create({ dkLen: i }).update(jn("H2C-OVERSIZE-DST-")).update(t).digest();
881
881
  }
@@ -895,9 +895,9 @@ function Sr(e, t, n) {
895
895
  const u = r.toString(2).length, l = Math.ceil((u + s) / 8), f = t * i * l;
896
896
  let d;
897
897
  if (a === "xmd")
898
- d = Ja(e, c, f, o);
898
+ d = za(e, c, f, o);
899
899
  else if (a === "xof")
900
- d = ja(e, c, f, s, o);
900
+ d = Ja(e, c, f, s, o);
901
901
  else if (a === "_internal_pass")
902
902
  d = e;
903
903
  else
@@ -907,20 +907,20 @@ function Sr(e, t, n) {
907
907
  const h = new Array(i);
908
908
  for (let g = 0; g < i; g++) {
909
909
  const b = l * (g + w * i), m = d.subarray(b, b + l);
910
- h[g] = qt(Xa(m), r);
910
+ h[g] = qt(Ka(m), r);
911
911
  }
912
912
  p[w] = h;
913
913
  }
914
914
  return p;
915
915
  }
916
- function qi(e, t) {
916
+ function Ui(e, t) {
917
917
  const n = t.map((r) => Array.from(r).reverse());
918
918
  return (r, s) => {
919
919
  const [i, o, a, c] = n.map((f) => f.reduce((d, p) => e.add(e.mul(d, r), p))), [u, l] = Me(e, [o, c], !0);
920
920
  return r = e.mul(i, u), s = e.mul(s, e.mul(a, l)), { x: r, y: s };
921
921
  };
922
922
  }
923
- const Qa = jn("HashToScalar-");
923
+ const ja = jn("HashToScalar-");
924
924
  function _s(e, t, n) {
925
925
  if (typeof t != "function")
926
926
  throw new Error("mapToCurve() must be defined");
@@ -959,12 +959,12 @@ function _s(e, t, n) {
959
959
  // hash_to_scalar can produce 0: https://www.rfc-editor.org/errata/eid8393
960
960
  // RFC 9380, draft-irtf-cfrg-bbs-signatures-08
961
961
  hashToScalar(i, o) {
962
- const a = e.Fn.ORDER, c = Object.assign({}, n, { p: a, m: 1, DST: Qa }, o);
962
+ const a = e.Fn.ORDER, c = Object.assign({}, n, { p: a, m: 1, DST: ja }, o);
963
963
  return Sr(i, 1, c)[0][0];
964
964
  }
965
965
  };
966
966
  }
967
- class Di {
967
+ class qi {
968
968
  oHash;
969
969
  iHash;
970
970
  blockLen;
@@ -1006,10 +1006,10 @@ class Di {
1006
1006
  this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
1007
1007
  }
1008
1008
  }
1009
- const Yr = (e, t, n) => new Di(e, t).update(n).digest();
1010
- Yr.create = (e, t) => new Di(e, t);
1009
+ const Yr = (e, t, n) => new qi(e, t).update(n).digest();
1010
+ Yr.create = (e, t) => new qi(e, t);
1011
1011
  const Ss = (e, t) => (e + (e >= 0 ? t : -t) / ie) / t;
1012
- function tc(e, t, n) {
1012
+ function Qa(e, t, n) {
1013
1013
  const [[r, s], [i, o]] = t, a = Ss(o * e, n), c = Ss(-s * e, n);
1014
1014
  let u = e - a * r - c * i, l = -a * s - c * o;
1015
1015
  const f = u < Ae, d = l < Ae;
@@ -1020,8 +1020,8 @@ function tc(e, t, n) {
1020
1020
  return { k1neg: f, k1: u, k2neg: d, k2: l };
1021
1021
  }
1022
1022
  const Ae = BigInt(0), kt = BigInt(1), ie = BigInt(2), Ke = BigInt(3), Nr = BigInt(4);
1023
- function Mi(e, t = {}) {
1024
- const n = Ka("weierstrass", e, t), { Fp: r, Fn: s } = n;
1023
+ function Di(e, t = {}) {
1024
+ const n = Ya("weierstrass", e, t), { Fp: r, Fn: s } = n;
1025
1025
  let i = n.CURVE;
1026
1026
  const { h: o, n: a } = i;
1027
1027
  Vr(t, {}, {
@@ -1035,7 +1035,7 @@ function Mi(e, t = {}) {
1035
1035
  const { endo: c } = t;
1036
1036
  if (c && (!r.is0(i.a) || typeof c.beta != "bigint" || !Array.isArray(c.basises)))
1037
1037
  throw new Error('invalid endo: expected "beta": bigint and "basises": array');
1038
- const u = rc(r, s);
1038
+ const u = nc(r, s);
1039
1039
  function l() {
1040
1040
  if (!r.isOdd)
1041
1041
  throw new Error("compression is not supported: Field does not have .isOdd()");
@@ -1045,7 +1045,7 @@ function Mi(e, t = {}) {
1045
1045
  if (gs(S, "isCompressed"), S) {
1046
1046
  l();
1047
1047
  const L = !r.isOdd(k);
1048
- return ht(ec(L), F);
1048
+ return ht(tc(L), F);
1049
1049
  } else
1050
1050
  return ht(Uint8Array.of(4), F, r.toBytes(k));
1051
1051
  }
@@ -1101,7 +1101,7 @@ function Mi(e, t = {}) {
1101
1101
  function D(U) {
1102
1102
  if (!c || !c.basises)
1103
1103
  throw new Error("no endo");
1104
- return tc(U, c.basises, s.ORDER);
1104
+ return Qa(U, c.basises, s.ORDER);
1105
1105
  }
1106
1106
  const $ = kr((U, y) => {
1107
1107
  const { X: S, Y: O, Z: k } = U;
@@ -1274,7 +1274,7 @@ function Mi(e, t = {}) {
1274
1274
  if (H.hasCache(this))
1275
1275
  return this.multiply(y);
1276
1276
  if (S) {
1277
- const { k1neg: k, k1: F, k2neg: L, k2: q } = D(y), { p1: N, p2: W } = Ya(_, O, F, q);
1277
+ const { k1neg: k, k1: F, k2neg: L, k2: q } = D(y), { p1: N, p2: W } = Za(_, O, F, q);
1278
1278
  return R(S.beta, N, W, k, L);
1279
1279
  } else
1280
1280
  return H.unsafe(O, y);
@@ -1311,13 +1311,13 @@ function Mi(e, t = {}) {
1311
1311
  return `<Point ${this.is0() ? "ZERO" : this.toHex()}>`;
1312
1312
  }
1313
1313
  }
1314
- const M = s.BITS, H = new Za(_, t.endo ? Math.ceil(M / 2) : M);
1314
+ const M = s.BITS, H = new Va(_, t.endo ? Math.ceil(M / 2) : M);
1315
1315
  return _.BASE.precompute(8), _;
1316
1316
  }
1317
- function ec(e) {
1317
+ function tc(e) {
1318
1318
  return Uint8Array.of(e ? 2 : 3);
1319
1319
  }
1320
- function nc(e, t) {
1320
+ function ec(e, t) {
1321
1321
  const n = e.ORDER;
1322
1322
  let r = Ae;
1323
1323
  for (let w = n - kt; w % ie === Ae; w /= ie)
@@ -1356,12 +1356,12 @@ function nc(e, t) {
1356
1356
  }
1357
1357
  return p;
1358
1358
  }
1359
- function Wi(e, t) {
1360
- Ni(e);
1359
+ function Mi(e, t) {
1360
+ ki(e);
1361
1361
  const { A: n, B: r, Z: s } = t;
1362
1362
  if (!e.isValid(n) || !e.isValid(r) || !e.isValid(s))
1363
1363
  throw new Error("mapToCurveSimpleSWU: invalid opts");
1364
- const i = nc(e, s);
1364
+ const i = ec(e, s);
1365
1365
  if (!e.isOdd)
1366
1366
  throw new Error("Field does not have .isOdd()");
1367
1367
  return (o) => {
@@ -1375,7 +1375,7 @@ function Wi(e, t) {
1375
1375
  return p = e.mul(p, m), { x: p, y: w };
1376
1376
  };
1377
1377
  }
1378
- function rc(e, t) {
1378
+ function nc(e, t) {
1379
1379
  return {
1380
1380
  secretKey: t.BYTES,
1381
1381
  publicKey: 1 + e.BYTES,
@@ -1384,18 +1384,18 @@ function rc(e, t) {
1384
1384
  signature: 2 * t.BYTES
1385
1385
  };
1386
1386
  }
1387
- const sc = BigInt(0), Cn = BigInt(1), Es = BigInt(2), Xe = BigInt(3);
1388
- function ic(e) {
1387
+ const rc = BigInt(0), Cn = BigInt(1), Es = BigInt(2), Xe = BigInt(3);
1388
+ function sc(e) {
1389
1389
  const t = [];
1390
1390
  for (; e > Cn; e >>= Cn)
1391
- (e & Cn) === sc ? t.unshift(0) : (e & Xe) === Xe ? (t.unshift(-1), e += Cn) : t.unshift(1);
1391
+ (e & Cn) === rc ? t.unshift(0) : (e & Xe) === Xe ? (t.unshift(-1), e += Cn) : t.unshift(1);
1392
1392
  return t;
1393
1393
  }
1394
1394
  function Er(e) {
1395
1395
  if (!Array.isArray(e) || e.length === 0)
1396
1396
  throw new Error("expected non-empty array");
1397
1397
  }
1398
- function oc(e, t, n, r) {
1398
+ function ic(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")
@@ -1415,7 +1415,7 @@ function oc(e, t, n, r) {
1415
1415
  const F = i.sqr(y), L = i.mul(F, y), q = i.mul(F, A), N = i.add(i.sub(L, i.mul(q, Es)), i.mul(i.sqr(U), _));
1416
1416
  return A = i.mul(y, N), R = i.sub(i.mul(i.sub(q, N), U), i.mul(L, R)), _ = i.mul(_, L), { Rx: A, Ry: R, Rz: _ };
1417
1417
  }
1418
- const w = ic(c), h = kr(($) => {
1418
+ const w = sc(c), h = kr(($) => {
1419
1419
  const A = $, { x: R, y: _ } = A.toAffine(), M = R, H = _, U = i.neg(_);
1420
1420
  let y = M, S = H, O = i.ONE;
1421
1421
  const k = [];
@@ -1458,8 +1458,8 @@ function oc(e, t, n, r) {
1458
1458
  return b([{ g1: $, g2: A }], R);
1459
1459
  }
1460
1460
  const v = {
1461
- seed: $i(s.ORDER)
1462
- }, T = r.randomBytes || mi;
1461
+ seed: Ci(s.ORDER)
1462
+ }, T = r.randomBytes || bi;
1463
1463
  return {
1464
1464
  lengths: v,
1465
1465
  Fr: s,
@@ -1469,7 +1469,7 @@ function oc(e, t, n, r) {
1469
1469
  pairing: m,
1470
1470
  pairingBatch: b,
1471
1471
  calcPairingPrecomputes: h,
1472
- randomSecretKey: ($ = T(v.seed)) => (ft($, v.seed, "seed"), Ai($, s.ORDER))
1472
+ randomSecretKey: ($ = T(v.seed)) => (ft($, v.seed, "seed"), $i($, s.ORDER))
1473
1473
  };
1474
1474
  }
1475
1475
  function Bs(e, t, n, r, s, i) {
@@ -1572,8 +1572,8 @@ function Bs(e, t, n, r, s, i) {
1572
1572
  Signature: i
1573
1573
  });
1574
1574
  }
1575
- function ac(e, t, n, r) {
1576
- const { Fp: s, Fr: i, Fp2: o, Fp6: a, Fp12: c } = e, u = { Point: t }, l = { Point: n }, f = oc(e, t, n, r), { millerLoopBatch: d, pairing: p, pairingBatch: w, calcPairingPrecomputes: h, randomSecretKey: g, lengths: b } = f;
1575
+ function oc(e, t, n, r) {
1576
+ const { Fp: s, Fr: i, Fp2: o, Fp6: a, Fp12: c } = e, u = { Point: t }, l = { Point: n }, f = ic(e, t, n, r), { millerLoopBatch: d, pairing: p, pairingBatch: w, calcPairingPrecomputes: h, randomSecretKey: g, lengths: b } = f;
1577
1577
  return u.Point.BASE.precompute(4), Object.freeze({
1578
1578
  lengths: b,
1579
1579
  millerLoopBatch: d,
@@ -1592,8 +1592,8 @@ function ac(e, t, n, r) {
1592
1592
  }
1593
1593
  });
1594
1594
  }
1595
- function cc(e, t, n, r, s) {
1596
- const i = ac(e, t, n, r), o = _s(t, s.mapToG1 || xe, {
1595
+ function ac(e, t, n, r, s) {
1596
+ const i = oc(e, t, n, r), o = _s(t, s.mapToG1 || xe, {
1597
1597
  ...s.hasherOpts,
1598
1598
  ...s.hasherOptsG1
1599
1599
  }), a = _s(n, s.mapToG2 || xe, {
@@ -1602,8 +1602,8 @@ function cc(e, t, n, r, s) {
1602
1602
  });
1603
1603
  return Object.freeze({ ...i, G1: o, G2: a });
1604
1604
  }
1605
- function uc(e, t, n, r, s, i) {
1606
- const o = cc(e, t, n, r, s), a = {
1605
+ function cc(e, t, n, r, s, i) {
1606
+ const o = ac(e, t, n, r, s), a = {
1607
1607
  ...o,
1608
1608
  Fr: o.fields.Fr,
1609
1609
  Fp12: o.fields.Fp12,
@@ -1625,7 +1625,7 @@ function Kr(e, t, n, r, s = 1, i) {
1625
1625
  }
1626
1626
  return c;
1627
1627
  }
1628
- function lc(e, t, n) {
1628
+ function uc(e, t, n) {
1629
1629
  const r = t.pow(n, (e.ORDER - ze) / Os), s = t.pow(n, (e.ORDER - ze) / Ot);
1630
1630
  function i(d, p) {
1631
1631
  const w = t.mul(t.frobeniusMap(d, 1), r), h = t.mul(t.frobeniusMap(p, 1), s);
@@ -1649,7 +1649,7 @@ const Is = (e, t) => {
1649
1649
  const n = t.map((r) => e.create(r));
1650
1650
  return { c0: n[0], c1: n[1] };
1651
1651
  };
1652
- class fc {
1652
+ class lc {
1653
1653
  ORDER;
1654
1654
  BITS;
1655
1655
  BYTES;
@@ -1802,7 +1802,7 @@ class fc {
1802
1802
  };
1803
1803
  }
1804
1804
  }
1805
- class dc {
1805
+ class fc {
1806
1806
  ORDER;
1807
1807
  BITS;
1808
1808
  BYTES;
@@ -1993,7 +1993,7 @@ class dc {
1993
1993
  };
1994
1994
  }
1995
1995
  }
1996
- class pc {
1996
+ class dc {
1997
1997
  ORDER;
1998
1998
  BITS;
1999
1999
  BYTES;
@@ -2205,15 +2205,15 @@ class pc {
2205
2205
  _cyclotomicExp(t, n) {
2206
2206
  let r = this.ONE;
2207
2207
  for (let s = this.X_LEN - 1; s >= 0; s--)
2208
- r = this._cyclotomicSquare(r), Na(n, s) && (r = this.mul(r, t));
2208
+ r = this._cyclotomicSquare(r), ka(n, s) && (r = this.mul(r, t));
2209
2209
  return r;
2210
2210
  }
2211
2211
  }
2212
- function hc(e) {
2213
- const t = Bn(e.ORDER), n = new fc(t, e), r = new dc(n), s = new pc(r, e);
2212
+ function pc(e) {
2213
+ const t = Bn(e.ORDER), n = new lc(t, e), r = new fc(n), s = new dc(r, e);
2214
2214
  return { Fp: t, Fp2: n, Fp6: r, Fp12: s };
2215
2215
  }
2216
- const St = BigInt(0), Zn = BigInt(1), Mt = BigInt(2), tr = BigInt(3), gn = BigInt(4), Se = BigInt("0xd201000000010000"), wc = Wn(Se), sn = {
2216
+ const St = BigInt(0), Zn = BigInt(1), Mt = BigInt(2), tr = BigInt(3), gn = BigInt(4), Se = BigInt("0xd201000000010000"), hc = Wn(Se), sn = {
2217
2217
  p: BigInt("0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab"),
2218
2218
  n: BigInt("0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001"),
2219
2219
  h: BigInt("0x396c8c005555e1568c00aaab0000aaab"),
@@ -2223,9 +2223,9 @@ const St = BigInt(0), Zn = BigInt(1), Mt = BigInt(2), tr = BigInt(3), gn = BigIn
2223
2223
  Gy: BigInt("0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1")
2224
2224
  }, Xr = Bn(sn.n, {
2225
2225
  modFromBytes: !0
2226
- }), { Fp: C, Fp2: V, Fp6: gc, Fp12: K } = hc({
2226
+ }), { Fp: C, Fp2: V, Fp6: wc, Fp12: K } = pc({
2227
2227
  ORDER: sn.p,
2228
- X_LEN: wc,
2228
+ X_LEN: hc,
2229
2229
  // Finite extension field over irreducible polynominal.
2230
2230
  // Fp(u) / (u² - β) where β = -1
2231
2231
  FP2_NONRESIDUE: [Zn, Zn],
@@ -2237,14 +2237,14 @@ const St = BigInt(0), Zn = BigInt(1), Mt = BigInt(2), tr = BigInt(3), gn = BigIn
2237
2237
  const t = Se, n = K.div(K.frobeniusMap(e, 6), e), r = K.mul(K.frobeniusMap(n, 2), n), s = K.conjugate(K._cyclotomicExp(r, t)), i = K.mul(K.conjugate(K._cyclotomicSquare(r)), s), o = K.conjugate(K._cyclotomicExp(i, t)), a = K.conjugate(K._cyclotomicExp(o, t)), c = K.mul(K.conjugate(K._cyclotomicExp(a, t)), K._cyclotomicSquare(s)), u = K.conjugate(K._cyclotomicExp(c, t)), l = K.frobeniusMap(K.mul(s, a), 2), f = K.frobeniusMap(K.mul(o, r), 3), d = K.frobeniusMap(K.mul(c, K.conjugate(r)), 1), p = K.mul(K.mul(u, K.conjugate(i)), r);
2238
2238
  return K.mul(K.mul(K.mul(l, f), d), p);
2239
2239
  }
2240
- }), { G2psi: Ts, G2psi2: yc } = lc(C, V, V.div(V.ONE, V.NONRESIDUE)), Br = Object.freeze({
2240
+ }), { G2psi: Ts, G2psi2: gc } = uc(C, V, V.div(V.ONE, V.NONRESIDUE)), Br = Object.freeze({
2241
2241
  DST: "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_",
2242
2242
  encodeDST: "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_",
2243
2243
  p: C.ORDER,
2244
2244
  m: 2,
2245
2245
  k: 128,
2246
2246
  expand: "xmd",
2247
- hash: Li
2247
+ hash: Ai
2248
2248
  }), zr = {
2249
2249
  p: V.ORDER,
2250
2250
  n: sn.n,
@@ -2261,7 +2261,7 @@ const St = BigInt(0), Zn = BigInt(1), Mt = BigInt(2), tr = BigInt(3), gn = BigIn
2261
2261
  ])
2262
2262
  }, er = vn(C.toBytes(St), { infinity: !0, compressed: !0 });
2263
2263
  function nr(e) {
2264
- e = Ei(e);
2264
+ e = Si(e);
2265
2265
  const t = e[0] & 224, n = !!(t >> 7 & 1), r = !!(t >> 6 & 1), s = !!(t >> 5 & 1);
2266
2266
  return e[0] &= 31, { compressed: n, infinity: r, sort: s, value: e };
2267
2267
  }
@@ -2270,7 +2270,7 @@ function vn(e, t) {
2270
2270
  throw new Error("setMask: non-empty mask");
2271
2271
  return t.compressed && (e[0] |= 128), t.infinity && (e[0] |= 64), t.sort && (e[0] |= 32), e;
2272
2272
  }
2273
- function bc(e, t, n) {
2273
+ function yc(e, t, n) {
2274
2274
  const { BYTES: r, ORDER: s } = C, i = t.is0(), { x: o, y: a } = t.toAffine();
2275
2275
  if (n) {
2276
2276
  if (i)
@@ -2288,7 +2288,7 @@ function vr(e) {
2288
2288
  const i = !!(s * Mt / n);
2289
2289
  return vn(mt(r, t), { compressed: !0, sort: i });
2290
2290
  }
2291
- function mc(e) {
2291
+ function bc(e) {
2292
2292
  const { compressed: t, infinity: n, sort: r, value: s } = nr(e), { BYTES: i, ORDER: o } = C;
2293
2293
  if (s.length === 48 && t) {
2294
2294
  const a = Xt(s), c = C.create(a & En(C.BITS));
@@ -2326,7 +2326,7 @@ function Rs(e) {
2326
2326
  const f = i.fromAffine({ x: a, y: u });
2327
2327
  return f.assertValidity(), f;
2328
2328
  }
2329
- function xc(e, t, n) {
2329
+ function mc(e, t, n) {
2330
2330
  const { BYTES: r, ORDER: s } = C, i = t.is0(), { x: o, y: a } = t.toAffine();
2331
2331
  if (n) {
2332
2332
  if (i)
@@ -2348,7 +2348,7 @@ function Or(e) {
2348
2348
  const { x: n, y: r } = e.toAffine(), { re: s, im: i } = V.reim(n), { re: o, im: a } = V.reim(r), u = !!((a > St ? a * Mt : o * Mt) / C.ORDER & Zn), l = s;
2349
2349
  return ht(vn(mt(i, t), { sort: u, compressed: !0 }), mt(l, t));
2350
2350
  }
2351
- function _c(e) {
2351
+ function xc(e) {
2352
2352
  const { BYTES: t, ORDER: n } = C, { compressed: r, infinity: s, sort: i, value: o } = nr(e);
2353
2353
  if (!r && !s && i || // 00100000
2354
2354
  !r && s && i || // 01100000
@@ -2392,7 +2392,7 @@ function ks(e) {
2392
2392
  const v = i.fromAffine({ x: f, y: p });
2393
2393
  return v.assertValidity(), v;
2394
2394
  }
2395
- const Sc = {
2395
+ const _c = {
2396
2396
  ShortSignature: {
2397
2397
  fromBytes(e) {
2398
2398
  return Rs(ft(e));
@@ -2427,17 +2427,17 @@ const Sc = {
2427
2427
  return wn(Or(e));
2428
2428
  }
2429
2429
  }
2430
- }, Ec = {
2430
+ }, Sc = {
2431
2431
  Fp: C,
2432
2432
  Fp2: V,
2433
- Fp6: gc,
2433
+ Fp6: wc,
2434
2434
  Fp12: K,
2435
2435
  Fr: Xr
2436
- }, Bc = Mi(sn, {
2436
+ }, Ec = Di(sn, {
2437
2437
  allowInfinityPoint: !0,
2438
2438
  Fn: Xr,
2439
- fromBytes: mc,
2440
- toBytes: bc,
2439
+ fromBytes: bc,
2440
+ toBytes: yc,
2441
2441
  // Checks is the point resides in prime-order subgroup.
2442
2442
  // point.isTorsionFree() should return true for valid points
2443
2443
  // It returns false for shitty points.
@@ -2449,12 +2449,12 @@ const Sc = {
2449
2449
  // Clear cofactor of G1
2450
2450
  // https://eprint.iacr.org/2019/403
2451
2451
  clearCofactor: (e, t) => t.multiplyUnsafe(Se).add(t)
2452
- }), vc = Mi(zr, {
2452
+ }), Bc = Di(zr, {
2453
2453
  Fp: V,
2454
2454
  allowInfinityPoint: !0,
2455
2455
  Fn: Xr,
2456
- fromBytes: _c,
2457
- toBytes: xc,
2456
+ fromBytes: xc,
2457
+ toBytes: mc,
2458
2458
  // https://eprint.iacr.org/2021/1130.pdf
2459
2459
  // Older version: https://eprint.iacr.org/2019/814.pdf
2460
2460
  isTorsionFree: (e, t) => t.multiplyUnsafe(Se).negate().equals(Ts(e, t)),
@@ -2464,20 +2464,20 @@ const Sc = {
2464
2464
  clearCofactor: (e, t) => {
2465
2465
  const n = Se;
2466
2466
  let r = t.multiplyUnsafe(n).negate(), s = Ts(e, t), i = t.double();
2467
- return i = yc(e, i), i = i.subtract(s), s = r.add(s), s = s.multiplyUnsafe(n).negate(), i = i.add(s), i = i.subtract(r), i.subtract(t);
2467
+ return i = gc(e, i), i = i.subtract(s), s = r.add(s), s = s.multiplyUnsafe(n).negate(), i = i.add(s), i = i.subtract(r), i.subtract(t);
2468
2468
  }
2469
- }), Oc = {
2470
- mapToG1: Cc,
2471
- mapToG2: $c,
2469
+ }), vc = {
2470
+ mapToG1: Nc,
2471
+ mapToG2: Cc,
2472
2472
  hasherOpts: Br,
2473
2473
  hasherOptsG1: { ...Br, m: 1, DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_" },
2474
2474
  hasherOptsG2: { ...Br }
2475
- }, Ic = {
2475
+ }, Oc = {
2476
2476
  ateLoopSize: Se,
2477
2477
  // The BLS parameter x for BLS12-381
2478
2478
  twistType: "multiplicative",
2479
- randomBytes: mi
2480
- }, I = uc(Ec, Bc, vc, Ic, Oc, Sc), Tc = qi(V, [
2479
+ randomBytes: bi
2480
+ }, I = cc(Sc, Ec, Bc, Oc, vc, _c), Ic = Ui(V, [
2481
2481
  // xNum
2482
2482
  [
2483
2483
  [
@@ -2546,7 +2546,7 @@ const Sc = {
2546
2546
  ["0x1", "0x0"]
2547
2547
  // LAST 1
2548
2548
  ]
2549
- ].map((e) => e.map((t) => V.fromBigTuple(t.map(BigInt))))), Rc = qi(C, [
2549
+ ].map((e) => e.map((t) => V.fromBigTuple(t.map(BigInt))))), Tc = Ui(C, [
2550
2550
  // xNum
2551
2551
  [
2552
2552
  "0x11a05f2b1e833340b809101dd99815856b303e88a2d7005ff2627b56cdb4e2c85610c2d5f2e62d6eaeac1662734649b7",
@@ -2616,11 +2616,11 @@ const Sc = {
2616
2616
  "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001"
2617
2617
  // LAST 1
2618
2618
  ]
2619
- ].map((e) => e.map((t) => BigInt(t)))), kc = Wi(C, {
2619
+ ].map((e) => e.map((t) => BigInt(t)))), Rc = Mi(C, {
2620
2620
  A: C.create(BigInt("0x144698a3b8e9433d693a02c96d4982b0ea985383ee66a8d8e8981aefd881ac98936f8da0e0f97f5cf428082d584c1d")),
2621
2621
  B: C.create(BigInt("0x12e2908d11688030018b12e8753eee3b2016c1f0f24f4070a0b9c14fcef35ef55a23215a316ceaa5d1cc48e98e172be0")),
2622
2622
  Z: C.create(BigInt(11))
2623
- }), Nc = Wi(V, {
2623
+ }), kc = Mi(V, {
2624
2624
  A: V.create({ c0: C.create(St), c1: C.create(BigInt(240)) }),
2625
2625
  // A' = 240 * I
2626
2626
  B: V.create({ c0: C.create(BigInt(1012)), c1: C.create(BigInt(1012)) }),
@@ -2628,19 +2628,19 @@ const Sc = {
2628
2628
  Z: V.create({ c0: C.create(BigInt(-2)), c1: C.create(BigInt(-1)) })
2629
2629
  // Z: -(2 + I)
2630
2630
  });
2631
- function Cc(e) {
2632
- const { x: t, y: n } = kc(C.create(e[0]));
2633
- return Rc(t, n);
2634
- }
2635
- function $c(e) {
2636
- const { x: t, y: n } = Nc(V.fromBigTuple(e));
2631
+ function Nc(e) {
2632
+ const { x: t, y: n } = Rc(C.create(e[0]));
2637
2633
  return Tc(t, n);
2638
2634
  }
2639
- function Ac(e, t, n) {
2635
+ function Cc(e) {
2636
+ const { x: t, y: n } = kc(V.fromBigTuple(e));
2637
+ return Ic(t, n);
2638
+ }
2639
+ function $c(e, t, n) {
2640
2640
  return Gr(e), n === void 0 && (n = new Uint8Array(e.outputLen)), Yr(e, n, t);
2641
2641
  }
2642
2642
  const Ir = /* @__PURE__ */ Uint8Array.of(0), Ns = /* @__PURE__ */ Uint8Array.of();
2643
- function Lc(e, t, n, r = 32) {
2643
+ function Ac(e, t, n, r = 32) {
2644
2644
  Gr(e), tn(r, "length");
2645
2645
  const s = e.outputLen;
2646
2646
  if (r > 255 * s)
@@ -2652,8 +2652,8 @@ function Lc(e, t, n, r = 32) {
2652
2652
  Ir[0] = l + 1, c.update(l === 0 ? Ns : u).update(n).update(Ir).digestInto(u), o.set(u, s * l), a._cloneInto(c);
2653
2653
  return a.destroy(), c.destroy(), hn(u, Ir), o.slice(0, r);
2654
2654
  }
2655
- const Pc = (e, t, n, r, s) => Lc(e, Ac(e, t, n), r, s), Fc = "6.16.0";
2656
- function Uc(e, t, n) {
2655
+ const Lc = (e, t, n, r, s) => Ac(e, $c(e, t, n), r, s), Pc = "6.16.0";
2656
+ function Fc(e, t, n) {
2657
2657
  const r = t.split("|").map((i) => i.trim());
2658
2658
  for (let i = 0; i < r.length; i++)
2659
2659
  switch (t) {
@@ -2673,7 +2673,7 @@ function st(e, t, n) {
2673
2673
  for (let r in t) {
2674
2674
  let s = t[r];
2675
2675
  const i = n ? n[r] : null;
2676
- i && Uc(s, i, r), Object.defineProperty(e, r, { enumerable: !0, value: s, writable: !1 });
2676
+ i && Fc(s, i, r), Object.defineProperty(e, r, { enumerable: !0, value: s, writable: !1 });
2677
2677
  }
2678
2678
  }
2679
2679
  function Je(e, t) {
@@ -2714,7 +2714,7 @@ function Je(e, t) {
2714
2714
  function Cs(e, t) {
2715
2715
  return e && e.code === t;
2716
2716
  }
2717
- function Gi(e, t, n) {
2717
+ function Wi(e, t, n) {
2718
2718
  let r = e;
2719
2719
  {
2720
2720
  const i = [];
@@ -2728,7 +2728,7 @@ function Gi(e, t, n) {
2728
2728
  i.push(o + "=" + Je(a));
2729
2729
  }
2730
2730
  }
2731
- i.push(`code=${t}`), i.push(`version=${Fc}`), i.length && (e += " (" + i.join(", ") + ")");
2731
+ i.push(`code=${t}`), i.push(`version=${Pc}`), i.length && (e += " (" + i.join(", ") + ")");
2732
2732
  }
2733
2733
  let s;
2734
2734
  switch (t) {
@@ -2746,12 +2746,12 @@ function Gi(e, t, n) {
2746
2746
  }
2747
2747
  function at(e, t, n, r) {
2748
2748
  if (!e)
2749
- throw Gi(t, n, r);
2749
+ throw Wi(t, n, r);
2750
2750
  }
2751
2751
  function x(e, t, n, r) {
2752
2752
  at(e, t, "INVALID_ARGUMENT", { argument: n, value: r });
2753
2753
  }
2754
- function Hi(e, t, n) {
2754
+ function Gi(e, t, n) {
2755
2755
  n == null && (n = ""), n && (n = ": " + n), at(e >= t, "missing argument" + n, "MISSING_ARGUMENT", {
2756
2756
  count: e,
2757
2757
  expectedCount: t
@@ -2779,7 +2779,7 @@ function Jr(e, t, n) {
2779
2779
  });
2780
2780
  }
2781
2781
  }
2782
- function Vi(e, t, n) {
2782
+ function Hi(e, t, n) {
2783
2783
  if (e instanceof Uint8Array)
2784
2784
  return n ? new Uint8Array(e) : e;
2785
2785
  if (typeof e == "string" && e.length % 2 === 0 && e.match(/^0x[0-9a-f]*$/i)) {
@@ -2792,10 +2792,10 @@ function Vi(e, t, n) {
2792
2792
  x(!1, "invalid BytesLike value", t || "value", e);
2793
2793
  }
2794
2794
  function yt(e, t) {
2795
- return Vi(e, t, !1);
2795
+ return Hi(e, t, !1);
2796
2796
  }
2797
2797
  function zt(e, t) {
2798
- return Vi(e, t, !0);
2798
+ return Hi(e, t, !0);
2799
2799
  }
2800
2800
  function fn(e, t) {
2801
2801
  return !(typeof e != "string" || !e.match(/^0x[0-9A-Fa-f]*$/) || typeof t == "number" && e.length !== 2 + 2 * t || t === !0 && e.length % 2 !== 0);
@@ -2813,7 +2813,7 @@ function bt(e) {
2813
2813
  function Ee(e) {
2814
2814
  return "0x" + e.map((t) => bt(t).substring(2)).join("");
2815
2815
  }
2816
- function qc(e) {
2816
+ function Uc(e) {
2817
2817
  return fn(e, !0) ? (e.length - 2) / 2 : yt(e).length;
2818
2818
  }
2819
2819
  function Ze(e, t, n) {
@@ -2824,7 +2824,7 @@ function Ze(e, t, n) {
2824
2824
  offset: n
2825
2825
  }), bt(r.slice(t ?? 0, n ?? r.length));
2826
2826
  }
2827
- function Zi(e, t, n) {
2827
+ function Vi(e, t, n) {
2828
2828
  const r = yt(e);
2829
2829
  at(t >= r.length, "padding exceeds data length", "BUFFER_OVERRUN", {
2830
2830
  buffer: new Uint8Array(r),
@@ -2835,13 +2835,13 @@ function Zi(e, t, n) {
2835
2835
  return s.fill(0), n ? s.set(r, t - r.length) : s.set(r, 0), bt(s);
2836
2836
  }
2837
2837
  function Un(e, t) {
2838
- return Zi(e, t, !0);
2838
+ return Vi(e, t, !0);
2839
2839
  }
2840
- function Yi(e, t) {
2841
- return Zi(e, t, !1);
2840
+ function Zi(e, t) {
2841
+ return Vi(e, t, !1);
2842
2842
  }
2843
2843
  const On = BigInt(0), Gt = BigInt(1), je = 9007199254740991;
2844
- function Dc(e, t) {
2844
+ function qc(e, t) {
2845
2845
  const n = rr(e, "value"), r = BigInt(Be(t, "width"));
2846
2846
  if (at(n >> r === On, "overflow", "NUMERIC_FAULT", {
2847
2847
  operation: "fromTwos",
@@ -2853,7 +2853,7 @@ function Dc(e, t) {
2853
2853
  }
2854
2854
  return n;
2855
2855
  }
2856
- function Ki(e, t) {
2856
+ function Yi(e, t) {
2857
2857
  let n = on(e, "value");
2858
2858
  const r = BigInt(Be(t, "width")), s = Gt << r - Gt;
2859
2859
  if (n < On) {
@@ -2902,7 +2902,7 @@ function rr(e, t) {
2902
2902
  }), n;
2903
2903
  }
2904
2904
  const As = "0123456789abcdef";
2905
- function Xi(e) {
2905
+ function Ki(e) {
2906
2906
  if (e instanceof Uint8Array) {
2907
2907
  let t = "0x0";
2908
2908
  for (const n of e)
@@ -2928,10 +2928,10 @@ function Be(e, t) {
2928
2928
  }
2929
2929
  x(!1, "invalid numeric value", t || "value", e);
2930
2930
  }
2931
- function Mc(e) {
2932
- return Be(Xi(e));
2931
+ function Dc(e) {
2932
+ return Be(Ki(e));
2933
2933
  }
2934
- function zi(e, t) {
2934
+ function Xi(e, t) {
2935
2935
  const n = rr(e, "value");
2936
2936
  let r = n.toString(16);
2937
2937
  if (t == null)
@@ -2949,7 +2949,7 @@ function zi(e, t) {
2949
2949
  }
2950
2950
  return "0x" + r;
2951
2951
  }
2952
- function Ji(e, t) {
2952
+ function zi(e, t) {
2953
2953
  const n = rr(e, "value");
2954
2954
  if (n === On)
2955
2955
  return new Uint8Array(0);
@@ -2962,10 +2962,10 @@ function Ji(e, t) {
2962
2962
  }
2963
2963
  return s;
2964
2964
  }
2965
- function Wc(e, t, n, r, s) {
2965
+ function Mc(e, t, n, r, s) {
2966
2966
  x(!1, `invalid codepoint at offset ${t}; ${e}`, "bytes", n);
2967
2967
  }
2968
- function ji(e, t, n, r, s) {
2968
+ function Ji(e, t, n, r, s) {
2969
2969
  if (e === "BAD_PREFIX" || e === "UNEXPECTED_CONTINUE") {
2970
2970
  let i = 0;
2971
2971
  for (let o = t + 1; o < n.length && n[o] >> 6 === 2; o++)
@@ -2974,16 +2974,16 @@ function ji(e, t, n, r, s) {
2974
2974
  }
2975
2975
  return e === "OVERRUN" ? n.length - t - 1 : 0;
2976
2976
  }
2977
- function Gc(e, t, n, r, s) {
2978
- return e === "OVERLONG" ? (x(typeof s == "number", "invalid bad code point for replacement", "badCodepoint", s), r.push(s), 0) : (r.push(65533), ji(e, t, n));
2977
+ function Wc(e, t, n, r, s) {
2978
+ return e === "OVERLONG" ? (x(typeof s == "number", "invalid bad code point for replacement", "badCodepoint", s), r.push(s), 0) : (r.push(65533), Ji(e, t, n));
2979
2979
  }
2980
- const Hc = Object.freeze({
2981
- error: Wc,
2982
- ignore: ji,
2983
- replace: Gc
2980
+ const Gc = Object.freeze({
2981
+ error: Mc,
2982
+ ignore: Ji,
2983
+ replace: Wc
2984
2984
  });
2985
- function Vc(e, t) {
2986
- t == null && (t = Hc.error);
2985
+ function Hc(e, t) {
2986
+ t == null && (t = Gc.error);
2987
2987
  const n = yt(e, "bytes"), r = [];
2988
2988
  let s = 0;
2989
2989
  for (; s < n.length; ) {
@@ -3054,18 +3054,18 @@ function jr(e, t) {
3054
3054
  }
3055
3055
  return new Uint8Array(n);
3056
3056
  }
3057
- function Zc(e) {
3057
+ function Vc(e) {
3058
3058
  return e.map((t) => t <= 65535 ? String.fromCharCode(t) : (t -= 65536, String.fromCharCode((t >> 10 & 1023) + 55296, (t & 1023) + 56320))).join("");
3059
3059
  }
3060
- function Yc(e, t) {
3061
- return Zc(Vc(e, t));
3060
+ function Zc(e, t) {
3061
+ return Vc(Hc(e, t));
3062
3062
  }
3063
- const It = 32, Cr = new Uint8Array(It), Kc = ["then"], An = {}, Qi = /* @__PURE__ */ new WeakMap();
3063
+ const It = 32, Cr = new Uint8Array(It), Yc = ["then"], An = {}, ji = /* @__PURE__ */ new WeakMap();
3064
3064
  function Ne(e) {
3065
- return Qi.get(e);
3065
+ return ji.get(e);
3066
3066
  }
3067
3067
  function Ls(e, t) {
3068
- Qi.set(e, t);
3068
+ ji.set(e, t);
3069
3069
  }
3070
3070
  function un(e, t) {
3071
3071
  const n = new Error(`deferred error during ABI decoding triggered accessing ${e}`);
@@ -3108,7 +3108,7 @@ class ce extends Array {
3108
3108
  const p = c[d];
3109
3109
  return p instanceof Error && un(`index ${d}`, p), p;
3110
3110
  }
3111
- if (Kc.indexOf(u) >= 0)
3111
+ if (Yc.indexOf(u) >= 0)
3112
3112
  return Reflect.get(c, u, l);
3113
3113
  const f = c[u];
3114
3114
  if (f instanceof Function)
@@ -3206,7 +3206,7 @@ class ce extends Array {
3206
3206
  }
3207
3207
  }
3208
3208
  function Ps(e) {
3209
- let t = Ji(e);
3209
+ let t = zi(e);
3210
3210
  return at(t.length <= It, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: t, length: It, offset: t.length }), t.length !== It && (t = zt(Ee([Cr.slice(t.length % It), t]))), t;
3211
3211
  }
3212
3212
  class we {
@@ -3332,17 +3332,17 @@ class Qr {
3332
3332
  }
3333
3333
  // Read a numeric values
3334
3334
  readValue() {
3335
- return Xi(this.readBytes(It));
3335
+ return Ki(this.readBytes(It));
3336
3336
  }
3337
3337
  readIndex() {
3338
- return Mc(this.readBytes(It));
3338
+ return Dc(this.readBytes(It));
3339
3339
  }
3340
3340
  }
3341
3341
  function Fs(e) {
3342
3342
  if (!Number.isSafeInteger(e) || e < 0)
3343
3343
  throw new Error(`Wrong positive integer: ${e}`);
3344
3344
  }
3345
- function to(e, ...t) {
3345
+ function Qi(e, ...t) {
3346
3346
  if (!(e instanceof Uint8Array))
3347
3347
  throw new Error("Expected Uint8Array");
3348
3348
  if (t.length > 0 && !t.includes(e.length))
@@ -3354,57 +3354,57 @@ function Us(e, t = !0) {
3354
3354
  if (t && e.finished)
3355
3355
  throw new Error("Hash#digest() has already been called");
3356
3356
  }
3357
- function Xc(e, t) {
3358
- to(e);
3357
+ function Kc(e, t) {
3358
+ Qi(e);
3359
3359
  const n = t.outputLen;
3360
3360
  if (e.length < n)
3361
3361
  throw new Error(`digestInto() expects output buffer of length at least ${n}`);
3362
3362
  }
3363
- const zc = (e) => e instanceof Uint8Array, Jc = (e) => new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4)), jc = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
3364
- if (!jc)
3363
+ const Xc = (e) => e instanceof Uint8Array, zc = (e) => new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4)), Jc = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
3364
+ if (!Jc)
3365
3365
  throw new Error("Non little-endian hardware is not supported");
3366
- function Qc(e) {
3366
+ function jc(e) {
3367
3367
  if (typeof e != "string")
3368
3368
  throw new Error(`utf8ToBytes expected string, got ${typeof e}`);
3369
3369
  return new Uint8Array(new TextEncoder().encode(e));
3370
3370
  }
3371
- function eo(e) {
3372
- if (typeof e == "string" && (e = Qc(e)), !zc(e))
3371
+ function to(e) {
3372
+ if (typeof e == "string" && (e = jc(e)), !Xc(e))
3373
3373
  throw new Error(`expected Uint8Array, got ${typeof e}`);
3374
3374
  return e;
3375
3375
  }
3376
- class tu {
3376
+ class Qc {
3377
3377
  // Safe version that clones internal state
3378
3378
  clone() {
3379
3379
  return this._cloneInto();
3380
3380
  }
3381
3381
  }
3382
- function eu(e) {
3383
- const t = (r) => e().update(eo(r)).digest(), n = e();
3382
+ function tu(e) {
3383
+ const t = (r) => e().update(to(r)).digest(), n = e();
3384
3384
  return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
3385
3385
  }
3386
3386
  const Ln = /* @__PURE__ */ BigInt(2 ** 32 - 1), qs = /* @__PURE__ */ BigInt(32);
3387
- function nu(e, t = !1) {
3387
+ function eu(e, t = !1) {
3388
3388
  return t ? { h: Number(e & Ln), l: Number(e >> qs & Ln) } : { h: Number(e >> qs & Ln) | 0, l: Number(e & Ln) | 0 };
3389
3389
  }
3390
- function ru(e, t = !1) {
3390
+ function nu(e, t = !1) {
3391
3391
  let n = new Uint32Array(e.length), r = new Uint32Array(e.length);
3392
3392
  for (let s = 0; s < e.length; s++) {
3393
- const { h: i, l: o } = nu(e[s], t);
3393
+ const { h: i, l: o } = eu(e[s], t);
3394
3394
  [n[s], r[s]] = [i, o];
3395
3395
  }
3396
3396
  return [n, r];
3397
3397
  }
3398
- const su = (e, t, n) => e << n | t >>> 32 - n, iu = (e, t, n) => t << n | e >>> 32 - n, ou = (e, t, n) => t << n - 32 | e >>> 64 - n, au = (e, t, n) => e << n - 32 | t >>> 64 - n, [no, ro, so] = [[], [], []], cu = /* @__PURE__ */ BigInt(0), ln = /* @__PURE__ */ BigInt(1), uu = /* @__PURE__ */ BigInt(2), lu = /* @__PURE__ */ BigInt(7), fu = /* @__PURE__ */ BigInt(256), du = /* @__PURE__ */ BigInt(113);
3398
+ const ru = (e, t, n) => e << n | t >>> 32 - n, su = (e, t, n) => t << n | e >>> 32 - n, iu = (e, t, n) => t << n - 32 | e >>> 64 - n, ou = (e, t, n) => e << n - 32 | t >>> 64 - n, [eo, no, ro] = [[], [], []], au = /* @__PURE__ */ BigInt(0), ln = /* @__PURE__ */ BigInt(1), cu = /* @__PURE__ */ BigInt(2), uu = /* @__PURE__ */ BigInt(7), lu = /* @__PURE__ */ BigInt(256), fu = /* @__PURE__ */ BigInt(113);
3399
3399
  for (let e = 0, t = ln, n = 1, r = 0; e < 24; e++) {
3400
- [n, r] = [r, (2 * n + 3 * r) % 5], no.push(2 * (5 * r + n)), ro.push((e + 1) * (e + 2) / 2 % 64);
3401
- let s = cu;
3400
+ [n, r] = [r, (2 * n + 3 * r) % 5], eo.push(2 * (5 * r + n)), no.push((e + 1) * (e + 2) / 2 % 64);
3401
+ let s = au;
3402
3402
  for (let i = 0; i < 7; i++)
3403
- t = (t << ln ^ (t >> lu) * du) % fu, t & uu && (s ^= ln << (ln << /* @__PURE__ */ BigInt(i)) - ln);
3404
- so.push(s);
3403
+ t = (t << ln ^ (t >> uu) * fu) % lu, t & cu && (s ^= ln << (ln << /* @__PURE__ */ BigInt(i)) - ln);
3404
+ ro.push(s);
3405
3405
  }
3406
- const [pu, hu] = /* @__PURE__ */ ru(so, !0), Ds = (e, t, n) => n > 32 ? ou(e, t, n) : su(e, t, n), Ms = (e, t, n) => n > 32 ? au(e, t, n) : iu(e, t, n);
3407
- function wu(e, t = 24) {
3406
+ const [du, pu] = /* @__PURE__ */ nu(ro, !0), Ds = (e, t, n) => n > 32 ? iu(e, t, n) : ru(e, t, n), Ms = (e, t, n) => n > 32 ? ou(e, t, n) : su(e, t, n);
3407
+ function hu(e, t = 24) {
3408
3408
  const n = new Uint32Array(10);
3409
3409
  for (let r = 24 - t; r < 24; r++) {
3410
3410
  for (let o = 0; o < 10; o++)
@@ -3416,7 +3416,7 @@ function wu(e, t = 24) {
3416
3416
  }
3417
3417
  let s = e[2], i = e[3];
3418
3418
  for (let o = 0; o < 24; o++) {
3419
- const a = ro[o], c = Ds(s, i, a), u = Ms(s, i, a), l = no[o];
3419
+ const a = no[o], c = Ds(s, i, a), u = Ms(s, i, a), l = eo[o];
3420
3420
  s = e[l], i = e[l + 1], e[l] = c, e[l + 1] = u;
3421
3421
  }
3422
3422
  for (let o = 0; o < 50; o += 10) {
@@ -3425,24 +3425,24 @@ function wu(e, t = 24) {
3425
3425
  for (let a = 0; a < 10; a++)
3426
3426
  e[o + a] ^= ~n[(a + 2) % 10] & n[(a + 4) % 10];
3427
3427
  }
3428
- e[0] ^= pu[r], e[1] ^= hu[r];
3428
+ e[0] ^= du[r], e[1] ^= pu[r];
3429
3429
  }
3430
3430
  n.fill(0);
3431
3431
  }
3432
- class ts extends tu {
3432
+ class ts extends Qc {
3433
3433
  // NOTE: we accept arguments in bytes instead of bits here.
3434
3434
  constructor(t, n, r, s = !1, i = 24) {
3435
3435
  if (super(), this.blockLen = t, this.suffix = n, this.outputLen = r, this.enableXOF = s, this.rounds = i, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, Fs(r), 0 >= this.blockLen || this.blockLen >= 200)
3436
3436
  throw new Error("Sha3 supports only keccak-f1600 function");
3437
- this.state = new Uint8Array(200), this.state32 = Jc(this.state);
3437
+ this.state = new Uint8Array(200), this.state32 = zc(this.state);
3438
3438
  }
3439
3439
  keccak() {
3440
- wu(this.state32, this.rounds), this.posOut = 0, this.pos = 0;
3440
+ hu(this.state32, this.rounds), this.posOut = 0, this.pos = 0;
3441
3441
  }
3442
3442
  update(t) {
3443
3443
  Us(this);
3444
3444
  const { blockLen: n, state: r } = this;
3445
- t = eo(t);
3445
+ t = to(t);
3446
3446
  const s = t.length;
3447
3447
  for (let i = 0; i < s; ) {
3448
3448
  const o = Math.min(n - this.pos, s - i);
@@ -3460,7 +3460,7 @@ class ts extends tu {
3460
3460
  t[r] ^= n, (n & 128) !== 0 && r === s - 1 && this.keccak(), t[s - 1] ^= 128, this.keccak();
3461
3461
  }
3462
3462
  writeInto(t) {
3463
- Us(this, !1), to(t), this.finish();
3463
+ Us(this, !1), Qi(t), this.finish();
3464
3464
  const n = this.state, { blockLen: r } = this;
3465
3465
  for (let s = 0, i = t.length; s < i; ) {
3466
3466
  this.posOut >= r && this.keccak();
@@ -3478,7 +3478,7 @@ class ts extends tu {
3478
3478
  return Fs(t), this.xofInto(new Uint8Array(t));
3479
3479
  }
3480
3480
  digestInto(t) {
3481
- if (Xc(t, this), this.finished)
3481
+ if (Kc(t, this), this.finished)
3482
3482
  throw new Error("digest() was already called");
3483
3483
  return this.writeInto(t), this.destroy(), t;
3484
3484
  }
@@ -3493,27 +3493,27 @@ class ts extends tu {
3493
3493
  return t || (t = new ts(n, r, s, o, i)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = i, t.suffix = r, t.outputLen = s, t.enableXOF = o, t.destroyed = this.destroyed, t;
3494
3494
  }
3495
3495
  }
3496
- const gu = (e, t, n) => eu(() => new ts(t, e, n)), yu = /* @__PURE__ */ gu(1, 136, 256 / 8);
3497
- let io = !1;
3498
- const oo = function(e) {
3499
- return yu(e);
3496
+ const wu = (e, t, n) => tu(() => new ts(t, e, n)), gu = /* @__PURE__ */ wu(1, 136, 256 / 8);
3497
+ let so = !1;
3498
+ const io = function(e) {
3499
+ return gu(e);
3500
3500
  };
3501
- let ao = oo;
3501
+ let oo = io;
3502
3502
  function tt(e) {
3503
3503
  const t = yt(e, "data");
3504
- return bt(ao(t));
3504
+ return bt(oo(t));
3505
3505
  }
3506
- tt._ = oo;
3506
+ tt._ = io;
3507
3507
  tt.lock = function() {
3508
- io = !0;
3508
+ so = !0;
3509
3509
  };
3510
3510
  tt.register = function(e) {
3511
- if (io)
3511
+ if (so)
3512
3512
  throw new TypeError("keccak256 is locked");
3513
- ao = e;
3513
+ oo = e;
3514
3514
  };
3515
3515
  Object.freeze(tt);
3516
- const bu = BigInt(0), mu = BigInt(36);
3516
+ const yu = BigInt(0), bu = BigInt(36);
3517
3517
  function Ws(e) {
3518
3518
  e = e.toLowerCase();
3519
3519
  const t = e.substring(2).split(""), n = new Uint8Array(40);
@@ -3530,7 +3530,7 @@ for (let e = 0; e < 10; e++)
3530
3530
  for (let e = 0; e < 26; e++)
3531
3531
  es[String.fromCharCode(65 + e)] = String(10 + e);
3532
3532
  const Gs = 15;
3533
- function xu(e) {
3533
+ function mu(e) {
3534
3534
  e = e.toUpperCase(), e = e.substring(4) + e.substring(0, 2) + "00";
3535
3535
  let t = e.split("").map((r) => es[r]).join("");
3536
3536
  for (; t.length >= Gs; ) {
@@ -3542,7 +3542,7 @@ function xu(e) {
3542
3542
  n = "0" + n;
3543
3543
  return n;
3544
3544
  }
3545
- const _u = (function() {
3545
+ const xu = (function() {
3546
3546
  const e = {};
3547
3547
  for (let t = 0; t < 36; t++) {
3548
3548
  const n = "0123456789abcdefghijklmnopqrstuvwxyz"[t];
@@ -3550,11 +3550,11 @@ const _u = (function() {
3550
3550
  }
3551
3551
  return e;
3552
3552
  })();
3553
- function Su(e) {
3553
+ function _u(e) {
3554
3554
  e = e.toLowerCase();
3555
- let t = bu;
3555
+ let t = yu;
3556
3556
  for (let n = 0; n < e.length; n++)
3557
- t = t * mu + _u[e[n]];
3557
+ t = t * bu + xu[e[n]];
3558
3558
  return t;
3559
3559
  }
3560
3560
  function yn(e) {
@@ -3564,8 +3564,8 @@ function yn(e) {
3564
3564
  return x(!e.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || t === e, "bad address checksum", "address", e), t;
3565
3565
  }
3566
3566
  if (e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
3567
- x(e.substring(2, 4) === xu(e), "bad icap checksum", "address", e);
3568
- let t = Su(e.substring(4)).toString(16);
3567
+ x(e.substring(2, 4) === mu(e), "bad icap checksum", "address", e);
3568
+ let t = _u(e.substring(4)).toString(16);
3569
3569
  for (; t.length < 40; )
3570
3570
  t = "0" + t;
3571
3571
  return Ws("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(oe, `${n ? "" : "u"}int${t}`, e, { signed: n, width: t });
3579
3579
  }
3580
- function z(e, t) {
3580
+ function J(e, t) {
3581
3581
  return new pt(oe, `bytes${t || ""}`, e, { size: t });
3582
3582
  }
3583
3583
  const Hs = /* @__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 z(t, 1);
4078
+ return J(t, 1);
4079
4079
  }
4080
4080
  /**
4081
4081
  * Return a new ``bytes2`` type for %%v%%.
4082
4082
  */
4083
4083
  static bytes2(t) {
4084
- return z(t, 2);
4084
+ return J(t, 2);
4085
4085
  }
4086
4086
  /**
4087
4087
  * Return a new ``bytes3`` type for %%v%%.
4088
4088
  */
4089
4089
  static bytes3(t) {
4090
- return z(t, 3);
4090
+ return J(t, 3);
4091
4091
  }
4092
4092
  /**
4093
4093
  * Return a new ``bytes4`` type for %%v%%.
4094
4094
  */
4095
4095
  static bytes4(t) {
4096
- return z(t, 4);
4096
+ return J(t, 4);
4097
4097
  }
4098
4098
  /**
4099
4099
  * Return a new ``bytes5`` type for %%v%%.
4100
4100
  */
4101
4101
  static bytes5(t) {
4102
- return z(t, 5);
4102
+ return J(t, 5);
4103
4103
  }
4104
4104
  /**
4105
4105
  * Return a new ``bytes6`` type for %%v%%.
4106
4106
  */
4107
4107
  static bytes6(t) {
4108
- return z(t, 6);
4108
+ return J(t, 6);
4109
4109
  }
4110
4110
  /**
4111
4111
  * Return a new ``bytes7`` type for %%v%%.
4112
4112
  */
4113
4113
  static bytes7(t) {
4114
- return z(t, 7);
4114
+ return J(t, 7);
4115
4115
  }
4116
4116
  /**
4117
4117
  * Return a new ``bytes8`` type for %%v%%.
4118
4118
  */
4119
4119
  static bytes8(t) {
4120
- return z(t, 8);
4120
+ return J(t, 8);
4121
4121
  }
4122
4122
  /**
4123
4123
  * Return a new ``bytes9`` type for %%v%%.
4124
4124
  */
4125
4125
  static bytes9(t) {
4126
- return z(t, 9);
4126
+ return J(t, 9);
4127
4127
  }
4128
4128
  /**
4129
4129
  * Return a new ``bytes10`` type for %%v%%.
4130
4130
  */
4131
4131
  static bytes10(t) {
4132
- return z(t, 10);
4132
+ return J(t, 10);
4133
4133
  }
4134
4134
  /**
4135
4135
  * Return a new ``bytes11`` type for %%v%%.
4136
4136
  */
4137
4137
  static bytes11(t) {
4138
- return z(t, 11);
4138
+ return J(t, 11);
4139
4139
  }
4140
4140
  /**
4141
4141
  * Return a new ``bytes12`` type for %%v%%.
4142
4142
  */
4143
4143
  static bytes12(t) {
4144
- return z(t, 12);
4144
+ return J(t, 12);
4145
4145
  }
4146
4146
  /**
4147
4147
  * Return a new ``bytes13`` type for %%v%%.
4148
4148
  */
4149
4149
  static bytes13(t) {
4150
- return z(t, 13);
4150
+ return J(t, 13);
4151
4151
  }
4152
4152
  /**
4153
4153
  * Return a new ``bytes14`` type for %%v%%.
4154
4154
  */
4155
4155
  static bytes14(t) {
4156
- return z(t, 14);
4156
+ return J(t, 14);
4157
4157
  }
4158
4158
  /**
4159
4159
  * Return a new ``bytes15`` type for %%v%%.
4160
4160
  */
4161
4161
  static bytes15(t) {
4162
- return z(t, 15);
4162
+ return J(t, 15);
4163
4163
  }
4164
4164
  /**
4165
4165
  * Return a new ``bytes16`` type for %%v%%.
4166
4166
  */
4167
4167
  static bytes16(t) {
4168
- return z(t, 16);
4168
+ return J(t, 16);
4169
4169
  }
4170
4170
  /**
4171
4171
  * Return a new ``bytes17`` type for %%v%%.
4172
4172
  */
4173
4173
  static bytes17(t) {
4174
- return z(t, 17);
4174
+ return J(t, 17);
4175
4175
  }
4176
4176
  /**
4177
4177
  * Return a new ``bytes18`` type for %%v%%.
4178
4178
  */
4179
4179
  static bytes18(t) {
4180
- return z(t, 18);
4180
+ return J(t, 18);
4181
4181
  }
4182
4182
  /**
4183
4183
  * Return a new ``bytes19`` type for %%v%%.
4184
4184
  */
4185
4185
  static bytes19(t) {
4186
- return z(t, 19);
4186
+ return J(t, 19);
4187
4187
  }
4188
4188
  /**
4189
4189
  * Return a new ``bytes20`` type for %%v%%.
4190
4190
  */
4191
4191
  static bytes20(t) {
4192
- return z(t, 20);
4192
+ return J(t, 20);
4193
4193
  }
4194
4194
  /**
4195
4195
  * Return a new ``bytes21`` type for %%v%%.
4196
4196
  */
4197
4197
  static bytes21(t) {
4198
- return z(t, 21);
4198
+ return J(t, 21);
4199
4199
  }
4200
4200
  /**
4201
4201
  * Return a new ``bytes22`` type for %%v%%.
4202
4202
  */
4203
4203
  static bytes22(t) {
4204
- return z(t, 22);
4204
+ return J(t, 22);
4205
4205
  }
4206
4206
  /**
4207
4207
  * Return a new ``bytes23`` type for %%v%%.
4208
4208
  */
4209
4209
  static bytes23(t) {
4210
- return z(t, 23);
4210
+ return J(t, 23);
4211
4211
  }
4212
4212
  /**
4213
4213
  * Return a new ``bytes24`` type for %%v%%.
4214
4214
  */
4215
4215
  static bytes24(t) {
4216
- return z(t, 24);
4216
+ return J(t, 24);
4217
4217
  }
4218
4218
  /**
4219
4219
  * Return a new ``bytes25`` type for %%v%%.
4220
4220
  */
4221
4221
  static bytes25(t) {
4222
- return z(t, 25);
4222
+ return J(t, 25);
4223
4223
  }
4224
4224
  /**
4225
4225
  * Return a new ``bytes26`` type for %%v%%.
4226
4226
  */
4227
4227
  static bytes26(t) {
4228
- return z(t, 26);
4228
+ return J(t, 26);
4229
4229
  }
4230
4230
  /**
4231
4231
  * Return a new ``bytes27`` type for %%v%%.
4232
4232
  */
4233
4233
  static bytes27(t) {
4234
- return z(t, 27);
4234
+ return J(t, 27);
4235
4235
  }
4236
4236
  /**
4237
4237
  * Return a new ``bytes28`` type for %%v%%.
4238
4238
  */
4239
4239
  static bytes28(t) {
4240
- return z(t, 28);
4240
+ return J(t, 28);
4241
4241
  }
4242
4242
  /**
4243
4243
  * Return a new ``bytes29`` type for %%v%%.
4244
4244
  */
4245
4245
  static bytes29(t) {
4246
- return z(t, 29);
4246
+ return J(t, 29);
4247
4247
  }
4248
4248
  /**
4249
4249
  * Return a new ``bytes30`` type for %%v%%.
4250
4250
  */
4251
4251
  static bytes30(t) {
4252
- return z(t, 30);
4252
+ return J(t, 30);
4253
4253
  }
4254
4254
  /**
4255
4255
  * Return a new ``bytes31`` type for %%v%%.
4256
4256
  */
4257
4257
  static bytes31(t) {
4258
- return z(t, 31);
4258
+ return J(t, 31);
4259
4259
  }
4260
4260
  /**
4261
4261
  * Return a new ``bytes32`` type for %%v%%.
4262
4262
  */
4263
4263
  static bytes32(t) {
4264
- return z(t, 32);
4264
+ return J(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 Eu extends we {
4330
+ class Su extends we {
4331
4331
  constructor(t) {
4332
4332
  super("address", "address", t, !1);
4333
4333
  }
@@ -4344,10 +4344,10 @@ class Eu extends we {
4344
4344
  return t.writeValue(r);
4345
4345
  }
4346
4346
  decode(t) {
4347
- return yn(zi(t.readValue(), 20));
4347
+ return yn(Xi(t.readValue(), 20));
4348
4348
  }
4349
4349
  }
4350
- class Bu extends we {
4350
+ class Eu extends we {
4351
4351
  coder;
4352
4352
  constructor(t) {
4353
4353
  super(t.name, t.type, "_", t.dynamic), this.coder = t;
@@ -4362,7 +4362,7 @@ class Bu extends we {
4362
4362
  return this.coder.decode(t);
4363
4363
  }
4364
4364
  }
4365
- function co(e, t, n) {
4365
+ function ao(e, t, n) {
4366
4366
  let r = [];
4367
4367
  if (Array.isArray(n))
4368
4368
  r = n;
@@ -4393,7 +4393,7 @@ function co(e, t, n) {
4393
4393
  let a = e.appendWriter(s);
4394
4394
  return a += e.appendWriter(i), a;
4395
4395
  }
4396
- function uo(e, t) {
4396
+ function co(e, t) {
4397
4397
  let n = [], r = [], s = e.subReader(0);
4398
4398
  return t.forEach((i) => {
4399
4399
  let o = null;
@@ -4419,7 +4419,7 @@ function uo(e, t) {
4419
4419
  n.push(o), r.push(i.localName || null);
4420
4420
  }), ce.fromItems(n, r);
4421
4421
  }
4422
- class vu extends we {
4422
+ class Bu extends we {
4423
4423
  coder;
4424
4424
  length;
4425
4425
  constructor(t, n, r) {
@@ -4436,22 +4436,22 @@ class vu extends we {
4436
4436
  const r = pt.dereference(n, "array");
4437
4437
  Array.isArray(r) || this._throwError("expected array value", r);
4438
4438
  let s = this.length;
4439
- s === -1 && (s = r.length, t.writeValue(r.length)), Hi(r.length, s, "coder array" + (this.localName ? " " + this.localName : ""));
4439
+ s === -1 && (s = r.length, t.writeValue(r.length)), Gi(r.length, s, "coder array" + (this.localName ? " " + this.localName : ""));
4440
4440
  let i = [];
4441
4441
  for (let o = 0; o < r.length; o++)
4442
4442
  i.push(this.coder);
4443
- return co(t, i, r);
4443
+ return ao(t, i, r);
4444
4444
  }
4445
4445
  decode(t) {
4446
4446
  let n = this.length;
4447
4447
  n === -1 && (n = t.readIndex(), at(n * It <= t.dataLength, "insufficient data length", "BUFFER_OVERRUN", { buffer: t.bytes, offset: n * It, length: t.dataLength }));
4448
4448
  let r = [];
4449
4449
  for (let s = 0; s < n; s++)
4450
- r.push(new Bu(this.coder));
4451
- return uo(t, r);
4450
+ r.push(new Eu(this.coder));
4451
+ return co(t, r);
4452
4452
  }
4453
4453
  }
4454
- class Ou extends we {
4454
+ class vu extends we {
4455
4455
  constructor(t) {
4456
4456
  super("bool", "bool", t, !1);
4457
4457
  }
@@ -4466,7 +4466,7 @@ class Ou extends we {
4466
4466
  return !!t.readValue();
4467
4467
  }
4468
4468
  }
4469
- class lo extends we {
4469
+ class uo extends we {
4470
4470
  constructor(t, n) {
4471
4471
  super(t, t, n, !0);
4472
4472
  }
@@ -4482,7 +4482,7 @@ class lo extends we {
4482
4482
  return t.readBytes(t.readIndex(), !0);
4483
4483
  }
4484
4484
  }
4485
- class Iu extends lo {
4485
+ class Ou extends uo {
4486
4486
  constructor(t) {
4487
4487
  super("bytes", t);
4488
4488
  }
@@ -4490,7 +4490,7 @@ class Iu extends lo {
4490
4490
  return bt(super.decode(t));
4491
4491
  }
4492
4492
  }
4493
- class Tu extends we {
4493
+ class Iu extends we {
4494
4494
  size;
4495
4495
  constructor(t, n) {
4496
4496
  let r = "bytes" + String(t);
@@ -4507,8 +4507,8 @@ class Tu extends we {
4507
4507
  return bt(t.readBytes(this.size));
4508
4508
  }
4509
4509
  }
4510
- const Ru = new Uint8Array([]);
4511
- class ku extends we {
4510
+ const Tu = new Uint8Array([]);
4511
+ class Ru extends we {
4512
4512
  constructor(t) {
4513
4513
  super("null", "", t, !1);
4514
4514
  }
@@ -4516,14 +4516,14 @@ class ku extends we {
4516
4516
  return null;
4517
4517
  }
4518
4518
  encode(t, n) {
4519
- return n != null && this._throwError("not null", n), t.writeBytes(Ru);
4519
+ return n != null && this._throwError("not null", n), t.writeBytes(Tu);
4520
4520
  }
4521
4521
  decode(t) {
4522
4522
  return t.readBytes(0), null;
4523
4523
  }
4524
4524
  }
4525
- const Nu = BigInt(0), Cu = BigInt(1), $u = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
4526
- class Au extends we {
4525
+ const ku = BigInt(0), Nu = BigInt(1), Cu = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
4526
+ class $u extends we {
4527
4527
  size;
4528
4528
  signed;
4529
4529
  constructor(t, n, r) {
@@ -4534,19 +4534,19 @@ class Au extends we {
4534
4534
  return 0;
4535
4535
  }
4536
4536
  encode(t, n) {
4537
- let r = on(pt.dereference(n, this.type)), s = $n($u, It * 8);
4537
+ let r = on(pt.dereference(n, this.type)), s = $n(Cu, It * 8);
4538
4538
  if (this.signed) {
4539
4539
  let i = $n(s, this.size * 8 - 1);
4540
- (r > i || r < -(i + Cu)) && this._throwError("value out-of-bounds", n), r = Ki(r, 8 * It);
4541
- } else (r < Nu || r > $n(s, this.size * 8)) && this._throwError("value out-of-bounds", n);
4540
+ (r > i || r < -(i + Nu)) && this._throwError("value out-of-bounds", n), r = Yi(r, 8 * It);
4541
+ } else (r < ku || r > $n(s, this.size * 8)) && this._throwError("value out-of-bounds", n);
4542
4542
  return t.writeValue(r);
4543
4543
  }
4544
4544
  decode(t) {
4545
4545
  let n = $n(t.readValue(), this.size * 8);
4546
- return this.signed && (n = Dc(n, this.size * 8)), n;
4546
+ return this.signed && (n = qc(n, this.size * 8)), n;
4547
4547
  }
4548
4548
  }
4549
- class Lu extends lo {
4549
+ class Au extends uo {
4550
4550
  constructor(t) {
4551
4551
  super("string", t);
4552
4552
  }
@@ -4557,7 +4557,7 @@ class Lu extends lo {
4557
4557
  return super.encode(t, jr(pt.dereference(n, "string")));
4558
4558
  }
4559
4559
  decode(t) {
4560
- return Yc(super.decode(t));
4560
+ return Zc(super.decode(t));
4561
4561
  }
4562
4562
  }
4563
4563
  class Pn extends we {
@@ -4587,17 +4587,17 @@ class Pn extends we {
4587
4587
  }
4588
4588
  encode(t, n) {
4589
4589
  const r = pt.dereference(n, "tuple");
4590
- return co(t, this.coders, r);
4590
+ return ao(t, this.coders, r);
4591
4591
  }
4592
4592
  decode(t) {
4593
- return uo(t, this.coders);
4593
+ return co(t, this.coders);
4594
4594
  }
4595
4595
  }
4596
4596
  function bn(e) {
4597
4597
  return tt(jr(e));
4598
4598
  }
4599
- const Pu = new RegExp("^bytes([0-9]+)$"), Fu = new RegExp("^(u?int)([0-9]*)$"), Uu = new RegExp("^(.*)\\[([0-9]*)\\]$");
4600
- function fo(e, t, n) {
4599
+ const Lu = new RegExp("^bytes([0-9]+)$"), Pu = new RegExp("^(u?int)([0-9]*)$"), Fu = new RegExp("^(.*)\\[([0-9]*)\\]$");
4600
+ function lo(e, t, n) {
4601
4601
  switch (e) {
4602
4602
  case "address":
4603
4603
  return yt(n ? Un(t, 32) : yn(t));
@@ -4608,21 +4608,21 @@ function fo(e, t, n) {
4608
4608
  case "bool":
4609
4609
  return t = t ? "0x01" : "0x00", yt(n ? Un(t, 32) : t);
4610
4610
  }
4611
- let r = e.match(Fu);
4611
+ let r = e.match(Pu);
4612
4612
  if (r) {
4613
4613
  let s = r[1] === "int", i = parseInt(r[2] || "256");
4614
- return x((!r[2] || r[2] === String(i)) && i % 8 === 0 && i !== 0 && i <= 256, "invalid number type", "type", e), n && (i = 256), s && (t = Ki(t, i)), yt(Un(Ji(t), i / 8));
4614
+ return x((!r[2] || r[2] === String(i)) && i % 8 === 0 && i !== 0 && i <= 256, "invalid number type", "type", e), n && (i = 256), s && (t = Yi(t, i)), yt(Un(zi(t), i / 8));
4615
4615
  }
4616
- if (r = e.match(Pu), r) {
4616
+ if (r = e.match(Lu), r) {
4617
4617
  const s = parseInt(r[1]);
4618
- return x(String(s) === r[1] && s !== 0 && s <= 32, "invalid bytes type", "type", e), x(qc(t) === s, `invalid value for ${e}`, "value", t), n ? yt(Yi(t, 32)) : t;
4618
+ return x(String(s) === r[1] && s !== 0 && s <= 32, "invalid bytes type", "type", e), x(Uc(t) === s, `invalid value for ${e}`, "value", t), n ? yt(Zi(t, 32)) : t;
4619
4619
  }
4620
- if (r = e.match(Uu), r && Array.isArray(t)) {
4620
+ if (r = e.match(Fu), r && Array.isArray(t)) {
4621
4621
  const s = r[1], i = parseInt(r[2] || String(t.length));
4622
4622
  x(i === t.length, `invalid array length for ${e}`, "value", t);
4623
4623
  const o = [];
4624
4624
  return t.forEach(function(a) {
4625
- o.push(fo(s, a, !0));
4625
+ o.push(lo(s, a, !0));
4626
4626
  }), yt(Ee(o));
4627
4627
  }
4628
4628
  x(!1, "invalid type", "type", e);
@@ -4631,21 +4631,21 @@ function Vs(e, t) {
4631
4631
  x(e.length === t.length, "wrong number of values; expected ${ types.length }", "values", t);
4632
4632
  const n = [];
4633
4633
  return e.forEach(function(r, s) {
4634
- n.push(fo(r, t[s]));
4634
+ n.push(lo(r, t[s]));
4635
4635
  }), bt(Ee(n));
4636
4636
  }
4637
4637
  function Tt(e) {
4638
4638
  const t = /* @__PURE__ */ new Set();
4639
4639
  return e.forEach((n) => t.add(n)), Object.freeze(t);
4640
4640
  }
4641
- const qu = "external public payable override", Du = Tt(qu.split(" ")), po = "constant external internal payable private public pure view override", Mu = Tt(po.split(" ")), ho = "constructor error event fallback function receive struct", wo = Tt(ho.split(" ")), go = "calldata memory storage payable indexed", Wu = Tt(go.split(" ")), Gu = "tuple returns", Hu = [ho, go, Gu, po].join(" "), Vu = Tt(Hu.split(" ")), Zu = {
4641
+ const Uu = "external public payable override", qu = Tt(Uu.split(" ")), fo = "constant external internal payable private public pure view override", Du = Tt(fo.split(" ")), po = "constructor error event fallback function receive struct", ho = Tt(po.split(" ")), wo = "calldata memory storage payable indexed", Mu = Tt(wo.split(" ")), Wu = "tuple returns", Gu = [po, wo, Wu, fo].join(" "), Hu = Tt(Gu.split(" ")), Vu = {
4642
4642
  "(": "OPEN_PAREN",
4643
4643
  ")": "CLOSE_PAREN",
4644
4644
  "[": "OPEN_BRACKET",
4645
4645
  "]": "CLOSE_BRACKET",
4646
4646
  ",": "COMMA",
4647
4647
  "@": "AT"
4648
- }, Yu = new RegExp("^(\\s*)"), Ku = new RegExp("^([0-9]+)"), Xu = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"), yo = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"), bo = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");
4648
+ }, Zu = new RegExp("^(\\s*)"), Yu = new RegExp("^([0-9]+)"), Ku = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"), go = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"), yo = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");
4649
4649
  class Wt {
4650
4650
  #t;
4651
4651
  #e;
@@ -4745,11 +4745,11 @@ function ve(e) {
4745
4745
  };
4746
4746
  let r = [], s = [], i = 0;
4747
4747
  for (; i < e.length; ) {
4748
- let o = e.substring(i), a = o.match(Yu);
4748
+ let o = e.substring(i), a = o.match(Zu);
4749
4749
  a && (i += a[1].length, o = e.substring(i));
4750
4750
  const c = { depth: r.length, linkBack: -1, linkNext: -1, match: -1, type: "", text: "", offset: i, value: -1 };
4751
4751
  t.push(c);
4752
- let u = Zu[o[0]] || "";
4752
+ let u = Vu[o[0]] || "";
4753
4753
  if (u) {
4754
4754
  if (c.type = u, c.text = o[0], i++, u === "OPEN_PAREN")
4755
4755
  r.push(t.length - 1), s.push(t.length - 1);
@@ -4771,19 +4771,19 @@ function ve(e) {
4771
4771
  }
4772
4772
  continue;
4773
4773
  }
4774
- if (a = o.match(Xu), a) {
4775
- if (c.text = a[1], i += c.text.length, Vu.has(c.text)) {
4774
+ if (a = o.match(Ku), a) {
4775
+ if (c.text = a[1], i += c.text.length, Hu.has(c.text)) {
4776
4776
  c.type = "KEYWORD";
4777
4777
  continue;
4778
4778
  }
4779
- if (c.text.match(bo)) {
4779
+ if (c.text.match(yo)) {
4780
4780
  c.type = "TYPE";
4781
4781
  continue;
4782
4782
  }
4783
4783
  c.type = "ID";
4784
4784
  continue;
4785
4785
  }
4786
- if (a = o.match(Ku), a) {
4786
+ if (a = o.match(Yu), a) {
4787
4787
  c.text = a[1], c.type = "NUMBER", i += c.text.length;
4788
4788
  continue;
4789
4789
  }
@@ -4799,7 +4799,7 @@ function Zs(e, t) {
4799
4799
  throw new Error(`conflicting types: ${n.join(", ")}`);
4800
4800
  }
4801
4801
  function sr(e, t) {
4802
- if (t.peekKeyword(wo)) {
4802
+ if (t.peekKeyword(ho)) {
4803
4803
  const n = t.pop().text;
4804
4804
  if (n !== e)
4805
4805
  throw new Error(`expected ${e}, got ${n}`);
@@ -4818,14 +4818,14 @@ function de(e, t) {
4818
4818
  }
4819
4819
  return Object.freeze(n);
4820
4820
  }
4821
- function mo(e) {
4822
- let t = de(e, Mu);
4821
+ function bo(e) {
4822
+ let t = de(e, Du);
4823
4823
  return Zs(t, Tt("constant payable nonpayable".split(" "))), Zs(t, Tt("pure view payable nonpayable".split(" "))), t.has("view") ? "view" : t.has("pure") ? "pure" : t.has("payable") ? "payable" : t.has("nonpayable") ? "nonpayable" : t.has("constant") ? "view" : "nonpayable";
4824
4824
  }
4825
4825
  function fe(e, t) {
4826
4826
  return e.popParams().map((n) => nt.from(n, t));
4827
4827
  }
4828
- function xo(e) {
4828
+ function mo(e) {
4829
4829
  if (e.peekType("AT")) {
4830
4830
  if (e.pop(), e.peekType("NUMBER"))
4831
4831
  return on(e.pop().text);
@@ -4837,9 +4837,9 @@ function Ue(e) {
4837
4837
  if (e.length)
4838
4838
  throw new Error(`unexpected tokens at offset ${e.offset}: ${e.toString()}`);
4839
4839
  }
4840
- const zu = new RegExp(/^(.*)\[([0-9]*)\]$/);
4840
+ const Xu = new RegExp(/^(.*)\[([0-9]*)\]$/);
4841
4841
  function Ys(e) {
4842
- const t = e.match(bo);
4842
+ const t = e.match(yo);
4843
4843
  if (x(t, "invalid type", "type", e), e === "uint")
4844
4844
  return "uint256";
4845
4845
  if (e === "int")
@@ -5074,7 +5074,7 @@ class nt {
5074
5074
  l = new nt(ot, "", a, c, null, u, f, l), f = h.value, a += h.text, c = "array", u = null;
5075
5075
  }
5076
5076
  let d = null;
5077
- if (de(t, Wu).has("indexed")) {
5077
+ if (de(t, Mu).has("indexed")) {
5078
5078
  if (!n)
5079
5079
  throw new Error("");
5080
5080
  d = !0;
@@ -5085,10 +5085,10 @@ class nt {
5085
5085
  return new nt(ot, w, a, c, d, u, f, l);
5086
5086
  }
5087
5087
  const r = t.name;
5088
- x(!r || typeof r == "string" && r.match(yo), "invalid name", "obj.name", r);
5088
+ x(!r || typeof r == "string" && r.match(go), "invalid name", "obj.name", r);
5089
5089
  let s = t.indexed;
5090
5090
  s != null && (x(n, "parameter cannot be indexed", "obj.indexed", t.indexed), s = !!s);
5091
- let i = t.type, o = i.match(zu);
5091
+ let i = t.type, o = i.match(Xu);
5092
5092
  if (o) {
5093
5093
  const a = parseInt(o[2] || "-1"), c = nt.from({
5094
5094
  type: o[1],
@@ -5143,7 +5143,7 @@ class qe {
5143
5143
  return qe.from(ve(t));
5144
5144
  }
5145
5145
  if (t instanceof Wt)
5146
- switch (t.peekKeyword(wo)) {
5146
+ switch (t.peekKeyword(ho)) {
5147
5147
  case "constructor":
5148
5148
  return ue.from(t);
5149
5149
  case "error":
@@ -5220,7 +5220,7 @@ class ir extends qe {
5220
5220
  * @private
5221
5221
  */
5222
5222
  constructor(t, n, r, s) {
5223
- super(t, n, s), x(typeof r == "string" && r.match(yo), "invalid identifier", "name", r), s = Object.freeze(s.slice()), st(this, { name: r });
5223
+ super(t, n, s), x(typeof r == "string" && r.match(go), "invalid identifier", "name", r), s = Object.freeze(s.slice()), st(this, { name: r });
5224
5224
  }
5225
5225
  }
5226
5226
  function mn(e, t) {
@@ -5381,7 +5381,7 @@ class ue extends qe {
5381
5381
  }
5382
5382
  else if (t instanceof Wt) {
5383
5383
  de(t, Tt(["constructor"]));
5384
- const n = fe(t), r = !!de(t, Du).has("payable"), s = xo(t);
5384
+ const n = fe(t), r = !!de(t, qu).has("payable"), s = mo(t);
5385
5385
  return Ue(t), new ue(ot, "constructor", n, r, s);
5386
5386
  }
5387
5387
  return new ue(ot, "constructor", t.inputs ? t.inputs.map(nt.from) : [], !!t.payable, t.gas != null ? t.gas : null);
@@ -5433,7 +5433,7 @@ class ae extends qe {
5433
5433
  }
5434
5434
  let i = fe(t);
5435
5435
  i.length ? x(i.length === 1 && i[0].type === "bytes", "invalid fallback inputs", "obj.inputs", i.map((a) => a.format("minimal")).join(", ")) : i = [nt.from("bytes")];
5436
- const o = mo(t);
5436
+ const o = bo(t);
5437
5437
  if (x(o === "nonpayable" || o === "payable", "fallback cannot be constants", "obj.stateMutability", o), de(t, Tt(["returns"])).has("returns")) {
5438
5438
  const a = fe(t);
5439
5439
  x(a.length === 1 && a[0].type === "bytes", "invalid fallback outputs", "obj.outputs", a.map((c) => c.format("minimal")).join(", "));
@@ -5527,10 +5527,10 @@ class Yt extends ir {
5527
5527
  x(!1, "invalid function fragment", "obj", t);
5528
5528
  }
5529
5529
  else if (t instanceof Wt) {
5530
- const r = sr("function", t), s = fe(t), i = mo(t);
5530
+ const r = sr("function", t), s = fe(t), i = bo(t);
5531
5531
  let o = [];
5532
5532
  de(t, Tt(["returns"])).has("returns") && (o = fe(t));
5533
- const a = xo(t);
5533
+ const a = mo(t);
5534
5534
  return Ue(t), new Yt(ot, r, i, s, o, a);
5535
5535
  }
5536
5536
  let n = t.stateMutability;
@@ -5593,9 +5593,9 @@ Ht.set(49, "STACK_UNDERFLOW");
5593
5593
  Ht.set(50, "ARRAY_RANGE_ERROR");
5594
5594
  Ht.set(65, "OUT_OF_MEMORY");
5595
5595
  Ht.set(81, "UNINITIALIZED_FUNCTION_CALL");
5596
- const Ju = new RegExp(/^bytes([0-9]*)$/), ju = new RegExp(/^(u?int)([0-9]*)$/);
5596
+ const zu = new RegExp(/^bytes([0-9]*)$/), Ju = new RegExp(/^(u?int)([0-9]*)$/);
5597
5597
  let Tr = null, ei = 1024;
5598
- function Qu(e, t, n, r) {
5598
+ function ju(e, t, n, r) {
5599
5599
  let s = "missing revert data", i = null;
5600
5600
  const o = null;
5601
5601
  let a = null;
@@ -5634,7 +5634,7 @@ function Qu(e, t, n, r) {
5634
5634
  to: t.to ? yn(t.to) : null,
5635
5635
  data: t.data || "0x"
5636
5636
  };
5637
- return t.from && (c.from = yn(t.from)), Gi(s, "CALL_EXCEPTION", {
5637
+ return t.from && (c.from = yn(t.from)), Wi(s, "CALL_EXCEPTION", {
5638
5638
  action: e,
5639
5639
  data: n,
5640
5640
  reason: i,
@@ -5646,29 +5646,29 @@ function Qu(e, t, n, r) {
5646
5646
  class pe {
5647
5647
  #t(t) {
5648
5648
  if (t.isArray())
5649
- return new vu(this.#t(t.arrayChildren), t.arrayLength, t.name);
5649
+ return new Bu(this.#t(t.arrayChildren), t.arrayLength, t.name);
5650
5650
  if (t.isTuple())
5651
5651
  return new Pn(t.components.map((r) => this.#t(r)), t.name);
5652
5652
  switch (t.baseType) {
5653
5653
  case "address":
5654
- return new Eu(t.name);
5654
+ return new Su(t.name);
5655
5655
  case "bool":
5656
- return new Ou(t.name);
5656
+ return new vu(t.name);
5657
5657
  case "string":
5658
- return new Lu(t.name);
5658
+ return new Au(t.name);
5659
5659
  case "bytes":
5660
- return new Iu(t.name);
5660
+ return new Ou(t.name);
5661
5661
  case "":
5662
- return new ku(t.name);
5662
+ return new Ru(t.name);
5663
5663
  }
5664
- let n = t.type.match(ju);
5664
+ let n = t.type.match(Ju);
5665
5665
  if (n) {
5666
5666
  let r = parseInt(n[2] || "256");
5667
- return x(r !== 0 && r <= 256 && r % 8 === 0, "invalid " + n[1] + " bit length", "param", t), new Au(r / 8, n[1] === "int", t.name);
5667
+ return x(r !== 0 && r <= 256 && r % 8 === 0, "invalid " + n[1] + " bit length", "param", t), new $u(r / 8, n[1] === "int", t.name);
5668
5668
  }
5669
- if (n = t.type.match(Ju), n) {
5669
+ if (n = t.type.match(zu), n) {
5670
5670
  let r = parseInt(n[1]);
5671
- return x(r !== 0 && r <= 32, "invalid bytes length", "param", t), new Tu(r, t.name);
5671
+ return x(r !== 0 && r <= 32, "invalid bytes length", "param", t), new Iu(r, t.name);
5672
5672
  }
5673
5673
  x(!1, "invalid type", "type", t.type);
5674
5674
  }
@@ -5688,7 +5688,7 @@ class pe {
5688
5688
  * @returns DataHexstring
5689
5689
  */
5690
5690
  encode(t, n) {
5691
- Hi(n.length, t.length, "types/values length mismatch");
5691
+ Gi(n.length, t.length, "types/values length mismatch");
5692
5692
  const r = t.map((o) => this.#t(nt.from(o))), s = new Pn(r, "_"), i = new Ar();
5693
5693
  return s.encode(i, n), i.data;
5694
5694
  }
@@ -5720,10 +5720,10 @@ class pe {
5720
5720
  * the Transaction %%tx%%.
5721
5721
  */
5722
5722
  static getBuiltinCallException(t, n, r) {
5723
- return Qu(t, n, r, pe.defaultAbiCoder());
5723
+ return ju(t, n, r, pe.defaultAbiCoder());
5724
5724
  }
5725
5725
  }
5726
- class tl {
5726
+ class Qu {
5727
5727
  /**
5728
5728
  * The matching fragment for the ``topic0``.
5729
5729
  */
@@ -5758,7 +5758,7 @@ class tl {
5758
5758
  });
5759
5759
  }
5760
5760
  }
5761
- class el {
5761
+ class tl {
5762
5762
  /**
5763
5763
  * The matching fragment from the transaction ``data``.
5764
5764
  */
@@ -5798,7 +5798,7 @@ class el {
5798
5798
  });
5799
5799
  }
5800
5800
  }
5801
- class nl {
5801
+ class el {
5802
5802
  /**
5803
5803
  * The matching fragment.
5804
5804
  */
@@ -6420,7 +6420,7 @@ class me {
6420
6420
  at(n.length <= t.inputs.length, `too many arguments for ${t.format()}`, "UNEXPECTED_ARGUMENT", { count: n.length, expectedCount: t.inputs.length });
6421
6421
  const r = [];
6422
6422
  t.anonymous || r.push(t.topicHash);
6423
- const s = (i, o) => i.type === "string" ? bn(o) : i.type === "bytes" ? tt(bt(o)) : (i.type === "bool" && typeof o == "boolean" ? o = o ? "0x01" : "0x00" : i.type.match(/^u?int/) ? o = zi(o) : i.type.match(/^bytes/) ? o = Yi(o, 32) : i.type === "address" && this.#r.encode(["address"], [o]), Un(bt(o), 32));
6423
+ const s = (i, o) => i.type === "string" ? bn(o) : i.type === "bytes" ? tt(bt(o)) : (i.type === "bool" && typeof o == "boolean" ? o = o ? "0x01" : "0x00" : i.type.match(/^u?int/) ? o = Xi(o) : i.type.match(/^bytes/) ? o = Zi(o, 32) : i.type === "address" && this.#r.encode(["address"], [o]), Un(bt(o), 32));
6424
6424
  for (n.forEach((i, o) => {
6425
6425
  const a = t.inputs[o];
6426
6426
  if (!a.indexed) {
@@ -6506,7 +6506,7 @@ class me {
6506
6506
  if (!s)
6507
6507
  return null;
6508
6508
  const i = this.#r.decode(s.inputs, n.slice(4));
6509
- return new el(s, s.selector, i, r);
6509
+ return new tl(s, s.selector, i, r);
6510
6510
  }
6511
6511
  parseCallResult(t) {
6512
6512
  throw new Error("@TODO");
@@ -6519,7 +6519,7 @@ class me {
6519
6519
  */
6520
6520
  parseLog(t) {
6521
6521
  const n = this.getEvent(t.topics[0]);
6522
- return !n || n.anonymous ? null : new tl(n, n.topicHash, this.decodeEventLog(n, t.data, t.topics));
6522
+ return !n || n.anonymous ? null : new Qu(n, n.topicHash, this.decodeEventLog(n, t.data, t.topics));
6523
6523
  }
6524
6524
  /**
6525
6525
  * Parses a revert data, finding the matching error and extracts
@@ -6532,7 +6532,7 @@ class me {
6532
6532
  if (!r)
6533
6533
  return null;
6534
6534
  const s = this.#r.decode(r.inputs, Ze(n, 4));
6535
- return new nl(r, r.selector, s);
6535
+ return new el(r, r.selector, s);
6536
6536
  }
6537
6537
  /**
6538
6538
  * Creates a new [[Interface]] from the ABI %%value%%.
@@ -6544,16 +6544,16 @@ class me {
6544
6544
  return t instanceof me ? t : typeof t == "string" ? new me(JSON.parse(t)) : typeof t.formatJson == "function" ? new me(t.formatJson()) : typeof t.format == "function" ? new me(t.format("json")) : new me(t);
6545
6545
  }
6546
6546
  }
6547
- const _o = "The swap backend did not return a fee_policy from get_swap_info, so it is older than this wallet-kit release and swap fees cannot be computed. Upgrade the swap backend, or pin @bestinslot/wallet-kit below 0.11.0.", rl = /^0x[0-9a-f]{40}$/;
6547
+ const xo = "The swap backend did not return a fee_policy from get_swap_info, so it is older than this wallet-kit release and swap fees cannot be computed. Upgrade the swap backend, or pin @bestinslot/wallet-kit below 0.11.0.", nl = /^0x[0-9a-f]{40}$/;
6548
6548
  function Ye(e) {
6549
6549
  return new Error(`Invalid fee_policy from the swap backend: ${e}`);
6550
6550
  }
6551
6551
  function ii(e) {
6552
6552
  return typeof e == "number" && Number.isInteger(e) && e >= 0 && e <= 1e4;
6553
6553
  }
6554
- function sl(e) {
6554
+ function rl(e) {
6555
6555
  if (e == null)
6556
- throw new Error(_o);
6556
+ throw new Error(xo);
6557
6557
  if (typeof e != "object")
6558
6558
  throw Ye("not an object");
6559
6559
  const {
@@ -6573,7 +6573,7 @@ function sl(e) {
6573
6573
  throw Ye("priority_tokens must be a non-empty array");
6574
6574
  const o = r.map((a) => {
6575
6575
  const c = typeof a == "string" ? a.toLowerCase() : "";
6576
- if (!rl.test(c))
6576
+ if (!nl.test(c))
6577
6577
  throw Ye(`priority_tokens contains an invalid address (${String(a)})`);
6578
6578
  return c;
6579
6579
  });
@@ -6586,7 +6586,7 @@ function sl(e) {
6586
6586
  min_btc_exposure_sats: s
6587
6587
  };
6588
6588
  }
6589
- function il(e, t, n) {
6589
+ function sl(e, t, n) {
6590
6590
  const r = n.priority_tokens.indexOf(e.toLowerCase()), s = n.priority_tokens.indexOf(t.toLowerCase()), o = BigInt(r === 0 || s === 0 ? n.swap_fee_bps : n.token_pair_swap_fee_bps);
6591
6591
  if (r === -1 && s === -1) {
6592
6592
  const c = o / 2n;
@@ -6594,23 +6594,23 @@ function il(e, t, n) {
6594
6594
  }
6595
6595
  return r !== -1 && (s === -1 || r < s) ? { token1FeeBps: o, token2FeeBps: 0n } : { token1FeeBps: 0n, token2FeeBps: o };
6596
6596
  }
6597
- const ol = 30n;
6598
- function al(e, t, n) {
6597
+ const il = 30n;
6598
+ function ol(e, t, n) {
6599
6599
  const r = n.toLowerCase();
6600
6600
  return e.toLowerCase() === r ? "buy" : t.toLowerCase() === r ? "sell" : null;
6601
6601
  }
6602
- function So(e) {
6602
+ function _o(e) {
6603
6603
  const t = BigInt(Number.MAX_SAFE_INTEGER);
6604
6604
  if (e > t || e < -t)
6605
6605
  throw new RangeError("satsToBtc: amount exceeds safe-integer precision (~90,000 BTC).");
6606
6606
  return Number(e) / 1e8;
6607
6607
  }
6608
- function cl(e, t) {
6609
- return So(e) * t;
6608
+ function al(e, t) {
6609
+ return _o(e) * t;
6610
6610
  }
6611
- function Eo(e, t, n, r, s) {
6611
+ function So(e, t, n, r, s) {
6612
6612
  return {
6613
- pool_fee_bps: ol,
6613
+ pool_fee_bps: il,
6614
6614
  token_in_fee_bps: n,
6615
6615
  token_in_fee: e * n / 10000n,
6616
6616
  token_out_fee_bps: r,
@@ -6618,7 +6618,7 @@ function Eo(e, t, n, r, s) {
6618
6618
  miner_fee_sats: s
6619
6619
  };
6620
6620
  }
6621
- function Bo(e, t, n, r, s, i) {
6621
+ function Eo(e, t, n, r, s, i) {
6622
6622
  const o = e.toLowerCase() === t.toLowerCase() ? n * 10n ** BigInt(i) * 100n / r : r * 10n ** BigInt(s) * 100n / n;
6623
6623
  return Number(o) / 100;
6624
6624
  }
@@ -6626,7 +6626,7 @@ let wt = "", ns = "";
6626
6626
  function or(e, t) {
6627
6627
  wt = e.toLowerCase(), ns = t.toLowerCase();
6628
6628
  }
6629
- function ul(e) {
6629
+ function cl(e) {
6630
6630
  if (e < 0n)
6631
6631
  throw new Error("square root of negative numbers is not supported");
6632
6632
  if (e < 2n)
@@ -6655,14 +6655,14 @@ async function oi(e, t, n) {
6655
6655
  const r = await e.balanceOf(t, n);
6656
6656
  return r === null ? BigInt(0) : r;
6657
6657
  }
6658
- async function ll(e, t, n) {
6658
+ async function ul(e, t, n) {
6659
6659
  t.toLowerCase() > n.toLowerCase() && ([t, n] = [n, t]);
6660
6660
  const r = await e.reservesOf(ar(t, n));
6661
6661
  if (r === null)
6662
6662
  throw new Error("Token pair does not exist");
6663
6663
  return r;
6664
6664
  }
6665
- class fl {
6665
+ class ll {
6666
6666
  map;
6667
6667
  proxy;
6668
6668
  constructor() {
@@ -6697,7 +6697,7 @@ class fl {
6697
6697
  this.map[s] = r;
6698
6698
  }
6699
6699
  }
6700
- class dl {
6700
+ class fl {
6701
6701
  map;
6702
6702
  proxy;
6703
6703
  constructor() {
@@ -6718,7 +6718,7 @@ class dl {
6718
6718
  throw new Error("Undefined reserves encountered");
6719
6719
  return this.map[r];
6720
6720
  }
6721
- const s = await ll(this.proxy, t, n);
6721
+ const s = await ul(this.proxy, t, n);
6722
6722
  return this.map[r] = s, s;
6723
6723
  }
6724
6724
  set(t, n, r) {
@@ -6728,7 +6728,7 @@ class dl {
6728
6728
  this.map[s] = r;
6729
6729
  }
6730
6730
  }
6731
- const P = new fl(), it = new dl();
6731
+ const P = new ll(), it = new fl();
6732
6732
  let ai = Promise.resolve();
6733
6733
  async function In(e) {
6734
6734
  const t = ai;
@@ -6745,10 +6745,10 @@ async function In(e) {
6745
6745
  }
6746
6746
  return n;
6747
6747
  }
6748
- function vo(e, t) {
6748
+ function Bo(e, t) {
6749
6749
  return e < t ? e + t : t + e;
6750
6750
  }
6751
- function pl(e, t, n) {
6751
+ function dl(e, t, n) {
6752
6752
  if (e <= 0n)
6753
6753
  throw new Error("Insufficient input amount");
6754
6754
  if (t <= 0n || n <= 0n)
@@ -6756,7 +6756,7 @@ function pl(e, t, n) {
6756
6756
  const r = e * 997n, s = r * n, i = t * 1000n + r;
6757
6757
  return s / i;
6758
6758
  }
6759
- function hl(e, t, n) {
6759
+ function pl(e, t, n) {
6760
6760
  if (e <= 0n)
6761
6761
  throw new Error("Insufficient output amount");
6762
6762
  if (t <= 0n || n <= 0n || e >= n)
@@ -6764,23 +6764,23 @@ function hl(e, t, n) {
6764
6764
  const r = t * e * 1000n, s = (n - e) * 997n;
6765
6765
  return r / s + 1n;
6766
6766
  }
6767
- async function wl(e, t) {
6767
+ async function hl(e, t) {
6768
6768
  if (t.length < 2)
6769
6769
  throw new Error("Invalid path");
6770
6770
  const n = [e];
6771
6771
  for (let r = 0; r < t.length - 1; r++) {
6772
- const { reserveA: s, reserveB: i } = await jt(t[r], t[r + 1]), o = pl(n[r], s, i);
6772
+ const { reserveA: s, reserveB: i } = await jt(t[r], t[r + 1]), o = dl(n[r], s, i);
6773
6773
  n.push(o);
6774
6774
  }
6775
6775
  return n;
6776
6776
  }
6777
- async function gl(e, t) {
6777
+ async function wl(e, t) {
6778
6778
  if (t.length < 2)
6779
6779
  throw new Error("Invalid path");
6780
6780
  const n = [];
6781
6781
  n[t.length - 1] = e;
6782
6782
  for (let r = t.length - 1; r > 0; r--) {
6783
- const { reserveA: s, reserveB: i } = await jt(t[r - 1], t[r]), o = hl(n[r], s, i);
6783
+ const { reserveA: s, reserveB: i } = await jt(t[r - 1], t[r]), o = pl(n[r], s, i);
6784
6784
  n[r - 1] = o;
6785
6785
  }
6786
6786
  return n;
@@ -6806,8 +6806,8 @@ async function jt(e, t) {
6806
6806
  total_supply: n.total_supply
6807
6807
  };
6808
6808
  }
6809
- const yl = (...e) => e.reduce((t, n) => n < t ? n : t);
6810
- async function bl(e, t, n, r) {
6809
+ const gl = (...e) => e.reduce((t, n) => n < t ? n : t);
6810
+ async function yl(e, t, n, r) {
6811
6811
  const {
6812
6812
  reserveA: s,
6813
6813
  reserveB: i,
@@ -6815,7 +6815,7 @@ async function bl(e, t, n, r) {
6815
6815
  } = await jt(e, t), a = s - n, c = i - r;
6816
6816
  let u;
6817
6817
  if (o === 0n) {
6818
- u = ul(n * r) - 1000n;
6818
+ u = cl(n * r) - 1000n;
6819
6819
  const f = await it.get(e, t);
6820
6820
  it.set(e, t, {
6821
6821
  reserveA: f.reserveA,
@@ -6823,7 +6823,7 @@ async function bl(e, t, n, r) {
6823
6823
  total_supply: f.total_supply + 1000n
6824
6824
  });
6825
6825
  } else
6826
- u = yl(n * o / a, r * o / c);
6826
+ u = gl(n * o / a, r * o / c);
6827
6827
  if (u <= 0n)
6828
6828
  throw new Error("Insufficient liquidity minted");
6829
6829
  const l = await it.get(e, t);
@@ -6833,7 +6833,7 @@ async function bl(e, t, n, r) {
6833
6833
  total_supply: l.total_supply + u
6834
6834
  }), u;
6835
6835
  }
6836
- async function ml(e, t, n, r, s, i) {
6836
+ async function bl(e, t, n, r, s, i) {
6837
6837
  let o, a;
6838
6838
  try {
6839
6839
  await it.get(e, t);
@@ -6858,8 +6858,8 @@ async function ml(e, t, n, r, s, i) {
6858
6858
  }
6859
6859
  return { amountA: o, amountB: a };
6860
6860
  }
6861
- async function xl(e, t, n, r, s, i) {
6862
- const { amountA: o, amountB: a } = await ml(
6861
+ async function ml(e, t, n, r, s, i) {
6862
+ const { amountA: o, amountB: a } = await bl(
6863
6863
  e,
6864
6864
  t,
6865
6865
  n,
@@ -6876,10 +6876,10 @@ async function xl(e, t, n, r, s, i) {
6876
6876
  reserveB: c.reserveB + o,
6877
6877
  total_supply: c.total_supply
6878
6878
  });
6879
- const u = await bl(e, t, o, a);
6879
+ const u = await yl(e, t, o, a);
6880
6880
  return { amountA: o, amountB: a, liquidity: u };
6881
6881
  }
6882
- async function _l(e, t, n) {
6882
+ async function xl(e, t, n) {
6883
6883
  const {
6884
6884
  reserveA: r,
6885
6885
  reserveB: s,
@@ -6895,7 +6895,7 @@ async function _l(e, t, n) {
6895
6895
  total_supply: u
6896
6896
  }), { amountA: o, amountB: a };
6897
6897
  }
6898
- async function Sl(e, t, n, r, s, i, o, a) {
6898
+ async function _l(e, t, n, r, s, i, o, a) {
6899
6899
  if (s <= 0n && i <= 0n)
6900
6900
  throw new Error("Insufficient output amount");
6901
6901
  const { reserveA: c, reserveB: u } = await jt(e, t), l = c - n, f = u - r;
@@ -6925,7 +6925,7 @@ async function Sl(e, t, n, r, s, i, o, a) {
6925
6925
  if (b * m < BigInt(l) * BigInt(f) * 1000n * 1000n)
6926
6926
  throw new Error("K");
6927
6927
  }
6928
- async function Oo(e, t) {
6928
+ async function vo(e, t) {
6929
6929
  if (e.length !== t.length)
6930
6930
  throw new Error("Amounts and path length mismatch");
6931
6931
  if (e.length < 2)
@@ -6945,34 +6945,34 @@ async function Oo(e, t) {
6945
6945
  if (s === void 0 || i === void 0 || o === void 0 || a === void 0)
6946
6946
  throw new Error("Undefined value in swap path or amounts");
6947
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];
6948
- await Sl(d, p, c, u, l, f, w, h);
6948
+ await _l(d, p, c, u, l, f, w, h);
6949
6949
  }
6950
6950
  }
6951
- async function El(e, t, n) {
6951
+ async function Sl(e, t, n) {
6952
6952
  if (n.length < 2)
6953
6953
  throw new Error("Invalid path");
6954
- const r = await wl(e, n);
6954
+ const r = await hl(e, n);
6955
6955
  if (r[r.length - 1] < t)
6956
6956
  throw new Error("Insufficient output amount");
6957
- return await Oo(r, n), r;
6957
+ return await vo(r, n), r;
6958
6958
  }
6959
- async function Bl(e, t, n) {
6959
+ async function El(e, t, n) {
6960
6960
  if (n.length < 2)
6961
6961
  throw new Error("Invalid path");
6962
- const r = await gl(t, n);
6962
+ const r = await wl(t, n);
6963
6963
  if (r[0] > e)
6964
6964
  throw new Error("Excessive Input Amount");
6965
- return await Oo(r, n), r;
6965
+ return await vo(r, n), r;
6966
6966
  }
6967
- async function vl(e, t, n, r, s) {
6968
- const { amountA: i, amountB: o } = await _l(e, t, n);
6967
+ async function Bl(e, t, n, r, s) {
6968
+ const { amountA: i, amountB: o } = await xl(e, t, n);
6969
6969
  if (i < r)
6970
6970
  throw new Error("Insufficient A amount");
6971
6971
  if (o < s)
6972
6972
  throw new Error("Insufficient B amount");
6973
6973
  return { amountA: i, amountB: o };
6974
6974
  }
6975
- function Ol(e, t, n, r, s, i, o, a, c, u, l, f) {
6975
+ function vl(e, t, n, r, s, i, o, a, c, u, l, f) {
6976
6976
  if (f === "")
6977
6977
  return !0;
6978
6978
  let d = tt(B.from(e, "hex")).slice(2);
@@ -6986,11 +6986,11 @@ function Ol(e, t, n, r, s, i, o, a, c, u, l, f) {
6986
6986
  );
6987
6987
  return I.shortSignatures.verify(b, w, $);
6988
6988
  }
6989
- async function Il(e, t, n, r, s, i, o, a, c, u, l, f, d) {
6989
+ async function Ol(e, t, n, r, s, i, o, a, c, u, l, f, d) {
6990
6990
  n = n.toLowerCase(), r = r.toLowerCase(), t = t.startsWith("0x") ? t.slice(2) : t, c = c.startsWith("0x") ? c.slice(2) : c;
6991
6991
  const p = await In(e);
6992
6992
  try {
6993
- if (!Ol(
6993
+ if (!vl(
6994
6994
  t,
6995
6995
  u,
6996
6996
  n,
@@ -7005,14 +7005,14 @@ async function Il(e, t, n, r, s, i, o, a, c, u, l, f, d) {
7005
7005
  c
7006
7006
  ))
7007
7007
  throw new Error("Invalid BLS signature");
7008
- const { amountA: w, amountB: h, liquidity: g } = await xl(
7008
+ const { amountA: w, amountB: h, liquidity: g } = await ml(
7009
7009
  n,
7010
7010
  r,
7011
7011
  s,
7012
7012
  i,
7013
7013
  o,
7014
7014
  a
7015
- ), b = vo(n, r);
7015
+ ), b = Bo(n, r);
7016
7016
  return P.setCheckPositive(
7017
7017
  t,
7018
7018
  n,
@@ -7044,7 +7044,7 @@ async function Il(e, t, n, r, s, i, o, a, c, u, l, f, d) {
7044
7044
  p();
7045
7045
  }
7046
7046
  }
7047
- function Tl(e, t, n, r, s, i, o, a, c, u, l) {
7047
+ function Il(e, t, n, r, s, i, o, a, c, u, l) {
7048
7048
  if (l === "")
7049
7049
  return !0;
7050
7050
  let f = tt(B.from(e, "hex")).slice(2);
@@ -7058,11 +7058,11 @@ function Tl(e, t, n, r, s, i, o, a, c, u, l) {
7058
7058
  );
7059
7059
  return I.shortSignatures.verify(g, p, D);
7060
7060
  }
7061
- async function Rl(e, t, n, r, s, i, o, a, c, u, l, f) {
7061
+ async function Tl(e, t, n, r, s, i, o, a, c, u, l, f) {
7062
7062
  n = n.toLowerCase(), r = r.toLowerCase(), t = t.startsWith("0x") ? t.slice(2) : t, a = a.startsWith("0x") ? a.slice(2) : a;
7063
7063
  const d = await In(e);
7064
7064
  try {
7065
- if (!Tl(
7065
+ if (!Il(
7066
7066
  t,
7067
7067
  c,
7068
7068
  n,
@@ -7076,10 +7076,10 @@ async function Rl(e, t, n, r, s, i, o, a, c, u, l, f) {
7076
7076
  a
7077
7077
  ))
7078
7078
  throw new Error("Invalid BLS signature");
7079
- const p = vo(n, r);
7079
+ const p = Bo(n, r);
7080
7080
  if ((await P.get(t, p) || 0n) < s)
7081
7081
  throw new Error("Insufficient liquidity balance");
7082
- const { amountA: w, amountB: h } = await vl(
7082
+ const { amountA: w, amountB: h } = await Bl(
7083
7083
  n,
7084
7084
  r,
7085
7085
  s,
@@ -7117,7 +7117,7 @@ async function Rl(e, t, n, r, s, i, o, a, c, u, l, f) {
7117
7117
  d();
7118
7118
  }
7119
7119
  }
7120
- function kl(e, t, n, r, s, i, o, a, c, u) {
7120
+ function Rl(e, t, n, r, s, i, o, a, c, u) {
7121
7121
  if (u === "")
7122
7122
  return !0;
7123
7123
  let l = tt(B.from(e, "hex")).slice(2);
@@ -7131,11 +7131,11 @@ function kl(e, t, n, r, s, i, o, a, c, u) {
7131
7131
  );
7132
7132
  return I.shortSignatures.verify(h, d, T);
7133
7133
  }
7134
- async function Nl(e, t, n, r, s, i, o, a, c, u, l) {
7134
+ async function kl(e, t, n, r, s, i, o, a, c, u, l) {
7135
7135
  n = n.toLowerCase(), r = r.toLowerCase(), t = t.startsWith("0x") ? t.slice(2) : t, o = o.startsWith("0x") ? o.slice(2) : o;
7136
7136
  const f = await In(e);
7137
7137
  try {
7138
- if (!kl(
7138
+ if (!Rl(
7139
7139
  t,
7140
7140
  a,
7141
7141
  n,
@@ -7153,7 +7153,7 @@ async function Nl(e, t, n, r, s, i, o, a, c, u, l) {
7153
7153
  const { reserveA: d, reserveB: p } = await jt(
7154
7154
  n,
7155
7155
  r
7156
- ), w = await El(s, i, [n, r]);
7156
+ ), w = await Sl(s, i, [n, r]);
7157
7157
  if (w.length !== 2)
7158
7158
  throw new Error("Invalid swap output amounts");
7159
7159
  P.setCheckPositive(
@@ -7194,7 +7194,7 @@ async function Nl(e, t, n, r, s, i, o, a, c, u, l) {
7194
7194
  f();
7195
7195
  }
7196
7196
  }
7197
- function Cl(e, t, n, r, s, i, o, a, c, u) {
7197
+ function Nl(e, t, n, r, s, i, o, a, c, u) {
7198
7198
  if (u === "")
7199
7199
  return !0;
7200
7200
  let l = tt(B.from(e, "hex")).slice(2);
@@ -7208,11 +7208,11 @@ function Cl(e, t, n, r, s, i, o, a, c, u) {
7208
7208
  );
7209
7209
  return I.shortSignatures.verify(h, d, T);
7210
7210
  }
7211
- async function $l(e, t, n, r, s, i, o, a, c, u, l) {
7211
+ async function Cl(e, t, n, r, s, i, o, a, c, u, l) {
7212
7212
  n = n.toLowerCase(), r = r.toLowerCase(), t = t.startsWith("0x") ? t.slice(2) : t, o = o.startsWith("0x") ? o.slice(2) : o;
7213
7213
  const f = await In(e);
7214
7214
  try {
7215
- if (!Cl(
7215
+ if (!Nl(
7216
7216
  t,
7217
7217
  a,
7218
7218
  n,
@@ -7228,7 +7228,7 @@ async function $l(e, t, n, r, s, i, o, a, c, u, l) {
7228
7228
  const { reserveA: d, reserveB: p } = await jt(
7229
7229
  n,
7230
7230
  r
7231
- ), w = await Bl(s, i, [n, r]);
7231
+ ), w = await El(s, i, [n, r]);
7232
7232
  if (w.length !== 2)
7233
7233
  throw new Error("Invalid swap output amounts");
7234
7234
  P.setCheckPositive(
@@ -7269,7 +7269,7 @@ async function $l(e, t, n, r, s, i, o, a, c, u, l) {
7269
7269
  f();
7270
7270
  }
7271
7271
  }
7272
- function Al(e, t, n, r, s, i) {
7272
+ function $l(e, t, n, r, s, i) {
7273
7273
  if (i === "")
7274
7274
  return !0;
7275
7275
  let o = tt(B.from(e, "hex")).slice(2);
@@ -7283,13 +7283,13 @@ function Al(e, t, n, r, s, i) {
7283
7283
  );
7284
7284
  return I.shortSignatures.verify(f, c, g);
7285
7285
  }
7286
- async function Ll(e, t, n, r, s, i, o) {
7286
+ async function Al(e, t, n, r, s, i, o) {
7287
7287
  if (n = n.toLowerCase(), n = n.startsWith("0x") ? n.slice(2) : n, n.length > 126)
7288
7288
  throw new Error("Pkscript too long");
7289
7289
  t = t.startsWith("0x") ? t.slice(2) : t, s = s.startsWith("0x") ? s.slice(2) : s;
7290
7290
  const a = await In(e);
7291
7291
  try {
7292
- if (!Al(t, i, n, r, o, s))
7292
+ if (!$l(t, i, n, r, o, s))
7293
7293
  throw new Error("Invalid BLS signature");
7294
7294
  if ((await P.get(t, wt) || 0n) < r)
7295
7295
  throw new Error("Insufficient token balance");
@@ -7327,7 +7327,7 @@ class cr {
7327
7327
  return (...n) => (this.next(), t(...n));
7328
7328
  }
7329
7329
  }
7330
- const Io = [
7330
+ const Oo = [
7331
7331
  {
7332
7332
  type: "function",
7333
7333
  name: "deposit",
@@ -7343,42 +7343,21 @@ const Io = [
7343
7343
  outputs: [],
7344
7344
  stateMutability: "nonpayable"
7345
7345
  }
7346
- ], Pl = Io, _e = 1e3, ui = 12e3, To = 2500n, Fl = `Sign this message only on official BiS interfaces.
7346
+ ], Ll = Oo, _e = 1e3, ui = 12e3, Io = 2500n, Pl = `Sign this message only on official BiS interfaces.
7347
7347
  This signature is required to generate your session-specific swap key.
7348
7348
  Signing this message outside official BiS interfaces may result in unauthorized access to your swap session and is at the user's own risk.
7349
- By signing, you acknowledge that the BiS Terms of Service also apply: https://bestinslot.xyz/legal/terms.`, Ul = `Sign this message only on official BiS interfaces.
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.
7350
7350
  This signature is required to generate your session-specific swap key.
7351
7351
  Signing this message outside official BiS interfaces may result in unauthorized access to your swap session and is at the user's own risk.
7352
7352
  By signing, you acknowledge that the BiS Terms of Service also apply: https://bestinslot.xyz/legal/terms.
7353
7353
 
7354
7354
  Current Network: Bitcoin Mainnet`;
7355
- async function J(e, t) {
7356
- try {
7357
- const n = await fetch(e, t);
7358
- if (!n.ok) {
7359
- let s = `HTTP Error: ${n.status} ${n.statusText}`;
7360
- try {
7361
- const i = await n.json();
7362
- s = i.error || JSON.stringify(i);
7363
- } catch {
7364
- }
7365
- throw new Error(s);
7366
- }
7367
- const r = await n.json();
7368
- if (r && r.error)
7369
- throw new Error(String(r.error));
7370
- return r;
7371
- } catch (n) {
7372
- const r = n instanceof Error ? n.message : String(n);
7373
- throw new Error(`API Request Failed: ${r}`);
7374
- }
7375
- }
7376
7355
  function li() {
7377
7356
  const e = Fe();
7378
7357
  if (e === "signet")
7379
- return Fl;
7358
+ return Pl;
7380
7359
  if (e === "mainnet")
7381
- return Ul;
7360
+ return Fl;
7382
7361
  throw new Error("Unsupported network for swap signature request text");
7383
7362
  }
7384
7363
  function ur() {
@@ -7389,22 +7368,22 @@ function ur() {
7389
7368
  return "0x62879BB3dD949c4CF06f71BF7c281DcF24D163e7";
7390
7369
  throw new Error("Unsupported network for orderbook contract address");
7391
7370
  }
7392
- function Ro() {
7371
+ function To() {
7393
7372
  const e = Fe();
7394
7373
  if (e === "signet")
7395
- return new me(Io);
7374
+ return new me(Oo);
7396
7375
  if (e === "mainnet")
7397
- return new me(Pl);
7376
+ return new me(Ll);
7398
7377
  throw new Error("Unsupported network for orderbook contract address");
7399
7378
  }
7400
7379
  async function et() {
7401
7380
  return await Ur(Lt()?.address || "");
7402
7381
  }
7403
- function ko(e) {
7382
+ function Ro(e) {
7404
7383
  const t = I.shortSignatures.getPublicKey(e);
7405
7384
  return `0x${t.x.c0.toString(16).padStart(128, "0")}${t.x.c1.toString(16).padStart(128, "0")}${t.y.c0.toString(16).padStart(128, "0")}${t.y.c1.toString(16).padStart(128, "0")}`;
7406
7385
  }
7407
- async function No(e = {}) {
7386
+ async function ko(e = {}) {
7408
7387
  const t = Lt();
7409
7388
  if (!t?.address)
7410
7389
  throw new Error("Ordinals wallet address not found.");
@@ -7415,14 +7394,14 @@ async function No(e = {}) {
7415
7394
  const s = await ds(li());
7416
7395
  if (r !== s)
7417
7396
  throw new Error("Deterministic signature mismatch. Please try again.");
7418
- const i = B.from(tt(`0x${r}`).slice(2), "hex"), o = B.from("my-app/bls-keygen", "utf-8"), a = Pc(Li, i, void 0, o, 48), c = Ai(a, I.fields.Fr.ORDER), u = B.from(c), l = ko(u), f = `0x${u.toString("hex")}`, d = {
7397
+ const i = B.from(tt(`0x${r}`).slice(2), "hex"), o = B.from("my-app/bls-keygen", "utf-8"), a = Lc(Ai, i, void 0, o, 48), c = $i(a, I.fields.Fr.ORDER), u = B.from(c), l = Ro(u), f = `0x${u.toString("hex")}`, d = {
7419
7398
  bitcoinAddress: t.address,
7420
7399
  swapPubkey: l,
7421
7400
  swapPrivkey: f
7422
7401
  };
7423
7402
  return await di(d), d;
7424
7403
  }
7425
- function ql(e) {
7404
+ function Ul(e) {
7426
7405
  const t = e.trim(), n = t.toLowerCase().startsWith("0x") ? t.slice(2) : t;
7427
7406
  if (!/^[0-9a-f]{64}$/i.test(n))
7428
7407
  throw new Error("Invalid security code. Expected a 32-byte hex value.");
@@ -7431,13 +7410,13 @@ function ql(e) {
7431
7410
  throw new Error("Invalid security code. Not a valid swap key.");
7432
7411
  return B.from(n, "hex");
7433
7412
  }
7434
- async function Dl(e, t = {}) {
7413
+ async function ql(e, t = {}) {
7435
7414
  const n = Lt();
7436
7415
  if (!n?.address)
7437
7416
  throw new Error("Ordinals wallet address not found.");
7438
- const r = ql(e), s = {
7417
+ const r = Ul(e), s = {
7439
7418
  bitcoinAddress: n.address,
7440
- swapPubkey: ko(r),
7419
+ swapPubkey: Ro(r),
7441
7420
  swapPrivkey: `0x${r.toString("hex")}`
7442
7421
  }, i = await Ur(n.address);
7443
7422
  if (i && i.swapPubkey !== s.swapPubkey && !t.overwrite)
@@ -7446,30 +7425,30 @@ async function Dl(e, t = {}) {
7446
7425
  );
7447
7426
  return await di(s), s;
7448
7427
  }
7449
- async function Ml(e = {}) {
7428
+ async function Dl(e = {}) {
7450
7429
  const t = Lt();
7451
7430
  if (!t?.address)
7452
7431
  throw new Error("Ordinals wallet address not found.");
7453
7432
  const n = await Ur(t.address);
7454
- return n ? { wallet: n, created: !1 } : { wallet: await No(e), created: !0 };
7433
+ return n ? { wallet: n, created: !1 } : { wallet: await ko(e), created: !0 };
7455
7434
  }
7456
- async function Wl() {
7435
+ async function Ml() {
7457
7436
  return (await et())?.swapPrivkey ?? null;
7458
7437
  }
7459
- async function Gl() {
7438
+ async function Wl() {
7460
7439
  const e = await X("status");
7461
- return await J(e, {
7440
+ return await z(e, {
7462
7441
  method: "GET"
7463
7442
  });
7464
7443
  }
7465
- async function Co(e) {
7444
+ async function No(e) {
7466
7445
  const t = Lt();
7467
7446
  if (!t?.address)
7468
7447
  throw new Error("Ordinals wallet address not found.");
7469
7448
  const n = await X("check_swap_allowance"), r = {
7470
7449
  ordinal_address: t.address,
7471
7450
  token_address: e
7472
- }, s = await J(n, {
7451
+ }, s = await z(n, {
7473
7452
  method: "POST",
7474
7453
  headers: {
7475
7454
  "Content-Type": "application/json"
@@ -7478,18 +7457,18 @@ async function Co(e) {
7478
7457
  });
7479
7458
  return BigInt(s.result);
7480
7459
  }
7481
- const Hl = 6e4, fi = /* @__PURE__ */ new Map(), Lr = /* @__PURE__ */ new Map();
7460
+ const Gl = 6e4, fi = /* @__PURE__ */ new Map(), Lr = /* @__PURE__ */ new Map();
7482
7461
  async function Qt() {
7483
7462
  const e = Fe(), t = fi.get(e);
7484
- if (t && Date.now() - t.fetchedAt < Hl)
7463
+ if (t && Date.now() - t.fetchedAt < Gl)
7485
7464
  return t.info;
7486
- const n = await X("get_swap_info"), r = await J(n, {
7465
+ const n = await X("get_swap_info"), r = await z(n, {
7487
7466
  method: "GET"
7488
7467
  }), s = r.result.fee_policy;
7489
7468
  let i = null;
7490
7469
  if (Lr.delete(e), s != null)
7491
7470
  try {
7492
- i = sl(s);
7471
+ i = rl(s);
7493
7472
  } catch (a) {
7494
7473
  Lr.set(e, a instanceof Error ? a.message : String(a));
7495
7474
  }
@@ -7515,14 +7494,14 @@ async function lr(e, t) {
7515
7494
  if (s.reserveA === 0n || s.reserveB === 0n)
7516
7495
  throw new Error(`No swap pool with liquidity for ${e} / ${t}.`);
7517
7496
  }
7518
- async function $o(e) {
7497
+ async function Co(e) {
7519
7498
  const t = Lt();
7520
7499
  if (!t?.address)
7521
7500
  throw new Error("Ordinals wallet address not found.");
7522
7501
  const n = await X("check_brc20_balance"), r = {
7523
7502
  ordinal_address: t.address,
7524
7503
  token_address: e
7525
- }, s = await J(n, {
7504
+ }, s = await z(n, {
7526
7505
  method: "POST",
7527
7506
  headers: {
7528
7507
  "Content-Type": "application/json"
@@ -7531,14 +7510,14 @@ async function $o(e) {
7531
7510
  });
7532
7511
  return BigInt(s.result);
7533
7512
  }
7534
- async function Ao(e) {
7513
+ async function $o(e) {
7535
7514
  const t = Lt();
7536
7515
  if (!t?.address)
7537
7516
  throw new Error("Ordinals wallet address not found.");
7538
7517
  const n = await X("check_base_brc20_balance"), r = {
7539
7518
  ordinal_address: t.address,
7540
7519
  token_address: e
7541
- }, s = await J(n, {
7520
+ }, s = await z(n, {
7542
7521
  method: "POST",
7543
7522
  headers: {
7544
7523
  "Content-Type": "application/json"
@@ -7552,9 +7531,9 @@ async function Ao(e) {
7552
7531
  ticker: s.result.ticker
7553
7532
  };
7554
7533
  }
7555
- async function Vl(e) {
7534
+ async function Hl(e) {
7556
7535
  const t = await X("get_all_balances");
7557
- return (await J(t, {
7536
+ return (await z(t, {
7558
7537
  method: "POST",
7559
7538
  headers: {
7560
7539
  "Content-Type": "application/json"
@@ -7564,11 +7543,11 @@ async function Vl(e) {
7564
7543
  })
7565
7544
  })).result;
7566
7545
  }
7567
- async function Zl(e) {
7546
+ async function Vl(e) {
7568
7547
  const t = await et();
7569
7548
  if (!t?.swapPubkey)
7570
7549
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
7571
- const n = t.swapPubkey, r = await X("get_balance"), i = await J(r, {
7550
+ const n = t.swapPubkey, r = await X("get_balance"), i = await z(r, {
7572
7551
  method: "POST",
7573
7552
  headers: {
7574
7553
  "Content-Type": "application/json"
@@ -7581,7 +7560,7 @@ async function Zl(e) {
7581
7560
  return BigInt(i.result);
7582
7561
  }
7583
7562
  async function Tn(e, t) {
7584
- const n = await X("get_balance"), s = await J(n, {
7563
+ const n = await X("get_balance"), s = await z(n, {
7585
7564
  method: "POST",
7586
7565
  headers: {
7587
7566
  "Content-Type": "application/json"
@@ -7594,7 +7573,7 @@ async function Tn(e, t) {
7594
7573
  return BigInt(s.result);
7595
7574
  }
7596
7575
  async function We(e) {
7597
- const t = await X("get_pair_reserves"), r = await J(t, {
7576
+ const t = await X("get_pair_reserves"), r = await z(t, {
7598
7577
  method: "POST",
7599
7578
  headers: {
7600
7579
  "Content-Type": "application/json"
@@ -7613,7 +7592,7 @@ async function Ge() {
7613
7592
  const e = (await et())?.swapPubkey;
7614
7593
  if (!e)
7615
7594
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
7616
- const t = await X("get_swap_wallet_nonce"), r = await J(t, {
7595
+ const t = await X("get_swap_wallet_nonce"), r = await z(t, {
7617
7596
  method: "POST",
7618
7597
  headers: {
7619
7598
  "Content-Type": "application/json"
@@ -7624,8 +7603,8 @@ async function Ge() {
7624
7603
  });
7625
7604
  return BigInt(r.result);
7626
7605
  }
7627
- async function Yl(e, t) {
7628
- const n = await X("get_swap_referrer_info"), s = await J(n, {
7606
+ async function Zl(e, t) {
7607
+ const n = await X("get_swap_referrer_info"), s = await z(n, {
7629
7608
  method: "POST",
7630
7609
  headers: {
7631
7610
  "Content-Type": "application/json"
@@ -7641,13 +7620,13 @@ async function Yl(e, t) {
7641
7620
  }
7642
7621
  async function rs(e, t) {
7643
7622
  try {
7644
- return await Yl(e, t);
7623
+ return await Zl(e, t);
7645
7624
  } catch (n) {
7646
7625
  return console.warn(`Failed to get referrer info for ref_id ${t}:`, n), { referrerPubkey: void 0, refReturnBps: void 0 };
7647
7626
  }
7648
7627
  }
7649
7628
  async function Pt(e) {
7650
- const t = await X("get_miner_fee"), r = await J(t, {
7629
+ const t = await X("get_miner_fee"), r = await z(t, {
7651
7630
  method: "POST",
7652
7631
  headers: {
7653
7632
  "Content-Type": "application/json"
@@ -7658,16 +7637,16 @@ async function Pt(e) {
7658
7637
  });
7659
7638
  return BigInt(r.result);
7660
7639
  }
7661
- async function Kl() {
7640
+ async function Yl() {
7662
7641
  const e = await X("get_tokens");
7663
- return (await J(e, {
7642
+ return (await z(e, {
7664
7643
  method: "GET"
7665
7644
  })).tokens;
7666
7645
  }
7667
7646
  function Fn(e) {
7668
7647
  return e === null ? null : BigInt(e);
7669
7648
  }
7670
- async function Xl(e = {}) {
7649
+ async function Kl(e = {}) {
7671
7650
  const t = e.order_by ?? "tvl_desc", n = e.page ?? 1, r = e.count ?? 20;
7672
7651
  if (r > 100)
7673
7652
  throw new Error("Count cannot exceed 100");
@@ -7675,7 +7654,7 @@ async function Xl(e = {}) {
7675
7654
  order_by: t,
7676
7655
  page: String(n),
7677
7656
  count: String(r)
7678
- }), i = await X(`get_table_data?${s}`), o = await J(i, {
7657
+ }), i = await X(`get_table_data?${s}`), o = await z(i, {
7679
7658
  method: "GET"
7680
7659
  });
7681
7660
  return {
@@ -7692,50 +7671,50 @@ async function Xl(e = {}) {
7692
7671
  }))
7693
7672
  };
7694
7673
  }
7695
- async function zl(e) {
7674
+ async function Xl(e) {
7696
7675
  const t = await X(`volume/${e.pair_address}?days=${e.days}`);
7697
- return await J(t, {
7676
+ return await z(t, {
7698
7677
  method: "GET"
7699
7678
  });
7700
7679
  }
7701
- async function Jl(e) {
7680
+ async function zl(e) {
7702
7681
  if (e.limit > 1e3)
7703
7682
  throw new Error("Limit cannot exceed 1000");
7704
7683
  let t = await X(
7705
7684
  `klines/${e.pair_address}?interval=${e.interval}&limit=${e.limit}`
7706
7685
  );
7707
- return e.startTime !== null && (t += `&startTime=${e.startTime}`), e.endTime !== null && (t += `&endTime=${e.endTime}`), await J(t, {
7686
+ return e.startTime !== null && (t += `&startTime=${e.startTime}`), e.endTime !== null && (t += `&endTime=${e.endTime}`), await z(t, {
7708
7687
  method: "GET"
7709
7688
  });
7710
7689
  }
7711
- async function jl(e) {
7690
+ async function Jl(e) {
7712
7691
  const t = await X(
7713
7692
  `tvl/${encodeURIComponent(e.pair_address)}?${new URLSearchParams({
7714
7693
  days: String(e.days)
7715
7694
  })}`
7716
7695
  );
7717
- return await J(t, {
7696
+ return await z(t, {
7718
7697
  method: "GET"
7719
7698
  });
7720
7699
  }
7721
- async function Ql(e) {
7700
+ async function jl(e) {
7722
7701
  if (e.limit > 200)
7723
7702
  throw new Error("Limit cannot exceed 200");
7724
7703
  const t = await X(
7725
7704
  `pair-activity/${e.pair_address}?limit=${e.limit}&offset=${e.offset}`
7726
7705
  );
7727
- return await J(t, {
7706
+ return await z(t, {
7728
7707
  method: "GET"
7729
7708
  });
7730
7709
  }
7731
- const tf = [
7710
+ const Ql = [
7732
7711
  "swap",
7733
7712
  "add_liq",
7734
7713
  "remove_liq",
7735
7714
  "withdraw",
7736
7715
  "unwrap"
7737
7716
  ];
7738
- async function ef(e = {}) {
7717
+ async function tf(e = {}) {
7739
7718
  if (e.limit !== void 0) {
7740
7719
  if (e.limit > 100)
7741
7720
  throw new Error("Limit cannot exceed 100");
@@ -7747,18 +7726,18 @@ async function ef(e = {}) {
7747
7726
  if (e.kinds !== void 0) {
7748
7727
  if (e.kinds.length === 0)
7749
7728
  throw new Error("Kinds must name at least one kind");
7750
- const s = e.kinds.find((i) => !tf.includes(i));
7729
+ const s = e.kinds.find((i) => !Ql.includes(i));
7751
7730
  if (s !== void 0)
7752
7731
  throw new Error(`Unknown activity kind: ${s}`);
7753
7732
  }
7754
7733
  const t = new URLSearchParams();
7755
7734
  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
7735
  const n = t.toString(), r = await X(`recent-activity${n ? `?${n}` : ""}`);
7757
- return await J(r, {
7736
+ return await z(r, {
7758
7737
  method: "GET"
7759
7738
  });
7760
7739
  }
7761
- const nf = [
7740
+ const ef = [
7762
7741
  "swap",
7763
7742
  "add_liq",
7764
7743
  "remove_liq",
@@ -7766,7 +7745,7 @@ const nf = [
7766
7745
  "withdraw",
7767
7746
  "unwrap"
7768
7747
  ];
7769
- async function rf(e) {
7748
+ async function nf(e) {
7770
7749
  if (e.limit !== void 0) {
7771
7750
  if (e.limit > 200)
7772
7751
  throw new Error("Limit cannot exceed 200");
@@ -7778,7 +7757,7 @@ async function rf(e) {
7778
7757
  if (e.kinds !== void 0) {
7779
7758
  if (e.kinds.length === 0)
7780
7759
  throw new Error("Kinds must name at least one kind");
7781
- const s = e.kinds.find((i) => !nf.includes(i));
7760
+ const s = e.kinds.find((i) => !ef.includes(i));
7782
7761
  if (s !== void 0)
7783
7762
  throw new Error(`Unknown activity kind: ${s}`);
7784
7763
  }
@@ -7787,13 +7766,13 @@ async function rf(e) {
7787
7766
  const n = await X(
7788
7767
  `wallet-activity/${encodeURIComponent(e.pubkey)}?${t}`
7789
7768
  );
7790
- return await J(n, {
7769
+ return await z(n, {
7791
7770
  method: "GET"
7792
7771
  });
7793
7772
  }
7794
7773
  async function xn(e) {
7795
7774
  const t = await X("get_token_decimals");
7796
- return (await J(t, {
7775
+ return (await z(t, {
7797
7776
  method: "POST",
7798
7777
  headers: {
7799
7778
  "Content-Type": "application/json"
@@ -7803,7 +7782,7 @@ async function xn(e) {
7803
7782
  })
7804
7783
  })).result;
7805
7784
  }
7806
- async function Lo(e) {
7785
+ async function Ao(e) {
7807
7786
  e.bls_pubkey = e.bls_pubkey.startsWith("0x") ? e.bls_pubkey.slice(2) : e.bls_pubkey, e.bls_pubkey = e.bls_pubkey.toLowerCase(), e.token_address = e.token_address.toLowerCase();
7808
7787
  const t = `Deposit Order:
7809
7788
  Bitcoin Address: ${e.btc_address}
@@ -7825,7 +7804,7 @@ async function fr(e) {
7825
7804
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), c = I.shortSignatures.sign(r, o).negate();
7826
7805
  return `0x${c.x.toString(16).padStart(128, "0")}${c.y.toString(16).padStart(128, "0")}`;
7827
7806
  }
7828
- async function Po(e) {
7807
+ async function Lo(e) {
7829
7808
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
7830
7809
  let t = tt(B.from(e.pubkey, "hex")).slice(2);
7831
7810
  t += "99", t += e.ordinals_script;
@@ -7837,9 +7816,9 @@ async function Po(e) {
7837
7816
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), c = I.shortSignatures.sign(r, o).negate();
7838
7817
  return `0x${c.x.toString(16).padStart(128, "0")}${c.y.toString(16).padStart(128, "0")}`;
7839
7818
  }
7840
- async function Fo(e) {
7819
+ async function Po(e) {
7841
7820
  const t = await X("get_deposit_signature");
7842
- return J(t, {
7821
+ return z(t, {
7843
7822
  method: "POST",
7844
7823
  headers: {
7845
7824
  "Content-Type": "application/json"
@@ -7847,9 +7826,9 @@ async function Fo(e) {
7847
7826
  body: JSON.stringify(e)
7848
7827
  });
7849
7828
  }
7850
- async function sf(e) {
7829
+ async function rf(e) {
7851
7830
  const t = await X("deposit");
7852
- return J(t, {
7831
+ return z(t, {
7853
7832
  method: "POST",
7854
7833
  headers: {
7855
7834
  "Content-Type": "application/json"
@@ -7857,7 +7836,7 @@ async function sf(e) {
7857
7836
  body: JSON.stringify(e)
7858
7837
  });
7859
7838
  }
7860
- function Uo(e, t) {
7839
+ function Fo(e, t) {
7861
7840
  if (e < 0n)
7862
7841
  throw new Error("Amount cannot be negative");
7863
7842
  if (t < 0 || t > 18)
@@ -7873,10 +7852,10 @@ function Uo(e, t) {
7873
7852
  }
7874
7853
  return i ? `${s}.${i}` : s;
7875
7854
  }
7876
- function qo(e) {
7855
+ function Uo(e) {
7877
7856
  return e ? e.reduce((t, n) => t + n.amount, 0n) : 0n;
7878
7857
  }
7879
- async function of(e, t, n, r = !0, s, i = {}) {
7858
+ async function sf(e, t, n, r = !0, s, i = {}) {
7880
7859
  const o = rn();
7881
7860
  if (!o || !o.wallets) throw new Error("Wallets not found");
7882
7861
  const a = Jt(), c = Sn(), u = Lt();
@@ -7886,17 +7865,17 @@ async function of(e, t, n, r = !0, s, i = {}) {
7886
7865
  if (!u.address) throw new Error("Ordinals wallet address not found");
7887
7866
  const l = c.address, f = c.pubkey, d = u.address, p = new xt(!1, null, l, null, f);
7888
7867
  let w = 0n, h = 0, g = "";
7889
- const b = await $o(e);
7868
+ const b = await Co(e);
7890
7869
  if (b < t) {
7891
- const Ut = await Ao(e), ne = Ut.available_balance_in_18_dec;
7870
+ const Ut = await $o(e), ne = Ut.available_balance_in_18_dec;
7892
7871
  h = Ut.decimals, g = Ut.ticker, w = t - b;
7893
- const re = qo(s);
7872
+ const re = Uo(s);
7894
7873
  if (ne + re < w)
7895
7874
  throw console.error(
7896
7875
  `Insufficient BRC-2.0 + BRC20 available balance. Current BRC-2.0: ${b}, Available in base: ${ne}, Reclaimable: ${re}, Required: ${t}`
7897
7876
  ), new Error("Insufficient BRC-2.0 + BRC20 available balance");
7898
7877
  }
7899
- const m = await Co(e);
7878
+ const m = await No(e);
7900
7879
  let v = !1;
7901
7880
  if (m < BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")) {
7902
7881
  if (!r)
@@ -7919,14 +7898,14 @@ async function of(e, t, n, r = !0, s, i = {}) {
7919
7898
  if (!H)
7920
7899
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
7921
7900
  T.next();
7922
- const U = await Lo({
7901
+ const U = await Ao({
7923
7902
  btc_address: d,
7924
7903
  bls_pubkey: H,
7925
7904
  token_address: e
7926
- }), y = he.address.toOutputScript(d, Jt()), S = await Po({
7905
+ }), y = he.address.toOutputScript(d, Jt()), S = await Lo({
7927
7906
  pubkey: H,
7928
7907
  ordinals_script: y.toString("hex")
7929
- }), O = await Fo({
7908
+ }), O = await Po({
7930
7909
  btc_address: d,
7931
7910
  bls_pubkey: H,
7932
7911
  token_address: e.toLowerCase(),
@@ -7935,7 +7914,7 @@ async function of(e, t, n, r = !0, s, i = {}) {
7935
7914
  }), k = O.edcsa_signature, F = O.pubkey_idx, L = O.token_idx, q = await fr({
7936
7915
  pubkey: H,
7937
7916
  pk_idx: BigInt(F)
7938
- }), W = Ro().encodeFunctionData("deposit", [
7917
+ }), W = To().encodeFunctionData("deposit", [
7939
7918
  e,
7940
7919
  L,
7941
7920
  t,
@@ -7955,7 +7934,7 @@ async function of(e, t, n, r = !0, s, i = {}) {
7955
7934
  );
7956
7935
  let G = null, ut = null, gt = null, Et = null, Q = null, rt = null, te = null, Oe = null, ee = null;
7957
7936
  if (w > 0n) {
7958
- const Ut = Uo(
7937
+ const Ut = Fo(
7959
7938
  w,
7960
7939
  h
7961
7940
  ), ne = new Kt(
@@ -7969,7 +7948,7 @@ async function of(e, t, n, r = !0, s, i = {}) {
7969
7948
  )
7970
7949
  );
7971
7950
  if ((s?.length ?? 0) > 0) {
7972
- const Nn = await pi(s, d), ke = await ya(
7951
+ const Nn = await pi(s, d), ke = await ga(
7973
7952
  ne,
7974
7953
  Nn,
7975
7954
  n,
@@ -8152,13 +8131,13 @@ async function of(e, t, n, r = !0, s, i = {}) {
8152
8131
  }
8153
8132
  if (kn == null)
8154
8133
  throw new Error("Failed to send inscription to OP_RETURN");
8155
- const la = kn.signedTxHex, fa = kn.txId, da = {
8134
+ const ua = kn.signedTxHex, la = kn.txId, fa = {
8156
8135
  commit_txid: Re.commitTxId,
8157
8136
  commit_txhex: gr,
8158
8137
  reveal_txid: Re.revealTxId,
8159
8138
  reveal_txhex: yr,
8160
- send_to_opreturn_txid: fa,
8161
- send_to_opreturn_txhex: la,
8139
+ send_to_opreturn_txid: la,
8140
+ send_to_opreturn_txhex: ua,
8162
8141
  secret: fs,
8163
8142
  inscription_id: cn,
8164
8143
  fee_rate: n,
@@ -8185,9 +8164,9 @@ async function of(e, t, n, r = !0, s, i = {}) {
8185
8164
  fee_rate: n
8186
8165
  } : null
8187
8166
  };
8188
- return (await sf(da)).result;
8167
+ return (await rf(fa)).result;
8189
8168
  }
8190
- async function af(e, t, n, r = !0, s) {
8169
+ async function of(e, t, n, r = !0, s) {
8191
8170
  const i = rn();
8192
8171
  if (!i || !i.wallets) throw new Error("Wallets not found");
8193
8172
  const o = Jt(), a = Sn();
@@ -8195,17 +8174,17 @@ async function af(e, t, n, r = !0, s) {
8195
8174
  if (!a.address) throw new Error("Payment wallet address not found");
8196
8175
  const c = a.address, u = a.pubkey, l = new xt(!1, null, c, null, u);
8197
8176
  let f = 0n, d = 0, p = "";
8198
- const w = await $o(e);
8177
+ const w = await Co(e);
8199
8178
  if (w < t) {
8200
- const lt = await Ao(e), Ft = lt.available_balance_in_18_dec;
8179
+ const lt = await $o(e), Ft = lt.available_balance_in_18_dec;
8201
8180
  d = lt.decimals, p = lt.ticker, f = t - w;
8202
- const dt = qo(s);
8181
+ const dt = Uo(s);
8203
8182
  if (Ft + dt < f)
8204
8183
  throw console.error(
8205
8184
  `Insufficient BRC-2.0 + BRC20 available balance. Current BRC-2.0: ${w}, Available in base: ${Ft}, Reclaimable: ${dt}, Required: ${t}`
8206
8185
  ), new Error("Insufficient BRC-2.0 + BRC20 available balance");
8207
8186
  }
8208
- const h = await Co(e);
8187
+ const h = await No(e);
8209
8188
  let g = !1;
8210
8189
  if (h < BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")) {
8211
8190
  if (!r)
@@ -8227,7 +8206,7 @@ async function af(e, t, n, r = !0, s) {
8227
8206
  const A = `0x${"00".repeat(64)}`, R = 1, _ = 1, M = await fr({
8228
8207
  pubkey: $,
8229
8208
  pk_idx: BigInt(R)
8230
- }), U = Ro().encodeFunctionData("deposit", [
8209
+ }), U = To().encodeFunctionData("deposit", [
8231
8210
  e,
8232
8211
  _,
8233
8212
  t,
@@ -8247,7 +8226,7 @@ async function af(e, t, n, r = !0, s) {
8247
8226
  ), k = await qr(c);
8248
8227
  let F = null, L = null, q = null, N = null, W = null, Z = 0;
8249
8228
  if (f > 0n) {
8250
- const lt = Uo(
8229
+ const lt = Fo(
8251
8230
  f,
8252
8231
  d
8253
8232
  ), Ft = new Kt(
@@ -8266,7 +8245,7 @@ async function af(e, t, n, r = !0, s) {
8266
8245
  if (!$t) throw new Error("Ordinals wallet not found");
8267
8246
  if (!$t.address) throw new Error("Ordinals wallet address not found");
8268
8247
  const Ie = $t.address, an = await pi(s, Ie);
8269
- dt = await ga(
8248
+ dt = await wa(
8270
8249
  Ft,
8271
8250
  an,
8272
8251
  n,
@@ -8443,9 +8422,9 @@ async function af(e, t, n, r = !0, s) {
8443
8422
  fee_rate: n
8444
8423
  };
8445
8424
  }
8446
- async function cf(e) {
8425
+ async function af(e) {
8447
8426
  const t = await X("wrap");
8448
- return J(t, {
8427
+ return z(t, {
8449
8428
  method: "POST",
8450
8429
  headers: {
8451
8430
  "Content-Type": "application/json"
@@ -8453,9 +8432,9 @@ async function cf(e) {
8453
8432
  body: JSON.stringify(e)
8454
8433
  });
8455
8434
  }
8456
- async function uf(e) {
8435
+ async function cf(e) {
8457
8436
  const t = await X("estimate_wrap_gas");
8458
- return J(t, {
8437
+ return z(t, {
8459
8438
  method: "POST",
8460
8439
  headers: {
8461
8440
  "Content-Type": "application/json"
@@ -8463,7 +8442,7 @@ async function uf(e) {
8463
8442
  body: JSON.stringify(e)
8464
8443
  });
8465
8444
  }
8466
- async function lf(e, t, n = {}) {
8445
+ async function uf(e, t, n = {}) {
8467
8446
  const r = await Qt(), s = rn();
8468
8447
  if (!s || !s.wallets) throw new Error("Wallets not found");
8469
8448
  const i = new cr(n), o = i.wrap(Xn(s.provider)), a = Sn(), c = Lt();
@@ -8475,14 +8454,14 @@ async function lf(e, t, n = {}) {
8475
8454
  if (!f)
8476
8455
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8477
8456
  i.next();
8478
- const d = await Lo({
8457
+ const d = await Ao({
8479
8458
  btc_address: u,
8480
8459
  bls_pubkey: f,
8481
8460
  token_address: r.wbtc_address
8482
- }), p = he.address.toOutputScript(u, Jt()), w = await Po({
8461
+ }), p = he.address.toOutputScript(u, Jt()), w = await Lo({
8483
8462
  pubkey: f,
8484
8463
  ordinals_script: p.toString("hex")
8485
- }), h = await Fo({
8464
+ }), h = await Po({
8486
8465
  btc_address: u,
8487
8466
  bls_pubkey: f,
8488
8467
  token_address: r.wbtc_address.toLowerCase(),
@@ -8572,7 +8551,7 @@ async function lf(e, t, n = {}) {
8572
8551
  secret: N,
8573
8552
  inscription_id: L,
8574
8553
  fee_rate: t
8575
- }, G = await uf(j), ut = Math.max(
8554
+ }, G = await cf(j), ut = Math.max(
8576
8555
  G.estimated_gas + 1e5,
8577
8556
  G.estimated_gas * 1.2
8578
8557
  );
@@ -8580,11 +8559,11 @@ async function lf(e, t, n = {}) {
8580
8559
  _ = ut + 5e4;
8581
8560
  continue;
8582
8561
  }
8583
- return (await cf(j)).result;
8562
+ return (await af(j)).result;
8584
8563
  }
8585
8564
  throw new Error("Failed to estimate gas for wrap order after multiple attempts");
8586
8565
  }
8587
- async function ff(e, t) {
8566
+ async function lf(e, t) {
8588
8567
  const n = await Qt(), r = rn();
8589
8568
  if (!r || !r.wallets) throw new Error("Wallets not found");
8590
8569
  const s = Sn();
@@ -8668,7 +8647,7 @@ async function ff(e, t) {
8668
8647
  fee_rate: t
8669
8648
  };
8670
8649
  }
8671
- async function df(e, t, n, r) {
8650
+ async function ff(e, t, n, r) {
8672
8651
  const s = await Qt();
8673
8652
  or(s.wbtc_address, s.factory_address);
8674
8653
  const i = (await et())?.swapPubkey;
@@ -8677,7 +8656,7 @@ async function df(e, t, n, r) {
8677
8656
  const o = {
8678
8657
  balanceOf: Tn,
8679
8658
  reservesOf: We
8680
- }, a = await Pt("add_liquidity"), c = await Il(
8659
+ }, a = await Pt("add_liquidity"), c = await Ol(
8681
8660
  o,
8682
8661
  i,
8683
8662
  e,
@@ -8705,7 +8684,7 @@ async function df(e, t, n, r) {
8705
8684
  throw new Error("No data returned from add liquidity request.");
8706
8685
  return c.data;
8707
8686
  }
8708
- async function pf(e) {
8687
+ async function df(e) {
8709
8688
  e.token1_addr = e.token1_addr.toLowerCase(), e.token2_addr = e.token2_addr.toLowerCase();
8710
8689
  const t = `Add Liquidity Order:
8711
8690
  Token 1 Address: ${e.token1_addr}
@@ -8721,7 +8700,7 @@ BTC Fee: ${e.btc_fee}
8721
8700
  By signing this message, you authorize the creation of an add liquidity order with the above parameters.`;
8722
8701
  return await De(t, "ordinals");
8723
8702
  }
8724
- async function hf(e) {
8703
+ async function pf(e) {
8725
8704
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
8726
8705
  let t = tt(B.from(e.pubkey, "hex")).slice(2);
8727
8706
  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");
@@ -8733,9 +8712,9 @@ async function hf(e) {
8733
8712
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), a = I.shortSignatures.sign(r, o);
8734
8713
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
8735
8714
  }
8736
- async function wf(e) {
8715
+ async function hf(e) {
8737
8716
  const t = await X("add_liq_req");
8738
- return J(t, {
8717
+ return z(t, {
8739
8718
  method: "POST",
8740
8719
  headers: {
8741
8720
  "Content-Type": "application/json"
@@ -8743,11 +8722,11 @@ async function wf(e) {
8743
8722
  body: JSON.stringify(e)
8744
8723
  });
8745
8724
  }
8746
- async function gf(e, t, n, r, s) {
8725
+ async function wf(e, t, n, r, s) {
8747
8726
  const i = (await et())?.swapPubkey;
8748
8727
  if (!i)
8749
8728
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8750
- const o = n * (10000n - s) / 10000n, a = r * (10000n - s) / 10000n, c = 0n, u = 0n, l = await Ge(), f = await Pt("add_liquidity"), d = await pf({
8729
+ const o = n * (10000n - s) / 10000n, a = r * (10000n - s) / 10000n, c = 0n, u = 0n, l = await Ge(), f = await Pt("add_liquidity"), d = await df({
8751
8730
  token1_addr: e,
8752
8731
  token2_addr: t,
8753
8732
  amt1: n.toString(),
@@ -8757,7 +8736,7 @@ async function gf(e, t, n, r, s) {
8757
8736
  token1FeeBps: c.toString(),
8758
8737
  token2FeeBps: u.toString(),
8759
8738
  btc_fee: f.toString()
8760
- }), p = await hf({
8739
+ }), p = await pf({
8761
8740
  pubkey: i,
8762
8741
  nonce: l,
8763
8742
  token1_addr: e,
@@ -8770,7 +8749,7 @@ async function gf(e, t, n, r, s) {
8770
8749
  token2FeeBps: u,
8771
8750
  btc_fee: f
8772
8751
  });
8773
- return await wf({
8752
+ return await hf({
8774
8753
  pubkey: i,
8775
8754
  token1_addr: e,
8776
8755
  token2_addr: t,
@@ -8785,7 +8764,7 @@ async function gf(e, t, n, r, s) {
8785
8764
  bip322_signature: d
8786
8765
  });
8787
8766
  }
8788
- async function yf(e, t, n) {
8767
+ async function gf(e, t, n) {
8789
8768
  const r = await Qt();
8790
8769
  or(r.wbtc_address, r.factory_address);
8791
8770
  const s = (await et())?.swapPubkey;
@@ -8794,7 +8773,7 @@ async function yf(e, t, n) {
8794
8773
  const i = {
8795
8774
  balanceOf: Tn,
8796
8775
  reservesOf: We
8797
- }, o = await Pt("remove_liquidity"), a = await Rl(
8776
+ }, o = await Pt("remove_liquidity"), a = await Tl(
8798
8777
  i,
8799
8778
  s,
8800
8779
  e,
@@ -8821,7 +8800,7 @@ async function yf(e, t, n) {
8821
8800
  throw new Error("No data returned from remove liquidity request.");
8822
8801
  return a.data;
8823
8802
  }
8824
- async function bf(e) {
8803
+ async function yf(e) {
8825
8804
  e.token1_addr = e.token1_addr.toLowerCase(), e.token2_addr = e.token2_addr.toLowerCase();
8826
8805
  const t = `Remove Liquidity Order:
8827
8806
  Token 1 Address: ${e.token1_addr}
@@ -8836,7 +8815,7 @@ BTC Fee: ${e.btc_fee}
8836
8815
  By signing this message, you authorize the creation of a remove liquidity order with the above parameters.`;
8837
8816
  return await De(t, "ordinals");
8838
8817
  }
8839
- async function mf(e) {
8818
+ async function bf(e) {
8840
8819
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
8841
8820
  let t = tt(B.from(e.pubkey, "hex")).slice(2);
8842
8821
  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");
@@ -8848,9 +8827,9 @@ async function mf(e) {
8848
8827
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), a = I.shortSignatures.sign(r, o);
8849
8828
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
8850
8829
  }
8851
- async function xf(e) {
8830
+ async function mf(e) {
8852
8831
  const t = await X("remove_liq_req");
8853
- return J(t, {
8832
+ return z(t, {
8854
8833
  method: "POST",
8855
8834
  headers: {
8856
8835
  "Content-Type": "application/json"
@@ -8858,11 +8837,11 @@ async function xf(e) {
8858
8837
  body: JSON.stringify(e)
8859
8838
  });
8860
8839
  }
8861
- async function _f(e, t, n, r, s, i) {
8840
+ async function xf(e, t, n, r, s, i) {
8862
8841
  const o = (await et())?.swapPubkey;
8863
8842
  if (!o)
8864
8843
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8865
- const a = r * (10000n - i) / 10000n, c = s * (10000n - i) / 10000n, u = 0n, l = 0n, f = await Ge(), d = await Pt("remove_liquidity"), p = await bf({
8844
+ const a = r * (10000n - i) / 10000n, c = s * (10000n - i) / 10000n, u = 0n, l = 0n, f = await Ge(), d = await Pt("remove_liquidity"), p = await yf({
8866
8845
  token1_addr: e,
8867
8846
  token2_addr: t,
8868
8847
  lp_amt: n.toString(),
@@ -8871,7 +8850,7 @@ async function _f(e, t, n, r, s, i) {
8871
8850
  token1FeeBps: u.toString(),
8872
8851
  token2FeeBps: l.toString(),
8873
8852
  btc_fee: d.toString()
8874
- }), w = await mf({
8853
+ }), w = await bf({
8875
8854
  pubkey: o,
8876
8855
  nonce: f,
8877
8856
  token1_addr: e,
@@ -8883,7 +8862,7 @@ async function _f(e, t, n, r, s, i) {
8883
8862
  token2FeeBps: l,
8884
8863
  btc_fee: d
8885
8864
  });
8886
- return await xf({
8865
+ return await mf({
8887
8866
  pubkey: o,
8888
8867
  token1_addr: e,
8889
8868
  token2_addr: t,
@@ -8901,11 +8880,11 @@ async function dr(e, t) {
8901
8880
  const n = await Qt();
8902
8881
  if (n.fee_policy === null) {
8903
8882
  const r = Lr.get(Fe());
8904
- throw new Error(r ?? _o);
8883
+ throw new Error(r ?? xo);
8905
8884
  }
8906
- return il(e, t, n.fee_policy);
8885
+ return sl(e, t, n.fee_policy);
8907
8886
  }
8908
- async function Sf(e, t, n) {
8887
+ async function _f(e, t, n) {
8909
8888
  const r = await Qt();
8910
8889
  await lr(e, t);
8911
8890
  const s = (await et())?.swapPubkey;
@@ -8914,7 +8893,7 @@ async function Sf(e, t, n) {
8914
8893
  const i = {
8915
8894
  balanceOf: Tn,
8916
8895
  reservesOf: We
8917
- }, o = await Pt("swap"), { token1FeeBps: a, token2FeeBps: c } = await dr(e, t), u = await Nl(
8896
+ }, o = await Pt("swap"), { token1FeeBps: a, token2FeeBps: c } = await dr(e, t), u = await kl(
8918
8897
  i,
8919
8898
  s,
8920
8899
  e,
@@ -8936,7 +8915,7 @@ async function Sf(e, t, n) {
8936
8915
  throw new Error("No data returned from swap request.");
8937
8916
  if (u.amounts.length < 2)
8938
8917
  throw new Error("Invalid amounts returned from swap request.");
8939
- const l = await xn(e), f = await xn(t), d = Bo(
8918
+ const l = await xn(e), f = await xn(t), d = Eo(
8940
8919
  e,
8941
8920
  r.wbtc_address,
8942
8921
  n,
@@ -8950,10 +8929,10 @@ async function Sf(e, t, n) {
8950
8929
  price_impact_bps: u.price_impact_bps,
8951
8930
  reserve_in: u.reserve_in,
8952
8931
  reserve_out: u.reserve_out,
8953
- fees: Eo(n, u.amounts[1], a, c, o)
8932
+ fees: So(n, u.amounts[1], a, c, o)
8954
8933
  };
8955
8934
  }
8956
- async function Ef(e) {
8935
+ async function Sf(e) {
8957
8936
  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;
8958
8937
  const t = `Swap Order:
8959
8938
  Token 1 Address: ${e.token1_addr}
@@ -8969,10 +8948,10 @@ ${e.referrer_pubkey ? `Referrer Pubkey: ${e.referrer_pubkey}
8969
8948
  By signing this message, you authorize the creation of a swap order with the above parameters.`;
8970
8949
  return await De(t, "ordinals");
8971
8950
  }
8972
- async function Bf(e) {
8951
+ async function Ef(e) {
8973
8952
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey, e.referrer_pubkey = e.referrer_pubkey?.startsWith("0x") ? e.referrer_pubkey.slice(2) : e.referrer_pubkey;
8974
8953
  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 += To.toString(16).padStart(8, "0"), e.ref_return_bps && e.ref_return_bps > 0n && (t += e.ref_return_bps.toString(16).padStart(8, "0")));
8954
+ t += e.nonce.toString(16).padStart(8, "0"), t += "03", t += e.token1_addr.slice(2).padStart(64, "0"), t += e.token2_addr.slice(2).padStart(64, "0"), t += e.in_amt.toString(16).padStart(64, "0"), t += e.min_out_amt.toString(16).padStart(64, "0"), t += e.token1FeeBps.toString(16).padStart(64, "0"), t += e.token2FeeBps.toString(16).padStart(64, "0"), t += e.btc_fee.toString(16).padStart(64, "0"), e.referrer_pubkey && (t += tt(B.from(e.referrer_pubkey, "hex")).slice(2), t += Io.toString(16).padStart(8, "0"), e.ref_return_bps && e.ref_return_bps > 0n && (t += e.ref_return_bps.toString(16).padStart(8, "0")));
8976
8955
  const n = B.from(t, "hex"), r = I.G1.hashToCurve(n, {
8977
8956
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
8978
8957
  }), s = await et();
@@ -8981,9 +8960,9 @@ async function Bf(e) {
8981
8960
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), a = I.shortSignatures.sign(r, o);
8982
8961
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
8983
8962
  }
8984
- async function vf(e) {
8963
+ async function Bf(e) {
8985
8964
  const t = await X("swap");
8986
- return J(t, {
8965
+ return z(t, {
8987
8966
  method: "POST",
8988
8967
  headers: {
8989
8968
  "Content-Type": "application/json"
@@ -8991,12 +8970,12 @@ async function vf(e) {
8991
8970
  body: JSON.stringify(e)
8992
8971
  });
8993
8972
  }
8994
- async function Of(e, t, n, r, s, i) {
8973
+ async function vf(e, t, n, r, s, i) {
8995
8974
  const o = (await et())?.swapPubkey;
8996
8975
  if (!o)
8997
8976
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8998
8977
  await lr(e, t);
8999
- const a = r * (10000n - s) / 10000n, c = await Ge(), u = await Pt("swap"), { token1FeeBps: l, token2FeeBps: f } = await dr(e, t), { referrerPubkey: d, refReturnBps: p } = i ? await rs(o, i) : { referrerPubkey: void 0, refReturnBps: void 0 }, w = await Ef({
8978
+ const a = r * (10000n - s) / 10000n, c = await Ge(), u = await Pt("swap"), { token1FeeBps: l, token2FeeBps: f } = await dr(e, t), { referrerPubkey: d, refReturnBps: p } = i ? await rs(o, i) : { referrerPubkey: void 0, refReturnBps: void 0 }, w = await Sf({
9000
8979
  token1_addr: e,
9001
8980
  token2_addr: t,
9002
8981
  in_amt: n.toString(),
@@ -9006,7 +8985,7 @@ async function Of(e, t, n, r, s, i) {
9006
8985
  btc_fee: u.toString(),
9007
8986
  referrer_pubkey: d,
9008
8987
  ref_return_bps: p ? p.toString() : void 0
9009
- }), h = await Bf({
8988
+ }), h = await Ef({
9010
8989
  pubkey: o,
9011
8990
  nonce: c,
9012
8991
  token1_addr: e,
@@ -9019,7 +8998,7 @@ async function Of(e, t, n, r, s, i) {
9019
8998
  referrer_pubkey: d,
9020
8999
  ref_return_bps: p
9021
9000
  });
9022
- return await vf({
9001
+ return await Bf({
9023
9002
  pubkey: o,
9024
9003
  token1_addr: e,
9025
9004
  token2_addr: t,
@@ -9034,7 +9013,7 @@ async function Of(e, t, n, r, s, i) {
9034
9013
  referrer_id: d ? i : void 0
9035
9014
  });
9036
9015
  }
9037
- async function If(e, t, n) {
9016
+ async function Of(e, t, n) {
9038
9017
  const r = await Qt();
9039
9018
  await lr(e, t);
9040
9019
  const s = (await et())?.swapPubkey;
@@ -9043,7 +9022,7 @@ async function If(e, t, n) {
9043
9022
  const i = {
9044
9023
  balanceOf: Tn,
9045
9024
  reservesOf: We
9046
- }, o = await Pt("swap"), { token1FeeBps: a, token2FeeBps: c } = await dr(e, t), u = await $l(
9025
+ }, o = await Pt("swap"), { token1FeeBps: a, token2FeeBps: c } = await dr(e, t), u = await Cl(
9047
9026
  i,
9048
9027
  s,
9049
9028
  e,
@@ -9065,7 +9044,7 @@ async function If(e, t, n) {
9065
9044
  throw new Error("No data returned from swap request.");
9066
9045
  if (u.amounts.length < 2)
9067
9046
  throw new Error("Invalid data returned from swap request.");
9068
- const l = await xn(e), f = await xn(t), d = Bo(
9047
+ const l = await xn(e), f = await xn(t), d = Eo(
9069
9048
  e,
9070
9049
  r.wbtc_address,
9071
9050
  u.amounts[0],
@@ -9079,10 +9058,10 @@ async function If(e, t, n) {
9079
9058
  price_impact_bps: u.price_impact_bps,
9080
9059
  reserve_in: u.reserve_in,
9081
9060
  reserve_out: u.reserve_out,
9082
- fees: Eo(u.amounts[0], n, a, c, o)
9061
+ fees: So(u.amounts[0], n, a, c, o)
9083
9062
  };
9084
9063
  }
9085
- async function Tf(e) {
9064
+ async function If(e) {
9086
9065
  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;
9087
9066
  const t = `Swap Order:
9088
9067
  Token 1 Address: ${e.token1_addr}
@@ -9098,10 +9077,10 @@ ${e.referrer_pubkey ? `Referrer Pubkey: ${e.referrer_pubkey}
9098
9077
  By signing this message, you authorize the creation of a swap order with the above parameters.`;
9099
9078
  return await De(t, "ordinals");
9100
9079
  }
9101
- async function Rf(e) {
9080
+ async function Tf(e) {
9102
9081
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey, e.referrer_pubkey = e.referrer_pubkey?.startsWith("0x") ? e.referrer_pubkey.slice(2) : e.referrer_pubkey;
9103
9082
  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 += To.toString(16).padStart(8, "0"), e.ref_return_bps && e.ref_return_bps > 0n && (t += e.ref_return_bps.toString(16).padStart(8, "0")));
9083
+ t += e.nonce.toString(16).padStart(8, "0"), t += "04", t += e.token1_addr.slice(2).padStart(64, "0"), t += e.token2_addr.slice(2).padStart(64, "0"), t += e.max_in_amt.toString(16).padStart(64, "0"), t += e.out_amt.toString(16).padStart(64, "0"), t += e.token1FeeBps.toString(16).padStart(64, "0"), t += e.token2FeeBps.toString(16).padStart(64, "0"), t += e.btc_fee.toString(16).padStart(64, "0"), e.referrer_pubkey && (t += tt(B.from(e.referrer_pubkey, "hex")).slice(2), t += Io.toString(16).padStart(8, "0"), e.ref_return_bps && e.ref_return_bps > 0n && (t += e.ref_return_bps.toString(16).padStart(8, "0")));
9105
9084
  const n = B.from(t, "hex"), r = I.G1.hashToCurve(n, {
9106
9085
  DST: "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"
9107
9086
  }), s = await et();
@@ -9110,9 +9089,9 @@ async function Rf(e) {
9110
9089
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), a = I.shortSignatures.sign(r, o);
9111
9090
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
9112
9091
  }
9113
- async function kf(e) {
9092
+ async function Rf(e) {
9114
9093
  const t = await X("swap2");
9115
- return J(t, {
9094
+ return z(t, {
9116
9095
  method: "POST",
9117
9096
  headers: {
9118
9097
  "Content-Type": "application/json"
@@ -9120,12 +9099,12 @@ async function kf(e) {
9120
9099
  body: JSON.stringify(e)
9121
9100
  });
9122
9101
  }
9123
- async function Nf(e, t, n, r, s, i) {
9102
+ async function kf(e, t, n, r, s, i) {
9124
9103
  const o = (await et())?.swapPubkey;
9125
9104
  if (!o)
9126
9105
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
9127
9106
  await lr(e, t);
9128
- const a = n * (10000n + s) / 10000n, c = await Ge(), u = await Pt("swap"), { token1FeeBps: l, token2FeeBps: f } = await dr(e, t), { referrerPubkey: d, refReturnBps: p } = i ? await rs(o, i) : { referrerPubkey: void 0, refReturnBps: void 0 }, w = await Tf({
9107
+ const a = n * (10000n + s) / 10000n, c = await Ge(), u = await Pt("swap"), { token1FeeBps: l, token2FeeBps: f } = await dr(e, t), { referrerPubkey: d, refReturnBps: p } = i ? await rs(o, i) : { referrerPubkey: void 0, refReturnBps: void 0 }, w = await If({
9129
9108
  token1_addr: e,
9130
9109
  token2_addr: t,
9131
9110
  max_in_amt: a.toString(),
@@ -9135,7 +9114,7 @@ async function Nf(e, t, n, r, s, i) {
9135
9114
  btc_fee: u.toString(),
9136
9115
  referrer_pubkey: d,
9137
9116
  ref_return_bps: p ? p.toString() : void 0
9138
- }), h = await Rf({
9117
+ }), h = await Tf({
9139
9118
  pubkey: o,
9140
9119
  nonce: c,
9141
9120
  token1_addr: e,
@@ -9148,7 +9127,7 @@ async function Nf(e, t, n, r, s, i) {
9148
9127
  referrer_pubkey: d,
9149
9128
  ref_return_bps: p
9150
9129
  });
9151
- return await kf({
9130
+ return await Rf({
9152
9131
  pubkey: o,
9153
9132
  token1_addr: e,
9154
9133
  token2_addr: t,
@@ -9163,11 +9142,11 @@ async function Nf(e, t, n, r, s, i) {
9163
9142
  referrer_id: d ? i : void 0
9164
9143
  });
9165
9144
  }
9166
- function Do(e) {
9145
+ function qo(e) {
9167
9146
  const t = Jt();
9168
9147
  return `0x${tt(he.address.toOutputScript(e, t)).slice(26)}`;
9169
9148
  }
9170
- async function Mo(e) {
9149
+ async function Do(e) {
9171
9150
  e.token_address = e.token_address.toLowerCase(), e.target_addr = e.target_addr.toLowerCase();
9172
9151
  const t = `Withdraw Order:
9173
9152
  Token Address: ${e.token_address}
@@ -9180,7 +9159,7 @@ BTC Fee: ${e.btc_fee}
9180
9159
  By signing this message, you authorize the creation of a withdraw order with the above parameters.`;
9181
9160
  return await De(t, "ordinals");
9182
9161
  }
9183
- async function Wo(e) {
9162
+ async function Mo(e) {
9184
9163
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
9185
9164
  let t = tt(B.from(e.pubkey, "hex")).slice(2);
9186
9165
  t += e.nonce.toString(16).padStart(8, "0"), t += "05", t += e.token_addr.slice(2).padStart(40, "0"), t += e.target_addr.slice(2).padStart(40, "0"), t += e.amt.toString(16).padStart(64, "0"), t += e.btc_fee.toString(16).padStart(64, "0");
@@ -9192,9 +9171,9 @@ async function Wo(e) {
9192
9171
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), a = I.shortSignatures.sign(r, o);
9193
9172
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
9194
9173
  }
9195
- async function Go(e) {
9174
+ async function Wo(e) {
9196
9175
  const t = await X("withdraw");
9197
- return J(t, {
9176
+ return z(t, {
9198
9177
  method: "POST",
9199
9178
  headers: {
9200
9179
  "Content-Type": "application/json"
@@ -9202,18 +9181,18 @@ async function Go(e) {
9202
9181
  body: JSON.stringify(e)
9203
9182
  });
9204
9183
  }
9205
- async function Cf(e, t, n) {
9184
+ async function Nf(e, t, n) {
9206
9185
  const r = (await et())?.swapPubkey;
9207
9186
  if (!r)
9208
9187
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
9209
- const i = Do(t), o = 0n, a = 0n, c = await Ge(), u = await Pt("withdraw"), l = await Mo({
9188
+ const i = qo(t), o = 0n, a = 0n, c = await Ge(), u = await Pt("withdraw"), l = await Do({
9210
9189
  token_address: e,
9211
9190
  target_addr: i,
9212
9191
  amt: n.toString(),
9213
9192
  token1FeeBps: o.toString(),
9214
9193
  token2FeeBps: a.toString(),
9215
9194
  btc_fee: u.toString()
9216
- }), f = await Wo({
9195
+ }), f = await Mo({
9217
9196
  pubkey: r,
9218
9197
  nonce: c,
9219
9198
  token_addr: e,
@@ -9221,7 +9200,7 @@ async function Cf(e, t, n) {
9221
9200
  amt: n,
9222
9201
  btc_fee: u
9223
9202
  });
9224
- return await Go({
9203
+ return await Wo({
9225
9204
  pubkey: r,
9226
9205
  token_addr: e,
9227
9206
  target_addr: i,
@@ -9233,21 +9212,21 @@ async function Cf(e, t, n) {
9233
9212
  bip322_signature: l
9234
9213
  });
9235
9214
  }
9236
- async function $f(e, t) {
9215
+ async function Cf(e, t) {
9237
9216
  const n = (await et())?.swapPubkey;
9238
9217
  if (!n)
9239
9218
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
9240
9219
  const r = Lt();
9241
9220
  if (!r || !r.address)
9242
9221
  throw new Error("Ordinals wallet not found. Please set up your ordinals wallet first.");
9243
- const s = r.address, i = Do(s), o = 0n, a = 0n, c = await Ge(), u = await Pt("withdraw"), l = await Mo({
9222
+ const s = r.address, i = qo(s), o = 0n, a = 0n, c = await Ge(), u = await Pt("withdraw"), l = await Do({
9244
9223
  token_address: e,
9245
9224
  target_addr: i,
9246
9225
  amt: t.toString(),
9247
9226
  token1FeeBps: o.toString(),
9248
9227
  token2FeeBps: a.toString(),
9249
9228
  btc_fee: u.toString()
9250
- }), f = await Wo({
9229
+ }), f = await Mo({
9251
9230
  pubkey: n,
9252
9231
  nonce: c,
9253
9232
  token_addr: e,
@@ -9255,7 +9234,7 @@ async function $f(e, t) {
9255
9234
  amt: t,
9256
9235
  btc_fee: u
9257
9236
  });
9258
- return await Go({
9237
+ return await Wo({
9259
9238
  pubkey: n,
9260
9239
  token_addr: e,
9261
9240
  target_addr: i,
@@ -9267,7 +9246,7 @@ async function $f(e, t) {
9267
9246
  bip322_signature: l
9268
9247
  });
9269
9248
  }
9270
- async function Af(e, t) {
9249
+ async function $f(e, t) {
9271
9250
  const n = await Qt();
9272
9251
  or(n.wbtc_address, n.factory_address);
9273
9252
  const r = (await et())?.swapPubkey;
@@ -9276,7 +9255,7 @@ async function Af(e, t) {
9276
9255
  const s = {
9277
9256
  balanceOf: Tn,
9278
9257
  reservesOf: We
9279
- }, i = await Pt("unwrap"), o = await Ll(
9258
+ }, i = await Pt("unwrap"), o = await Al(
9280
9259
  s,
9281
9260
  r,
9282
9261
  e,
@@ -9293,7 +9272,7 @@ async function Af(e, t) {
9293
9272
  throw new Error("No data returned from unwrap request.");
9294
9273
  return { amt: o.data.amt };
9295
9274
  }
9296
- async function Lf(e) {
9275
+ async function Af(e) {
9297
9276
  e.pkscript = e.pkscript.toLowerCase();
9298
9277
  const t = `Unwrap Order:
9299
9278
  Pkscript: ${e.pkscript}
@@ -9305,7 +9284,7 @@ BTC Fee: ${e.btc_fee}
9305
9284
  By signing this message, you authorize the creation of a withdraw order with the above parameters.`;
9306
9285
  return await De(t, "ordinals");
9307
9286
  }
9308
- async function Pf(e) {
9287
+ async function Lf(e) {
9309
9288
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
9310
9289
  let t = tt(B.from(e.pubkey, "hex")).slice(2);
9311
9290
  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");
@@ -9317,9 +9296,9 @@ async function Pf(e) {
9317
9296
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = B.from(i, "hex"), a = I.shortSignatures.sign(r, o);
9318
9297
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
9319
9298
  }
9320
- async function Ff(e) {
9299
+ async function Pf(e) {
9321
9300
  const t = await X("unwrap");
9322
- return J(t, {
9301
+ return z(t, {
9323
9302
  method: "POST",
9324
9303
  headers: {
9325
9304
  "Content-Type": "application/json"
@@ -9327,24 +9306,24 @@ async function Ff(e) {
9327
9306
  body: JSON.stringify(e)
9328
9307
  });
9329
9308
  }
9330
- async function Uf(e, t) {
9309
+ async function Ff(e, t) {
9331
9310
  const n = (await et())?.swapPubkey;
9332
9311
  if (!n)
9333
9312
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
9334
- const r = 0n, s = 0n, i = await Ge(), o = await Pt("unwrap"), a = await Lf({
9313
+ const r = 0n, s = 0n, i = await Ge(), o = await Pt("unwrap"), a = await Af({
9335
9314
  pkscript: e,
9336
9315
  amt: t.toString(),
9337
9316
  token1FeeBps: r.toString(),
9338
9317
  token2FeeBps: s.toString(),
9339
9318
  btc_fee: o.toString()
9340
- }), c = await Pf({
9319
+ }), c = await Lf({
9341
9320
  pubkey: n,
9342
9321
  nonce: i,
9343
9322
  pkscript: e,
9344
9323
  amt: t,
9345
9324
  btc_fee: o
9346
9325
  });
9347
- return await Ff({
9326
+ return await Pf({
9348
9327
  pubkey: n,
9349
9328
  pkscript: e,
9350
9329
  amt: t.toString(),
@@ -9355,8 +9334,8 @@ async function Uf(e, t) {
9355
9334
  bip322_signature: a
9356
9335
  });
9357
9336
  }
9358
- async function qf(e, t, n, r, s) {
9359
- return await rf({
9337
+ async function Uf(e, t, n, r, s) {
9338
+ return await nf({
9360
9339
  pubkey: e,
9361
9340
  pairAddress: t,
9362
9341
  limit: n,
@@ -9364,18 +9343,18 @@ async function qf(e, t, n, r, s) {
9364
9343
  kinds: s
9365
9344
  });
9366
9345
  }
9367
- async function Df(e, t, n) {
9368
- return await Ql({
9346
+ async function qf(e, t, n) {
9347
+ return await jl({
9369
9348
  pair_address: e,
9370
9349
  limit: t || 20,
9371
9350
  offset: n || 0
9372
9351
  });
9373
9352
  }
9374
- async function Mf(e) {
9375
- return await ef(e);
9353
+ async function Df(e) {
9354
+ return await tf(e);
9376
9355
  }
9377
- async function Wf(e, t, n, r, s) {
9378
- return (await gf(
9356
+ async function Mf(e, t, n, r, s) {
9357
+ return (await wf(
9379
9358
  e,
9380
9359
  t,
9381
9360
  n,
@@ -9383,8 +9362,8 @@ async function Wf(e, t, n, r, s) {
9383
9362
  s
9384
9363
  )).success;
9385
9364
  }
9386
- async function Gf(e, t, n, r, s, i) {
9387
- return (await _f(
9365
+ async function Wf(e, t, n, r, s, i) {
9366
+ return (await xf(
9388
9367
  e,
9389
9368
  t,
9390
9369
  n,
@@ -9393,8 +9372,8 @@ async function Gf(e, t, n, r, s, i) {
9393
9372
  i
9394
9373
  )).success;
9395
9374
  }
9396
- async function Hf(e, t, n, r, s, i) {
9397
- return (await Of(
9375
+ async function Gf(e, t, n, r, s, i) {
9376
+ return (await vf(
9398
9377
  e,
9399
9378
  t,
9400
9379
  n,
@@ -9403,8 +9382,8 @@ async function Hf(e, t, n, r, s, i) {
9403
9382
  i
9404
9383
  )).success;
9405
9384
  }
9406
- async function Vf(e, t, n, r, s, i) {
9407
- return (await Nf(
9385
+ async function Hf(e, t, n, r, s, i) {
9386
+ return (await kf(
9408
9387
  e,
9409
9388
  t,
9410
9389
  n,
@@ -9413,11 +9392,11 @@ async function Vf(e, t, n, r, s, i) {
9413
9392
  i
9414
9393
  )).success;
9415
9394
  }
9416
- async function Zf(e, t) {
9417
- return (await Uf(e, t)).success;
9395
+ async function Vf(e, t) {
9396
+ return (await Ff(e, t)).success;
9418
9397
  }
9419
- async function Yf(e, t, n, r = !0, s, i) {
9420
- return await of(
9398
+ async function Zf(e, t, n, r = !0, s, i) {
9399
+ return await sf(
9421
9400
  e,
9422
9401
  t,
9423
9402
  n,
@@ -9426,61 +9405,61 @@ async function Yf(e, t, n, r = !0, s, i) {
9426
9405
  i
9427
9406
  );
9428
9407
  }
9429
- async function Kf(e, t, n) {
9430
- return await lf(e, t, n);
9408
+ async function Yf(e, t, n) {
9409
+ return await uf(e, t, n);
9431
9410
  }
9432
- async function Xf(e, t, n) {
9433
- return n ? (await Cf(e, n, t)).success : (await $f(e, t)).success;
9411
+ async function Kf(e, t, n) {
9412
+ return n ? (await Nf(e, n, t)).success : (await Cf(e, t)).success;
9434
9413
  }
9435
- const Ad = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9414
+ const $d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9436
9415
  __proto__: null,
9437
- addLiquidity: Wf,
9438
- createSwapWallet: No,
9439
- deposit: Yf,
9440
- ensureSwapWallet: Ml,
9441
- getActivityOfPair: Df,
9442
- getAddLiquidityResult: df,
9443
- getKlines: Jl,
9416
+ addLiquidity: Mf,
9417
+ createSwapWallet: ko,
9418
+ deposit: Zf,
9419
+ ensureSwapWallet: Dl,
9420
+ getActivityOfPair: qf,
9421
+ getAddLiquidityResult: ff,
9422
+ getKlines: zl,
9444
9423
  getMinerFee: Pt,
9445
- getMinerFeesOfDepositOrder: af,
9446
- getMinerFeesOfWrapOrder: ff,
9424
+ getMinerFeesOfDepositOrder: of,
9425
+ getMinerFeesOfWrapOrder: lf,
9447
9426
  getPairAddress: ar,
9448
9427
  getPairReserves: We,
9449
- getPairVolumeOverDays: zl,
9450
- getRecentActivity: Mf,
9451
- getRemoveLiquidityResult: yf,
9452
- getSwapBalance: Zl,
9453
- getSwapBalances: Vl,
9454
- getSwapExactInputResult: Sf,
9455
- getSwapExactOutputResult: If,
9428
+ getPairVolumeOverDays: Xl,
9429
+ getRecentActivity: Df,
9430
+ getRemoveLiquidityResult: gf,
9431
+ getSwapBalance: Vl,
9432
+ getSwapBalances: Hl,
9433
+ getSwapExactInputResult: _f,
9434
+ getSwapExactOutputResult: Of,
9456
9435
  getSwapInfo: Qt,
9457
- getSwapStatus: Gl,
9458
- getSwapWalletSecurityCode: Wl,
9436
+ getSwapStatus: Wl,
9437
+ getSwapWalletSecurityCode: Ml,
9459
9438
  getTokenDecimals: xn,
9460
- getTvlHistory: jl,
9461
- getUnwrapBtcResult: Af,
9462
- getWalletActivities: qf,
9463
- importSwapWallet: Dl,
9464
- listPairs: Xl,
9465
- listTokens: Kl,
9466
- removeLiquidity: Gf,
9467
- satsToBtc: So,
9468
- satsToUsd: cl,
9469
- swapExactInput: Hf,
9470
- swapExactOutput: Vf,
9471
- swapSide: al,
9439
+ getTvlHistory: Jl,
9440
+ getUnwrapBtcResult: $f,
9441
+ getWalletActivities: Uf,
9442
+ importSwapWallet: ql,
9443
+ listPairs: Kl,
9444
+ listTokens: Yl,
9445
+ removeLiquidity: Wf,
9446
+ satsToBtc: _o,
9447
+ satsToUsd: al,
9448
+ swapExactInput: Gf,
9449
+ swapExactOutput: Hf,
9450
+ swapSide: ol,
9472
9451
  tryGetSwapReferrerInfo: rs,
9473
- unwrapBtc: Zf,
9474
- withdraw: Xf,
9475
- wrapBtc: Kf
9476
- }, Symbol.toStringTag, { value: "Module" })), zf = "text/plain", Ho = /^[a-z0-9-]{6}$/i, Jf = /^(?:[0-9a-f]{2})+$/i;
9452
+ unwrapBtc: Vf,
9453
+ withdraw: Kf,
9454
+ wrapBtc: Yf
9455
+ }, Symbol.toStringTag, { value: "Module" })), Xf = "text/plain", Go = /^[a-z0-9-]{6}$/i, zf = /^(?:[0-9a-f]{2})+$/i;
9477
9456
  function ss(e) {
9478
9457
  if (typeof e != "string" || e.length === 0)
9479
9458
  throw new Error("tick must be a non-empty string");
9480
9459
  return Y.str(e).length;
9481
9460
  }
9482
9461
  function Pr(e, t) {
9483
- if (typeof e != "string" || !Jf.test(e))
9462
+ if (typeof e != "string" || !zf.test(e))
9484
9463
  throw new Error(`${t} must be a non-empty hex string`);
9485
9464
  }
9486
9465
  function Yn(e, t) {
@@ -9489,7 +9468,7 @@ function Yn(e, t) {
9489
9468
  }
9490
9469
  function _n(e) {
9491
9470
  return new Kt(
9492
- Y.str(zf),
9471
+ Y.str(Xf),
9493
9472
  null,
9494
9473
  null,
9495
9474
  null,
@@ -9497,7 +9476,7 @@ function _n(e) {
9497
9476
  Y.str(JSON.stringify(e))
9498
9477
  );
9499
9478
  }
9500
- function Vo(e, t, n) {
9479
+ function Ho(e, t, n) {
9501
9480
  Yn(e.max, "max"), e.lim != null && Yn(e.lim, "lim");
9502
9481
  const r = t === 5 || n != null;
9503
9482
  if (r && e.selfMint === !1)
@@ -9507,15 +9486,15 @@ function Vo(e, t, n) {
9507
9486
  const s = r || e.selfMint === !0, i = { p: "brc-20", op: "deploy", tick: e.tick };
9508
9487
  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;
9509
9488
  }
9510
- function jf(e) {
9489
+ function Jf(e) {
9511
9490
  const t = ss(e.tick);
9512
9491
  if (t === 6)
9513
9492
  throw new Error("6-byte tickers require a predeploy; use predeployInscriptions()");
9514
9493
  if (t !== 4 && t !== 5)
9515
9494
  throw new Error(`deploy ticker must be 4 or 5 bytes, got ${t}`);
9516
- return _n(Vo(e, t, null));
9495
+ return _n(Ho(e, t, null));
9517
9496
  }
9518
- function Qf(e) {
9497
+ function jf(e) {
9519
9498
  const t = ss(e.tick);
9520
9499
  if (t < 4 || t > 6) throw new Error(`ticker must be 4-6 bytes, got ${t}`);
9521
9500
  return Yn(e.amt, "amt"), _n({ p: "brc-20", op: "mint", tick: e.tick, amt: e.amt });
@@ -9525,18 +9504,18 @@ function is(e) {
9525
9504
  if (t < 4 || t > 6) throw new Error(`ticker must be 4-6 bytes, got ${t}`);
9526
9505
  return Yn(e.amt, "amt"), _n({ p: "brc-20", op: "transfer", tick: e.tick, amt: e.amt });
9527
9506
  }
9528
- function Zo(e = 16) {
9507
+ function Vo(e = 16) {
9529
9508
  if (!Number.isInteger(e) || e <= 0)
9530
9509
  throw new Error("byteLength must be a positive integer");
9531
9510
  return Y.random(e).hex;
9532
9511
  }
9533
- function td(e) {
9512
+ function Qf(e) {
9534
9513
  if (typeof e != "string" || e.length === 0)
9535
9514
  throw new Error("address must be a non-empty string");
9536
9515
  return he.address.toOutputScript(e, Jt()).toString("hex");
9537
9516
  }
9538
- function Yo(e, t, n) {
9539
- if (typeof e != "string" || !Ho.test(e))
9517
+ function Zo(e, t, n) {
9518
+ if (typeof e != "string" || !Go.test(e))
9540
9519
  throw new Error("6-byte ticker must match /^[A-Za-z0-9-]{6}$/");
9541
9520
  Pr(t, "salt"), Pr(n, "pkscript");
9542
9521
  const r = B.concat([
@@ -9546,12 +9525,12 @@ function Yo(e, t, n) {
9546
9525
  ]);
9547
9526
  return he.crypto.hash256(r).toString("hex");
9548
9527
  }
9549
- function ed(e) {
9550
- if (typeof e.tick != "string" || !Ho.test(e.tick))
9528
+ function td(e) {
9529
+ if (typeof e.tick != "string" || !Go.test(e.tick))
9551
9530
  throw new Error("6-byte ticker must match /^[A-Za-z0-9-]{6}$/");
9552
- const t = td(e.address), n = e.salt ?? Zo();
9531
+ const t = Qf(e.address), n = e.salt ?? Vo();
9553
9532
  Pr(n, "salt");
9554
- const r = Yo(e.tick, n, t), s = Vo(
9533
+ const r = Zo(e.tick, n, t), s = Ho(
9555
9534
  { tick: e.tick, max: e.max, lim: e.lim, dec: e.dec },
9556
9535
  6,
9557
9536
  n
@@ -9563,7 +9542,7 @@ function ed(e) {
9563
9542
  deploy: _n(s)
9564
9543
  };
9565
9544
  }
9566
- const Rr = 12e3, nd = 1e5, os = 1e3, rd = /^\d+(?:\.\d{1,18})?$/, sd = [
9545
+ const Rr = 12e3, ed = 1e5, os = 1e3, nd = /^\d+(?:\.\d{1,18})?$/, rd = [
9567
9546
  {
9568
9547
  name: "transfer",
9569
9548
  type: "function",
@@ -9575,7 +9554,7 @@ const Rr = 12e3, nd = 1e5, os = 1e3, rd = /^\d+(?:\.\d{1,18})?$/, sd = [
9575
9554
  outputs: [{ name: "", type: "bool" }]
9576
9555
  }
9577
9556
  ];
9578
- function Ko(e, t) {
9557
+ function Yo(e, t) {
9579
9558
  if (e.maxSendInputs == null) return;
9580
9559
  const n = he.Transaction.fromHex(t).ins.length;
9581
9560
  if (n > e.maxSendInputs)
@@ -9592,11 +9571,11 @@ function Kn() {
9592
9571
  null
9593
9572
  );
9594
9573
  }
9595
- function Xo(e) {
9574
+ function Ko(e) {
9596
9575
  return new Kt(Y.str("text/plain"), null, null, null, null, e);
9597
9576
  }
9598
- function zo(e) {
9599
- return e.isOpReturn ? 1 : ma(e);
9577
+ function Xo(e) {
9578
+ return e.isOpReturn ? 1 : ba(e);
9600
9579
  }
9601
9580
  async function as(e, t, n) {
9602
9581
  let r = Y.str(
@@ -9606,14 +9585,14 @@ async function as(e, t, n) {
9606
9585
  const s = Math.ceil((n - r.length * Rr) / Rr);
9607
9586
  r = r.append("20".repeat(s));
9608
9587
  }
9609
- return Xo(r);
9588
+ return Ko(r);
9610
9589
  }
9611
- function Jo(e, t, n) {
9590
+ function zo(e, t, n) {
9612
9591
  const r = [...e.extraOutputs ?? []], s = 1 + r.length;
9613
9592
  return t || r.push({ wallet: n, value: os }), { outputs: r, linkVout: s };
9614
9593
  }
9615
9594
  function Fr(e, t) {
9616
- if (typeof e != "string" || !rd.test(e))
9595
+ if (typeof e != "string" || !nd.test(e))
9617
9596
  throw new Error(`${t} must be a decimal string with at most 18 fractional digits`);
9618
9597
  const [n, r = ""] = e.split(".");
9619
9598
  return BigInt(n) * 10n ** 18n + BigInt(r.padEnd(18, "0"));
@@ -9631,7 +9610,7 @@ function pr(e) {
9631
9610
  if (typeof e != "number" || !Number.isFinite(e) || e <= 0)
9632
9611
  throw new Error("feeRate must be a positive number");
9633
9612
  }
9634
- function jo() {
9613
+ function Jo() {
9635
9614
  const e = rn();
9636
9615
  if (!e || !e.wallets) throw new Error("Wallets not found");
9637
9616
  const t = Sn(), n = Lt();
@@ -9642,8 +9621,8 @@ function jo() {
9642
9621
  payerWallet: new xt(!1, null, t.address, null, t.pubkey)
9643
9622
  };
9644
9623
  }
9645
- async function id(e, t, n) {
9646
- const { provider: r, payerWallet: s } = jo(), o = new cr(n, e.length * 2).wrap(Xn(r)), a = Qe(
9624
+ async function sd(e, t, n) {
9625
+ const { provider: r, payerWallet: s } = Jo(), o = new cr(n, e.length * 2).wrap(Xn(r)), a = Qe(
9647
9626
  s.outputScript,
9648
9627
  Jt()
9649
9628
  ), c = {}, u = [];
@@ -9670,17 +9649,17 @@ async function id(e, t, n) {
9670
9649
  o
9671
9650
  );
9672
9651
  u.push(h.signedCommitTxHex, h.signedRevealTxHex), _t(u, [h.inscriptionId, `${h.revealTxId}:0:0`]);
9673
- const { outputs: g, linkVout: b } = Jo(d, p, s), m = await pn(
9652
+ const { outputs: g, linkVout: b } = zo(d, p, s), m = await pn(
9674
9653
  h.inscriptionId,
9675
9654
  [],
9676
9655
  d.target,
9677
- zo(d.target),
9656
+ Xo(d.target),
9678
9657
  g,
9679
9658
  t,
9680
9659
  !0,
9681
9660
  o
9682
9661
  );
9683
- Ko(d, m.signedTxHex), u.push(m.signedTxHex), l = { utxo: `${m.txId}:${b}` }, c[d.name] = {
9662
+ Yo(d, m.signedTxHex), u.push(m.signedTxHex), l = { utxo: `${m.txId}:${b}` }, c[d.name] = {
9684
9663
  commitTxId: h.commitTxId,
9685
9664
  revealTxId: h.revealTxId,
9686
9665
  sendTxId: m.txId,
@@ -9692,8 +9671,8 @@ async function id(e, t, n) {
9692
9671
  }
9693
9672
  return { parts: c, txHexes: u };
9694
9673
  }
9695
- async function od(e, t) {
9696
- const { payerWallet: n } = jo(), r = Qe(
9674
+ async function id(e, t) {
9675
+ const { payerWallet: n } = Jo(), r = Qe(
9697
9676
  n.outputScript,
9698
9677
  Jt()
9699
9678
  ), s = await qr(n.addr), i = [], o = [];
@@ -9721,7 +9700,7 @@ async function od(e, t) {
9721
9700
  o.push(h.unsigned_commit_tx_hex, h.signed_reveal_tx_hex);
9722
9701
  const g = h.inscription_id.split("i")[0];
9723
9702
  _t(o, [h.inscription_id, `${g}:0:0`]);
9724
- const b = zo(d.target), { outputs: m, linkVout: v } = Jo(d, p, n), T = await dn(
9703
+ const b = Xo(d.target), { outputs: m, linkVout: v } = zo(d, p, n), T = await dn(
9725
9704
  h.inscription_id,
9726
9705
  [],
9727
9706
  d.target,
@@ -9730,7 +9709,7 @@ async function od(e, t) {
9730
9709
  t,
9731
9710
  s
9732
9711
  );
9733
- Ko(d, T.unsigned_tx_hex), o.push(T.unsigned_tx_hex), a = { utxo: `${T.txid}:${v}` }, i.push({
9712
+ Yo(d, T.unsigned_tx_hex), o.push(T.unsigned_tx_hex), a = { utxo: `${T.txid}:${v}` }, i.push({
9734
9713
  step: d.name,
9735
9714
  minerFeeSats: h.total_fee + T.tx_fee,
9736
9715
  postageSats: b,
@@ -9753,15 +9732,15 @@ async function od(e, t) {
9753
9732
  };
9754
9733
  }
9755
9734
  async function us(e, t, n, r) {
9756
- if (n) return await od(e, t);
9757
- const { parts: s, txHexes: i } = await id(e, t, r);
9758
- if (await ba(i) == null) throw new Error("Broadcast request failed");
9735
+ if (n) return await id(e, t);
9736
+ const { parts: s, txHexes: i } = await sd(e, t, r);
9737
+ if (await ya(i) == null) throw new Error("Broadcast request failed");
9759
9738
  return {
9760
9739
  parts: s,
9761
9740
  txIds: i.map((a) => he.Transaction.fromHex(a).getId())
9762
9741
  };
9763
9742
  }
9764
- async function ad(e) {
9743
+ async function od(e) {
9765
9744
  const { tick: t, fromBrc20Amount: n, fromProgAmount: r, recipient: s, feeRate: i, dryRun: o } = e;
9766
9745
  if (typeof o != "boolean") throw new Error("dryRun must be a boolean");
9767
9746
  pr(i), cs(s);
@@ -9775,7 +9754,7 @@ async function ad(e) {
9775
9754
  target: u
9776
9755
  }), c > 0n && l.push({
9777
9756
  name: "progWithdraw",
9778
- inscription: Xo(
9757
+ inscription: Ko(
9779
9758
  Y.str(
9780
9759
  `{"p":"brc20-module","op":"withdraw","tick":"${t}","amt":"${r}","module":"BRC20PROG"}`
9781
9760
  )
@@ -9789,7 +9768,7 @@ async function ad(e) {
9789
9768
  txIds: f.txIds
9790
9769
  } : f;
9791
9770
  }
9792
- async function cd(e) {
9771
+ async function ad(e) {
9793
9772
  const { tick: t, contractAddress: n, topUpFromBrc20: r, amount: s, recipient: i, feeRate: o, dryRun: a } = e;
9794
9773
  if (typeof a != "boolean") throw new Error("dryRun must be a boolean");
9795
9774
  if (pr(o), cs(i), typeof n != "string" || !/^0x[0-9a-fA-F]{40}$/.test(n))
@@ -9804,13 +9783,13 @@ async function cd(e) {
9804
9783
  inscription: is({ tick: t, amt: r }),
9805
9784
  target: Kn()
9806
9785
  });
9807
- const l = zn(sd, "transfer", [
9786
+ const l = zn(rd, "transfer", [
9808
9787
  Wr(i),
9809
9788
  s.toString()
9810
9789
  ]);
9811
9790
  u.push({
9812
9791
  name: "progTransfer",
9813
- inscription: await as(n, l, nd),
9792
+ inscription: await as(n, l, ed),
9814
9793
  target: Kn()
9815
9794
  });
9816
9795
  const f = await us(u, o, a, e);
@@ -9820,10 +9799,10 @@ async function cd(e) {
9820
9799
  txIds: f.txIds
9821
9800
  } : f;
9822
9801
  }
9823
- const ud = {
9802
+ const cd = {
9824
9803
  mainnet: "0xdbb5b6a1d422fca2813cf486e5f986adb09d8337",
9825
9804
  signet: "0x1eb63d0d0e5a86146b4e1cebc79b1d6e35093288"
9826
- }, Qo = 546, ld = 1, fd = 4e5, ls = 8, ta = fd * (1 + ls) + 4e5, hr = [
9805
+ }, jo = 546, ud = 1, ld = 4e5, ls = 8, Qo = ld * (1 + ls) + 4e5, hr = [
9827
9806
  {
9828
9807
  name: "wrap",
9829
9808
  type: "function",
@@ -9858,46 +9837,46 @@ const ud = {
9858
9837
  }
9859
9838
  ];
9860
9839
  function Rn() {
9861
- const e = ud[Fe()];
9840
+ const e = cd[Fe()];
9862
9841
  if (!e) throw new Error(`frBTC is not deployed on ${Fe()}`);
9863
9842
  return e;
9864
9843
  }
9865
- async function ea() {
9844
+ async function ta() {
9866
9845
  const e = await Jn(Rn(), hr, "getSignerAddress", []), t = e.startsWith("0x") ? e.slice(2) : e, n = Number.parseInt(t.slice(64, 128), 16);
9867
9846
  if (!Number.isSafeInteger(n) || n === 0)
9868
9847
  throw new Error("frBTC returned no signer address");
9869
9848
  return B.from(t.slice(128, 128 + n * 2), "hex");
9870
9849
  }
9871
- async function na(e) {
9850
+ async function ea(e) {
9872
9851
  const t = await Jn(Rn(), hr, "balanceOf", [
9873
9852
  Wr(e)
9874
9853
  ]);
9875
9854
  return BigInt(t);
9876
9855
  }
9877
- function ra(e, t) {
9856
+ function na(e, t) {
9878
9857
  if (typeof e != "bigint" || e < t)
9879
9858
  throw new Error(`amount must be a bigint of at least ${t} sats`);
9880
9859
  }
9881
- function sa(e) {
9860
+ function ra(e) {
9882
9861
  if (typeof e != "boolean") throw new Error("dryRun must be a boolean");
9883
9862
  }
9884
- function ia() {
9863
+ function sa() {
9885
9864
  const e = Lt()?.address;
9886
9865
  if (!e) throw new Error("Ordinals wallet not found");
9887
9866
  return e;
9888
9867
  }
9889
- async function oa(e, t, n, r) {
9868
+ async function ia(e, t, n, r) {
9890
9869
  const s = await us([e], t, n, r);
9891
9870
  return "parts" in s ? { call: s.parts[e.name], txIds: s.txIds } : s;
9892
9871
  }
9893
- async function dd(e) {
9872
+ async function fd(e) {
9894
9873
  const { amount: t, feeRate: n, dryRun: r } = e;
9895
- sa(r), pr(n), ra(t, BigInt(Qo)), ia();
9896
- const s = await ea(), i = zn(hr, "wrap", []);
9897
- return await oa(
9874
+ ra(r), pr(n), na(t, BigInt(jo)), sa();
9875
+ const s = await ta(), i = zn(hr, "wrap", []);
9876
+ return await ia(
9898
9877
  {
9899
9878
  name: "frBtcWrap",
9900
- inscription: await as(Rn(), i, ta),
9879
+ inscription: await as(Rn(), i, Qo),
9901
9880
  target: Kn(),
9902
9881
  extraOutputs: [
9903
9882
  { wallet: new xt(!1, s, null, null, null), value: Number(t) }
@@ -9909,26 +9888,26 @@ async function dd(e) {
9909
9888
  e
9910
9889
  );
9911
9890
  }
9912
- async function pd(e) {
9891
+ async function dd(e) {
9913
9892
  const { amount: t, recipient: n, feeRate: r, dryRun: s } = e;
9914
- sa(s), pr(r), ra(t, 1n), cs(n);
9915
- const i = await na(ia());
9893
+ ra(s), pr(r), na(t, 1n), cs(n);
9894
+ const i = await ea(sa());
9916
9895
  if (i < t)
9917
9896
  throw new Error(`Insufficient BRC2.0 frBTC balance: ${i} sats, need ${t}`);
9918
- const o = he.address.toOutputScript(n, Jt()), a = await ea(), c = zn(hr, "unwrap2", [
9897
+ const o = he.address.toOutputScript(n, Jt()), a = await ta(), c = zn(hr, "unwrap2", [
9919
9898
  t.toString(),
9920
- ld,
9899
+ ud,
9921
9900
  `0x${o.toString("hex")}`
9922
9901
  ]);
9923
- return await oa(
9902
+ return await ia(
9924
9903
  {
9925
9904
  name: "frBtcUnwrap",
9926
- inscription: await as(Rn(), c, ta),
9905
+ inscription: await as(Rn(), c, Qo),
9927
9906
  target: Kn(),
9928
9907
  extraOutputs: [
9929
9908
  {
9930
9909
  wallet: new xt(!1, a, null, null, null),
9931
- value: Qo
9910
+ value: jo
9932
9911
  }
9933
9912
  ],
9934
9913
  maxSendInputs: ls
@@ -9938,21 +9917,21 @@ async function pd(e) {
9938
9917
  e
9939
9918
  );
9940
9919
  }
9920
+ async function pd(e) {
9921
+ return await od(e);
9922
+ }
9941
9923
  async function hd(e) {
9942
9924
  return await ad(e);
9943
9925
  }
9944
9926
  async function wd(e) {
9945
- return await cd(e);
9927
+ return await fd(e);
9946
9928
  }
9947
9929
  async function gd(e) {
9948
9930
  return await dd(e);
9949
9931
  }
9950
- async function yd(e) {
9951
- return await pd(e);
9952
- }
9953
- async function aa(e, t, n, r, s, i, o, a, c) {
9932
+ async function oa(e, t, n, r, s, i, o, a, c) {
9954
9933
  if (!c || c === "ordinals")
9955
- return await xa(
9934
+ return await ma(
9956
9935
  e,
9957
9936
  t,
9958
9937
  n,
@@ -9964,7 +9943,7 @@ async function aa(e, t, n, r, s, i, o, a, c) {
9964
9943
  o
9965
9944
  );
9966
9945
  if (c === "payment")
9967
- return await _a(
9946
+ return await xa(
9968
9947
  e,
9969
9948
  t,
9970
9949
  n,
@@ -9977,12 +9956,12 @@ async function aa(e, t, n, r, s, i, o, a, c) {
9977
9956
  );
9978
9957
  throw new Error(`Unsupported wallet type: ${c}`);
9979
9958
  }
9980
- async function bd(e, t, n, r, s, i, o, a, c, u, l) {
9959
+ async function yd(e, t, n, r, s, i, o, a, c, u, l) {
9981
9960
  if (typeof t != "object") throw new Error("abi must be an object");
9982
9961
  if (typeof n != "string") throw new Error("func_name must be a string");
9983
9962
  if (!Array.isArray(r)) throw new Error("params must be an array");
9984
9963
  const f = l || "payment", d = zn(t, n, r);
9985
- return await aa(
9964
+ return await oa(
9986
9965
  e,
9987
9966
  d,
9988
9967
  s,
@@ -9994,8 +9973,8 @@ async function bd(e, t, n, r, s, i, o, a, c, u, l) {
9994
9973
  f
9995
9974
  );
9996
9975
  }
9997
- async function md(e, t, n, r, s, i) {
9998
- return await Sa(
9976
+ async function bd(e, t, n, r, s, i) {
9977
+ return await _a(
9999
9978
  e,
10000
9979
  t,
10001
9980
  n,
@@ -10005,8 +9984,8 @@ async function md(e, t, n, r, s, i) {
10005
9984
  s
10006
9985
  );
10007
9986
  }
10008
- async function xd(e, t, n, r, s, i, o) {
10009
- return await Ea(
9987
+ async function md(e, t, n, r, s, i, o) {
9988
+ return await Sa(
10010
9989
  e,
10011
9990
  t,
10012
9991
  n,
@@ -10017,25 +9996,25 @@ async function xd(e, t, n, r, s, i, o) {
10017
9996
  i
10018
9997
  );
10019
9998
  }
10020
- const Ld = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9999
+ const Ad = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10021
10000
  __proto__: null,
10022
- callSmartContract: aa,
10023
- callSmartContractAbi: bd,
10024
- computeBrc20PredeployHash: Yo,
10025
- deployBrc20Inscription: jf,
10026
- depositToBrc20Prog: md,
10027
- generateBrc20Salt: Zo,
10001
+ callSmartContract: oa,
10002
+ callSmartContractAbi: yd,
10003
+ computeBrc20PredeployHash: Zo,
10004
+ deployBrc20Inscription: Jf,
10005
+ depositToBrc20Prog: bd,
10006
+ generateBrc20Salt: Vo,
10028
10007
  getFrBtcAddress: Rn,
10029
- mintBrc20Inscription: Qf,
10030
- predeployInscriptions: ed,
10031
- sendAsBrc20: hd,
10032
- sendAsBrc20Prog: wd,
10008
+ mintBrc20Inscription: jf,
10009
+ predeployInscriptions: td,
10010
+ sendAsBrc20: pd,
10011
+ sendAsBrc20Prog: hd,
10033
10012
  transferBrc20Inscription: is,
10034
- unwrapBtcFromBrc20Prog: yd,
10035
- withdrawFromBrc20Prog: xd,
10036
- wrapBtcToBrc20Prog: gd
10013
+ unwrapBtcFromBrc20Prog: gd,
10014
+ withdrawFromBrc20Prog: md,
10015
+ wrapBtcToBrc20Prog: wd
10037
10016
  }, Symbol.toStringTag, { value: "Module" }));
10038
- async function _d(e, t, n, r, s) {
10017
+ async function xd(e, t, n, r, s) {
10039
10018
  const i = await hi(
10040
10019
  [e],
10041
10020
  t,
@@ -10053,11 +10032,11 @@ async function _d(e, t, n, r, s) {
10053
10032
  secret: i.secret
10054
10033
  };
10055
10034
  }
10056
- async function Sd(e, t, n, r, s) {
10035
+ async function _d(e, t, n, r, s) {
10057
10036
  return await hi(e, t, n, r, s);
10058
10037
  }
10059
- async function Ed(e, t, n, r, s, i) {
10060
- return await Ba(
10038
+ async function Sd(e, t, n, r, s, i) {
10039
+ return await Ea(
10061
10040
  e,
10062
10041
  t,
10063
10042
  n,
@@ -10066,20 +10045,20 @@ async function Ed(e, t, n, r, s, i) {
10066
10045
  i
10067
10046
  );
10068
10047
  }
10069
- async function Bd(e, t, n, r) {
10048
+ async function Ed(e, t, n, r) {
10070
10049
  return await wi([e], t, n, r);
10071
10050
  }
10072
- async function vd(e, t, n, r) {
10051
+ async function Bd(e, t, n, r) {
10073
10052
  return await wi(e, t, n, r);
10074
10053
  }
10075
- const Pd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10054
+ const Ld = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10076
10055
  __proto__: null,
10077
- getInscribeFee: Bd,
10078
- getInscribeMultipleFee: vd,
10079
- inscribe: _d,
10080
- inscribeMultiple: Sd,
10081
- inscribeWithParent: Ed
10082
- }, Symbol.toStringTag, { value: "Module" })), ca = [
10056
+ getInscribeFee: Ed,
10057
+ getInscribeMultipleFee: Bd,
10058
+ inscribe: xd,
10059
+ inscribeMultiple: _d,
10060
+ inscribeWithParent: Sd
10061
+ }, Symbol.toStringTag, { value: "Module" })), aa = [
10083
10062
  { inputs: [], stateMutability: "nonpayable", type: "constructor" },
10084
10063
  {
10085
10064
  inputs: [{ internalType: "address", name: "owner", type: "address" }],
@@ -10236,12 +10215,12 @@ const Pd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10236
10215
  stateMutability: "nonpayable",
10237
10216
  type: "function"
10238
10217
  }
10239
- ], ua = "0xc54dd4581af2dbf18e4d90840226756e9d2b3cdb";
10240
- async function Od(e, t) {
10218
+ ], ca = "0xc54dd4581af2dbf18e4d90840226756e9d2b3cdb";
10219
+ async function vd(e, t) {
10241
10220
  const n = await X("check_base_brc20_balance"), r = {
10242
10221
  ordinal_address: e,
10243
10222
  token_address: t.toLowerCase()
10244
- }, s = await gi(n, {
10223
+ }, s = await z(n, {
10245
10224
  method: "POST",
10246
10225
  headers: {
10247
10226
  "Content-Type": "application/json"
@@ -10255,8 +10234,8 @@ async function Od(e, t) {
10255
10234
  ticker: s.result.ticker
10256
10235
  };
10257
10236
  }
10258
- async function Id(e, t) {
10259
- const n = await X("check_brc20_balance"), s = await gi(n, {
10237
+ async function Od(e, t) {
10238
+ const n = await X("check_brc20_balance"), s = await z(n, {
10260
10239
  method: "POST",
10261
10240
  headers: {
10262
10241
  "Content-Type": "application/json"
@@ -10268,39 +10247,39 @@ async function Id(e, t) {
10268
10247
  });
10269
10248
  return BigInt(s.result);
10270
10249
  }
10271
- async function Td(e, t) {
10250
+ async function Id(e, t) {
10272
10251
  const n = B.from(t, "utf-8"), r = await Jn(
10273
- ua,
10274
10252
  ca,
10253
+ aa,
10275
10254
  "balanceOf",
10276
10255
  [n, Wr(e)]
10277
10256
  );
10278
10257
  return BigInt(r);
10279
10258
  }
10280
- async function Rd(e) {
10281
- return await na(e);
10259
+ async function Td(e) {
10260
+ return await ea(e);
10282
10261
  }
10283
- async function kd(e) {
10262
+ async function Rd(e) {
10284
10263
  const t = B.from(e, "utf-8");
10285
10264
  return `0x${(await Jn(
10286
- ua,
10287
10265
  ca,
10266
+ aa,
10288
10267
  "getTickerAddress",
10289
10268
  [t]
10290
10269
  )).slice(-40)}`;
10291
10270
  }
10292
- const Fd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10271
+ const Pd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10293
10272
  __proto__: null,
10294
- getBRC20ProgBalanceOfAddress: Id,
10295
- getBRC20ProgBalanceOfTicker: Td,
10296
- getBRC20ProgTokenAddressOfTicker: kd,
10297
- getBaseBRC20BalanceOfAddress: Od,
10298
- getFrBtcBalanceOfAddress: Rd
10273
+ getBRC20ProgBalanceOfAddress: Od,
10274
+ getBRC20ProgBalanceOfTicker: Id,
10275
+ getBRC20ProgTokenAddressOfTicker: Rd,
10276
+ getBaseBRC20BalanceOfAddress: vd,
10277
+ getFrBtcBalanceOfAddress: Td
10299
10278
  }, Symbol.toStringTag, { value: "Module" }));
10300
10279
  export {
10301
- Ad as a,
10302
- Ld as b,
10303
- Fd as c,
10304
- Pd as m,
10305
- $d as s
10280
+ $d as a,
10281
+ Ad as b,
10282
+ Pd as c,
10283
+ Ld as m,
10284
+ Cd as s
10306
10285
  };