@babylonlabs-io/ts-sdk 0.62.1 → 0.64.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 (95) hide show
  1. package/dist/{BTCVaultRegistry.abi-B3BLhpJ4.js → BTCVaultRegistry.abi-CJwWI2EO.js} +5 -1
  2. package/dist/{BTCVaultRegistry.abi-B3BLhpJ4.js.map → BTCVaultRegistry.abi-CJwWI2EO.js.map} +1 -1
  3. package/dist/{BTCVaultRegistry.abi-3VLWva2x.cjs → BTCVaultRegistry.abi-z7d_eP22.cjs} +2 -2
  4. package/dist/{BTCVaultRegistry.abi-3VLWva2x.cjs.map → BTCVaultRegistry.abi-z7d_eP22.cjs.map} +1 -1
  5. package/dist/{PeginManager-C8kIl0gw.js → PeginManager-BBl4xkWz.js} +7 -6
  6. package/dist/{PeginManager-C8kIl0gw.js.map → PeginManager-BBl4xkWz.js.map} +1 -1
  7. package/dist/{PeginManager-BgBt4hqp.cjs → PeginManager-p-ajwSxG.cjs} +2 -2
  8. package/dist/{PeginManager-BgBt4hqp.cjs.map → PeginManager-p-ajwSxG.cjs.map} +1 -1
  9. package/dist/{ProtocolParams.abi-CV938AYZ.js → ProtocolParams.abi-C0TSRaHV.js} +17 -1
  10. package/dist/{ProtocolParams.abi-CV938AYZ.js.map → ProtocolParams.abi-C0TSRaHV.js.map} +1 -1
  11. package/dist/{ProtocolParams.abi-C8U7BHCS.cjs → ProtocolParams.abi-CYZoV2EI.cjs} +2 -2
  12. package/dist/{ProtocolParams.abi-C8U7BHCS.cjs.map → ProtocolParams.abi-CYZoV2EI.cjs.map} +1 -1
  13. package/dist/batchPoll-6L5oToGr.cjs +2 -0
  14. package/dist/batchPoll-6L5oToGr.cjs.map +1 -0
  15. package/dist/{batchPoll-9w-Gv5dt.js → batchPoll-cIxrSLLJ.js} +43 -21
  16. package/dist/batchPoll-cIxrSLLJ.js.map +1 -0
  17. package/dist/{buildAndBroadcastRefund-CH2awK6h.js → buildAndBroadcastRefund-C2fP3Rva.js} +5 -5
  18. package/dist/{buildAndBroadcastRefund-CH2awK6h.js.map → buildAndBroadcastRefund-C2fP3Rva.js.map} +1 -1
  19. package/dist/{buildAndBroadcastRefund-CYzhA_B8.cjs → buildAndBroadcastRefund-CYtnT0D_.cjs} +2 -2
  20. package/dist/{buildAndBroadcastRefund-CYzhA_B8.cjs.map → buildAndBroadcastRefund-CYtnT0D_.cjs.map} +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +157 -146
  23. package/dist/{mempoolApi-BXaOZL_I.js → mempoolApi-BxSINXIB.js} +2 -2
  24. package/dist/{mempoolApi-BXaOZL_I.js.map → mempoolApi-BxSINXIB.js.map} +1 -1
  25. package/dist/{mempoolApi-Bsurcl43.cjs → mempoolApi-CXfr-L6x.cjs} +2 -2
  26. package/dist/{mempoolApi-Bsurcl43.cjs.map → mempoolApi-CXfr-L6x.cjs.map} +1 -1
  27. package/dist/{noPayout-oaUVsEjk.js → noPayout-BaZGRLD2.js} +2 -2
  28. package/dist/{noPayout-oaUVsEjk.js.map → noPayout-BaZGRLD2.js.map} +1 -1
  29. package/dist/{noPayout-CbxQqBw1.cjs → noPayout-CnQ1WLtr.cjs} +2 -2
  30. package/dist/{noPayout-CbxQqBw1.cjs.map → noPayout-CnQ1WLtr.cjs.map} +1 -1
  31. package/dist/reconstructPeginParams-BVA67Iv8.js +400 -0
  32. package/dist/reconstructPeginParams-BVA67Iv8.js.map +1 -0
  33. package/dist/reconstructPeginParams-BmUVK7F_.cjs +2 -0
  34. package/dist/reconstructPeginParams-BmUVK7F_.cjs.map +1 -0
  35. package/dist/{signPsbtsWithFallback-DC4rUCsy.js → signPsbtsWithFallback-Bb66DfY5.js} +2 -2
  36. package/dist/{signPsbtsWithFallback-DC4rUCsy.js.map → signPsbtsWithFallback-Bb66DfY5.js.map} +1 -1
  37. package/dist/{signPsbtsWithFallback-DbOmw8Ou.cjs → signPsbtsWithFallback-PTgWxsG3.cjs} +2 -2
  38. package/dist/{signPsbtsWithFallback-DbOmw8Ou.cjs.map → signPsbtsWithFallback-PTgWxsG3.cjs.map} +1 -1
  39. package/dist/tbv/core/clients/eth/protocol-params-reader.d.ts +11 -0
  40. package/dist/tbv/core/clients/eth/protocol-params-reader.d.ts.map +1 -1
  41. package/dist/tbv/core/clients/eth/types.d.ts +18 -0
  42. package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
  43. package/dist/tbv/core/clients/index.cjs +1 -1
  44. package/dist/tbv/core/clients/index.js +2 -2
  45. package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +4 -0
  46. package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
  47. package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts +10 -0
  48. package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts.map +1 -1
  49. package/dist/tbv/core/contracts/index.cjs +1 -1
  50. package/dist/tbv/core/contracts/index.js +2 -2
  51. package/dist/tbv/core/index.cjs +1 -1
  52. package/dist/tbv/core/index.d.ts +3 -0
  53. package/dist/tbv/core/index.d.ts.map +1 -1
  54. package/dist/tbv/core/index.js +151 -140
  55. package/dist/tbv/core/managers/index.cjs +1 -1
  56. package/dist/tbv/core/managers/index.js +2 -2
  57. package/dist/tbv/core/primitives/index.cjs +1 -1
  58. package/dist/tbv/core/primitives/index.js +2 -2
  59. package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts +16 -2
  60. package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts.map +1 -1
  61. package/dist/tbv/core/recovery/__tests__/deriveHashlocksFromPrePegin.test.d.ts +10 -0
  62. package/dist/tbv/core/recovery/__tests__/deriveHashlocksFromPrePegin.test.d.ts.map +1 -0
  63. package/dist/tbv/core/recovery/__tests__/peginSizingIntegrity.test.d.ts +16 -0
  64. package/dist/tbv/core/recovery/__tests__/peginSizingIntegrity.test.d.ts.map +1 -0
  65. package/dist/tbv/core/recovery/__tests__/reconstructPeginParams.test.d.ts +14 -0
  66. package/dist/tbv/core/recovery/__tests__/reconstructPeginParams.test.d.ts.map +1 -0
  67. package/dist/tbv/core/recovery/deriveHashlocksFromPrePegin.d.ts +37 -0
  68. package/dist/tbv/core/recovery/deriveHashlocksFromPrePegin.d.ts.map +1 -0
  69. package/dist/tbv/core/recovery/index.d.ts +18 -0
  70. package/dist/tbv/core/recovery/index.d.ts.map +1 -0
  71. package/dist/tbv/core/recovery/peginParamsCandidates.d.ts +98 -0
  72. package/dist/tbv/core/recovery/peginParamsCandidates.d.ts.map +1 -0
  73. package/dist/tbv/core/recovery/reconstructPeginParams.d.ts +112 -0
  74. package/dist/tbv/core/recovery/reconstructPeginParams.d.ts.map +1 -0
  75. package/dist/tbv/core/recovery/recoveryErrors.d.ts +97 -0
  76. package/dist/tbv/core/recovery/recoveryErrors.d.ts.map +1 -0
  77. package/dist/tbv/core/services/index.cjs +1 -1
  78. package/dist/tbv/core/services/index.js +2 -2
  79. package/dist/tbv/index.cjs +1 -1
  80. package/dist/tbv/index.js +151 -140
  81. package/dist/verifyScriptPathSchnorrSignature-DPAd_qke.cjs +2 -0
  82. package/dist/verifyScriptPathSchnorrSignature-DPAd_qke.cjs.map +1 -0
  83. package/dist/{verifyScriptPathSchnorrSignature-XsICweGG.js → verifyScriptPathSchnorrSignature-i-koT139.js} +176 -170
  84. package/dist/verifyScriptPathSchnorrSignature-i-koT139.js.map +1 -0
  85. package/package.json +1 -1
  86. package/dist/batchPoll-9w-Gv5dt.js.map +0 -1
  87. package/dist/batchPoll-WMXweT_O.cjs +0 -2
  88. package/dist/batchPoll-WMXweT_O.cjs.map +0 -1
  89. package/dist/errors-BxL9QObN.js +0 -137
  90. package/dist/errors-BxL9QObN.js.map +0 -1
  91. package/dist/errors-DwjbI9h1.cjs +0 -2
  92. package/dist/errors-DwjbI9h1.cjs.map +0 -1
  93. package/dist/verifyScriptPathSchnorrSignature-B8zK1ctE.cjs +0 -2
  94. package/dist/verifyScriptPathSchnorrSignature-B8zK1ctE.cjs.map +0 -1
  95. package/dist/verifyScriptPathSchnorrSignature-XsICweGG.js.map +0 -1
