@babylonlabs-io/ts-sdk 0.41.0 → 0.41.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.
Files changed (60) hide show
  1. package/dist/{PayoutManager-B5bovfkD.cjs → PayoutManager-BwYlPF2C.cjs} +2 -2
  2. package/dist/{PayoutManager-B5bovfkD.cjs.map → PayoutManager-BwYlPF2C.cjs.map} +1 -1
  3. package/dist/{PayoutManager-DChODEOJ.js → PayoutManager-CXDccwDN.js} +2 -2
  4. package/dist/{PayoutManager-DChODEOJ.js.map → PayoutManager-CXDccwDN.js.map} +1 -1
  5. package/dist/PeginManager-BOuzU8Zo.cjs +2 -0
  6. package/dist/PeginManager-BOuzU8Zo.cjs.map +1 -0
  7. package/dist/{PeginManager-D9ZZ8wx2.js → PeginManager-Bsou6AQV.js} +44 -47
  8. package/dist/PeginManager-Bsou6AQV.js.map +1 -0
  9. package/dist/{assertPsbtUnsignedTxMatches-r1svclbd.cjs → assertPsbtUnsignedTxMatches-CABhEADu.cjs} +2 -2
  10. package/dist/{assertPsbtUnsignedTxMatches-r1svclbd.cjs.map → assertPsbtUnsignedTxMatches-CABhEADu.cjs.map} +1 -1
  11. package/dist/{assertPsbtUnsignedTxMatches-CzVv57QF.js → assertPsbtUnsignedTxMatches-GHobJP-d.js} +2 -2
  12. package/dist/{assertPsbtUnsignedTxMatches-CzVv57QF.js.map → assertPsbtUnsignedTxMatches-GHobJP-d.js.map} +1 -1
  13. package/dist/{buildAndBroadcastRefund-fIHDHiFh.js → buildAndBroadcastRefund-37Bs7-V1.js} +4 -4
  14. package/dist/{buildAndBroadcastRefund-fIHDHiFh.js.map → buildAndBroadcastRefund-37Bs7-V1.js.map} +1 -1
  15. package/dist/{buildAndBroadcastRefund-Cj8JDI7F.cjs → buildAndBroadcastRefund-DbcNEsOv.cjs} +2 -2
  16. package/dist/{buildAndBroadcastRefund-Cj8JDI7F.cjs.map → buildAndBroadcastRefund-DbcNEsOv.cjs.map} +1 -1
  17. package/dist/{challengeAssert-DLEmAhT0.js → challengeAssert-ChqnvtRg.js} +2 -2
  18. package/dist/{challengeAssert-DLEmAhT0.js.map → challengeAssert-ChqnvtRg.js.map} +1 -1
  19. package/dist/{challengeAssert-rpDaS3fH.cjs → challengeAssert-Cmj_OG6V.cjs} +2 -2
  20. package/dist/{challengeAssert-rpDaS3fH.cjs.map → challengeAssert-Cmj_OG6V.cjs.map} +1 -1
  21. package/dist/{fundPeginTransaction-t-6TsHAY.js → fundPeginTransaction-C11tYf6I.js} +32 -33
  22. package/dist/fundPeginTransaction-C11tYf6I.js.map +1 -0
  23. package/dist/fundPeginTransaction-C8qsXxNV.cjs +2 -0
  24. package/dist/fundPeginTransaction-C8qsXxNV.cjs.map +1 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.js +9 -9
  27. package/dist/{noPayout-CS2wnluA.js → noPayout-BtP-R-b-.js} +2 -2
  28. package/dist/{noPayout-CS2wnluA.js.map → noPayout-BtP-R-b-.js.map} +1 -1
  29. package/dist/{noPayout-B06Z9RTe.cjs → noPayout-DliaHuc6.cjs} +2 -2
  30. package/dist/{noPayout-B06Z9RTe.cjs.map → noPayout-DliaHuc6.cjs.map} +1 -1
  31. package/dist/{reservation-hjXStM03.cjs → reservation-Cwf2u4vu.cjs} +2 -2
  32. package/dist/{reservation-hjXStM03.cjs.map → reservation-Cwf2u4vu.cjs.map} +1 -1
  33. package/dist/{reservation-CB-4FBPk.js → reservation-DNOGLBt4.js} +2 -2
  34. package/dist/{reservation-CB-4FBPk.js.map → reservation-DNOGLBt4.js.map} +1 -1
  35. package/dist/tbv/core/index.cjs +1 -1
  36. package/dist/tbv/core/index.js +9 -9
  37. package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
  38. package/dist/tbv/core/managers/index.cjs +1 -1
  39. package/dist/tbv/core/managers/index.js +2 -2
  40. package/dist/tbv/core/primitives/index.cjs +1 -1
  41. package/dist/tbv/core/primitives/index.js +3 -3
  42. package/dist/tbv/core/services/index.cjs +1 -1
  43. package/dist/tbv/core/services/index.js +2 -2
  44. package/dist/tbv/core/utils/fee/constants.d.ts +8 -12
  45. package/dist/tbv/core/utils/fee/constants.d.ts.map +1 -1
  46. package/dist/tbv/core/utils/index.cjs +1 -1
  47. package/dist/tbv/core/utils/index.js +3 -3
  48. package/dist/tbv/index.cjs +1 -1
  49. package/dist/tbv/index.js +9 -9
  50. package/dist/{waitForTransactionReceiptSmartAware-tv1mtSIY.cjs → waitForTransactionReceiptSmartAware-BFMQFEzj.cjs} +2 -2
  51. package/dist/{waitForTransactionReceiptSmartAware-tv1mtSIY.cjs.map → waitForTransactionReceiptSmartAware-BFMQFEzj.cjs.map} +1 -1
  52. package/dist/{waitForTransactionReceiptSmartAware-CmgFXFza.js → waitForTransactionReceiptSmartAware-Dt5VcMK0.js} +2 -2
  53. package/dist/{waitForTransactionReceiptSmartAware-CmgFXFza.js.map → waitForTransactionReceiptSmartAware-Dt5VcMK0.js.map} +1 -1
  54. package/package.json +1 -1
  55. package/dist/PeginManager-D9ZZ8wx2.js.map +0 -1
  56. package/dist/PeginManager-UqbOj2oV.cjs +0 -2
  57. package/dist/PeginManager-UqbOj2oV.cjs.map +0 -1
  58. package/dist/fundPeginTransaction-BBE3wTjR.cjs +0 -2
  59. package/dist/fundPeginTransaction-BBE3wTjR.cjs.map +0 -1
  60. package/dist/fundPeginTransaction-t-6TsHAY.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  var qt = Object.defineProperty;
