@babylonlabs-io/ts-sdk 0.38.1 → 0.39.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.
Files changed (28) hide show
  1. package/dist/{PeginManager-Cp2Tn5sH.js → PeginManager-DXrfY4d6.js} +388 -334
  2. package/dist/{PeginManager-Cp2Tn5sH.js.map → PeginManager-DXrfY4d6.js.map} +1 -1
  3. package/dist/PeginManager-zkTJOy_U.cjs +2 -0
  4. package/dist/{PeginManager-DaDs-bGr.cjs.map → PeginManager-zkTJOy_U.cjs.map} +1 -1
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.js +128 -127
  7. package/dist/tbv/core/clients/eth/types.d.ts +2 -0
  8. package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
  9. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +5 -0
  10. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
  11. package/dist/tbv/core/clients/index.cjs +1 -1
  12. package/dist/tbv/core/clients/index.js +1 -1
  13. package/dist/tbv/core/index.cjs +1 -1
  14. package/dist/tbv/core/index.js +125 -124
  15. package/dist/tbv/core/managers/PeginManager.d.ts +25 -0
  16. package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
  17. package/dist/tbv/core/managers/index.cjs +1 -1
  18. package/dist/tbv/core/managers/index.d.ts +2 -2
  19. package/dist/tbv/core/managers/index.d.ts.map +1 -1
  20. package/dist/tbv/core/managers/index.js +5 -4
  21. package/dist/tbv/index.cjs +1 -1
  22. package/dist/tbv/index.js +125 -124
  23. package/dist/{vault-registry-reader-CbJHSxVe.cjs → vault-registry-reader-BM_993Lb.cjs} +2 -2
  24. package/dist/{vault-registry-reader-CbJHSxVe.cjs.map → vault-registry-reader-BM_993Lb.cjs.map} +1 -1
  25. package/dist/{vault-registry-reader-BrARgFre.js → vault-registry-reader-DXvw-1f6.js} +28 -16
  26. package/dist/{vault-registry-reader-BrARgFre.js.map → vault-registry-reader-DXvw-1f6.js.map} +1 -1
  27. package/package.json +1 -1
  28. package/dist/PeginManager-DaDs-bGr.cjs +0 -2