@@ -1,15 +1,15 @@
1
1
  var Ce = Object.defineProperty;
2
2
  var Te = (r, e, t) => e in r ? Ce(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var f = (r, e, t) => Te(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { B } from "./BTCVaultRegistry.abi-B3BLhpJ4.js";
5
- import { A as R, P as y } from "./ProtocolParams.abi-CV938AYZ.js";
6
- import { k as $e, v as U, l as Ve, j as Ie } from "./mempoolApi-BXaOZL_I.js";
4
+ import { B } from "./BTCVaultRegistry.abi-CJwWI2EO.js";
5
+ import { A as R, P as y } from "./ProtocolParams.abi-C0TSRaHV.js";
6
+ import { k as $e, v as U, l as Ve, j as Ie } from "./mempoolApi-BxSINXIB.js";
7
7
  import { X as O, C as j, s as I, S as Re, h as Oe, p as fe } from "./bitcoin-d9eaaZB_.js";
8
8
  import { D as Ne, a as _e, e as Be } from "./json-rpc-client-DuUARJvV.js";
9
9
  import { C as ee } from "./constants-GjWXdaqV.js";
10
10
  import { H as k } from "./validation-Dj3dqYtl.js";
11
11
  import * as K from "@bitcoin-js/tiny-secp256k1-asmjs";
12
- import { payments as Ge, Transaction as X } from "bitcoinjs-lib";
12
+ import { payments as De, Transaction as X } from "bitcoinjs-lib";
13
13
  import { Buffer as V } from "buffer";
14
14
  import { s as Y } from "./sha2-BYVxyZzX.js";
15
15
  async function cr(r, e) {
@@ -39,7 +39,7 @@ function te(r, e, t) {
39
39
  `${t}: multicall returned ${r} results for ${e} calls, so the results are not roster-aligned; refusing to use them`
40
40
  );
41
41
  }
42
- function De(r, e) {
42
+ function Ge(r, e) {
43
43
  return {
44
44
  vaultProvider: r[0],
45
45
  vaultKeepers: r.slice(1, 1 + e),
@@ -65,7 +65,7 @@ class lr {
65
65
  s.length,
66
66
  1 + t + n,
67
67
  i
68
- ), De(s, t);
68
+ ), Ge(s, t);
69
69
  }
70
70
  async getCurrentOperationKeys(e) {
71
71
  const t = [
@@ -169,7 +169,7 @@ class lr {
169
169
  }
170
170
  }
171
171
  const re = 65535;
172
- function G(r) {
172
+ function D(r) {
173
173
  return {
174
174
  timelockAssert: r.timelockAssert,
175
175
  timelockChallengeAssert: r.timelockChallengeAssert,
@@ -220,7 +220,7 @@ class ur {
220
220
  address: this.contractAddress,
221
221
  abi: y,
222
222
  functionName: "getLatestOffchainParams"
223
- }), t = G(e);
223
+ }), t = D(e);
224
224
  return U(t), t;
225
225
  }
226
226
  async getOffchainParamsByVersion(e) {
@@ -229,7 +229,7 @@ class ur {
229
229
  abi: y,
230
230
  functionName: "getOffchainParamsByVersion",
231
231
  args: [e]
232
- }), n = G(t);
232
+ }), n = D(t);
233
233
  return U(n), n;
234
234
  }