2
2
  var zt = (n, t, e) => t in n ? qt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
3
  var x = (n, t, e) => zt(n, typeof t != "symbol" ? t + "" : t, e);
4
- import { s as it, c as It, H as Yt, r as M, a as X, b as lt, u as jt, d as ut, e as ht, f as dt, g as Zt } from "./sha2-BYVxyZzX.js";
4
+ import { s as it, c as It, H as Yt, r as M, a as W, b as lt, u as jt, d as ut, e as ht, f as dt, g as Zt } from "./sha2-BYVxyZzX.js";
5
5
  import * as Ct from "bitcoinjs-lib";
6
6
  import { Transaction as Qt, Psbt as gt } from "bitcoinjs-lib";
7
7
  import { Buffer as J } from "buffer";
@@ -9,14 +9,14 @@ import { isAddressEqual as ft, encodeFunctionData as tt, zeroAddress as Jt } fro
9
9
  import { B as I } from "./BTCVaultRegistry.abi-Cq9-JlqT.js";
10
10
  import { h as H } from "./errors-CznAK5NB.js";
11
11
  import { expandWotsSeed as te, expandHashlockSecret as ee, expandAuthAnchor as ne, deriveVaultId as pt } from "@babylonlabs-io/babylon-tbv-rust-wasm";
12
- import { b as mt, a as se, d as bt } from "./assertPsbtUnsignedTxMatches-CzVv57QF.js";
12
+ import { b as mt, a as se, d as bt } from "./assertPsbtUnsignedTxMatches-GHobJP-d.js";
13
13
  import { b as oe, e as re, f as ie } from "./peginInput-BPRB9tUi.js";
14
- import { u as K, h as et, e as v, p as ae, i as Pt, s as T, j as wt, X as ce } from "./bitcoin-B5aNKtsk.js";
14
+ import { u as X, h as et, e as v, p as ae, i as Pt, s as T, j as wt, X as ce } from "./bitcoin-B5aNKtsk.js";
15
15
  import { c as le } from "./signing-DaLvGwQe.js";
16
16
  import { M as yt } from "./validation-CxqROCno.js";