@@ -3,7 +3,7 @@ var me = (t, e, n) => e in t ? fe(t, e, { enumerable: !0, configurable: !0, writ
3
3
  var p = (t, e, n) => me(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  import { D as be, J as ie, e as _e } from "./types-TOmEvvRy.js";
5
5
  import { X as H, C as L, s as S, S as ye, h as Pe } from "./bitcoin-B5aNKtsk.js";
6
- import { H as T } from "./validation-CxqROCno.js";
6
+ import { H as C } from "./validation-CxqROCno.js";
7
7
  import * as U from "@bitcoin-js/tiny-secp256k1-asmjs";
8
8
  import { payments as we, Transaction as F } from "bitcoinjs-lib";
9
9
  import { Buffer as A } from "buffer";
@@ -25,7 +25,7 @@ class o extends Error {
25
25
  }
26
26
  const $ = 64;
27
27
  function v(t) {
28
- return typeof t == "string" && t.length > 0 && T.test(t);
28
+ return typeof t == "string" && t.length > 0 && C.test(t);
29
29
  }
30
30
  function se(t) {
31
31
  return typeof t == "string" && t.length > 0;
@@ -135,7 +135,7 @@ function $e(t, e) {
135
135
  const n = t;
136
136
  q(n.claimer_pubkey, `${e}.claimer_pubkey`), y(n.claim_tx, `${e}.claim_tx`), y(n.assert_tx, `${e}.assert_tx`), y(n.payout_tx, `${e}.payout_tx`), m(n.payout_psbt, `${e}.payout_psbt`);
137
137
  }
138
- function Te(t, e) {
138
+ function Ce(t, e) {
139
139
  if (t === null || typeof t != "object")
140
140
  throw new o(
141
141
  `VP response validation failed: "${e}" must be an object`
@@ -143,7 +143,7 @@ function Te(t, e) {
143
143
  const n = t;
144
144
  m(n.wots_pks_json, `${e}.wots_pks_json`), m(n.gc_wots_keys_json, `${e}.gc_wots_keys_json`);
145
145
  }
146
- function Ce(t, e) {
146
+ function Te(t, e) {
147
147
  if (t === null || typeof t != "object")
148
148
  throw new o(
149
149
  `VP response validation failed: "${e}" must be an object`
@@ -160,7 +160,7 @@ function Ce(t, e) {
160
160
  `VP response validation failed: "${e}.challenge_assert_connectors" must be an array`
161
161
  );
162
162
  for (let r = 0; r < n.challenge_assert_connectors.length; r++)
163
- Te(
163
+ Ce(
164
164
  n.challenge_assert_connectors[r],
165
165
  `${e}.challenge_assert_connectors[${r}]`
166
166
  );
@@ -332,7 +332,7 @@ function Re(t) {
332
332
  'VP response validation failed: "depositor_graph.challenger_presign_data" must be an array'
333
333
  );
334
334
  for (let e = 0; e < t.challenger_presign_data.length; e++)
335
- Ce(
335
+ Te(
336
336
  t.challenger_presign_data[e],
337
337
  `depositor_graph.challenger_presign_data[${e}]`
338
338
  );
@@ -463,10 +463,10 @@ async function lt(t) {
463
463
  `batchPollByProvider: batchSize must be a positive integer, got ${f}`
464
464
  );
465
465
  for (let P = 0; P < e.length; P += f) {
466
- const x = e.slice(P, P + f), C = /* @__PURE__ */ new Map(), K = [];
466
+ const x = e.slice(P, P + f), T = /* @__PURE__ */ new Map(), K = [];
467
467
  for (const h of x) {
468
468
  const b = n(h).toLowerCase();
469
- C.set(b, h), K.push(b);
469
+ T.set(b, h), K.push(b);
470
470
  }
471
471
  let V;
472
472
  try {
@@ -479,17 +479,17 @@ async function lt(t) {
479
479
  d && V.unexpected.length > 0 && d(V.unexpected);
480
480
  const k = new Set(V.duplicate);
481
481
  for (const h of k) {
482
- const b = C.get(h);
482
+ const b = T.get(h);
483
483
  b && a(b);
484
484
  }
485
485
  c && k.size > 0 && c(k.size);
486
486
  for (const h of V.missing) {
487
- const b = C.get(h);
487
+ const b = T.get(h);
488
488
  b && i(b);
489
489
  }
490
490
  for (const [h, b] of V.byTxid) {
491
491
  if (k.has(h)) continue;
492
- const z = C.get(h);
492
+ const z = T.get(h);
493
493
  z && s(z, {
494
494
  pegin_txid: h,
495
495
  result: b.result,
@@ -607,13 +607,13 @@ function E(t) {
607
607
  }
608
608
  function qe(t) {
609
609
  const { proof: e, pinnedServerPubkey: n, now: r } = t, s = t.maxLifetimeSecs ?? Xe, i = S(n).toLowerCase();
610
- if (i.length !== H || !T.test(i))
610
+ if (i.length !== H || !C.test(i))
611
611
  throw new g(
612
612
  `pinnedServerPubkey must be 32-byte hex; got ${i.length} chars`,
613
613
  "invalid_pubkey_encoding"
614
614
  );
615
615
  const a = S(e.server_pubkey).toLowerCase();
616
- if (a.length !== H || !T.test(a))
616
+ if (a.length !== H || !C.test(a))
617
617
  throw new g(
618
618
  `server_pubkey must be 32-byte hex; got ${a.length} chars`,
619
619
  "invalid_pubkey_encoding"
@@ -649,7 +649,7 @@ function qe(t) {
649
649
  "expires_too_far"
650
650
  );
651
651
  const c = S(e.ephemeral_pubkey).toLowerCase();
652
- if (c.length !== L || !T.test(c))
652
+ if (c.length !== L || !C.test(c))
653
653
  throw new g(
654
654
  `ephemeral_pubkey must be 33-byte compressed hex; got ${c.length} chars`,
655
655
  "invalid_ephemeral_pubkey"
@@ -667,7 +667,7 @@ function qe(t) {
667
667
  "invalid_ephemeral_pubkey"
668
668
  );
669
669
  const f = S(e.signature).toLowerCase();
670
- if (f.length !== ye || !T.test(f))
670
+ if (f.length !== ye || !C.test(f))
671
671
  throw new g(
672
672
  `signature must be 64-byte Schnorr hex; got ${f.length} chars`,
673
673
  "invalid_signature_encoding"
@@ -1274,6 +1274,18 @@ class mt {
1274
1274
  };
1275
1275
  });
1276
1276
  }
1277
+ /**
1278
+ * Read the protocol pegin fee (in wei) for a given vault provider.
1279
+ * Mirrors the `getPegInFee(address)` view on BTCVaultRegistry.
1280
+ */
1281
+ async getPegInFee(e) {
1282
+ return await this.publicClient.readContract({
1283
+ address: this.contractAddress,
1284
+ abi: w,
1285
+ functionName: "getPegInFee",
1286
+ args: [e]
1287
+ });
1288
+ }
1277
1289
  async getVaultData(e) {
1278
1290
  const [n, r] = await Promise.all([
1279
1291
  this.getVaultBasicInfo(e),
@@ -1330,4 +1342,4 @@ export {
1330
1342
  ht as r,
1331
1343
  ke as v
1332
1344
  };
1333
- //# sourceMappingURL=vault-registry-reader-BrARgFre.js.map
1345
+ //# sourceMappingURL=vault-registry-reader-DXvw-1f6.js.map