235
235
  async getLatestOffchainParamsVersion() {
@@ -244,6 +244,28 @@ class ur {
244
244
  const t = await this.getOffchainParamsByVersion(e);
245
245
  return se(t.timelockAssert);
246
246
  }
247
+ /**
248
+ * Returned as `bigint` with no `Number` narrowing: the registry compares it
249
+ * against `block.number`, so callers must do the same arithmetic the
250
+ * contract does. `0` is the documented "disabled" case and is returned as
251
+ * `0n`. A missing getter or a non-bigint payload throws — never coerced to
252
+ * `0`, which would fail open and skip the observation window.
253
+ *
254
+ * @throws If the deployment does not expose `peginActivationDelay()`, or
255
+ * the decoded payload is not a `bigint`.
256
+ */
257
+ async getPeginActivationDelay() {
258
+ const e = await this.publicClient.readContract({
259
+ address: this.contractAddress,
260
+ abi: y,
261
+ functionName: "peginActivationDelay"
262
+ });
263
+ if (typeof e != "bigint")
264
+ throw new Error(
265
+ `Invalid peginActivationDelay from contract: must be a bigint, got ${typeof e}`
266
+ );
267
+ return e;
268
+ }
247
269
  /**
248
270
  * Read TBV protocol params, latest offchain params, and the latest version
249
271
  * label atomically via multicall. The version is paired with the params so
@@ -276,7 +298,7 @@ class ur {
276
298
  }
277
299
  ],
278
300
  allowFailure: !1
279
- }), t = ne(e[0]), n = G(e[1]), i = Number(e[2]), s = Number(e[3]), a = {
301
+ }), t = ne(e[0]), n = D(e[1]), i = Number(e[2]), s = Number(e[3]), a = {
280
302
  minimumPegInAmount: t.minimumPegInAmount,
281
303
  maxPegInAmount: t.maxPegInAmount,
282
304
  pegInAckTimeout: t.pegInAckTimeout,
@@ -316,7 +338,7 @@ class ur {
316
338
  allowFailure: !1
317
339
  }), a = /* @__PURE__ */ new Map();
318
340
  for (let c = 0; c < n.length; c++) {
319
- const d = G(s[c]);
341
+ const d = D(s[c]);
320
342
  try {
321
343
  U(d), a.set(n[c], d);
322
344
  } catch (l) {
@@ -649,13 +671,13 @@ function ze(r, e) {
649
671
  `VP response validation failed: "challengers[${e}]" must be an object, got ${h(r)}`
650
672
  );
651
673
  const t = r;
652
- if (w(t.status, `challengers[${e}].status`), w(t.claim_txid, `challengers[${e}].claim_txid`), w(t.claimer_pubkey, `challengers[${e}].claimer_pubkey`), D(t.assert_txid, `challengers[${e}].assert_txid`), D(
674
+ if (w(t.status, `challengers[${e}].status`), w(t.claim_txid, `challengers[${e}].claim_txid`), w(t.claimer_pubkey, `challengers[${e}].claimer_pubkey`), G(t.assert_txid, `challengers[${e}].assert_txid`), G(
653
675
  t.challenge_assert_x_txid,
654
676
  `challengers[${e}].challenge_assert_x_txid`
655
- ), D(
677
+ ), G(
656
678
  t.challenge_assert_y_txid,
657
679
  `challengers[${e}].challenge_assert_y_txid`
658
- ), D(t.nopayout_txid, `challengers[${e}].nopayout_txid`), typeof t.created_at != "number")
680
+ ), G(t.nopayout_txid, `challengers[${e}].nopayout_txid`), typeof t.created_at != "number")
659
681
  throw new o(
660
682
  `VP response validation failed: "challengers[${e}].created_at" must be a number, got ${h(t.created_at)}`
661
683
  );
@@ -664,7 +686,7 @@ function ze(r, e) {
664
686
  `VP response validation failed: "challengers[${e}].updated_at" must be a number, got ${h(t.updated_at)}`
665
687
  );
666
688
  }
667
- function D(r, e) {
689
+ function G(r, e) {
668
690
  if (r !== null && typeof r != "string")
669
691
  throw new o(
670
692
  `VP response validation failed: "${e}" must be a string or null, got ${h(r)}`
@@ -826,7 +848,7 @@ function it(r) {
826
848
  function at(r, e, t) {
827
849
  if (e.length !== xe || t.length !== st) return !1;
828
850
  try {
829
- const n = Pe(rt, r), i = Ge.p2tr({
851
+ const n = Pe(rt, r), i = De.p2tr({
830
852
  internalPubkey: V.from(e)
831
853
  });
832
854
  if (!i.output) return !1;
@@ -1130,13 +1152,13 @@ function Se(r) {
1130
1152
  throw new v("trailing bytes after top-level item");
1131
1153
  return t;
1132
1154
  }
1133
- const Et = "vaultd-jsonrpc", St = "vaultd-grpc", le = 18, Z = 4, ue = -47, kt = 1, de = 64, Ct = 128, Tt = 96, $t = 64, Vt = 1, It = 2, Rt = 3, Ot = 4, Nt = 5, Bt = 6, Gt = 7, pe = new TextEncoder().encode("Signature1");
1155
+ const Et = "vaultd-jsonrpc", St = "vaultd-grpc", le = 18, Z = 4, ue = -47, kt = 1, de = 64, Ct = 128, Tt = 96, $t = 64, Vt = 1, It = 2, Rt = 3, Ot = 4, Nt = 5, Bt = 6, Dt = 7, pe = new TextEncoder().encode("Signature1");
1134
1156
  class p extends Error {
1135
1157
  constructor(e, t) {
1136
1158
  super(e), this.reason = t, this.name = "CwtVerificationError";
1137
1159
  }
1138
1160
  }
1139
- function Dt(r) {
1161
+ function Gt(r) {
1140
1162
  const e = he(
1141
1163
  r.expectedIssuerXOnlyPubkey,
1142
1164
  "expectedIssuerXOnlyPubkey"
@@ -1267,7 +1289,7 @@ function Ht(r) {
1267
1289
  "CWT claims root is not a map",
1268
1290
  "invalid_claims"
1269
1291
  );
1270
- if (Lt(e, Gt, "cti").length === 0)
1292
+ if (Lt(e, Dt, "cti").length === 0)
1271
1293
  throw new p("token cti is empty", "invalid_claims");
1272
1294
  return {
1273
1295
  issuer: J(e, Vt, "iss"),
@@ -1460,7 +1482,7 @@ class Wt {
1460
1482
  throw new Error(
1461
1483
  `VpTokenProvider: invalid expires_at in acquire response (got ${JSON.stringify(s.expires_at)}; must be a safe integer in (${a}, ${ge}])`
1462
1484
  );
1463
- Dt({
1485
+ Gt({
1464
1486
  token: s.token,
1465
1487
  ephemeralPubkeyHex: s.server_identity.ephemeral_pubkey,
1466
1488
  expectedIssuerXOnlyPubkey: this.pinnedServerPubkey,
@@ -1675,4 +1697,4 @@ export {
1675
1697
  cr as r,
1676
1698
  Je as v
1677
1699
  };
1678
- //# sourceMappingURL=batchPoll-9w-Gv5dt.js.map
1700
+ //# sourceMappingURL=batchPoll-cIxrSLLJ.js.map