17
- import { c as ue, a as he } from "./PayoutManager-DChODEOJ.js";
18
- import { s as de, f as z, i as ge, w as xt } from "./waitForTransactionReceiptSmartAware-CmgFXFza.js";
19
- import { p as fe, f as pe } from "./fundPeginTransaction-t-6TsHAY.js";
17
+ import { c as ue, a as he } from "./PayoutManager-CXDccwDN.js";
18
+ import { s as de, f as q, i as ge, w as xt } from "./waitForTransactionReceiptSmartAware-Dt5VcMK0.js";
19
+ import { p as fe, f as pe } from "./fundPeginTransaction-C11tYf6I.js";
20
20
  import { p as me, h as be } from "./mempoolApi-C7hkVkym.js";
21
21
  const N = /* @__PURE__ */ BigInt(2 ** 32 - 1), kt = /* @__PURE__ */ BigInt(32);
22
22
  function Pe(n, t = !1) {
@@ -31,19 +31,19 @@ function we(n, t = !1) {
31
31
  }
32
32
  return [s, o];
33
33
  }
34
- const ye = (n, t, e) => n << e | t >>> 32 - e, xe = (n, t, e) => t << e | n >>> 32 - e, ke = (n, t, e) => t << e - 32 | n >>> 64 - e, Ee = (n, t, e) => n << e - 32 | t >>> 64 - e, U = 32, Y = 32, nt = 36, Ht = 32, D = 4, Te = D + U + D + Ht;
34
+ const ye = (n, t, e) => n << e | t >>> 32 - e, xe = (n, t, e) => t << e | n >>> 32 - e, ke = (n, t, e) => t << e - 32 | n >>> 64 - e, Ee = (n, t, e) => n << e - 32 | t >>> 64 - e, U = 32, z = 32, nt = 36, Ht = 32, K = 4, Te = K + U + K + Ht;
35
35
  function st(n, t, e) {
36
36
  n[t] = e >>> 24 & 255, n[t + 1] = e >>> 16 & 255, n[t + 2] = e >>> 8 & 255, n[t + 3] = e & 255;
37
37
  }
38
38
  function _e(n) {
39
- if (n.txid.length !== Y)
39
+ if (n.txid.length !== z)
40
40
  throw new Error(
41
- `outpoint.txid must be exactly ${Y} bytes, got ${n.txid.length}`
41
+ `outpoint.txid must be exactly ${z} bytes, got ${n.txid.length}`
42
42
  );
43
43
  if (!Number.isInteger(n.vout) || n.vout < 0 || n.vout > 4294967295)
44
44
  throw new Error(`outpoint.vout must be a u32, got ${n.vout}`);
45
45
  const t = new Uint8Array(nt);
46
- return t.set(n.txid, 0), st(t, Y, n.vout), t;
46
+ return t.set(n.txid, 0), st(t, z, n.vout), t;
47
47
  }
48
48
  function Et(n, t) {
49
49
  const e = Math.min(n.length, t.length);
@@ -75,11 +75,11 @@ function ve(n) {
75
75
  );
76
76
  const t = Be(n.fundingOutpoints), e = new Uint8Array(Te);
77
77
  let s = 0;
78
- return st(e, s, U), s += D, e.set(n.depositorBtcPubkey, s), s += U, st(e, s, Ht), s += D, e.set(t, s), e;
78
+ return st(e, s, U), s += K, e.set(n.depositorBtcPubkey, s), s += U, st(e, s, Ht), s += K, e.set(t, s), e;
79
79
  }
80
80
  const Se = "babylon-btc-vault", Ot = 32, Tt = Ot * 2, Ae = /^[0-9a-f]+$/;
81
81
  async function Ie(n, t) {
82
- const e = ve(t), s = K(e), o = await n.deriveContextHash(Se, s);
82
+ const e = ve(t), s = X(e), o = await n.deriveContextHash(Se, s);
83
83
  if (typeof o != "string")
84
84
  throw new Error(
85
85
  `deriveVaultRoot: wallet must return a string, got ${typeof o}`
@@ -174,10 +174,10 @@ class Me extends Yt {
174
174
  this.set(this.h1 + c + m | 0, this.h2 + l + P | 0, this.h3 + b + r | 0, this.h4 + o + a | 0, this.h0 + i + u | 0);
175
175
  }
176
176
  roundClean() {
177
- X(V);
177
+ W(V);
178
178
  }
179
179
  destroy() {
180
- this.destroyed = !0, X(this.buffer), this.set(0, 0, 0, 0, 0);
180
+ this.destroyed = !0, W(this.buffer), this.set(0, 0, 0, 0, 0);
181
181
  }
182
182
  }
183
183
  const Ne = /* @__PURE__ */ It(() => new Me()), Ve = BigInt(0), R = BigInt(1), Fe = BigInt(2), Le = BigInt(7), We = BigInt(256), Xe = BigInt(113), Vt = [], Ft = [], Lt = [];
@@ -212,7 +212,7 @@ function Ge(n, t = 24) {
212
212
  }
213
213
  n[0] ^= Ke[s], n[1] ^= De[s];
214
214
  }
