@bestinslot/wallet-kit 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { h as pn, T as Sr, U as No, V as ko, X as Co, B as S, e as Ht, l as Wr, Y as Ds, Z as Br, Q as Ye, f as Wn, W as qt, _ as ze, $ as K, a0 as ce, a1 as Ms, a2 as $o, a3 as Gr, a4 as Ut, a5 as me, a6 as Rn, a7 as Kt, a8 as Cn, a9 as Ws, x as hn, aa as Lo, ab as Hr, ac as Nn, ad as Gs, d as wn, k as $e, ae as Ao, af as Po, ag as Fo, ah as Uo, ai as qo, aj as Hs, ak as Vs, al as Do, am as Zs, an as Ys, q as Mo, ao as zs } from "./mint-BXVHw4CQ.js";
2
- async function vf(e, t, n, r, s, i) {
2
+ async function Of(e, t, n, r, s, i) {
3
3
  const o = pn();
4
4
  if (!o)
5
5
  throw new Error("No wallet connected");
@@ -1061,8 +1061,8 @@ function mi(e, t = {}) {
1061
1061
  try {
1062
1062
  C = r.sqrt(q);
1063
1063
  } catch (Q) {
1064
- const X = Q instanceof Error ? ": " + Q.message : "";
1065
- throw new Error("bad point: is not on curve, sqrt error" + X);
1064
+ const j = Q instanceof Error ? ": " + Q.message : "";
1065
+ throw new Error("bad point: is not on curve, sqrt error" + j);
1066
1066
  }
1067
1067
  l();
1068
1068
  const M = r.isOdd(C);
@@ -1211,8 +1211,8 @@ function mi(e, t = {}) {
1211
1211
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
1212
1212
  double() {
1213
1213
  const { a: y, b: _ } = i, T = r.mul(_, We), { X: R, Y: A, Z: P } = this;
1214
- let q = r.ZERO, C = r.ZERO, M = r.ZERO, H = r.mul(R, R), Q = r.mul(A, A), X = r.mul(P, P), V = r.mul(R, A);
1215
- return V = r.add(V, V), M = r.mul(R, P), M = r.add(M, M), q = r.mul(y, M), C = r.mul(T, X), C = r.add(q, C), q = r.sub(Q, C), C = r.add(Q, C), C = r.mul(q, C), q = r.mul(V, q), M = r.mul(T, M), X = r.mul(y, X), V = r.sub(H, X), V = r.mul(y, V), V = r.add(V, M), M = r.add(H, H), H = r.add(M, H), H = r.add(H, X), H = r.mul(H, V), C = r.add(C, H), X = r.mul(A, P), X = r.add(X, X), H = r.mul(X, V), q = r.sub(q, H), M = r.mul(X, Q), M = r.add(M, M), M = r.add(M, M), new m(q, C, M);
1214
+ let q = r.ZERO, C = r.ZERO, M = r.ZERO, H = r.mul(R, R), Q = r.mul(A, A), j = r.mul(P, P), V = r.mul(R, A);
1215
+ return V = r.add(V, V), M = r.mul(R, P), M = r.add(M, M), q = r.mul(y, M), C = r.mul(T, j), C = r.add(q, C), q = r.sub(Q, C), C = r.add(Q, C), C = r.mul(q, C), q = r.mul(V, q), M = r.mul(T, M), j = r.mul(y, j), V = r.sub(H, j), V = r.mul(y, V), V = r.add(V, M), M = r.add(H, H), H = r.add(M, H), H = r.add(H, j), H = r.mul(H, V), C = r.add(C, H), j = r.mul(A, P), j = r.add(j, j), H = r.mul(j, V), q = r.sub(q, H), M = r.mul(j, Q), M = r.add(M, M), M = r.add(M, M), new m(q, C, M);
1216
1216
  }
1217
1217
  // Renes-Costello-Batina exception-free addition formula.
1218
1218
  // There is 30% faster Jacobian formula, but it is not complete.
@@ -1222,11 +1222,11 @@ function mi(e, t = {}) {
1222
1222
  F(y);
1223
1223
  const { X: _, Y: T, Z: R } = this, { X: A, Y: P, Z: q } = y;
1224
1224
  let C = r.ZERO, M = r.ZERO, H = r.ZERO;
1225
- const Q = i.a, X = r.mul(i.b, We);
1225
+ const Q = i.a, j = r.mul(i.b, We);
1226
1226
  let V = r.mul(_, A), dt = r.mul(T, P), st = r.mul(R, q), xt = r.add(_, T), tt = r.add(A, P);
1227
1227
  xt = r.mul(xt, tt), tt = r.add(V, dt), xt = r.sub(xt, tt), tt = r.add(_, R);
1228
1228
  let gt = r.add(A, q);
1229
- return tt = r.mul(tt, gt), gt = r.add(V, st), tt = r.sub(tt, gt), gt = r.add(T, R), C = r.add(P, q), gt = r.mul(gt, C), C = r.add(dt, st), gt = r.sub(gt, C), H = r.mul(Q, tt), C = r.mul(X, st), H = r.add(C, H), C = r.sub(dt, H), H = r.add(dt, H), M = r.mul(C, H), dt = r.add(V, V), dt = r.add(dt, V), st = r.mul(Q, st), tt = r.mul(X, tt), dt = r.add(dt, st), st = r.sub(V, st), st = r.mul(Q, st), tt = r.add(tt, st), V = r.mul(dt, tt), M = r.add(M, V), V = r.mul(gt, tt), C = r.mul(xt, C), C = r.sub(C, V), V = r.mul(xt, dt), H = r.mul(gt, H), H = r.add(H, V), new m(C, M, H);
1229
+ return tt = r.mul(tt, gt), gt = r.add(V, st), tt = r.sub(tt, gt), gt = r.add(T, R), C = r.add(P, q), gt = r.mul(gt, C), C = r.add(dt, st), gt = r.sub(gt, C), H = r.mul(Q, tt), C = r.mul(j, st), H = r.add(C, H), C = r.sub(dt, H), H = r.add(dt, H), M = r.mul(C, H), dt = r.add(V, V), dt = r.add(dt, V), st = r.mul(Q, st), tt = r.mul(j, tt), dt = r.add(dt, st), st = r.sub(V, st), st = r.mul(Q, st), tt = r.add(tt, st), V = r.mul(dt, tt), M = r.add(M, V), V = r.mul(gt, tt), C = r.mul(xt, C), C = r.sub(C, V), V = r.mul(xt, dt), H = r.mul(gt, H), H = r.add(H, V), new m(C, M, H);
1230
1230
  }
1231
1231
  subtract(y) {
1232
1232
  return this.add(y.negate());
@@ -1250,8 +1250,8 @@ function mi(e, t = {}) {
1250
1250
  let T, R;
1251
1251
  const A = (P) => z.cached(this, P, (q) => qn(m, q));
1252
1252
  if (_) {
1253
- const { k1neg: P, k1: q, k2neg: C, k2: M } = G(y), { p: H, f: Q } = A(q), { p: X, f: V } = A(M);
1254
- R = Q.add(V), T = k(_.beta, H, X, P, C);
1253
+ const { k1neg: P, k1: q, k2neg: C, k2: M } = G(y), { p: H, f: Q } = A(q), { p: j, f: V } = A(M);
1254
+ R = Q.add(V), T = k(_.beta, H, j, P, C);
1255
1255
  } else {
1256
1256
  const { p: P, f: q } = A(y);
1257
1257
  T = P, R = q;
@@ -7253,7 +7253,7 @@ Signing this message outside official BiS interfaces may result in unauthorized
7253
7253
  By signing, you acknowledge that the BiS Terms of Service also apply: https://bestinslot.xyz/legal/terms.
7254
7254
 
7255
7255
  Current Network: Bitcoin Mainnet`;
7256
- async function J(e, t) {
7256
+ async function X(e, t) {
7257
7257
  try {
7258
7258
  const n = await fetch(e, t);
7259
7259
  if (!n.ok) {
@@ -7282,7 +7282,7 @@ function Us() {
7282
7282
  return ju;
7283
7283
  throw new Error("Unsupported network for swap signature request text");
7284
7284
  }
7285
- function j(e) {
7285
+ function J(e) {
7286
7286
  const t = wn();
7287
7287
  if (t === "signet")
7288
7288
  return `https://sas-proxy.bestinslot.xyz/${e}`;
@@ -7364,8 +7364,8 @@ async function nl() {
7364
7364
  return (await nt())?.swapPrivkey ?? null;
7365
7365
  }
7366
7366
  async function rl() {
7367
- const e = j("status");
7368
- return await J(e, {
7367
+ const e = J("status");
7368
+ return await X(e, {
7369
7369
  method: "GET"
7370
7370
  });
7371
7371
  }
@@ -7373,10 +7373,10 @@ async function ao(e) {
7373
7373
  const t = Ht();
7374
7374
  if (!t?.address)
7375
7375
  throw new Error("Ordinals wallet address not found.");
7376
- const n = j("check_swap_allowance"), r = {
7376
+ const n = J("check_swap_allowance"), r = {
7377
7377
  ordinal_address: t.address,
7378
7378
  token_address: e
7379
- }, s = await J(n, {
7379
+ }, s = await X(n, {
7380
7380
  method: "POST",
7381
7381
  headers: {
7382
7382
  "Content-Type": "application/json"
@@ -7390,7 +7390,7 @@ async function Wt() {
7390
7390
  const e = wn(), t = qs.get(e);
7391
7391
  if (t)
7392
7392
  return t;
7393
- const n = j("get_swap_info"), r = await J(n, {
7393
+ const n = J("get_swap_info"), r = await X(n, {
7394
7394
  method: "GET"
7395
7395
  }), s = {
7396
7396
  factory_address: r.result.factory_address.toLowerCase(),
@@ -7416,10 +7416,10 @@ async function co(e) {
7416
7416
  const t = Ht();
7417
7417
  if (!t?.address)
7418
7418
  throw new Error("Ordinals wallet address not found.");
7419
- const n = j("check_brc20_balance"), r = {
7419
+ const n = J("check_brc20_balance"), r = {
7420
7420
  ordinal_address: t.address,
7421
7421
  token_address: e
7422
- }, s = await J(n, {
7422
+ }, s = await X(n, {
7423
7423
  method: "POST",
7424
7424
  headers: {
7425
7425
  "Content-Type": "application/json"
@@ -7432,10 +7432,10 @@ async function uo(e) {
7432
7432
  const t = Ht();
7433
7433
  if (!t?.address)
7434
7434
  throw new Error("Ordinals wallet address not found.");
7435
- const n = j("check_base_brc20_balance"), r = {
7435
+ const n = J("check_base_brc20_balance"), r = {
7436
7436
  ordinal_address: t.address,
7437
7437
  token_address: e
7438
- }, s = await J(n, {
7438
+ }, s = await X(n, {
7439
7439
  method: "POST",
7440
7440
  headers: {
7441
7441
  "Content-Type": "application/json"
@@ -7450,8 +7450,8 @@ async function uo(e) {
7450
7450
  };
7451
7451
  }
7452
7452
  async function sl(e) {
7453
- const t = j("get_all_balances");
7454
- return (await J(t, {
7453
+ const t = J("get_all_balances");
7454
+ return (await X(t, {
7455
7455
  method: "POST",
7456
7456
  headers: {
7457
7457
  "Content-Type": "application/json"
@@ -7465,7 +7465,7 @@ async function il(e) {
7465
7465
  const t = await nt();
7466
7466
  if (!t?.swapPubkey)
7467
7467
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
7468
- const n = t.swapPubkey, r = j("get_balance"), i = await J(r, {
7468
+ const n = t.swapPubkey, r = J("get_balance"), i = await X(r, {
7469
7469
  method: "POST",
7470
7470
  headers: {
7471
7471
  "Content-Type": "application/json"
@@ -7478,7 +7478,7 @@ async function il(e) {
7478
7478
  return BigInt(i.result);
7479
7479
  }
7480
7480
  async function _n(e, t) {
7481
- const n = j("get_balance"), s = await J(n, {
7481
+ const n = J("get_balance"), s = await X(n, {
7482
7482
  method: "POST",
7483
7483
  headers: {
7484
7484
  "Content-Type": "application/json"
@@ -7491,7 +7491,7 @@ async function _n(e, t) {
7491
7491
  return BigInt(s.result);
7492
7492
  }
7493
7493
  async function Ae(e) {
7494
- const t = j("get_pair_reserves"), r = await J(t, {
7494
+ const t = J("get_pair_reserves"), r = await X(t, {
7495
7495
  method: "POST",
7496
7496
  headers: {
7497
7497
  "Content-Type": "application/json"
@@ -7510,7 +7510,7 @@ async function Pe() {
7510
7510
  const e = (await nt())?.swapPubkey;
7511
7511
  if (!e)
7512
7512
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
7513
- const t = j("get_swap_wallet_nonce"), r = await J(t, {
7513
+ const t = J("get_swap_wallet_nonce"), r = await X(t, {
7514
7514
  method: "POST",
7515
7515
  headers: {
7516
7516
  "Content-Type": "application/json"
@@ -7522,7 +7522,7 @@ async function Pe() {
7522
7522
  return BigInt(r.result);
7523
7523
  }
7524
7524
  async function ol(e, t) {
7525
- const n = j("get_swap_referrer_info"), s = await J(n, {
7525
+ const n = J("get_swap_referrer_info"), s = await X(n, {
7526
7526
  method: "POST",
7527
7527
  headers: {
7528
7528
  "Content-Type": "application/json"
@@ -7544,7 +7544,7 @@ async function qr(e, t) {
7544
7544
  }
7545
7545
  }
7546
7546
  async function Ct(e) {
7547
- const t = j("get_miner_fee"), r = await J(t, {
7547
+ const t = J("get_miner_fee"), r = await X(t, {
7548
7548
  method: "POST",
7549
7549
  headers: {
7550
7550
  "Content-Type": "application/json"
@@ -7556,8 +7556,8 @@ async function Ct(e) {
7556
7556
  return BigInt(r.result);
7557
7557
  }
7558
7558
  async function al() {
7559
- const e = j("get_tokens");
7560
- return (await J(e, {
7559
+ const e = J("get_tokens");
7560
+ return (await X(e, {
7561
7561
  method: "GET"
7562
7562
  })).tokens;
7563
7563
  }
@@ -7569,7 +7569,7 @@ async function cl(e = {}) {
7569
7569
  order_by: t,
7570
7570
  page: String(n),
7571
7571
  count: String(r)
7572
- }), i = j(`get_table_data?${s}`), o = await J(i, {
7572
+ }), i = J(`get_table_data?${s}`), o = await X(i, {
7573
7573
  method: "GET"
7574
7574
  });
7575
7575
  return {
@@ -7585,8 +7585,8 @@ async function cl(e = {}) {
7585
7585
  };
7586
7586
  }
7587
7587
  async function ul(e) {
7588
- const t = j(`volume/${e.pair_address}?days=${e.days}`);
7589
- return await J(t, {
7588
+ const t = J(`volume/${e.pair_address}?days=${e.days}`);
7589
+ return await X(t, {
7590
7590
  method: "GET",
7591
7591
  headers: {
7592
7592
  "Content-Type": "application/json"
@@ -7596,10 +7596,10 @@ async function ul(e) {
7596
7596
  async function ll(e) {
7597
7597
  if (e.limit > 1e3)
7598
7598
  throw new Error("Limit cannot exceed 1000");
7599
- let t = j(
7599
+ let t = J(
7600
7600
  `klines/${e.pair_address}?interval=${e.interval}&limit=${e.limit}`
7601
7601
  );
7602
- return e.startTime !== null && (t += `&startTime=${e.startTime}`), e.endTime !== null && (t += `&endTime=${e.endTime}`), await J(t, {
7602
+ return e.startTime !== null && (t += `&startTime=${e.startTime}`), e.endTime !== null && (t += `&endTime=${e.endTime}`), await X(t, {
7603
7603
  method: "GET",
7604
7604
  headers: {
7605
7605
  "Content-Type": "application/json"
@@ -7607,23 +7607,36 @@ async function ll(e) {
7607
7607
  });
7608
7608
  }
7609
7609
  async function fl(e) {
7610
+ const t = J(
7611
+ `tvl/${encodeURIComponent(e.pair_address)}?${new URLSearchParams({
7612
+ days: String(e.days)
7613
+ })}`
7614
+ );
7615
+ return await X(t, {
7616
+ method: "GET",
7617
+ headers: {
7618
+ "Content-Type": "application/json"
7619
+ }
7620
+ });
7621
+ }
7622
+ async function dl(e) {
7610
7623
  if (e.limit > 200)
7611
7624
  throw new Error("Limit cannot exceed 200");
7612
- const t = j(
7625
+ const t = J(
7613
7626
  `pair-activity/${e.pair_address}?limit=${e.limit}&offset=${e.offset}`
7614
7627
  );
7615
- return await J(t, {
7628
+ return await X(t, {
7616
7629
  method: "GET",
7617
7630
  headers: {
7618
7631
  "Content-Type": "application/json"
7619
7632
  }
7620
7633
  });
7621
7634
  }
7622
- async function dl(e) {
7623
- const t = j(
7635
+ async function pl(e) {
7636
+ const t = J(
7624
7637
  `wallet-activity/${e.pubkey}?pairAddress=${e.pairAddress}`
7625
7638
  );
7626
- return await J(t, {
7639
+ return await X(t, {
7627
7640
  method: "GET",
7628
7641
  headers: {
7629
7642
  "Content-Type": "application/json"
@@ -7631,8 +7644,8 @@ async function dl(e) {
7631
7644
  });
7632
7645
  }
7633
7646
  async function fn(e) {
7634
- const t = j("get_token_decimals");
7635
- return (await J(t, {
7647
+ const t = J("get_token_decimals");
7648
+ return (await X(t, {
7636
7649
  method: "POST",
7637
7650
  headers: {
7638
7651
  "Content-Type": "application/json"
@@ -7677,8 +7690,8 @@ async function fo(e) {
7677
7690
  return `0x${c.x.toString(16).padStart(128, "0")}${c.y.toString(16).padStart(128, "0")}`;
7678
7691
  }
7679
7692
  async function po(e) {
7680
- const t = j("get_deposit_signature");
7681
- return J(t, {
7693
+ const t = J("get_deposit_signature");
7694
+ return X(t, {
7682
7695
  method: "POST",
7683
7696
  headers: {
7684
7697
  "Content-Type": "application/json"
@@ -7686,9 +7699,9 @@ async function po(e) {
7686
7699
  body: JSON.stringify(e)
7687
7700
  });
7688
7701
  }
7689
- async function pl(e) {
7690
- const t = j("deposit");
7691
- return J(t, {
7702
+ async function hl(e) {
7703
+ const t = J("deposit");
7704
+ return X(t, {
7692
7705
  method: "POST",
7693
7706
  headers: {
7694
7707
  "Content-Type": "application/json"
@@ -7715,7 +7728,7 @@ function ho(e, t) {
7715
7728
  function wo(e) {
7716
7729
  return e ? e.reduce((t, n) => t + n.amount, 0n) : 0n;
7717
7730
  }
7718
- async function hl(e, t, n, r = !0, s) {
7731
+ async function wl(e, t, n, r = !0, s) {
7719
7732
  const i = pn();
7720
7733
  if (!i || !i.wallets)
7721
7734
  throw new Error("Wallets not found");
@@ -7793,7 +7806,7 @@ async function hl(e, t, n, r = !0, s) {
7793
7806
  null,
7794
7807
  M
7795
7808
  );
7796
- let Q = null, X = null, V = null, dt = null, st = null, xt = null, tt = null, gt = null, $t = null;
7809
+ let Q = null, j = null, V = null, dt = null, st = null, xt = null, tt = null, gt = null, $t = null;
7797
7810
  if (w > 0n) {
7798
7811
  const Pt = ho(
7799
7812
  w,
@@ -7837,7 +7850,7 @@ async function hl(e, t, n, r = !0, s) {
7837
7850
  );
7838
7851
  st = $t.signed_commit_tx_hex, xt = $t.signed_reveal_tx_hex, V = $t.commit_txid, dt = $t.reveal_txid, Q = $t.inscription_id;
7839
7852
  const ee = `${Q.split("i")[0]}:0:0`;
7840
- X = $t.secret;
7853
+ j = $t.secret;
7841
7854
  let De = null;
7842
7855
  try {
7843
7856
  if (!st)
@@ -8020,14 +8033,14 @@ async function hl(e, t, n, r = !0, s) {
8020
8033
  reveal_txhex: xt,
8021
8034
  send_to_opreturn_txid: gt,
8022
8035
  send_to_opreturn_txhex: tt,
8023
- secret: X,
8036
+ secret: j,
8024
8037
  inscription_id: Q,
8025
8038
  fee_rate: n
8026
8039
  } : null
8027
8040
  };
8028
- return (await pl(Ro)).result;
8041
+ return (await hl(Ro)).result;
8029
8042
  }
8030
- async function wl(e, t, n, r = !0, s) {
8043
+ async function gl(e, t, n, r = !0, s) {
8031
8044
  const i = pn();
8032
8045
  if (!i || !i.wallets)
8033
8046
  throw new Error("Wallets not found");
@@ -8162,7 +8175,7 @@ async function wl(e, t, n, r = !0, s) {
8162
8175
  throw new Error("Failed to send inscription to OP_RETURN");
8163
8176
  q = Tt.unsigned_tx_hex, C = Tt.txid, M += Tt.tx_fee;
8164
8177
  }
8165
- let H = null, Q = null, X = null, V = null, dt = null, st = 0;
8178
+ let H = null, Q = null, j = null, V = null, dt = null, st = 0;
8166
8179
  if (g) {
8167
8180
  const yt = [];
8168
8181
  f > 0n && yt.push(
@@ -8179,7 +8192,7 @@ async function wl(e, t, n, r = !0, s) {
8179
8192
  null,
8180
8193
  0
8181
8194
  );
8182
- Q = pt.unsigned_commit_tx_hex, X = pt.signed_reveal_tx_hex, H = pt.inscription_id, st += pt.total_fee;
8195
+ Q = pt.unsigned_commit_tx_hex, j = pt.signed_reveal_tx_hex, H = pt.inscription_id, st += pt.total_fee;
8183
8196
  } finally {
8184
8197
  Kt();
8185
8198
  }
@@ -8188,7 +8201,7 @@ async function wl(e, t, n, r = !0, s) {
8188
8201
  try {
8189
8202
  if (!Q)
8190
8203
  throw new Error("Allowance commit tx hex is missing");
8191
- yt.push(Q, X), Ut(yt, [H, Lt]);
8204
+ yt.push(Q, j), Ut(yt, [H, Lt]);
8192
8205
  const pt = new qt(
8193
8206
  !0,
8194
8207
  S.from(me.encode(["OP_RETURN", K.str("BRC20PROG")], !1)),
@@ -8232,9 +8245,9 @@ async function wl(e, t, n, r = !0, s) {
8232
8245
  });
8233
8246
  }
8234
8247
  if (g) {
8235
- if (!Q || !X || !V)
8248
+ if (!Q || !j || !V)
8236
8249
  throw new Error("Allowance transaction hexes are missing");
8237
- tt.push(Q, X, V), xt.push({
8250
+ tt.push(Q, j, V), xt.push({
8238
8251
  utxo: `${dt}:1`,
8239
8252
  value: be,
8240
8253
  script_type: Cn(l.outputScript, o),
@@ -8281,9 +8294,9 @@ async function wl(e, t, n, r = !0, s) {
8281
8294
  fee_rate: n
8282
8295
  };
8283
8296
  }
8284
- async function gl(e) {
8285
- const t = j("wrap");
8286
- return J(t, {
8297
+ async function yl(e) {
8298
+ const t = J("wrap");
8299
+ return X(t, {
8287
8300
  method: "POST",
8288
8301
  headers: {
8289
8302
  "Content-Type": "application/json"
@@ -8291,9 +8304,9 @@ async function gl(e) {
8291
8304
  body: JSON.stringify(e)
8292
8305
  });
8293
8306
  }
8294
- async function yl(e) {
8295
- const t = j("estimate_wrap_gas");
8296
- return J(t, {
8307
+ async function bl(e) {
8308
+ const t = J("estimate_wrap_gas");
8309
+ return X(t, {
8297
8310
  method: "POST",
8298
8311
  headers: {
8299
8312
  "Content-Type": "application/json"
@@ -8301,7 +8314,7 @@ async function yl(e) {
8301
8314
  body: JSON.stringify(e)
8302
8315
  });
8303
8316
  }
8304
- async function bl(e, t) {
8317
+ async function ml(e, t) {
8305
8318
  const n = await Wt(), r = pn();
8306
8319
  if (!r || !r.wallets)
8307
8320
  throw new Error("Wallets not found");
@@ -8414,19 +8427,19 @@ async function bl(e, t) {
8414
8427
  secret: P,
8415
8428
  inscription_id: R,
8416
8429
  fee_rate: t
8417
- }, Q = await yl(H), X = Math.max(
8430
+ }, Q = await bl(H), j = Math.max(
8418
8431
  Q.estimated_gas + 1e5,
8419
8432
  Q.estimated_gas * 1.2
8420
8433
  );
8421
- if (Q.allocated_gas < X) {
8422
- O = X + 5e4;
8434
+ if (Q.allocated_gas < j) {
8435
+ O = j + 5e4;
8423
8436
  continue;
8424
8437
  }
8425
- return (await gl(H)).result;
8438
+ return (await yl(H)).result;
8426
8439
  }
8427
8440
  throw new Error("Failed to estimate gas for wrap order after multiple attempts");
8428
8441
  }
8429
- async function ml(e, t) {
8442
+ async function xl(e, t) {
8430
8443
  const n = await Wt(), r = pn();
8431
8444
  if (!r || !r.wallets)
8432
8445
  throw new Error("Wallets not found");
@@ -8511,7 +8524,7 @@ async function ml(e, t) {
8511
8524
  fee_rate: t
8512
8525
  };
8513
8526
  }
8514
- async function xl(e, t, n, r) {
8527
+ async function _l(e, t, n, r) {
8515
8528
  const s = await Wt();
8516
8529
  Jn(s.wbtc_address, s.factory_address);
8517
8530
  const i = (await nt())?.swapPubkey;
@@ -8548,7 +8561,7 @@ async function xl(e, t, n, r) {
8548
8561
  throw new Error("No data returned from add liquidity request.");
8549
8562
  return c.data;
8550
8563
  }
8551
- async function _l(e) {
8564
+ async function El(e) {
8552
8565
  e.token1_addr = e.token1_addr.toLowerCase(), e.token2_addr = e.token2_addr.toLowerCase();
8553
8566
  const t = `Add Liquidity Order:
8554
8567
  Token 1 Address: ${e.token1_addr}
@@ -8564,7 +8577,7 @@ BTC Fee: ${e.btc_fee}
8564
8577
  By signing this message, you authorize the creation of an add liquidity order with the above parameters.`;
8565
8578
  return await $e(t, "ordinals");
8566
8579
  }
8567
- async function El(e) {
8580
+ async function Sl(e) {
8568
8581
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
8569
8582
  let t = et(S.from(e.pubkey, "hex")).slice(2);
8570
8583
  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");
@@ -8576,9 +8589,9 @@ async function El(e) {
8576
8589
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = S.from(i, "hex"), a = v.shortSignatures.sign(r, o);
8577
8590
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
8578
8591
  }
8579
- async function Sl(e) {
8580
- const t = j("add_liq_req");
8581
- return J(t, {
8592
+ async function Bl(e) {
8593
+ const t = J("add_liq_req");
8594
+ return X(t, {
8582
8595
  method: "POST",
8583
8596
  headers: {
8584
8597
  "Content-Type": "application/json"
@@ -8586,14 +8599,14 @@ async function Sl(e) {
8586
8599
  body: JSON.stringify(e)
8587
8600
  });
8588
8601
  }
8589
- async function Bl(e, t, n, r, s) {
8602
+ async function vl(e, t, n, r, s) {
8590
8603
  const i = await Wt(), o = (await nt())?.swapPubkey;
8591
8604
  if (!o)
8592
8605
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8593
8606
  const a = n * (10000n - s) / 10000n, c = r * (10000n - s) / 10000n, u = 0n, l = 0n;
8594
8607
  if (e.toLowerCase() !== i.wbtc_address.toLowerCase() && t.toLowerCase() !== i.wbtc_address.toLowerCase())
8595
8608
  throw new Error("One of the tokens must be BTC");
8596
- const f = await Pe(), p = await Ct("add_liquidity"), d = await _l({
8609
+ const f = await Pe(), p = await Ct("add_liquidity"), d = await El({
8597
8610
  token1_addr: e,
8598
8611
  token2_addr: t,
8599
8612
  amt1: n.toString(),
@@ -8603,7 +8616,7 @@ async function Bl(e, t, n, r, s) {
8603
8616
  token1FeeBps: u.toString(),
8604
8617
  token2FeeBps: l.toString(),
8605
8618
  btc_fee: p.toString()
8606
- }), w = await El({
8619
+ }), w = await Sl({
8607
8620
  pubkey: o,
8608
8621
  nonce: f,
8609
8622
  token1_addr: e,
@@ -8616,7 +8629,7 @@ async function Bl(e, t, n, r, s) {
8616
8629
  token2FeeBps: l,
8617
8630
  btc_fee: p
8618
8631
  });
8619
- return await Sl({
8632
+ return await Bl({
8620
8633
  pubkey: o,
8621
8634
  token1_addr: e,
8622
8635
  token2_addr: t,
@@ -8631,7 +8644,7 @@ async function Bl(e, t, n, r, s) {
8631
8644
  bip322_signature: d
8632
8645
  });
8633
8646
  }
8634
- async function vl(e, t, n) {
8647
+ async function Ol(e, t, n) {
8635
8648
  const r = await Wt();
8636
8649
  Jn(r.wbtc_address, r.factory_address);
8637
8650
  const s = (await nt())?.swapPubkey;
@@ -8667,7 +8680,7 @@ async function vl(e, t, n) {
8667
8680
  throw new Error("No data returned from remove liquidity request.");
8668
8681
  return a.data;
8669
8682
  }
8670
- async function Ol(e) {
8683
+ async function Tl(e) {
8671
8684
  e.token1_addr = e.token1_addr.toLowerCase(), e.token2_addr = e.token2_addr.toLowerCase();
8672
8685
  const t = `Remove Liquidity Order:
8673
8686
  Token 1 Address: ${e.token1_addr}
@@ -8682,7 +8695,7 @@ BTC Fee: ${e.btc_fee}
8682
8695
  By signing this message, you authorize the creation of a remove liquidity order with the above parameters.`;
8683
8696
  return await $e(t, "ordinals");
8684
8697
  }
8685
- async function Tl(e) {
8698
+ async function Il(e) {
8686
8699
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
8687
8700
  let t = et(S.from(e.pubkey, "hex")).slice(2);
8688
8701
  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");
@@ -8694,9 +8707,9 @@ async function Tl(e) {
8694
8707
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = S.from(i, "hex"), a = v.shortSignatures.sign(r, o);
8695
8708
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
8696
8709
  }
8697
- async function Il(e) {
8698
- const t = j("remove_liq_req");
8699
- return J(t, {
8710
+ async function Rl(e) {
8711
+ const t = J("remove_liq_req");
8712
+ return X(t, {
8700
8713
  method: "POST",
8701
8714
  headers: {
8702
8715
  "Content-Type": "application/json"
@@ -8704,14 +8717,14 @@ async function Il(e) {
8704
8717
  body: JSON.stringify(e)
8705
8718
  });
8706
8719
  }
8707
- async function Rl(e, t, n, r, s, i) {
8720
+ async function Nl(e, t, n, r, s, i) {
8708
8721
  const o = await Wt(), a = (await nt())?.swapPubkey;
8709
8722
  if (!a)
8710
8723
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8711
8724
  const c = r * (10000n - i) / 10000n, u = s * (10000n - i) / 10000n, l = 0n, f = 0n;
8712
8725
  if (e.toLowerCase() !== o.wbtc_address.toLowerCase() && t.toLowerCase() !== o.wbtc_address.toLowerCase())
8713
8726
  throw new Error("One of the tokens must be BTC");
8714
- const p = await Pe(), d = await Ct("remove_liquidity"), w = await Ol({
8727
+ const p = await Pe(), d = await Ct("remove_liquidity"), w = await Tl({
8715
8728
  token1_addr: e,
8716
8729
  token2_addr: t,
8717
8730
  lp_amt: n.toString(),
@@ -8720,7 +8733,7 @@ async function Rl(e, t, n, r, s, i) {
8720
8733
  token1FeeBps: l.toString(),
8721
8734
  token2FeeBps: f.toString(),
8722
8735
  btc_fee: d.toString()
8723
- }), h = await Tl({
8736
+ }), h = await Il({
8724
8737
  pubkey: a,
8725
8738
  nonce: p,
8726
8739
  token1_addr: e,
@@ -8732,7 +8745,7 @@ async function Rl(e, t, n, r, s, i) {
8732
8745
  token2FeeBps: f,
8733
8746
  btc_fee: d
8734
8747
  });
8735
- return await Il({
8748
+ return await Rl({
8736
8749
  pubkey: a,
8737
8750
  token1_addr: e,
8738
8751
  token2_addr: t,
@@ -8753,7 +8766,7 @@ async function nr(e, t) {
8753
8766
  throw new Error("One of the tokens must be BTC");
8754
8767
  return e.toLowerCase() !== n.wbtc_address.toLowerCase() && (r = 0n, s = 25n), { token1FeeBps: r, token2FeeBps: s };
8755
8768
  }
8756
- async function Nl(e, t, n) {
8769
+ async function kl(e, t, n) {
8757
8770
  const r = await Wt();
8758
8771
  await tr(e, t);
8759
8772
  const s = (await nt())?.swapPubkey;
@@ -8794,7 +8807,7 @@ async function Nl(e, t, n) {
8794
8807
  fees: Qi(n, u.amounts[1], a, c, o)
8795
8808
  };
8796
8809
  }
8797
- async function kl(e) {
8810
+ async function Cl(e) {
8798
8811
  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;
8799
8812
  const t = `Swap Order:
8800
8813
  Token 1 Address: ${e.token1_addr}
@@ -8810,7 +8823,7 @@ ${e.referrer_pubkey ? `Referrer Pubkey: ${e.referrer_pubkey}
8810
8823
  By signing this message, you authorize the creation of a swap order with the above parameters.`;
8811
8824
  return await $e(t, "ordinals");
8812
8825
  }
8813
- async function Cl(e) {
8826
+ async function $l(e) {
8814
8827
  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;
8815
8828
  let t = et(S.from(e.pubkey, "hex")).slice(2);
8816
8829
  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 += et(S.from(e.referrer_pubkey, "hex")).slice(2), t += ro.toString(16).padStart(8, "0"), e.ref_return_bps && e.ref_return_bps > 0n && (t += e.ref_return_bps.toString(16).padStart(8, "0")));
@@ -8822,9 +8835,9 @@ async function Cl(e) {
8822
8835
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = S.from(i, "hex"), a = v.shortSignatures.sign(r, o);
8823
8836
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
8824
8837
  }
8825
- async function $l(e) {
8826
- const t = j("swap");
8827
- return J(t, {
8838
+ async function Ll(e) {
8839
+ const t = J("swap");
8840
+ return X(t, {
8828
8841
  method: "POST",
8829
8842
  headers: {
8830
8843
  "Content-Type": "application/json"
@@ -8832,12 +8845,12 @@ async function $l(e) {
8832
8845
  body: JSON.stringify(e)
8833
8846
  });
8834
8847
  }
8835
- async function Ll(e, t, n, r, s, i) {
8848
+ async function Al(e, t, n, r, s, i) {
8836
8849
  const o = (await nt())?.swapPubkey;
8837
8850
  if (!o)
8838
8851
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8839
8852
  await tr(e, t);
8840
- const a = r * (10000n - s) / 10000n, c = await Pe(), u = await Ct("swap"), { token1FeeBps: l, token2FeeBps: f } = await nr(e, t), { referrerPubkey: p, refReturnBps: d } = i ? await qr(o, i) : { referrerPubkey: void 0, refReturnBps: void 0 }, w = await kl({
8853
+ const a = r * (10000n - s) / 10000n, c = await Pe(), u = await Ct("swap"), { token1FeeBps: l, token2FeeBps: f } = await nr(e, t), { referrerPubkey: p, refReturnBps: d } = i ? await qr(o, i) : { referrerPubkey: void 0, refReturnBps: void 0 }, w = await Cl({
8841
8854
  token1_addr: e,
8842
8855
  token2_addr: t,
8843
8856
  in_amt: n.toString(),
@@ -8847,7 +8860,7 @@ async function Ll(e, t, n, r, s, i) {
8847
8860
  btc_fee: u.toString(),
8848
8861
  referrer_pubkey: p,
8849
8862
  ref_return_bps: d ? d.toString() : void 0
8850
- }), h = await Cl({
8863
+ }), h = await $l({
8851
8864
  pubkey: o,
8852
8865
  nonce: c,
8853
8866
  token1_addr: e,
@@ -8860,7 +8873,7 @@ async function Ll(e, t, n, r, s, i) {
8860
8873
  referrer_pubkey: p,
8861
8874
  ref_return_bps: d
8862
8875
  });
8863
- return await $l({
8876
+ return await Ll({
8864
8877
  pubkey: o,
8865
8878
  token1_addr: e,
8866
8879
  token2_addr: t,
@@ -8875,7 +8888,7 @@ async function Ll(e, t, n, r, s, i) {
8875
8888
  referrer_id: p ? i : void 0
8876
8889
  });
8877
8890
  }
8878
- async function Al(e, t, n) {
8891
+ async function Pl(e, t, n) {
8879
8892
  const r = await Wt();
8880
8893
  await tr(e, t);
8881
8894
  const s = (await nt())?.swapPubkey;
@@ -8916,7 +8929,7 @@ async function Al(e, t, n) {
8916
8929
  fees: Qi(u.amounts[0], n, a, c, o)
8917
8930
  };
8918
8931
  }
8919
- async function Pl(e) {
8932
+ async function Fl(e) {
8920
8933
  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;
8921
8934
  const t = `Swap Order:
8922
8935
  Token 1 Address: ${e.token1_addr}
@@ -8932,7 +8945,7 @@ ${e.referrer_pubkey ? `Referrer Pubkey: ${e.referrer_pubkey}
8932
8945
  By signing this message, you authorize the creation of a swap order with the above parameters.`;
8933
8946
  return await $e(t, "ordinals");
8934
8947
  }
8935
- async function Fl(e) {
8948
+ async function Ul(e) {
8936
8949
  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;
8937
8950
  let t = et(S.from(e.pubkey, "hex")).slice(2);
8938
8951
  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 += et(S.from(e.referrer_pubkey, "hex")).slice(2), t += ro.toString(16).padStart(8, "0"), e.ref_return_bps && e.ref_return_bps > 0n && (t += e.ref_return_bps.toString(16).padStart(8, "0")));
@@ -8944,9 +8957,9 @@ async function Fl(e) {
8944
8957
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = S.from(i, "hex"), a = v.shortSignatures.sign(r, o);
8945
8958
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
8946
8959
  }
8947
- async function Ul(e) {
8948
- const t = j("swap2");
8949
- return J(t, {
8960
+ async function ql(e) {
8961
+ const t = J("swap2");
8962
+ return X(t, {
8950
8963
  method: "POST",
8951
8964
  headers: {
8952
8965
  "Content-Type": "application/json"
@@ -8954,12 +8967,12 @@ async function Ul(e) {
8954
8967
  body: JSON.stringify(e)
8955
8968
  });
8956
8969
  }
8957
- async function ql(e, t, n, r, s, i) {
8970
+ async function Dl(e, t, n, r, s, i) {
8958
8971
  const o = (await nt())?.swapPubkey;
8959
8972
  if (!o)
8960
8973
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
8961
8974
  await tr(e, t);
8962
- const a = n * (10000n + s) / 10000n, c = await Pe(), u = await Ct("swap"), { token1FeeBps: l, token2FeeBps: f } = await nr(e, t), { referrerPubkey: p, refReturnBps: d } = i ? await qr(o, i) : { referrerPubkey: void 0, refReturnBps: void 0 }, w = await Pl({
8975
+ const a = n * (10000n + s) / 10000n, c = await Pe(), u = await Ct("swap"), { token1FeeBps: l, token2FeeBps: f } = await nr(e, t), { referrerPubkey: p, refReturnBps: d } = i ? await qr(o, i) : { referrerPubkey: void 0, refReturnBps: void 0 }, w = await Fl({
8963
8976
  token1_addr: e,
8964
8977
  token2_addr: t,
8965
8978
  max_in_amt: a.toString(),
@@ -8969,7 +8982,7 @@ async function ql(e, t, n, r, s, i) {
8969
8982
  btc_fee: u.toString(),
8970
8983
  referrer_pubkey: p,
8971
8984
  ref_return_bps: d ? d.toString() : void 0
8972
- }), h = await Fl({
8985
+ }), h = await Ul({
8973
8986
  pubkey: o,
8974
8987
  nonce: c,
8975
8988
  token1_addr: e,
@@ -8982,7 +8995,7 @@ async function ql(e, t, n, r, s, i) {
8982
8995
  referrer_pubkey: p,
8983
8996
  ref_return_bps: d
8984
8997
  });
8985
- return await Ul({
8998
+ return await ql({
8986
8999
  pubkey: o,
8987
9000
  token1_addr: e,
8988
9001
  token2_addr: t,
@@ -9027,8 +9040,8 @@ async function bo(e) {
9027
9040
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
9028
9041
  }
9029
9042
  async function mo(e) {
9030
- const t = j("withdraw");
9031
- return J(t, {
9043
+ const t = J("withdraw");
9044
+ return X(t, {
9032
9045
  method: "POST",
9033
9046
  headers: {
9034
9047
  "Content-Type": "application/json"
@@ -9036,7 +9049,7 @@ async function mo(e) {
9036
9049
  body: JSON.stringify(e)
9037
9050
  });
9038
9051
  }
9039
- async function Dl(e, t, n) {
9052
+ async function Ml(e, t, n) {
9040
9053
  const r = (await nt())?.swapPubkey;
9041
9054
  if (!r)
9042
9055
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
@@ -9067,7 +9080,7 @@ async function Dl(e, t, n) {
9067
9080
  bip322_signature: l
9068
9081
  });
9069
9082
  }
9070
- async function Ml(e, t) {
9083
+ async function Wl(e, t) {
9071
9084
  const n = (await nt())?.swapPubkey;
9072
9085
  if (!n)
9073
9086
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
@@ -9101,7 +9114,7 @@ async function Ml(e, t) {
9101
9114
  bip322_signature: l
9102
9115
  });
9103
9116
  }
9104
- async function Wl(e, t) {
9117
+ async function Gl(e, t) {
9105
9118
  const n = await Wt();
9106
9119
  Jn(n.wbtc_address, n.factory_address);
9107
9120
  const r = (await nt())?.swapPubkey;
@@ -9127,7 +9140,7 @@ async function Wl(e, t) {
9127
9140
  throw new Error("No data returned from unwrap request.");
9128
9141
  return { amt: o.data.amt };
9129
9142
  }
9130
- async function Gl(e) {
9143
+ async function Hl(e) {
9131
9144
  e.pkscript = e.pkscript.toLowerCase();
9132
9145
  const t = `Unwrap Order:
9133
9146
  Pkscript: ${e.pkscript}
@@ -9139,7 +9152,7 @@ BTC Fee: ${e.btc_fee}
9139
9152
  By signing this message, you authorize the creation of a withdraw order with the above parameters.`;
9140
9153
  return await $e(t, "ordinals");
9141
9154
  }
9142
- async function Hl(e) {
9155
+ async function Vl(e) {
9143
9156
  e.pubkey = e.pubkey.startsWith("0x") ? e.pubkey.slice(2) : e.pubkey;
9144
9157
  let t = et(S.from(e.pubkey, "hex")).slice(2);
9145
9158
  t += e.nonce.toString(16).padStart(8, "0"), t += "06", t += et(S.from(e.pkscript, "hex")).slice(2), t += e.amt.toString(16).padStart(64, "0"), t += e.btc_fee.toString(16).padStart(64, "0");
@@ -9151,9 +9164,9 @@ async function Hl(e) {
9151
9164
  const i = s.swapPrivkey.startsWith("0x") ? s.swapPrivkey.slice(2) : s.swapPrivkey, o = S.from(i, "hex"), a = v.shortSignatures.sign(r, o);
9152
9165
  return `0x${a.x.toString(16).padStart(128, "0")}${a.y.toString(16).padStart(128, "0")}`;
9153
9166
  }
9154
- async function Vl(e) {
9155
- const t = j("unwrap");
9156
- return J(t, {
9167
+ async function Zl(e) {
9168
+ const t = J("unwrap");
9169
+ return X(t, {
9157
9170
  method: "POST",
9158
9171
  headers: {
9159
9172
  "Content-Type": "application/json"
@@ -9161,24 +9174,24 @@ async function Vl(e) {
9161
9174
  body: JSON.stringify(e)
9162
9175
  });
9163
9176
  }
9164
- async function Zl(e, t) {
9177
+ async function Yl(e, t) {
9165
9178
  const n = (await nt())?.swapPubkey;
9166
9179
  if (!n)
9167
9180
  throw new Error("Smart wallet not found. Please generate a smart wallet first.");
9168
- const r = 0n, s = 0n, i = await Pe(), o = await Ct("unwrap"), a = await Gl({
9181
+ const r = 0n, s = 0n, i = await Pe(), o = await Ct("unwrap"), a = await Hl({
9169
9182
  pkscript: e,
9170
9183
  amt: t.toString(),
9171
9184
  token1FeeBps: r.toString(),
9172
9185
  token2FeeBps: s.toString(),
9173
9186
  btc_fee: o.toString()
9174
- }), c = await Hl({
9187
+ }), c = await Vl({
9175
9188
  pubkey: n,
9176
9189
  nonce: i,
9177
9190
  pkscript: e,
9178
9191
  amt: t,
9179
9192
  btc_fee: o
9180
9193
  });
9181
- return await Vl({
9194
+ return await Zl({
9182
9195
  pubkey: n,
9183
9196
  pkscript: e,
9184
9197
  amt: t.toString(),
@@ -9189,21 +9202,21 @@ async function Zl(e, t) {
9189
9202
  bip322_signature: a
9190
9203
  });
9191
9204
  }
9192
- async function Yl(e, t) {
9193
- return await dl({
9205
+ async function zl(e, t) {
9206
+ return await pl({
9194
9207
  pubkey: e,
9195
9208
  pairAddress: t
9196
9209
  });
9197
9210
  }
9198
- async function zl(e, t, n) {
9199
- return await fl({
9211
+ async function Kl(e, t, n) {
9212
+ return await dl({
9200
9213
  pair_address: e,
9201
9214
  limit: t || 20,
9202
9215
  offset: n || 0
9203
9216
  });
9204
9217
  }
9205
- async function Kl(e, t, n, r, s) {
9206
- return (await Bl(
9218
+ async function Xl(e, t, n, r, s) {
9219
+ return (await vl(
9207
9220
  e,
9208
9221
  t,
9209
9222
  n,
@@ -9211,8 +9224,8 @@ async function Kl(e, t, n, r, s) {
9211
9224
  s
9212
9225
  )).success;
9213
9226
  }
9214
- async function Xl(e, t, n, r, s, i) {
9215
- return (await Rl(
9227
+ async function Jl(e, t, n, r, s, i) {
9228
+ return (await Nl(
9216
9229
  e,
9217
9230
  t,
9218
9231
  n,
@@ -9221,8 +9234,8 @@ async function Xl(e, t, n, r, s, i) {
9221
9234
  i
9222
9235
  )).success;
9223
9236
  }
9224
- async function Jl(e, t, n, r, s, i) {
9225
- return (await Ll(
9237
+ async function jl(e, t, n, r, s, i) {
9238
+ return (await Al(
9226
9239
  e,
9227
9240
  t,
9228
9241
  n,
@@ -9231,8 +9244,8 @@ async function Jl(e, t, n, r, s, i) {
9231
9244
  i
9232
9245
  )).success;
9233
9246
  }
9234
- async function jl(e, t, n, r, s, i) {
9235
- return (await ql(
9247
+ async function Ql(e, t, n, r, s, i) {
9248
+ return (await Dl(
9236
9249
  e,
9237
9250
  t,
9238
9251
  n,
@@ -9241,11 +9254,11 @@ async function jl(e, t, n, r, s, i) {
9241
9254
  i
9242
9255
  )).success;
9243
9256
  }
9244
- async function Ql(e, t) {
9245
- return (await Zl(e, t)).success;
9257
+ async function tf(e, t) {
9258
+ return (await Yl(e, t)).success;
9246
9259
  }
9247
- async function tf(e, t, n, r = !0, s) {
9248
- return await hl(
9260
+ async function ef(e, t, n, r = !0, s) {
9261
+ return await wl(
9249
9262
  e,
9250
9263
  t,
9251
9264
  n,
@@ -9253,59 +9266,60 @@ async function tf(e, t, n, r = !0, s) {
9253
9266
  s
9254
9267
  );
9255
9268
  }
9256
- async function ef(e, t) {
9257
- return await bl(e, t);
9269
+ async function nf(e, t) {
9270
+ return await ml(e, t);
9258
9271
  }
9259
- async function nf(e, t, n) {
9260
- return n ? (await Dl(e, n, t)).success : (await Ml(e, t)).success;
9272
+ async function rf(e, t, n) {
9273
+ return n ? (await Ml(e, n, t)).success : (await Wl(e, t)).success;
9261
9274
  }
9262
- const Of = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9275
+ const Tf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9263
9276
  __proto__: null,
9264
- addLiquidity: Kl,
9277
+ addLiquidity: Xl,
9265
9278
  createSwapWallet: oo,
9266
- deposit: tf,
9279
+ deposit: ef,
9267
9280
  ensureSwapWallet: el,
9268
- getActivityOfPair: zl,
9269
- getAddLiquidityResult: xl,
9281
+ getActivityOfPair: Kl,
9282
+ getAddLiquidityResult: _l,
9270
9283
  getKlines: ll,
9271
9284
  getMinerFee: Ct,
9272
- getMinerFeesOfDepositOrder: wl,
9273
- getMinerFeesOfWrapOrder: ml,
9285
+ getMinerFeesOfDepositOrder: gl,
9286
+ getMinerFeesOfWrapOrder: xl,
9274
9287
  getPairAddress: jn,
9275
9288
  getPairReserves: Ae,
9276
9289
  getPairVolumeOverDays: ul,
9277
- getRemoveLiquidityResult: vl,
9290
+ getRemoveLiquidityResult: Ol,
9278
9291
  getSwapBalance: il,
9279
9292
  getSwapBalances: sl,
9280
- getSwapExactInputResult: Nl,
9281
- getSwapExactOutputResult: Al,
9293
+ getSwapExactInputResult: kl,
9294
+ getSwapExactOutputResult: Pl,
9282
9295
  getSwapInfo: Wt,
9283
9296
  getSwapStatus: rl,
9284
9297
  getSwapWalletSecurityCode: nl,
9285
9298
  getTokenDecimals: fn,
9286
- getUnwrapBtcResult: Wl,
9287
- getWalletActivities: Yl,
9299
+ getTvlHistory: fl,
9300
+ getUnwrapBtcResult: Gl,
9301
+ getWalletActivities: zl,
9288
9302
  importSwapWallet: tl,
9289
9303
  listPairs: cl,
9290
9304
  listTokens: al,
9291
- removeLiquidity: Xl,
9305
+ removeLiquidity: Jl,
9292
9306
  satsToBtc: ji,
9293
9307
  satsToUsd: Eu,
9294
- swapExactInput: Jl,
9295
- swapExactOutput: jl,
9308
+ swapExactInput: jl,
9309
+ swapExactOutput: Ql,
9296
9310
  swapSide: _u,
9297
9311
  tryGetSwapReferrerInfo: qr,
9298
- unwrapBtc: Ql,
9299
- withdraw: nf,
9300
- wrapBtc: ef
9301
- }, Symbol.toStringTag, { value: "Module" })), rf = "text/plain", xo = /^[a-z0-9-]{6}$/i, sf = /^(?:[0-9a-f]{2})+$/i;
9312
+ unwrapBtc: tf,
9313
+ withdraw: rf,
9314
+ wrapBtc: nf
9315
+ }, Symbol.toStringTag, { value: "Module" })), sf = "text/plain", xo = /^[a-z0-9-]{6}$/i, of = /^(?:[0-9a-f]{2})+$/i;
9302
9316
  function Dr(e) {
9303
9317
  if (typeof e != "string" || e.length === 0)
9304
9318
  throw new Error("tick must be a non-empty string");
9305
9319
  return K.str(e).length;
9306
9320
  }
9307
9321
  function Er(e, t) {
9308
- if (typeof e != "string" || !sf.test(e))
9322
+ if (typeof e != "string" || !of.test(e))
9309
9323
  throw new Error(`${t} must be a non-empty hex string`);
9310
9324
  }
9311
9325
  function Mn(e, t) {
@@ -9314,7 +9328,7 @@ function Mn(e, t) {
9314
9328
  }
9315
9329
  function dn(e) {
9316
9330
  return new ce(
9317
- K.str(rf),
9331
+ K.str(sf),
9318
9332
  null,
9319
9333
  null,
9320
9334
  null,
@@ -9330,7 +9344,7 @@ function _o(e, t, n) {
9330
9344
  const s = r || e.selfMint === !0, i = { p: "brc-20", op: "deploy", tick: e.tick };
9331
9345
  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;
9332
9346
  }
9333
- function of(e) {
9347
+ function af(e) {
9334
9348
  const t = Dr(e.tick);
9335
9349
  if (t === 6)
9336
9350
  throw new Error("6-byte tickers require a predeploy; use predeployInscriptions()");
@@ -9338,13 +9352,13 @@ function of(e) {
9338
9352
  throw new Error(`deploy ticker must be 4 or 5 bytes, got ${t}`);
9339
9353
  return dn(_o(e, t, null));
9340
9354
  }
9341
- function af(e) {
9355
+ function cf(e) {
9342
9356
  const t = Dr(e.tick);
9343
9357
  if (t < 4 || t > 6)
9344
9358
  throw new Error(`ticker must be 4-6 bytes, got ${t}`);
9345
9359
  return Mn(e.amt, "amt"), dn({ p: "brc-20", op: "mint", tick: e.tick, amt: e.amt });
9346
9360
  }
9347
- function cf(e) {
9361
+ function uf(e) {
9348
9362
  const t = Dr(e.tick);
9349
9363
  if (t < 4 || t > 6)
9350
9364
  throw new Error(`ticker must be 4-6 bytes, got ${t}`);
@@ -9355,7 +9369,7 @@ function Eo(e = 16) {
9355
9369
  throw new Error("byteLength must be a positive integer");
9356
9370
  return K.random(e).hex;
9357
9371
  }
9358
- function uf(e) {
9372
+ function lf(e) {
9359
9373
  if (typeof e != "string" || e.length === 0)
9360
9374
  throw new Error("address must be a non-empty string");
9361
9375
  return hn.address.toOutputScript(e, Ye()).toString("hex");
@@ -9371,10 +9385,10 @@ function So(e, t, n) {
9371
9385
  ]);
9372
9386
  return hn.crypto.hash256(r).toString("hex");
9373
9387
  }
9374
- function lf(e) {
9388
+ function ff(e) {
9375
9389
  if (typeof e.tick != "string" || !xo.test(e.tick))
9376
9390
  throw new Error("6-byte ticker must match /^[A-Za-z0-9-]{6}$/");
9377
- const t = uf(e.address), n = e.salt ?? Eo();
9391
+ const t = lf(e.address), n = e.salt ?? Eo();
9378
9392
  Er(n, "salt");
9379
9393
  const r = So(e.tick, n, t), s = _o(
9380
9394
  { tick: e.tick, max: e.max, lim: e.lim, dec: e.dec },
@@ -9415,7 +9429,7 @@ async function Bo(e, t, n, r, s, i, o, a, c) {
9415
9429
  );
9416
9430
  throw new Error(`Unsupported wallet type: ${c}`);
9417
9431
  }
9418
- async function ff(e, t, n, r, s, i, o, a, c, u, l) {
9432
+ async function df(e, t, n, r, s, i, o, a, c, u, l) {
9419
9433
  if (typeof t != "object")
9420
9434
  throw new Error("abi must be an object");
9421
9435
  if (typeof n != "string")
@@ -9435,7 +9449,7 @@ async function ff(e, t, n, r, s, i, o, a, c, u, l) {
9435
9449
  f
9436
9450
  );
9437
9451
  }
9438
- async function df(e, t, n, r, s, i) {
9452
+ async function pf(e, t, n, r, s, i) {
9439
9453
  return await Uo(
9440
9454
  e,
9441
9455
  t,
@@ -9446,7 +9460,7 @@ async function df(e, t, n, r, s, i) {
9446
9460
  s
9447
9461
  );
9448
9462
  }
9449
- async function pf(e, t, n, r, s, i, o) {
9463
+ async function hf(e, t, n, r, s, i, o) {
9450
9464
  return await qo(
9451
9465
  e,
9452
9466
  t,
@@ -9458,20 +9472,20 @@ async function pf(e, t, n, r, s, i, o) {
9458
9472
  i
9459
9473
  );
9460
9474
  }
9461
- const Tf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9475
+ const If = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9462
9476
  __proto__: null,
9463
9477
  callSmartContract: Bo,
9464
- callSmartContractAbi: ff,
9478
+ callSmartContractAbi: df,
9465
9479
  computeBrc20PredeployHash: So,
9466
- deployBrc20Inscription: of,
9467
- depositToBrc20Prog: df,
9480
+ deployBrc20Inscription: af,
9481
+ depositToBrc20Prog: pf,
9468
9482
  generateBrc20Salt: Eo,
9469
- mintBrc20Inscription: af,
9470
- predeployInscriptions: lf,
9471
- transferBrc20Inscription: cf,
9472
- withdrawFromBrc20Prog: pf
9483
+ mintBrc20Inscription: cf,
9484
+ predeployInscriptions: ff,
9485
+ transferBrc20Inscription: uf,
9486
+ withdrawFromBrc20Prog: hf
9473
9487
  }, Symbol.toStringTag, { value: "Module" }));
9474
- async function hf(e, t, n, r, s) {
9488
+ async function wf(e, t, n, r, s) {
9475
9489
  const i = await Vs(
9476
9490
  [e],
9477
9491
  t,
@@ -9489,10 +9503,10 @@ async function hf(e, t, n, r, s) {
9489
9503
  secret: i.secret
9490
9504
  };
9491
9505
  }
9492
- async function wf(e, t, n, r, s) {
9506
+ async function gf(e, t, n, r, s) {
9493
9507
  return await Vs(e, t, n, r, s);
9494
9508
  }
9495
- async function gf(e, t, n, r, s, i) {
9509
+ async function yf(e, t, n, r, s, i) {
9496
9510
  return await Do(
9497
9511
  e,
9498
9512
  t,
@@ -9502,19 +9516,19 @@ async function gf(e, t, n, r, s, i) {
9502
9516
  i
9503
9517
  );
9504
9518
  }
9505
- async function yf(e, t, n, r) {
9519
+ async function bf(e, t, n, r) {
9506
9520
  return await Hs([e], t, n, r);
9507
9521
  }
9508
- async function bf(e, t, n, r) {
9522
+ async function mf(e, t, n, r) {
9509
9523
  return await Hs(e, t, n, r);
9510
9524
  }
9511
- const If = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9525
+ const Rf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9512
9526
  __proto__: null,
9513
- getInscribeFee: yf,
9514
- getInscribeMultipleFee: bf,
9515
- inscribe: hf,
9516
- inscribeMultiple: wf,
9517
- inscribeWithParent: gf
9527
+ getInscribeFee: bf,
9528
+ getInscribeMultipleFee: mf,
9529
+ inscribe: wf,
9530
+ inscribeMultiple: gf,
9531
+ inscribeWithParent: yf
9518
9532
  }, Symbol.toStringTag, { value: "Module" })), vo = [
9519
9533
  { inputs: [], stateMutability: "nonpayable", type: "constructor" },
9520
9534
  {
@@ -9673,7 +9687,7 @@ const If = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9673
9687
  type: "function"
9674
9688
  }
9675
9689
  ], Oo = "0xc54dd4581af2dbf18e4d90840226756e9d2b3cdb";
9676
- async function mf(e, t) {
9690
+ async function xf(e, t) {
9677
9691
  const n = t.toUpperCase(), r = zs("check_base_brc20_balance"), i = await Zs(r, {
9678
9692
  method: "POST",
9679
9693
  headers: {
@@ -9691,7 +9705,7 @@ async function mf(e, t) {
9691
9705
  ticker: i.result.ticker
9692
9706
  };
9693
9707
  }
9694
- async function xf(e, t) {
9708
+ async function _f(e, t) {
9695
9709
  const n = zs("check_brc20_balance"), s = await Zs(n, {
9696
9710
  method: "POST",
9697
9711
  headers: {
@@ -9704,7 +9718,7 @@ async function xf(e, t) {
9704
9718
  });
9705
9719
  return BigInt(s.result);
9706
9720
  }
9707
- async function _f(e, t) {
9721
+ async function Ef(e, t) {
9708
9722
  const n = S.from(t, "utf-8"), r = await Ys(
9709
9723
  Oo,
9710
9724
  vo,
@@ -9713,7 +9727,7 @@ async function _f(e, t) {
9713
9727
  );
9714
9728
  return BigInt(r);
9715
9729
  }
9716
- async function Ef(e) {
9730
+ async function Sf(e) {
9717
9731
  const t = S.from(e, "utf-8");
9718
9732
  return `0x${(await Ys(
9719
9733
  Oo,
@@ -9722,17 +9736,17 @@ async function Ef(e) {
9722
9736
  [t]
9723
9737
  )).slice(-40)}`;
9724
9738
  }
9725
- const Rf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9739
+ const Nf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9726
9740
  __proto__: null,
9727
- getBRC20ProgBalanceOfAddress: xf,
9728
- getBRC20ProgBalanceOfTicker: _f,
9729
- getBRC20ProgTokenAddressOfTicker: Ef,
9730
- getBaseBRC20BalanceOfAddress: mf
9741
+ getBRC20ProgBalanceOfAddress: _f,
9742
+ getBRC20ProgBalanceOfTicker: Ef,
9743
+ getBRC20ProgTokenAddressOfTicker: Sf,
9744
+ getBaseBRC20BalanceOfAddress: xf
9731
9745
  }, Symbol.toStringTag, { value: "Module" }));
9732
9746
  export {
9733
- Tf as a,
9734
- Rf as b,
9735
- Of as c,
9736
- If as m,
9737
- vf as s
9747
+ If as a,
9748
+ Nf as b,
9749
+ Tf as c,
9750
+ Rf as m,
9751
+ Of as s
9738
9752
  };