215
- X(e);
215
+ W(e);
216
216
  }
217
217
  class at {
218
218
  // NOTE: we accept arguments in bytes instead of bits here.
@@ -283,7 +283,7 @@ class at {
283
283
  return this.digestInto(new Uint8Array(this.outputLen));
284
284
  }
285
285
  destroy() {
286
- this.destroyed = !0, X(this.state);
286
+ this.destroyed = !0, W(this.state);
287
287
  }
288
288
  _cloneInto(t) {
289
289
  const { blockLen: e, suffix: s, outputLen: o, rounds: r, enableXOF: i } = this;
@@ -306,7 +306,7 @@ function Je(n) {
306
306
  const t = ot, e = n * Kt(t);
307
307
  return { d: t, n, checksum_radix: Qe(e) };
308
308
  }
309
- function j(n, t) {
309
+ function Y(n, t) {
310
310
  const e = [];
311
311
  let s = t;
312
312
  for (; s > 0; )
@@ -317,7 +317,7 @@ function j(n, t) {
317
317
  o[n.length + r] = e[r];
318
318
  return ct(o);
319
319
  }
320
- function Z(n, t) {
320
+ function j(n, t) {
321
321
  let e = n;
322
322
  for (let s = 0; s < t; s++)
323
323
  e = ct(e);
@@ -326,19 +326,19 @@ function Z(n, t) {
326
326
  function tn(n, t) {
327
327
  const e = Kt(t.d), s = t.checksum_radix - 1, o = Math.floor(t.n * e / t.checksum_radix), r = [];
328
328
  for (let l = 0; l < t.n; l++) {
329
- const m = j(n, l + Xt), b = Z(m, e);
329
+ const m = Y(n, l + Xt), b = j(m, e);
330
330
  r.push(Array.from(b));
331
331
  }
332
- const i = j(
332
+ const i = Y(
333
333
  n,
334
334
  Ye
335
- ), a = Z(
335
+ ), a = j(
336
336
  i,
337
337
  s
338
- ), c = j(
338
+ ), c = Y(
339
339
  n,
340
340
  je
341
- ), u = Z(
341
+ ), u = j(
342
342
  c,
343
343
  o
344
344
  );
@@ -401,7 +401,7 @@ async function en(n) {
401
401
  n.fill(0);
402
402
  }
403
403
  }
404
- function Q(n, t, e) {
404
+ function Z(n, t, e) {
405
405
  if (n.length !== _)
406
406
  throw new Error(
407
407
  `Block ${t} ${e}: expected ${_} bytes, got ${n.length}`
@@ -419,9 +419,9 @@ function nn(n) {
419
419
  throw new Error("Public keys array must not be empty");
420
420
  for (let r = 0; r < n.length; r++) {
421
421
  const i = n[r];
422
- Q(i.checksum_minor_terminal, r, "checksum_minor_terminal"), Q(i.checksum_major_terminal, r, "checksum_major_terminal");
422
+ Z(i.checksum_minor_terminal, r, "checksum_minor_terminal"), Z(i.checksum_major_terminal, r, "checksum_major_terminal");
423
423
  for (let a = 0; a < i.message_terminals.length; a++)
424
- Q(i.message_terminals[a], r, `message_terminal[${a}]`);
424
+ Z(i.message_terminals[a], r, `message_terminal[${a}]`);
425
425
  }
426
426
  let t = 0;
427
427
  for (const r of n)
@@ -449,7 +449,7 @@ async function sn(n, t) {
449
449
  }
450
450
  const c = await ee(n, i);
451
451
  try {
452
- const u = K(c);
452
+ const u = X(c);
453
453
  o.push(u), r.push(ue(v(u)).slice(2));
454
454
  } finally {
455
455
  c.fill(0);
@@ -502,7 +502,7 @@ async function ln(n, t, e) {
502
502
  }
503
503
  return s;
504
504
  }
505
- const Dt = 0, L = 25, rt = 9999, W = "00".repeat(32);
505
+ const Dt = 0, L = 25, rt = 9999, Q = "00".repeat(32);
506
506
  function un(n, t) {
507
507
  const e = {
508
508
  bitcoin: "bc",
@@ -571,7 +571,7 @@ class $n {
571
571
  try {
572
572
  const f = await ne(i);
573
573
  try {
574
- a = K(f), c = K(it(f));
574
+ a = X(f), c = X(it(f));
575
575
  } finally {
576
576
  f.fill(0);
577
577
  }
@@ -629,7 +629,7 @@ class $n {
629
629
  */
630
630
  async prepareSizing(t, e) {
631
631
  const s = e.amounts.map(
632
- () => W
632
+ () => Q
633
633
  ), o = e.vaultKeeperBtcPubkeys.length, r = await mt({
634
634
  depositorPubkey: t,
635
635
  vaultProviderPubkey: T(e.vaultProviderBtcPubkey),
@@ -644,15 +644,12 @@ class $n {
644
644
  councilQuorum: e.councilQuorum,
645
645
  councilSize: e.councilSize,
646
646
  network: this.config.btcNetwork,
647
- authAnchorHash: W
647
+ authAnchorHash: Q
648
648
  }), i = de(
649
649
  [...e.availableUTXOs],
650
650
  r.totalOutputValue,
651
651
  e.mempoolFeeRate,
652
- fe(
653
- r.htlcValues.length,
654
- W
655
- )
652
+ fe(r.htlcValues.length, !0)
656
653
  );
657
654
  return {
658
655
  selectedUTXOs: i.selectedUTXOs,
@@ -669,7 +666,7 @@ class $n {
669
666
  authAnchorHash: r,
670
667
  sizing: i,
671
668
  params: a
672
- } = t, c = W.toLowerCase();
669
+ } = t, c = Q.toLowerCase();
673
670
  for (let d = 0; d < o.length; d++)
674
671
  if (o[d].toLowerCase() === c)
675
672
  throw new Error(
@@ -700,7 +697,7 @@ class $n {
700
697
  changeAddress: a.changeAddress,
701
698
  changeAmount: i.changeAmount,
702
699
  network: f
703
- }), S = T(z(k)), E = [], p = [], w = [];
700
+ }), S = T(q(k)), E = [], p = [], w = [];
704
701
  for (let d = 0; d < o.length; d++) {
705
702
  const B = await se({
706
703
  prePeginParams: P,
@@ -880,7 +877,7 @@ class $n {
880
877
  const m = await this.assertPopMatchesBtcWallet(u), b = u.btcPopSignature, P = v(u.depositorBtcPubkey), g = v(e), f = v(s), k = a ?? await this.config.btcWallet.getAddress(), S = this.resolvePayoutScriptPubKey(
881
878
  m,
882
879
  k
883
- ), E = z(f), p = await pt(
880
+ ), E = q(f), p = await pt(
884
881
  T(E),
885
882
  T(l)
886
883
  ), w = v(p);
@@ -934,9 +931,9 @@ class $n {
934
931
  } catch (O) {
935
932
  H(O);
936
933
  }
937
- let G;
934
+ let D;
938
935
  try {
939
- G = await this.config.ethWallet.sendTransaction({
936
+ D = await this.config.ethWallet.sendTransaction({
940
937
  to: this.config.vaultContracts.btcVaultRegistry,
941
938
  data: A,
942
939
  value: d,
@@ -947,18 +944,18 @@ class $n {
947
944
  } catch (O) {
948
945
  H(O);
949
946
  }
950
- const q = await xt({
947
+ const G = await xt({
951
948
  publicClient: h,
952
949
  walletAddress: this.config.ethWallet.account.address,
953
- hash: G,
950
+ hash: D,
954
951
  timeout: At
955
952
  });
956
- return q.status === "reverted" && H(
953
+ return G.status === "reverted" && H(
957
954
  new Error(
958
- `Transaction reverted. Hash: ${q.transactionHash}. Check the transaction on block explorer for details.`
955
+ `Transaction reverted. Hash: ${G.transactionHash}. Check the transaction on block explorer for details.`
959
956
  )
960
957
  ), {
961
- ethTxHash: q.transactionHash,
958
+ ethTxHash: G.transactionHash,
962
959
  vaultId: w,
963
960
  peginTxHash: E
964
961
  };
@@ -993,7 +990,7 @@ class $n {
993
990
  for (const h of o) {
994
991
  const d = v(
995
992
  h.depositorSignedPeginTx
996
- ), B = z(d), A = await pt(
993
+ ), B = q(d), A = await pt(
997
994
  T(B),
998
995
  T(i)
999
996
  ), C = v(A);
@@ -1290,4 +1287,4 @@ export {
1290
1287
  Un as e,
1291
1288
  Ie as f
1292
1289
  };
1293
- //# sourceMappingURL=PeginManager-D9ZZ8wx2.js.map
1290
+ //# sourceMappingURL=PeginManager-Bsou6AQV.js.map