@babylonlabs-io/ts-sdk 0.57.2 → 0.58.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 (136) hide show
  1. package/dist/{PeginManager-DbMFLh-1.js → PeginManager-C8ixWlUM.js} +319 -298
  2. package/dist/PeginManager-C8ixWlUM.js.map +1 -0
  3. package/dist/PeginManager-CogqZaa2.cjs +2 -0
  4. package/dist/PeginManager-CogqZaa2.cjs.map +1 -0
  5. package/dist/{batchPoll-X7D7OIcu.js → batchPoll-B0VxT62K.js} +4 -4
  6. package/dist/{batchPoll-X7D7OIcu.js.map → batchPoll-B0VxT62K.js.map} +1 -1
  7. package/dist/{batchPoll-D2OuUee1.cjs → batchPoll-D5IDDOa8.cjs} +2 -2
  8. package/dist/{batchPoll-D2OuUee1.cjs.map → batchPoll-D5IDDOa8.cjs.map} +1 -1
  9. package/dist/{bitcoin-CHzNE-rS.js → bitcoin-d9eaaZB_.js} +13 -14
  10. package/dist/bitcoin-d9eaaZB_.js.map +1 -0
  11. package/dist/{bitcoin-Dpcfff7b.cjs → bitcoin-m84N5a8o.cjs} +2 -2
  12. package/dist/bitcoin-m84N5a8o.cjs.map +1 -0
  13. package/dist/buildAndBroadcastRefund-BL8u-Ti4.cjs +2 -0
  14. package/dist/buildAndBroadcastRefund-BL8u-Ti4.cjs.map +1 -0
  15. package/dist/{buildAndBroadcastRefund-D_l93Gln.js → buildAndBroadcastRefund-DBA-Mp4I.js} +406 -376
  16. package/dist/buildAndBroadcastRefund-DBA-Mp4I.js.map +1 -0
  17. package/dist/{challengeAssert-CIHykYs3.cjs → challengeAssert-BFRE2DM-.cjs} +2 -2
  18. package/dist/{challengeAssert-CIHykYs3.cjs.map → challengeAssert-BFRE2DM-.cjs.map} +1 -1
  19. package/dist/{challengeAssert-XeAql2fF.js → challengeAssert-C7PzyJ7g.js} +2 -2
  20. package/dist/{challengeAssert-XeAql2fF.js.map → challengeAssert-C7PzyJ7g.js.map} +1 -1
  21. package/dist/constants-DU5CGcqO.cjs +2 -0
  22. package/dist/{constants-BqU1Uz15.cjs.map → constants-DU5CGcqO.cjs.map} +1 -1
  23. package/dist/constants-GjWXdaqV.js +23 -0
  24. package/dist/{constants-CDQE812z.js.map → constants-GjWXdaqV.js.map} +1 -1
  25. package/dist/{deriveVaultRoot-B5G8y6HJ.js → deriveVaultRoot-D0RY5GJc.js} +2 -2
  26. package/dist/{deriveVaultRoot-B5G8y6HJ.js.map → deriveVaultRoot-D0RY5GJc.js.map} +1 -1
  27. package/dist/{deriveVaultRoot-DH0kEyaS.cjs → deriveVaultRoot-p4uGsM7w.cjs} +2 -2
  28. package/dist/{deriveVaultRoot-DH0kEyaS.cjs.map → deriveVaultRoot-p4uGsM7w.cjs.map} +1 -1
  29. package/dist/errors-2aF9oRwM.cjs +2 -0
  30. package/dist/errors-2aF9oRwM.cjs.map +1 -0
  31. package/dist/errors-kXGQXKxZ.js +28 -0
  32. package/dist/errors-kXGQXKxZ.js.map +1 -0
  33. package/dist/index.cjs +1 -1
  34. package/dist/index.js +108 -105
  35. package/dist/{mempoolApi-4T6J5oxg.js → mempoolApi-CMHEz4ez.js} +3 -3
  36. package/dist/{mempoolApi-4T6J5oxg.js.map → mempoolApi-CMHEz4ez.js.map} +1 -1
  37. package/dist/{mempoolApi-BtIABIAQ.cjs → mempoolApi-DfD3_Y6v.cjs} +2 -2
  38. package/dist/{mempoolApi-BtIABIAQ.cjs.map → mempoolApi-DfD3_Y6v.cjs.map} +1 -1
  39. package/dist/{noPayout-DCf1xoJn.js → noPayout-DuE-UyhQ.js} +3 -3
  40. package/dist/{noPayout-DCf1xoJn.js.map → noPayout-DuE-UyhQ.js.map} +1 -1
  41. package/dist/{noPayout-BkXzkhU1.cjs → noPayout-qUEtRKc_.cjs} +2 -2
  42. package/dist/{noPayout-BkXzkhU1.cjs.map → noPayout-qUEtRKc_.cjs.map} +1 -1
  43. package/dist/{onChainBtcPubkey-DqYufM7j.cjs → onChainBtcPubkey-C_a2L3kL.cjs} +2 -2
  44. package/dist/{onChainBtcPubkey-DqYufM7j.cjs.map → onChainBtcPubkey-C_a2L3kL.cjs.map} +1 -1
  45. package/dist/{onChainBtcPubkey-mP95j21Z.js → onChainBtcPubkey-DeF4cKoO.js} +2 -2
  46. package/dist/{onChainBtcPubkey-mP95j21Z.js.map → onChainBtcPubkey-DeF4cKoO.js.map} +1 -1
  47. package/dist/peginInput-Ci921gTl.cjs +2 -0
  48. package/dist/peginInput-Ci921gTl.cjs.map +1 -0
  49. package/dist/peginInput-HQPWZfly.js +123 -0
  50. package/dist/peginInput-HQPWZfly.js.map +1 -0
  51. package/dist/{reservation-4F9XCk0v.js → reservation-CbAXa7VG.js} +2 -2
  52. package/dist/{reservation-4F9XCk0v.js.map → reservation-CbAXa7VG.js.map} +1 -1
  53. package/dist/{reservation-B_7tzSwY.cjs → reservation-RGKvg2x6.cjs} +2 -2
  54. package/dist/{reservation-B_7tzSwY.cjs.map → reservation-RGKvg2x6.cjs.map} +1 -1
  55. package/dist/signPsbtsWithFallback-Xs4jZw5z.cjs +2 -0
  56. package/dist/signPsbtsWithFallback-Xs4jZw5z.cjs.map +1 -0
  57. package/dist/{signPsbtsWithFallback-DxG_APbS.js → signPsbtsWithFallback-eY1YgV13.js} +69 -67
  58. package/dist/signPsbtsWithFallback-eY1YgV13.js.map +1 -0
  59. package/dist/tbv/core/clients/index.cjs +1 -1
  60. package/dist/tbv/core/clients/index.js +3 -3
  61. package/dist/tbv/core/deposit-terms/__tests__/depositTermsErrors.test.d.ts +2 -0
  62. package/dist/tbv/core/deposit-terms/__tests__/depositTermsErrors.test.d.ts.map +1 -0
  63. package/dist/tbv/core/deposit-terms/buildDepositTerms.d.ts.map +1 -1
  64. package/dist/tbv/core/deposit-terms/depositTerms.d.ts +72 -25
  65. package/dist/tbv/core/deposit-terms/depositTerms.d.ts.map +1 -1
  66. package/dist/tbv/core/deposit-terms/depositTermsErrors.d.ts +24 -0
  67. package/dist/tbv/core/deposit-terms/depositTermsErrors.d.ts.map +1 -0
  68. package/dist/tbv/core/deposit-terms/index.d.ts +2 -1
  69. package/dist/tbv/core/deposit-terms/index.d.ts.map +1 -1
  70. package/dist/tbv/core/index.cjs +1 -1
  71. package/dist/tbv/core/index.js +108 -105
  72. package/dist/tbv/core/managers/PayoutManager.d.ts +2 -0
  73. package/dist/tbv/core/managers/PayoutManager.d.ts.map +1 -1
  74. package/dist/tbv/core/managers/PeginManager.d.ts +16 -3
  75. package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
  76. package/dist/tbv/core/managers/index.cjs +1 -1
  77. package/dist/tbv/core/managers/index.js +2 -2
  78. package/dist/tbv/core/primitives/index.cjs +1 -1
  79. package/dist/tbv/core/primitives/index.js +6 -6
  80. package/dist/tbv/core/primitives/psbt/assertPayoutFeeBand.d.ts +14 -32
  81. package/dist/tbv/core/primitives/psbt/assertPayoutFeeBand.d.ts.map +1 -1
  82. package/dist/tbv/core/primitives/psbt/constants.d.ts +10 -1
  83. package/dist/tbv/core/primitives/psbt/constants.d.ts.map +1 -1
  84. package/dist/tbv/core/primitives/psbt/payout.d.ts +8 -2
  85. package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
  86. package/dist/tbv/core/primitives/psbt/peginInput.d.ts.map +1 -1
  87. package/dist/tbv/core/primitives/utils/bitcoin.d.ts +11 -1
  88. package/dist/tbv/core/primitives/utils/bitcoin.d.ts.map +1 -1
  89. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts +1 -1
  90. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -1
  91. package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts +1 -1
  92. package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts.map +1 -1
  93. package/dist/tbv/core/services/index.cjs +1 -1
  94. package/dist/tbv/core/services/index.js +2 -2
  95. package/dist/tbv/core/utils/index.cjs +1 -1
  96. package/dist/tbv/core/utils/index.js +2 -2
  97. package/dist/tbv/core/vault-secrets/index.cjs +1 -1
  98. package/dist/tbv/core/vault-secrets/index.js +1 -1
  99. package/dist/tbv/index.cjs +1 -1
  100. package/dist/tbv/index.js +108 -105
  101. package/dist/tbv/integrations/aave/index.cjs +1 -1
  102. package/dist/tbv/integrations/aave/index.cjs.map +1 -1
  103. package/dist/tbv/integrations/aave/index.d.ts +2 -0
  104. package/dist/tbv/integrations/aave/index.d.ts.map +1 -1
  105. package/dist/tbv/integrations/aave/index.js +2 -0
  106. package/dist/testing/index.cjs +1 -1
  107. package/dist/testing/index.js +1 -1
  108. package/dist/{verifyScriptPathSchnorrSignature-wwa1JhiB.js → verifyScriptPathSchnorrSignature-Bav08_7R.js} +268 -240
  109. package/dist/verifyScriptPathSchnorrSignature-Bav08_7R.js.map +1 -0
  110. package/dist/verifyScriptPathSchnorrSignature-CYjK4IP_.cjs +2 -0
  111. package/dist/verifyScriptPathSchnorrSignature-CYjK4IP_.cjs.map +1 -0
  112. package/package.json +1 -1
  113. package/dist/PeginManager-DOmyNYT-.cjs +0 -2
  114. package/dist/PeginManager-DOmyNYT-.cjs.map +0 -1
  115. package/dist/PeginManager-DbMFLh-1.js.map +0 -1
  116. package/dist/bitcoin-CHzNE-rS.js.map +0 -1
  117. package/dist/bitcoin-Dpcfff7b.cjs.map +0 -1
  118. package/dist/buildAndBroadcastRefund-COinY4dk.cjs +0 -2
  119. package/dist/buildAndBroadcastRefund-COinY4dk.cjs.map +0 -1
  120. package/dist/buildAndBroadcastRefund-D_l93Gln.js.map +0 -1
  121. package/dist/constants-BqU1Uz15.cjs +0 -2
  122. package/dist/constants-CDQE812z.js +0 -21
  123. package/dist/errors-B-H0seUG.js +0 -8
  124. package/dist/errors-B-H0seUG.js.map +0 -1
  125. package/dist/errors-Bfjxg_iJ.cjs +0 -2
  126. package/dist/errors-Bfjxg_iJ.cjs.map +0 -1
  127. package/dist/peginInput-CAYuE_5F.cjs +0 -2
  128. package/dist/peginInput-CAYuE_5F.cjs.map +0 -1
  129. package/dist/peginInput-DRUm164W.js +0 -105
  130. package/dist/peginInput-DRUm164W.js.map +0 -1
  131. package/dist/signPsbtsWithFallback-DxG_APbS.js.map +0 -1
  132. package/dist/signPsbtsWithFallback-r3bC-CfM.cjs +0 -2
  133. package/dist/signPsbtsWithFallback-r3bC-CfM.cjs.map +0 -1
  134. package/dist/verifyScriptPathSchnorrSignature-fhjfNoHK.cjs +0 -2
  135. package/dist/verifyScriptPathSchnorrSignature-fhjfNoHK.cjs.map +0 -1
  136. package/dist/verifyScriptPathSchnorrSignature-wwa1JhiB.js.map +0 -1
@@ -1,73 +1,81 @@
1
- var Ft = Object.defineProperty;
2
- var Nt = (s, e, t) => e in s ? Ft(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var y = (s, e, t) => Nt(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { c as Tt, H as Wt, r as M, a as L, b as st, u as Lt, d as ot, e as nt, f as rt, g as Dt, s as Bt } from "./sha2-BYVxyZzX.js";
5
- import * as Et from "bitcoinjs-lib";
6
- import { Transaction as Xt, Psbt as it } from "bitcoinjs-lib";
7
- import { Buffer as Y } from "buffer";
8
- import { isAddressEqual as at, encodeFunctionData as j, zeroAddress as Kt } from "viem";
1
+ var Wt = Object.defineProperty;
2
+ var Lt = (s, e, t) => e in s ? Wt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var y = (s, e, t) => Lt(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { c as Bt, H as Dt, r as M, a as W, b as ot, u as Xt, d as nt, e as rt, f as it, g as Kt, s as Et } from "./sha2-BYVxyZzX.js";
5
+ import * as vt from "bitcoinjs-lib";
6
+ import { Transaction as qt, Psbt as at } from "bitcoinjs-lib";
7
+ import { Buffer as j } from "buffer";
8
+ import { isAddressEqual as ct, encodeFunctionData as Q, zeroAddress as Gt } from "viem";
9
9
  import { B as H } from "./BTCVaultRegistry.abi-CixOlp3B.js";
10
10
  import { h as R } from "./errors-Blc-JWnI.js";
11
- import { expandWotsSeed as Gt, expandHashlockSecret as qt, expandAuthAnchor as zt, deriveVaultId as ct } from "@babylonlabs-io/babylon-tbv-rust-wasm";
12
- import { a as lt, b as Yt, d as ut, f as jt } from "./verifyScriptPathSchnorrSignature-wwa1JhiB.js";
13
- import { b as Qt, e as Zt, f as Jt } from "./peginInput-DRUm164W.js";
14
- import { u as Q, e as A, p as te, i as ht, h as dt, s as v, k as gt, X as ee } from "./bitcoin-CHzNE-rS.js";
15
- import { c as se } from "./signing-DaLvGwQe.js";
16
- import { M as ft } from "./validation-Dj3dqYtl.js";
17
- import { d as oe } from "./deriveVaultRoot-B5G8y6HJ.js";
18
- import { c as ne, a as re, s as ie, b as ae } from "./signPsbtsWithFallback-DxG_APbS.js";
19
- import { s as ce, f as X, i as le, w as pt } from "./waitForTransactionReceiptSmartAware-lobLm0q0.js";
20
- import { p as ue, f as he } from "./fundPeginTransaction-B2wyjqp0.js";
21
- import { M as mt, B as de } from "./constants-CDQE812z.js";
22
- import { p as ge, V as fe, i as pe } from "./mempoolApi-4T6J5oxg.js";
11
+ import { expandWotsSeed as zt, expandHashlockSecret as Yt, expandAuthAnchor as jt, deriveVaultId as lt } from "@babylonlabs-io/babylon-tbv-rust-wasm";
12
+ import { a as ut, b as Qt, d as ht, f as Zt } from "./verifyScriptPathSchnorrSignature-Bav08_7R.js";
13
+ import { b as Jt, e as te, f as ee } from "./peginInput-HQPWZfly.js";
14
+ import { u as Z, e as S, p as se, i as dt, h as gt, s as v, k as ft, X as oe } from "./bitcoin-d9eaaZB_.js";
15
+ import { M as L, B as ne } from "./constants-GjWXdaqV.js";
16
+ import { c as re } from "./signing-DaLvGwQe.js";
17
+ import { M as pt } from "./validation-Dj3dqYtl.js";
18
+ import { d as ie } from "./deriveVaultRoot-D0RY5GJc.js";
19
+ import { c as ae, a as ce, s as mt, b as le } from "./signPsbtsWithFallback-eY1YgV13.js";
20
+ import { s as ue, f as X, i as he, w as bt } from "./waitForTransactionReceiptSmartAware-lobLm0q0.js";
21
+ import { p as de, f as ge } from "./fundPeginTransaction-B2wyjqp0.js";
22
+ import { p as fe, V as pe, i as me } from "./mempoolApi-CMHEz4ez.js";
23
23
  const U = /* @__PURE__ */ BigInt(2 ** 32 - 1), Pt = /* @__PURE__ */ BigInt(32);
24
- function me(s, e = !1) {
24
+ function be(s, e = !1) {
25
25
  return e ? { h: Number(s & U), l: Number(s >> Pt & U) } : { h: Number(s >> Pt & U) | 0, l: Number(s & U) | 0 };
26
26
  }
27
27
  function Pe(s, e = !1) {
28
28
  const t = s.length;
29
29
  let o = new Uint32Array(t), n = new Uint32Array(t);
30
30
  for (let r = 0; r < t; r++) {
31
- const { h: i, l: a } = me(s[r], e);
31
+ const { h: i, l: a } = be(s[r], e);
32
32
  [o[r], n[r]] = [i, a];
33
33
  }
34
34
  return [o, n];
35
35
  }
36
- const be = (s, e, t) => s << t | e >>> 32 - t, we = (s, e, t) => e << t | s >>> 32 - t, xe = (s, e, t) => e << t - 32 | s >>> 64 - t, ye = (s, e, t) => s << t - 32 | e >>> 64 - t, ke = 64;
37
- function Te(s) {
36
+ const we = (s, e, t) => s << t | e >>> 32 - t, xe = (s, e, t) => e << t | s >>> 32 - t, ye = (s, e, t) => e << t - 32 | s >>> 64 - t, ke = (s, e, t) => s << t - 32 | e >>> 64 - t, Te = 64;
37
+ function Be(s) {
38
38
  const e = s.prepeginTxid.toLowerCase();
39
- if (!/^[0-9a-f]+$/.test(e) || e.length !== ke)
40
- throw new Error(`buildDepositTerms: prepeginTxid must be 64 hex chars, got "${s.prepeginTxid}"`);
41
- if (s.vaultAmounts.length === 0)
42
- throw new Error("buildDepositTerms: at least one vault amount is required");
43
- if (s.timelockPegin <= 0 || s.timelockRefund <= 0)
39
+ if (!/^[0-9a-f]+$/.test(e) || e.length !== Te)
40
+ throw new Error(
41
+ `buildDepositTerms: prepeginTxid must be 64 hex chars, got "${s.prepeginTxid}"`
42
+ );
43
+ if (s.peginAmounts.length === 0)
44
+ throw new Error("buildDepositTerms: at least one pegin amount is required");
45
+ if (s.timelockPegin <= 0 || s.timelockAssert <= 0 || s.timelockRefund <= 0)
44
46
  throw new Error("buildDepositTerms: timelocks must be positive");
45
- if (!Number.isInteger(s.commissionBps) || s.commissionBps < 0 || s.commissionBps >= mt)
47
+ if (!Number.isInteger(s.maxAcceptableCommissionBps) || s.maxAcceptableCommissionBps < 0 || s.maxAcceptableCommissionBps >= L)
46
48
  throw new Error(
47
- `buildDepositTerms: commissionBps must be an integer in [0, ${mt}), got ${s.commissionBps}`
49
+ `buildDepositTerms: maxAcceptableCommissionBps must be an integer in [0, ${L}), got ${s.maxAcceptableCommissionBps}`
48
50
  );
49
- const t = BigInt(de), o = s.vaultAmounts.map((n, r) => ({
50
- htlcVout: r,
51
- vaultProviderPk: s.vaultProviderPk,
52
- vaultAmount: n,
53
- // floor(vaultAmount * bps / 10_000) — matches the vault provider's commission math.
54
- commissionFee: n * BigInt(s.commissionBps) / t,
55
- depositorClaimValue: s.depositorClaimValue,
56
- peginMaxFee: s.peginMaxFee
57
- }));
51
+ const t = BigInt(ne), o = s.peginAmounts.map(
52
+ (n, r) => ({
53
+ htlcVout: r,
54
+ vaultProviderBtcPubkey: s.vaultProviderBtcPubkey,
55
+ peginAmount: n,
56
+ // Ceiling, not quote: floor(peginAmount * maxAcceptableBps / 10_000) —
57
+ // the same bound the registration calldata enforces on-chain, so any
58
+ // stamped commission the contract admits stays under it (firmware
59
+ // >= c8db53e checks the payout commission output <= this value).
60
+ commissionFee: n * BigInt(s.maxAcceptableCommissionBps) / t,
61
+ depositorClaimValue: s.depositorClaimValue,
62
+ peginMaxFee: s.peginMaxFee
63
+ })
64
+ );
58
65
  return {
59
- baseFeeRate: s.protocolFeeRate,
60
- peginCsvTimelock: s.timelockPegin,
61
- payoutTimelock: s.timelockPegin,
62
- htlcRefundTimelock: s.timelockRefund,
66
+ vaultCoreVersion: s.vaultCoreVersion,
67
+ protocolFeeRate: s.protocolFeeRate,
68
+ timelockPegin: s.timelockPegin,
69
+ timelockAssert: s.timelockAssert,
70
+ timelockRefund: s.timelockRefund,
63
71
  prepeginTxid: e,
64
72
  prepeginMaxFee: s.prepeginMaxFee,
65
- keeperPks: [...s.keeperPks],
66
- challengerPks: [...s.challengerPks],
73
+ vaultKeeperBtcPubkeys: [...s.vaultKeeperBtcPubkeys],
74
+ universalChallengerBtcPubkeys: [...s.universalChallengerBtcPubkeys],
67
75
  vaults: o
68
76
  };
69
77
  }
70
- const Be = /* @__PURE__ */ Uint8Array.from([
78
+ const Ee = /* @__PURE__ */ Uint8Array.from([
71
79
  7,
72
80
  4,
73
81
  13,
@@ -84,36 +92,36 @@ const Be = /* @__PURE__ */ Uint8Array.from([
84
92
  14,
85
93
  11,
86
94
  8
87
- ]), vt = Uint8Array.from(new Array(16).fill(0).map((s, e) => e)), Ee = vt.map((s) => (9 * s + 5) % 16), _t = /* @__PURE__ */ (() => {
88
- const t = [[vt], [Ee]];
95
+ ]), At = Uint8Array.from(new Array(16).fill(0).map((s, e) => e)), ve = At.map((s) => (9 * s + 5) % 16), _t = /* @__PURE__ */ (() => {
96
+ const t = [[At], [ve]];
89
97
  for (let o = 0; o < 4; o++)
90
98
  for (let n of t)
91
- n.push(n[o].map((r) => Be[r]));
99
+ n.push(n[o].map((r) => Ee[r]));
92
100
  return t;
93
- })(), St = _t[0], At = _t[1], It = /* @__PURE__ */ [
101
+ })(), St = _t[0], Ct = _t[1], It = /* @__PURE__ */ [
94
102
  [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
95
103
  [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
96
104
  [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
97
105
  [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
98
106
  [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
99
- ].map((s) => Uint8Array.from(s)), ve = /* @__PURE__ */ St.map((s, e) => s.map((t) => It[e][t])), _e = /* @__PURE__ */ At.map((s, e) => s.map((t) => It[e][t])), Se = /* @__PURE__ */ Uint32Array.from([
107
+ ].map((s) => Uint8Array.from(s)), Ae = /* @__PURE__ */ St.map((s, e) => s.map((t) => It[e][t])), _e = /* @__PURE__ */ Ct.map((s, e) => s.map((t) => It[e][t])), Se = /* @__PURE__ */ Uint32Array.from([
100
108
  0,
101
109
  1518500249,
102
110
  1859775393,
103
111
  2400959708,
104
112
  2840853838
105
- ]), Ae = /* @__PURE__ */ Uint32Array.from([
113
+ ]), Ce = /* @__PURE__ */ Uint32Array.from([
106
114
  1352829926,
107
115
  1548603684,
108
116
  1836072691,
109
117
  2053994217,
110
118
  0
111
119
  ]);
112
- function bt(s, e, t, o) {
120
+ function wt(s, e, t, o) {
113
121
  return s === 0 ? e ^ t ^ o : s === 1 ? e & t | ~e & o : s === 2 ? (e | ~t) ^ o : s === 3 ? e & o | t & ~o : e ^ (t | ~o);
114
122
  }
115
123
  const F = /* @__PURE__ */ new Uint32Array(16);
116
- class Ie extends Wt {
124
+ class Ie extends Dt {
117
125
  constructor() {
118
126
  super(64, 20, 8, !0);
119
127
  y(this, "h0", 1732584193);
@@ -132,49 +140,49 @@ class Ie extends Wt {
132
140
  process(t, o) {
133
141
  for (let d = 0; d < 16; d++, o += 4)
134
142
  F[d] = t.getUint32(o, !0);
135
- let n = this.h0 | 0, r = n, i = this.h1 | 0, a = i, c = this.h2 | 0, u = c, l = this.h3 | 0, m = l, b = this.h4 | 0, w = b;
143
+ let n = this.h0 | 0, r = n, i = this.h1 | 0, a = i, c = this.h2 | 0, u = c, l = this.h3 | 0, m = l, P = this.h4 | 0, w = P;
136
144
  for (let d = 0; d < 5; d++) {
137
- const E = 4 - d, k = Se[d], f = Ae[d], _ = St[d], p = At[d], P = ve[d], T = _e[d];
145
+ const E = 4 - d, k = Se[d], f = Ce[d], A = St[d], p = Ct[d], b = Ae[d], T = _e[d];
138
146
  for (let h = 0; h < 16; h++) {
139
- const x = M(n + bt(d, i, c, l) + F[_[h]] + k, P[h]) + b | 0;
140
- n = b, b = l, l = M(c, 10) | 0, c = i, i = x;
147
+ const x = M(n + wt(d, i, c, l) + F[A[h]] + k, b[h]) + P | 0;
148
+ n = P, P = l, l = M(c, 10) | 0, c = i, i = x;
141
149
  }
142
150
  for (let h = 0; h < 16; h++) {
143
- const x = M(r + bt(E, a, u, m) + F[p[h]] + f, T[h]) + w | 0;
151
+ const x = M(r + wt(E, a, u, m) + F[p[h]] + f, T[h]) + w | 0;
144
152
  r = w, w = m, m = M(u, 10) | 0, u = a, a = x;
145
153
  }
146
154
  }
147
- this.set(this.h1 + c + m | 0, this.h2 + l + w | 0, this.h3 + b + r | 0, this.h4 + n + a | 0, this.h0 + i + u | 0);
155
+ this.set(this.h1 + c + m | 0, this.h2 + l + w | 0, this.h3 + P + r | 0, this.h4 + n + a | 0, this.h0 + i + u | 0);
148
156
  }
149
157
  roundClean() {
150
- L(F);
158
+ W(F);
151
159
  }
152
160
  destroy() {
153
- this.destroyed = !0, L(this.buffer), this.set(0, 0, 0, 0, 0);
161
+ this.destroyed = !0, W(this.buffer), this.set(0, 0, 0, 0, 0);
154
162
  }
155
163
  }
156
- const Ce = /* @__PURE__ */ Tt(() => new Ie()), He = BigInt(0), $ = BigInt(1), Re = BigInt(2), Oe = BigInt(7), $e = BigInt(256), Ve = BigInt(113), Ct = [], Ht = [], Rt = [];
157
- for (let s = 0, e = $, t = 1, o = 0; s < 24; s++) {
158
- [t, o] = [o, (2 * t + 3 * o) % 5], Ct.push(2 * (5 * o + t)), Ht.push((s + 1) * (s + 2) / 2 % 64);
159
- let n = He;
164
+ const He = /* @__PURE__ */ Bt(() => new Ie()), Re = BigInt(0), O = BigInt(1), $e = BigInt(2), Oe = BigInt(7), Ve = BigInt(256), Me = BigInt(113), Ht = [], Rt = [], $t = [];
165
+ for (let s = 0, e = O, t = 1, o = 0; s < 24; s++) {
166
+ [t, o] = [o, (2 * t + 3 * o) % 5], Ht.push(2 * (5 * o + t)), Rt.push((s + 1) * (s + 2) / 2 % 64);
167
+ let n = Re;
160
168
  for (let r = 0; r < 7; r++)
161
- e = (e << $ ^ (e >> Oe) * Ve) % $e, e & Re && (n ^= $ << ($ << BigInt(r)) - $);
162
- Rt.push(n);
169
+ e = (e << O ^ (e >> Oe) * Me) % Ve, e & $e && (n ^= O << (O << BigInt(r)) - O);
170
+ $t.push(n);
163
171
  }
164
- const Ot = Pe(Rt, !0), Me = Ot[0], Ue = Ot[1], wt = (s, e, t) => t > 32 ? xe(s, e, t) : be(s, e, t), xt = (s, e, t) => t > 32 ? ye(s, e, t) : we(s, e, t);
165
- function Fe(s, e = 24) {
172
+ const Ot = Pe($t, !0), Ue = Ot[0], Fe = Ot[1], xt = (s, e, t) => t > 32 ? ye(s, e, t) : we(s, e, t), yt = (s, e, t) => t > 32 ? ke(s, e, t) : xe(s, e, t);
173
+ function Ne(s, e = 24) {
166
174
  const t = new Uint32Array(10);
167
175
  for (let o = 24 - e; o < 24; o++) {
168
176
  for (let i = 0; i < 10; i++)
169
177
  t[i] = s[i] ^ s[i + 10] ^ s[i + 20] ^ s[i + 30] ^ s[i + 40];
170
178
  for (let i = 0; i < 10; i += 2) {
171
- const a = (i + 8) % 10, c = (i + 2) % 10, u = t[c], l = t[c + 1], m = wt(u, l, 1) ^ t[a], b = xt(u, l, 1) ^ t[a + 1];
179
+ const a = (i + 8) % 10, c = (i + 2) % 10, u = t[c], l = t[c + 1], m = xt(u, l, 1) ^ t[a], P = yt(u, l, 1) ^ t[a + 1];
172
180
  for (let w = 0; w < 50; w += 10)
173
- s[i + w] ^= m, s[i + w + 1] ^= b;
181
+ s[i + w] ^= m, s[i + w + 1] ^= P;
174
182
  }
175
183
  let n = s[2], r = s[3];
176
184
  for (let i = 0; i < 24; i++) {
177
- const a = Ht[i], c = wt(n, r, a), u = xt(n, r, a), l = Ct[i];
185
+ const a = Rt[i], c = xt(n, r, a), u = yt(n, r, a), l = Ht[i];
178
186
  n = s[l], r = s[l + 1], s[l] = c, s[l + 1] = u;
179
187
  }
180
188
  for (let i = 0; i < 50; i += 10) {
@@ -183,11 +191,11 @@ function Fe(s, e = 24) {
183
191
  for (let a = 0; a < 10; a++)
184
192
  s[i + a] ^= ~t[(a + 2) % 10] & t[(a + 4) % 10];
185
193
  }
186
- s[0] ^= Me[o], s[1] ^= Ue[o];
194
+ s[0] ^= Ue[o], s[1] ^= Fe[o];
187
195
  }
188
- L(t);
196
+ W(t);
189
197
  }
190
- class tt {
198
+ class et {
191
199
  // NOTE: we accept arguments in bytes instead of bits here.
192
200
  constructor(e, t, o, n = !1, r = 24) {
193
201
  y(this, "state");
@@ -201,18 +209,18 @@ class tt {
201
209
  y(this, "outputLen");
202
210
  y(this, "enableXOF", !1);
203
211
  y(this, "rounds");
204
- if (this.blockLen = e, this.suffix = t, this.outputLen = o, this.enableXOF = n, this.rounds = r, st(o, "outputLen"), !(0 < e && e < 200))
212
+ if (this.blockLen = e, this.suffix = t, this.outputLen = o, this.enableXOF = n, this.rounds = r, ot(o, "outputLen"), !(0 < e && e < 200))
205
213
  throw new Error("only keccak-f1600 function is supported");
206
- this.state = new Uint8Array(200), this.state32 = Lt(this.state);
214
+ this.state = new Uint8Array(200), this.state32 = Xt(this.state);
207
215
  }
208
216
  clone() {
209
217
  return this._cloneInto();
210
218
  }
211
219
  keccak() {
212
- ot(this.state32), Fe(this.state32, this.rounds), ot(this.state32), this.posOut = 0, this.pos = 0;
220
+ nt(this.state32), Ne(this.state32, this.rounds), nt(this.state32), this.posOut = 0, this.pos = 0;
213
221
  }
214
222
  update(e) {
215
- nt(this), rt(e);
223
+ rt(this), it(e);
216
224
  const { blockLen: t, state: o } = this, n = e.length;
217
225
  for (let r = 0; r < n; ) {
218
226
  const i = Math.min(t - this.pos, n - r);
@@ -230,7 +238,7 @@ class tt {
230
238
  e[o] ^= t, (t & 128) !== 0 && o === n - 1 && this.keccak(), e[n - 1] ^= 128, this.keccak();
231
239
  }
232
240
  writeInto(e) {
233
- nt(this, !1), rt(e), this.finish();
241
+ rt(this, !1), it(e), this.finish();
234
242
  const t = this.state, { blockLen: o } = this;
235
243
  for (let n = 0, r = e.length; n < r; ) {
236
244
  this.posOut >= o && this.keccak();
@@ -245,10 +253,10 @@ class tt {
245
253
  return this.writeInto(e);
246
254
  }
247
255
  xof(e) {
248
- return st(e), this.xofInto(new Uint8Array(e));
256
+ return ot(e), this.xofInto(new Uint8Array(e));
249
257
  }
250
258
  digestInto(e) {
251
- if (Dt(e, this), this.finished)
259
+ if (Kt(e, this), this.finished)
252
260
  throw new Error("digest() was already called");
253
261
  return this.writeInto(e), this.destroy(), e;
254
262
  }
@@ -256,28 +264,28 @@ class tt {
256
264
  return this.digestInto(new Uint8Array(this.outputLen));
257
265
  }
258
266
  destroy() {
259
- this.destroyed = !0, L(this.state);
267
+ this.destroyed = !0, W(this.state);
260
268
  }
261
269
  _cloneInto(e) {
262
270
  const { blockLen: t, suffix: o, outputLen: n, rounds: r, enableXOF: i } = this;
263
- return e || (e = new tt(t, o, n, i, r)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = r, e.suffix = o, e.outputLen = n, e.enableXOF = i, e.destroyed = this.destroyed, e;
271
+ return e || (e = new et(t, o, n, i, r)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = r, e.suffix = o, e.outputLen = n, e.enableXOF = i, e.destroyed = this.destroyed, e;
264
272
  }
265
273
  }
266
- const Ne = (s, e, t, o = {}) => Tt(() => new tt(e, s, t), o), We = /* @__PURE__ */ Ne(1, 136, 32), yt = 64, S = 20, Z = 4, $t = 2, Le = 0, De = 1, N = [64, 64], Xe = (s) => Array.from(s).map((e) => e.toString(16).padStart(2, "0")).join("");
267
- function et(s) {
268
- return Ce(Bt(s));
274
+ const We = (s, e, t, o = {}) => Bt(() => new et(e, s, t), o), Le = /* @__PURE__ */ We(1, 136, 32), kt = 64, _ = 20, J = 4, Vt = 2, De = 0, Xe = 1, N = [64, 64], Ke = (s) => Array.from(s).map((e) => e.toString(16).padStart(2, "0")).join("");
275
+ function st(s) {
276
+ return He(Et(s));
269
277
  }
270
- function Vt(s) {
278
+ function Mt(s) {
271
279
  return (1 << s) - 1;
272
280
  }
273
- function Ke(s) {
281
+ function qe(s) {
274
282
  let e = 1;
275
283
  for (; e * e < s + 1; ) e++;
276
284
  return Math.max(e, 2);
277
285
  }
278
286
  function Ge(s) {
279
- const e = Z, t = s * Vt(e);
280
- return { d: e, n: s, checksum_radix: Ke(t) };
287
+ const e = J, t = s * Mt(e);
288
+ return { d: e, n: s, checksum_radix: qe(t) };
281
289
  }
282
290
  function K(s, e) {
283
291
  const t = [];
@@ -288,30 +296,30 @@ function K(s, e) {
288
296
  n.set(s);
289
297
  for (let r = 0; r < t.length; r++)
290
298
  n[s.length + r] = t[r];
291
- return et(n);
299
+ return st(n);
292
300
  }
293
- function G(s, e) {
301
+ function q(s, e) {
294
302
  let t = s;
295
303
  for (let o = 0; o < e; o++)
296
- t = et(t);
304
+ t = st(t);
297
305
  return t;
298
306
  }
299
- function qe(s, e) {
300
- const t = Vt(e.d), o = e.checksum_radix - 1, n = Math.floor(e.n * t / e.checksum_radix), r = [];
307
+ function ze(s, e) {
308
+ const t = Mt(e.d), o = e.checksum_radix - 1, n = Math.floor(e.n * t / e.checksum_radix), r = [];
301
309
  for (let l = 0; l < e.n; l++) {
302
- const m = K(s, l + $t), b = G(m, t);
303
- r.push(Array.from(b));
310
+ const m = K(s, l + Vt), P = q(m, t);
311
+ r.push(Array.from(P));
304
312
  }
305
313
  const i = K(
306
314
  s,
307
- Le
308
- ), a = G(
315
+ De
316
+ ), a = q(
309
317
  i,
310
318
  o
311
319
  ), c = K(
312
320
  s,
313
- De
314
- ), u = G(
321
+ Xe
322
+ ), u = q(
315
323
  c,
316
324
  n
317
325
  );
@@ -322,22 +330,22 @@ function qe(s, e) {
322
330
  checksum_minor_terminal: Array.from(a)
323
331
  };
324
332
  }
325
- async function ze(s) {
333
+ async function Ye(s) {
326
334
  try {
327
- if (s.length !== yt)
335
+ if (s.length !== kt)
328
336
  throw new Error(
329
- `WOTS seed must be exactly ${yt} bytes, got ${s.length}`
337
+ `WOTS seed must be exactly ${kt} bytes, got ${s.length}`
330
338
  );
331
339
  const e = [];
332
340
  for (let t = 0; t < N.length; t++) {
333
341
  const o = N[t], n = Ge(o), r = new Uint8Array(s.length + 1);
334
342
  r.set(s), r[s.length] = t;
335
- const i = et(r);
343
+ const i = st(r);
336
344
  try {
337
- const a = qe(i, n);
338
- if (a.config.d !== Z)
345
+ const a = ze(i, n);
346
+ if (a.config.d !== J)
339
347
  throw new Error(
340
- `Block ${t}: expected d=${Z}, got d=${a.config.d}`
348
+ `Block ${t}: expected d=${J}, got d=${a.config.d}`
341
349
  );
342
350
  if (a.config.n !== o)
343
351
  throw new Error(
@@ -348,17 +356,17 @@ async function ze(s) {
348
356
  `Block ${t}: expected ${o} message terminals, got ${a.message_terminals.length}`
349
357
  );
350
358
  for (let c = 0; c < a.message_terminals.length; c++)
351
- if (a.message_terminals[c].length !== S)
359
+ if (a.message_terminals[c].length !== _)
352
360
  throw new Error(
353
- `Block ${t} terminal ${c}: expected ${S} bytes, got ${a.message_terminals[c].length}`
361
+ `Block ${t} terminal ${c}: expected ${_} bytes, got ${a.message_terminals[c].length}`
354
362
  );
355
- if (a.checksum_minor_terminal.length !== S)
363
+ if (a.checksum_minor_terminal.length !== _)
356
364
  throw new Error(
357
- `Block ${t} checksum_minor: expected ${S} bytes`
365
+ `Block ${t} checksum_minor: expected ${_} bytes`
358
366
  );
359
- if (a.checksum_major_terminal.length !== S)
367
+ if (a.checksum_major_terminal.length !== _)
360
368
  throw new Error(
361
- `Block ${t} checksum_major: expected ${S} bytes`
369
+ `Block ${t} checksum_major: expected ${_} bytes`
362
370
  );
363
371
  e.push(a);
364
372
  } finally {
@@ -374,10 +382,10 @@ async function ze(s) {
374
382
  s.fill(0);
375
383
  }
376
384
  }
377
- function q(s, e, t) {
378
- if (s.length !== S)
385
+ function G(s, e, t) {
386
+ if (s.length !== _)
379
387
  throw new Error(
380
- `Block ${e} ${t}: expected ${S} bytes, got ${s.length}`
388
+ `Block ${e} ${t}: expected ${_} bytes, got ${s.length}`
381
389
  );
382
390
  for (let o = 0; o < s.length; o++) {
383
391
  const n = s[o];
@@ -387,43 +395,43 @@ function q(s, e, t) {
387
395
  );
388
396
  }
389
397
  }
390
- function Ye(s) {
398
+ function je(s) {
391
399
  if (s.length === 0)
392
400
  throw new Error("Public keys array must not be empty");
393
401
  for (let r = 0; r < s.length; r++) {
394
402
  const i = s[r];
395
- q(i.checksum_minor_terminal, r, "checksum_minor_terminal"), q(i.checksum_major_terminal, r, "checksum_major_terminal");
403
+ G(i.checksum_minor_terminal, r, "checksum_minor_terminal"), G(i.checksum_major_terminal, r, "checksum_major_terminal");
396
404
  for (let a = 0; a < i.message_terminals.length; a++)
397
- q(i.message_terminals[a], r, `message_terminal[${a}]`);
405
+ G(i.message_terminals[a], r, `message_terminal[${a}]`);
398
406
  }
399
407
  let e = 0;
400
408
  for (const r of s)
401
- e += $t + r.message_terminals.length;
402
- const t = new Uint8Array(e * S);
409
+ e += Vt + r.message_terminals.length;
410
+ const t = new Uint8Array(e * _);
403
411
  let o = 0;
404
412
  for (const r of s) {
405
- t.set(r.checksum_minor_terminal, o), o += S, t.set(r.checksum_major_terminal, o), o += S;
413
+ t.set(r.checksum_minor_terminal, o), o += _, t.set(r.checksum_major_terminal, o), o += _;
406
414
  for (const i of r.message_terminals)
407
- t.set(i, o), o += S;
415
+ t.set(i, o), o += _;
408
416
  }
409
- const n = We(t);
410
- return `0x${Xe(n)}`;
417
+ const n = Le(t);
418
+ return `0x${Ke(n)}`;
411
419
  }
412
- async function je(s, e) {
420
+ async function Qe(s, e) {
413
421
  const t = [], o = [], n = [], r = [];
414
422
  try {
415
423
  for (let i = 0; i < e; i++) {
416
- const a = await Gt(s, i);
424
+ const a = await zt(s, i);
417
425
  try {
418
- const u = await ze(a);
419
- t.push(u), o.push(Ye(u));
426
+ const u = await Ye(a);
427
+ t.push(u), o.push(je(u));
420
428
  } finally {
421
429
  a.fill(0);
422
430
  }
423
- const c = await qt(s, i);
431
+ const c = await Yt(s, i);
424
432
  try {
425
- const u = Q(c);
426
- n.push(u), r.push(ne(A(u)).slice(2));
433
+ const u = Z(c);
434
+ n.push(u), r.push(ae(S(u)).slice(2));
427
435
  } finally {
428
436
  c.fill(0);
429
437
  }
@@ -433,34 +441,45 @@ async function je(s, e) {
433
441
  }
434
442
  return { perVaultWotsKeys: t, wotsPkHashes: o, htlcSecretHexes: n, hashlocks: r };
435
443
  }
436
- const Qe = /^0x[0-9a-f]+$/i, Ze = /^[0-9a-f]+$/i, Je = /^[A-Za-z0-9+/]+={0,2}$/;
444
+ const Ze = /^0x[0-9a-f]+$/i, Je = /^[0-9a-f]+$/i, ts = /^[A-Za-z0-9+/]+={0,2}$/;
437
445
  function V(s) {
438
446
  if (typeof s != "string" || s.length === 0)
439
447
  throw new Error("BTC wallet returned empty public key");
440
- return te(s).toLowerCase();
448
+ return se(s).toLowerCase();
441
449
  }
442
- function ts(s) {
450
+ function es(s) {
443
451
  if (typeof s != "string" || s.length === 0)
444
452
  throw new Error("BTC wallet returned empty BIP-322 signature");
445
453
  if (s.startsWith("0x") || s.startsWith("0X")) {
446
- if (!Qe.test(s) || s.length < 4 || s.length % 2 !== 0)
454
+ if (!Ze.test(s) || s.length < 4 || s.length % 2 !== 0)
447
455
  throw new Error("BTC wallet returned malformed hex BIP-322 signature");
448
456
  return s.toLowerCase();
449
457
  }
450
- if (Ze.test(s)) {
458
+ if (Je.test(s)) {
451
459
  if (s.length % 2 !== 0)
452
460
  throw new Error("BTC wallet returned malformed hex BIP-322 signature");
453
461
  return `0x${s.toLowerCase()}`;
454
462
  }
455
- if (!Je.test(s) || s.length % 4 !== 0)
463
+ if (!ts.test(s) || s.length % 4 !== 0)
456
464
  throw new Error("BTC wallet returned malformed base64 BIP-322 signature");
457
- const e = Y.from(s, "base64");
465
+ const e = j.from(s, "base64");
458
466
  if (e.length === 0 || e.toString("base64") !== s)
459
467
  throw new Error("BTC wallet returned malformed base64 BIP-322 signature");
460
468
  return `0x${e.toString("hex")}`;
461
469
  }
462
- const Mt = 0, W = 25, J = 9999, z = "00".repeat(32);
463
- function es(s, e) {
470
+ const Ut = 0, tt = 25, Ft = 9999;
471
+ function z(s) {
472
+ if (!Number.isInteger(s) || s < 0 || s >= L)
473
+ throw new Error(
474
+ `Quoted commissionBps must be an integer in [0, ${L}), got ${s}`
475
+ );
476
+ return Math.min(
477
+ s + tt,
478
+ Ft
479
+ );
480
+ }
481
+ const Y = "00".repeat(32);
482
+ function ss(s, e) {
464
483
  const t = {
465
484
  bitcoin: "bc",
466
485
  testnet: "tb",
@@ -468,22 +487,22 @@ function es(s, e) {
468
487
  regtest: "bcrt"
469
488
  };
470
489
  try {
471
- const o = Et.address.fromBech32(s);
490
+ const o = vt.address.fromBech32(s);
472
491
  return o.prefix === t[e] && o.version === 0 && o.data.length === 20;
473
492
  } catch {
474
493
  return !1;
475
494
  }
476
495
  }
477
- function ss(s, e, t, o) {
496
+ function os(s, e, t, o) {
478
497
  const n = t == null ? void 0 : t[`${s}:${e}`];
479
498
  return n ? Promise.resolve({
480
499
  txid: s,
481
500
  vout: e,
482
501
  value: n.value,
483
502
  scriptPubKey: n.scriptPubKey
484
- }) : pe(s, e, o);
503
+ }) : me(s, e, o);
485
504
  }
486
- const kt = 12e4;
505
+ const Tt = 12e4;
487
506
  class Ss {
488
507
  /**
489
508
  * Creates a new PeginManager instance.
@@ -508,7 +527,7 @@ class Ss {
508
527
  if (e.amounts.length === 0)
509
528
  throw new Error("amounts must contain at least one entry");
510
529
  const t = await this.config.btcWallet.getPublicKeyHex(), o = V(t);
511
- if (!ht(
530
+ if (!dt(
512
531
  e.changeAddress,
513
532
  t,
514
533
  this.config.btcNetwork
@@ -518,25 +537,25 @@ class Ss {
518
537
  );
519
538
  const n = await this.prepareSizing(o, e), r = n.selectedUTXOs.map(
520
539
  (f) => ({
521
- txid: dt(f.txid),
540
+ txid: gt(f.txid),
522
541
  vout: f.vout
523
542
  })
524
- ), i = await oe(this.config.btcWallet, {
525
- depositorBtcPubkey: dt(o),
543
+ ), i = await ie(this.config.btcWallet, {
544
+ depositorBtcPubkey: gt(o),
526
545
  fundingOutpoints: r
527
546
  });
528
547
  let a, c;
529
548
  try {
530
- const f = await zt(i);
549
+ const f = await jt(i);
531
550
  try {
532
- a = Q(f), c = Q(Bt(f));
551
+ a = Z(f), c = Z(Et(f));
533
552
  } finally {
534
553
  f.fill(0);
535
554
  }
536
555
  } catch (f) {
537
556
  throw i.fill(0), f;
538
557
  }
539
- const u = await je(i, e.amounts.length), { perVaultWotsKeys: l, wotsPkHashes: m, htlcSecretHexes: b, hashlocks: w } = u, d = await this.preparePeginCommit({
558
+ const u = await Qe(i, e.amounts.length), { perVaultWotsKeys: l, wotsPkHashes: m, htlcSecretHexes: P, hashlocks: w } = u, d = await this.preparePeginCommit({
540
559
  depositorBtcPubkeyRaw: t,
541
560
  depositorBtcPubkey: o,
542
561
  hashlocks: w,
@@ -549,7 +568,7 @@ class Ss {
549
568
  throw new Error(
550
569
  `Internal invariant violation: htlcVout/index mismatch at vault ${f} (expected ${f}, got ${d.perVault[f].htlcVout})`
551
570
  );
552
- re(
571
+ ce(
553
572
  d.fundedPrePeginTxHex,
554
573
  e.amounts.length,
555
574
  c
@@ -566,7 +585,7 @@ class Ss {
566
585
  derivedSecrets: {
567
586
  perVaultWotsKeys: l,
568
587
  wotsPkHashes: m,
569
- htlcSecretHexes: b,
588
+ htlcSecretHexes: P,
570
589
  authAnchorHex: a
571
590
  },
572
591
  depositTerms: E
@@ -590,8 +609,8 @@ class Ss {
590
609
  */
591
610
  async prepareSizing(e, t) {
592
611
  const o = t.amounts.map(
593
- () => z
594
- ), n = t.vaultKeeperBtcPubkeys.length, r = await lt({
612
+ () => Y
613
+ ), n = t.vaultKeeperBtcPubkeys.length, r = await ut({
595
614
  vaultCoreVersion: t.vaultCoreVersion,
596
615
  depositorPubkey: e,
597
616
  vaultProviderPubkey: v(t.vaultProviderBtcPubkey),
@@ -606,12 +625,12 @@ class Ss {
606
625
  councilQuorum: t.councilQuorum,
607
626
  councilSize: t.councilSize,
608
627
  network: this.config.btcNetwork,
609
- authAnchorHash: z
610
- }), i = ce(
628
+ authAnchorHash: Y
629
+ }), i = ue(
611
630
  [...t.availableUTXOs],
612
631
  r.totalOutputValue,
613
632
  t.mempoolFeeRate,
614
- ue(r.htlcValues.length, !0)
633
+ de(r.htlcValues.length, !0)
615
634
  );
616
635
  return {
617
636
  selectedUTXOs: i.selectedUTXOs,
@@ -628,7 +647,7 @@ class Ss {
628
647
  authAnchorHash: r,
629
648
  sizing: i,
630
649
  params: a
631
- } = e, c = z.toLowerCase();
650
+ } = e, c = Y.toLowerCase();
632
651
  for (let g = 0; g < n.length; g++)
633
652
  if (n[g].toLowerCase() === c)
634
653
  throw new Error(
@@ -640,7 +659,7 @@ class Ss {
640
659
  );
641
660
  const u = v(
642
661
  a.vaultProviderBtcPubkey
643
- ), l = a.vaultKeeperBtcPubkeys.map(v), m = a.universalChallengerBtcPubkeys.map(v), b = l.length, w = {
662
+ ), l = a.vaultKeeperBtcPubkeys.map(v), m = a.universalChallengerBtcPubkeys.map(v), P = l.length, w = {
644
663
  vaultCoreVersion: a.vaultCoreVersion,
645
664
  depositorPubkey: o,
646
665
  vaultProviderPubkey: u,
@@ -651,12 +670,12 @@ class Ss {
651
670
  pegInAmounts: a.amounts,
652
671
  feeRate: a.protocolFeeRate,
653
672
  minPeginFeeRate: a.minPeginFeeRate,
654
- numLocalChallengers: b,
673
+ numLocalChallengers: P,
655
674
  councilQuorum: a.councilQuorum,
656
675
  councilSize: a.councilSize,
657
676
  network: this.config.btcNetwork,
658
677
  authAnchorHash: r
659
- }, d = await lt(w), E = gt(this.config.btcNetwork), k = he({
678
+ }, d = await ut(w), E = ft(this.config.btcNetwork), k = ge({
660
679
  unfundedTxHex: d.psbtHex,
661
680
  selectedUTXOs: i.selectedUTXOs,
662
681
  changeAddress: a.changeAddress,
@@ -667,16 +686,16 @@ class Ss {
667
686
  throw new Error(
668
687
  `Pre-PegIn funded fee ${f} does not match the sizing-pass fee ${i.fee}; refusing to publish a deposit-terms fee bound the funded transaction does not pay.`
669
688
  );
670
- const _ = v(
689
+ const A = v(
671
690
  X(k)
672
- ), p = [], P = [], T = [];
691
+ ), p = [], b = [], T = [];
673
692
  for (let g = 0; g < n.length; g++) {
674
- const B = await Yt({
693
+ const B = await Qt({
675
694
  prePeginParams: w,
676
695
  timelockPegin: a.timelockPegin,
677
696
  fundedPrePeginTxHex: k,
678
697
  htlcVout: g
679
- }), C = await Qt({
698
+ }), I = await Jt({
680
699
  vaultCoreVersion: a.vaultCoreVersion,
681
700
  peginTxHex: B.txHex,
682
701
  fundedPrePeginTxHex: k,
@@ -688,50 +707,54 @@ class Ss {
688
707
  timelockRefund: a.timelockRefund,
689
708
  network: this.config.btcNetwork
690
709
  });
691
- p.push(B), P.push(C.psbtHex), T.push(
692
- se(t, 1)
710
+ p.push(B), b.push(I.psbtHex), T.push(
711
+ re(t, 1)
693
712
  );
694
713
  }
695
- const h = Te({
714
+ const h = Be({
715
+ vaultCoreVersion: a.vaultCoreVersion,
696
716
  protocolFeeRate: a.protocolFeeRate,
697
717
  timelockPegin: a.timelockPegin,
718
+ timelockAssert: a.timelockAssert,
698
719
  timelockRefund: a.timelockRefund,
699
- prepeginTxid: _,
720
+ prepeginTxid: A,
700
721
  prepeginMaxFee: i.fee,
701
- vaultProviderPk: u,
702
- keeperPks: l,
703
- challengerPks: m,
704
- commissionBps: a.commissionBps,
705
- vaultAmounts: a.amounts,
722
+ vaultProviderBtcPubkey: u,
723
+ vaultKeeperBtcPubkeys: l,
724
+ universalChallengerBtcPubkeys: m,
725
+ maxAcceptableCommissionBps: z(
726
+ a.commissionBps
727
+ ),
728
+ peginAmounts: a.amounts,
706
729
  depositorClaimValue: d.depositorClaimValue,
707
730
  peginMaxFee: d.minPeginFee
708
731
  });
709
- ie(this.config.btcWallet) && await this.config.btcWallet.approveDepositTerms(h);
710
- const x = await ae(
732
+ mt(this.config.btcWallet) && await this.config.btcWallet.approveDepositTerms(h);
733
+ const x = await le(
711
734
  this.config.btcWallet,
712
- P,
735
+ b,
713
736
  T
714
- ), I = [];
737
+ ), C = [];
715
738
  for (let g = 0; g < x.length; g++) {
716
- ut({
717
- requestedPsbtHex: P[g],
739
+ ht({
740
+ requestedPsbtHex: b[g],
718
741
  returnedPsbtHex: x[g]
719
742
  });
720
- const B = Zt(
743
+ const B = te(
721
744
  x[g],
722
745
  o
723
746
  );
724
- jt({
725
- requestedPsbtHex: P[g],
747
+ Zt({
748
+ requestedPsbtHex: b[g],
726
749
  signatureHex: B,
727
750
  signerXOnlyPubkeyHex: o,
728
751
  inputIndex: 0
729
752
  });
730
- const C = Jt(x[g]);
731
- I.push({
753
+ const I = ee(x[g]);
754
+ C.push({
732
755
  htlcVout: g,
733
756
  htlcValue: d.htlcValues[g],
734
- peginTxHex: C,
757
+ peginTxHex: I,
735
758
  peginTxid: p[g].txid,
736
759
  peginInputSignature: B,
737
760
  vaultScriptPubKey: p[g].vaultScriptPubKey
@@ -739,8 +762,8 @@ class Ss {
739
762
  }
740
763
  return {
741
764
  fundedPrePeginTxHex: k,
742
- prePeginTxid: _,
743
- perVault: I,
765
+ prePeginTxid: A,
766
+ perVault: C,
744
767
  depositTerms: h
745
768
  };
746
769
  }
@@ -760,40 +783,40 @@ class Ss {
760
783
  * @throws Error if signing or broadcasting fails
761
784
  */
762
785
  async signAndBroadcast(e) {
763
- const { fundedPrePeginTxHex: t, depositorBtcPubkey: o } = e, n = t.startsWith("0x") ? t.slice(2) : t, r = Xt.fromHex(n);
786
+ const { fundedPrePeginTxHex: t, depositorBtcPubkey: o } = e, n = t.startsWith("0x") ? t.slice(2) : t, r = qt.fromHex(n);
764
787
  if (r.ins.length === 0)
765
788
  throw new Error("Transaction has no inputs");
766
- const i = new it();
789
+ const i = new at();
767
790
  i.setVersion(r.version), i.setLocktime(r.locktime);
768
- const a = Y.from(
791
+ const a = j.from(
769
792
  V(o),
770
793
  "hex"
771
794
  ), c = this.config.mempoolApiUrl, u = r.ins.map((p) => {
772
- const P = Y.from(p.hash).reverse().toString("hex"), T = p.index;
773
- return ss(P, T, e.localPrevouts, c).then(
774
- (h) => ({ input: p, utxoData: h, txid: P, vout: T })
795
+ const b = j.from(p.hash).reverse().toString("hex"), T = p.index;
796
+ return os(b, T, e.localPrevouts, c).then(
797
+ (h) => ({ input: p, utxoData: h, txid: b, vout: T })
775
798
  );
776
799
  }), l = await Promise.all(u), m = l.reduce(
777
- (p, P) => p + BigInt(P.utxoData.value),
800
+ (p, b) => p + BigInt(b.utxoData.value),
778
801
  0n
779
- ), b = r.outs.reduce(
780
- (p, P) => p + BigInt(P.value),
802
+ ), P = r.outs.reduce(
803
+ (p, b) => p + BigInt(b.value),
781
804
  0n
782
805
  );
783
- if (m < b)
806
+ if (m < P)
784
807
  throw new Error(
785
- `UTXO value mismatch: total input value (${m} sat) is less than total output value (${b} sat). This may indicate the mempool API returned manipulated UTXO data.`
808
+ `UTXO value mismatch: total input value (${m} sat) is less than total output value (${P} sat). This may indicate the mempool API returned manipulated UTXO data.`
786
809
  );
787
- const w = m - b;
788
- if (w > ft)
810
+ const w = m - P;
811
+ if (w > pt)
789
812
  throw new Error(
790
- `Implied transaction fee (${w} sat) exceeds maximum reasonable fee (${ft} sat). This may indicate manipulated UTXO data.`
813
+ `Implied transaction fee (${w} sat) exceeds maximum reasonable fee (${pt} sat). This may indicate manipulated UTXO data.`
791
814
  );
792
- for (const { input: p, utxoData: P, txid: T, vout: h } of l) {
793
- const x = le(
815
+ for (const { input: p, utxoData: b, txid: T, vout: h } of l) {
816
+ const x = he(
794
817
  {
795
- value: P.value,
796
- scriptPubKey: P.scriptPubKey
818
+ value: b.value,
819
+ scriptPubKey: b.scriptPubKey
797
820
  },
798
821
  a
799
822
  );
@@ -810,11 +833,11 @@ class Ss {
810
833
  value: p.value
811
834
  });
812
835
  const d = i.toHex(), E = await this.config.btcWallet.signPsbt(d);
813
- ut({
836
+ ht({
814
837
  requestedPsbtHex: d,
815
838
  returnedPsbtHex: E
816
839
  });
817
- const k = it.fromHex(E);
840
+ const k = at.fromHex(E);
818
841
  try {
819
842
  k.finalizeAllInputs();
820
843
  } catch (p) {
@@ -826,7 +849,7 @@ class Ss {
826
849
  );
827
850
  }
828
851
  const f = k.extractTransaction().toHex();
829
- return await ge(f, c);
852
+ return await fe(f, c);
830
853
  }
831
854
  /**
832
855
  * Registers a peg-in on Ethereum by calling the BTCVaultRegistry contract.
@@ -866,22 +889,22 @@ class Ss {
866
889
  if (!this.config.ethWallet.account)
867
890
  throw new Error("Ethereum wallet account not found");
868
891
  const l = this.config.ethWallet.account.address;
869
- if (!at(u.depositorEthAddress, l))
892
+ if (!ct(u.depositorEthAddress, l))
870
893
  throw new Error(
871
894
  `Proof of possession was signed for ${u.depositorEthAddress} but the Ethereum wallet is currently connected to ${l}. Reconnect the original account or call signProofOfPossession() again.`
872
895
  );
873
- const m = await this.assertPopMatchesBtcWallet(u), b = u.btcPopSignature, w = A(
896
+ const m = await this.assertPopMatchesBtcWallet(u), P = u.btcPopSignature, w = S(
874
897
  u.depositorBtcPubkey
875
- ), d = A(t), E = A(o), k = a ?? await this.config.btcWallet.getAddress(), f = this.resolvePayoutScriptPubKey(
898
+ ), d = S(t), E = S(o), k = a ?? await this.config.btcWallet.getAddress(), f = this.resolvePayoutScriptPubKey(
876
899
  m,
877
900
  k
878
- ), _ = X(E), p = await ct(
879
- v(_),
901
+ ), A = X(E), p = await lt(
902
+ v(A),
880
903
  v(l)
881
- ), P = A(p);
882
- if (await this.checkVaultExists(P))
904
+ ), b = S(p);
905
+ if (await this.checkVaultExists(b))
883
906
  throw new Error(
884
- `Vault already exists (ID: ${P}, peginTxHash: ${_}). Vault IDs are derived from the pegin transaction hash and depositor address. To create a new vault, use different UTXOs or a different amount to generate a unique transaction.`
907
+ `Vault already exists (ID: ${b}, peginTxHash: ${A}). Vault IDs are derived from the pegin transaction hash and depositor address. To create a new vault, use different UTXOs or a different amount to generate a unique transaction.`
885
908
  );
886
909
  const h = this.config.publicClient;
887
910
  let x;
@@ -892,26 +915,26 @@ class Ss {
892
915
  functionName: "getPegInFee",
893
916
  args: [n]
894
917
  });
895
- } catch (O) {
918
+ } catch ($) {
896
919
  throw new Error(
897
920
  "Failed to query pegin fee from the contract. Please check your network connection and that the contract address is correct.",
898
- { cause: O }
921
+ { cause: $ }
899
922
  );
900
923
  }
901
- const I = await this.resolveMaxAcceptableCommissionBps(
924
+ const C = await this.resolveMaxAcceptableCommissionBps(
902
925
  n,
903
926
  e.quotedCommissionBps
904
- ), g = j({
927
+ ), g = Q({
905
928
  abi: H,
906
929
  functionName: "submitPeginRequest",
907
930
  args: [
908
931
  l,
909
932
  w,
910
- b,
933
+ P,
911
934
  d,
912
935
  E,
913
936
  n,
914
- I,
937
+ C,
915
938
  r,
916
939
  i,
917
940
  f,
@@ -926,12 +949,12 @@ class Ss {
926
949
  value: x,
927
950
  account: this.config.ethWallet.account.address
928
951
  });
929
- } catch (O) {
930
- R(O);
952
+ } catch ($) {
953
+ R($);
931
954
  }
932
- let C;
955
+ let I;
933
956
  try {
934
- C = await this.config.ethWallet.sendTransaction({
957
+ I = await this.config.ethWallet.sendTransaction({
935
958
  to: this.config.vaultContracts.btcVaultRegistry,
936
959
  data: g,
937
960
  value: x,
@@ -939,14 +962,14 @@ class Ss {
939
962
  chain: this.config.ethChain,
940
963
  gas: B
941
964
  });
942
- } catch (O) {
943
- R(O);
965
+ } catch ($) {
966
+ R($);
944
967
  }
945
- const D = await pt({
968
+ const D = await bt({
946
969
  publicClient: h,
947
970
  walletAddress: this.config.ethWallet.account.address,
948
- hash: C,
949
- timeout: kt
971
+ hash: I,
972
+ timeout: Tt
950
973
  });
951
974
  return D.status === "reverted" && R(
952
975
  new Error(
@@ -954,8 +977,8 @@ class Ss {
954
977
  )
955
978
  ), {
956
979
  ethTxHash: D.transactionHash,
957
- vaultId: P,
958
- peginTxHash: _
980
+ vaultId: b,
981
+ peginTxHash: A
959
982
  };
960
983
  }
961
984
  /**
@@ -975,7 +998,7 @@ class Ss {
975
998
  if (!this.config.ethWallet.account)
976
999
  throw new Error("Ethereum wallet account not found");
977
1000
  const i = this.config.ethWallet.account.address;
978
- if (!at(r.depositorEthAddress, i))
1001
+ if (!ct(r.depositorEthAddress, i))
979
1002
  throw new Error(
980
1003
  `Proof of possession was signed for ${r.depositorEthAddress} but the Ethereum wallet is currently connected to ${i}. Reconnect the original account or call signProofOfPossession() again.`
981
1004
  );
@@ -986,22 +1009,22 @@ class Ss {
986
1009
  )
987
1010
  ), l = [];
988
1011
  for (const h of n) {
989
- const x = A(
1012
+ const x = S(
990
1013
  h.depositorSignedPeginTx
991
- ), I = X(x), g = await ct(
992
- v(I),
1014
+ ), C = X(x), g = await lt(
1015
+ v(C),
993
1016
  v(i)
994
- ), B = A(g);
1017
+ ), B = S(g);
995
1018
  if (await this.checkVaultExists(B))
996
1019
  throw new Error(
997
- `Vault already exists (ID: ${B}, peginTxHash: ${I}). To create a new vault, use different UTXOs or a different amount.`
1020
+ `Vault already exists (ID: ${B}, peginTxHash: ${C}). To create a new vault, use different UTXOs or a different amount.`
998
1021
  );
999
- l.push({ vaultId: B, peginTxHash: I });
1022
+ l.push({ vaultId: B, peginTxHash: C });
1000
1023
  }
1001
1024
  const m = this.config.publicClient;
1002
- let b;
1025
+ let P;
1003
1026
  try {
1004
- b = await m.readContract({
1027
+ P = await m.readContract({
1005
1028
  address: this.config.vaultContracts.btcVaultRegistry,
1006
1029
  abi: H,
1007
1030
  functionName: "getPegInFee",
@@ -1013,24 +1036,24 @@ class Ss {
1013
1036
  { cause: h }
1014
1037
  );
1015
1038
  }
1016
- const w = b * BigInt(n.length), d = await this.resolveMaxAcceptableCommissionBps(
1039
+ const w = P * BigInt(n.length), d = await this.resolveMaxAcceptableCommissionBps(
1017
1040
  t,
1018
1041
  e.quotedCommissionBps
1019
- ), E = A(
1042
+ ), E = S(
1020
1043
  r.depositorBtcPubkey
1021
- ), k = A(o), f = n.map((h, x) => ({
1044
+ ), k = S(o), f = n.map((h, x) => ({
1022
1045
  depositorBtcPubKey: E,
1023
1046
  btcPopSignature: c,
1024
1047
  unsignedPrePeginTx: k,
1025
- depositorSignedPeginTx: A(
1048
+ depositorSignedPeginTx: S(
1026
1049
  h.depositorSignedPeginTx
1027
1050
  ),
1028
1051
  hashlock: h.hashlock,
1029
1052
  htlcVout: h.htlcVout,
1030
- referralCode: Mt,
1053
+ referralCode: Ut,
1031
1054
  depositorPayoutBtcAddress: u[x],
1032
1055
  depositorWotsPkHash: h.depositorWotsPkHash
1033
- })), _ = j({
1056
+ })), A = Q({
1034
1057
  abi: H,
1035
1058
  functionName: "submitPeginRequestBatch",
1036
1059
  args: [
@@ -1044,18 +1067,18 @@ class Ss {
1044
1067
  try {
1045
1068
  p = await m.estimateGas({
1046
1069
  to: this.config.vaultContracts.btcVaultRegistry,
1047
- data: _,
1070
+ data: A,
1048
1071
  value: w,
1049
1072
  account: this.config.ethWallet.account.address
1050
1073
  });
1051
1074
  } catch (h) {
1052
1075
  R(h);
1053
1076
  }
1054
- let P;
1077
+ let b;
1055
1078
  try {
1056
- P = await this.config.ethWallet.sendTransaction({
1079
+ b = await this.config.ethWallet.sendTransaction({
1057
1080
  to: this.config.vaultContracts.btcVaultRegistry,
1058
- data: _,
1081
+ data: A,
1059
1082
  value: w,
1060
1083
  account: this.config.ethWallet.account,
1061
1084
  chain: this.config.ethChain,
@@ -1064,11 +1087,11 @@ class Ss {
1064
1087
  } catch (h) {
1065
1088
  R(h);
1066
1089
  }
1067
- const T = await pt({
1090
+ const T = await bt({
1068
1091
  publicClient: m,
1069
1092
  walletAddress: this.config.ethWallet.account.address,
1070
- hash: P,
1071
- timeout: kt
1093
+ hash: b,
1094
+ timeout: Tt
1072
1095
  });
1073
1096
  return T.status === "reverted" && R(
1074
1097
  new Error(
@@ -1082,9 +1105,13 @@ class Ss {
1082
1105
  // Anchor to quoted+headroom when supplied (refuse if chain drifted past it);
1083
1106
  // otherwise fall back to chain-current+headroom — see #1691.
1084
1107
  async resolveMaxAcceptableCommissionBps(e, t) {
1108
+ if (t === void 0 && mt(this.config.btcWallet))
1109
+ throw new Error(
1110
+ "quotedCommissionBps is required when the wallet approved deposit terms: the registration ceiling must anchor to the approved quote."
1111
+ );
1085
1112
  let o;
1086
1113
  try {
1087
- o = await new fe(
1114
+ o = await new pe(
1088
1115
  this.config.publicClient,
1089
1116
  this.config.vaultContracts.btcVaultRegistry
1090
1117
  ).getVaultProviderCommission(e);
@@ -1095,19 +1122,13 @@ class Ss {
1095
1122
  );
1096
1123
  }
1097
1124
  if (t !== void 0) {
1098
- if (o > t + W)
1125
+ if (o > t + tt)
1099
1126
  throw new Error(
1100
- `Vault provider commission changed since quote: quoted ${t} bps, chain currently reports ${o} bps (allowed drift ${W} bps). Please refresh to see the new commission and try again.`
1127
+ `Vault provider commission changed since quote: quoted ${t} bps, chain currently reports ${o} bps (allowed drift ${tt} bps). Please refresh to see the new commission and try again.`
1101
1128
  );
1102
- return Math.min(
1103
- t + W,
1104
- J
1105
- );
1129
+ return z(t);
1106
1130
  }
1107
- return Math.min(
1108
- o + W,
1109
- J
1110
- );
1131
+ return z(o);
1111
1132
  }
1112
1133
  /**
1113
1134
  * Check if a vault already exists for a given vault ID.
@@ -1128,7 +1149,7 @@ class Ss {
1128
1149
  abi: H,
1129
1150
  functionName: "getBtcVaultBasicInfo",
1130
1151
  args: [e]
1131
- })).depositor !== Kt;
1152
+ })).depositor !== Gt;
1132
1153
  }
1133
1154
  /**
1134
1155
  * Resolve the BTC scriptPubKey to register as the depositor's payout sink.
@@ -1147,19 +1168,19 @@ class Ss {
1147
1168
  * on-chain payout-script registration.
1148
1169
  */
1149
1170
  resolvePayoutScriptPubKey(e, t) {
1150
- if (!ht(
1171
+ if (!dt(
1151
1172
  t,
1152
1173
  e,
1153
1174
  this.config.btcNetwork
1154
1175
  ))
1155
- throw v(e).length === ee && es(t, this.config.btcNetwork) ? new Error(
1176
+ throw v(e).length === oe && ss(t, this.config.btcNetwork) ? new Error(
1156
1177
  `BTC payout address "${t}" is a P2WPKH (Native SegWit) address, but the connected wallet only exposes an x-only public key. P2WPKH validation requires a compressed key with known y-parity. Use a P2TR (Taproot) payout address instead.`
1157
1178
  ) : new Error(
1158
1179
  `BTC payout address "${t}" is not derived from the connected wallet's public key. The payout sink must be controlled by the same key that signs the pegin; refusing to register a mismatched address.`
1159
1180
  );
1160
- const o = gt(this.config.btcNetwork);
1181
+ const o = ft(this.config.btcNetwork);
1161
1182
  try {
1162
- return `0x${Et.address.toOutputScript(t, o).toString("hex")}`;
1183
+ return `0x${vt.address.toOutputScript(t, o).toString("hex")}`;
1163
1184
  } catch {
1164
1185
  throw new Error(
1165
1186
  `Invalid BTC payout address: "${t}". Please provide a valid Bitcoin address for the ${this.config.btcNetwork} network.`
@@ -1182,7 +1203,7 @@ class Ss {
1182
1203
  "bip322-simple"
1183
1204
  );
1184
1205
  return {
1185
- btcPopSignature: ts(r),
1206
+ btcPopSignature: es(r),
1186
1207
  depositorEthAddress: e,
1187
1208
  depositorBtcPubkey: t
1188
1209
  };
@@ -1220,29 +1241,29 @@ class Ss {
1220
1241
  return this.config.vaultContracts.btcVaultRegistry;
1221
1242
  }
1222
1243
  }
1223
- const os = 80, ns = 250, rs = 300, is = 22, Ut = "ab";
1224
- function as(s, e) {
1225
- const t = Ut.repeat(rs), o = v(s).toLowerCase(), n = e.toString(16).padStart(8, "0"), r = `${o}${n}`, i = t.slice(r.length);
1244
+ const ns = 80, rs = 250, is = 300, as = 22, Nt = "ab";
1245
+ function cs(s, e) {
1246
+ const t = Nt.repeat(is), o = v(s).toLowerCase(), n = e.toString(16).padStart(8, "0"), r = `${o}${n}`, i = t.slice(r.length);
1226
1247
  return `0x${r}${i}`;
1227
1248
  }
1228
- function cs(s, e) {
1229
- const t = (o) => `0x${Ut.repeat(o)}`;
1249
+ function ls(s, e) {
1250
+ const t = (o) => `0x${Nt.repeat(o)}`;
1230
1251
  return {
1231
1252
  depositorBtcPubKey: t(32),
1232
- btcPopSignature: t(os),
1233
- unsignedPrePeginTx: t(ns),
1234
- depositorSignedPeginTx: as(
1253
+ btcPopSignature: t(ns),
1254
+ unsignedPrePeginTx: t(rs),
1255
+ depositorSignedPeginTx: cs(
1235
1256
  s,
1236
1257
  e
1237
1258
  ),
1238
1259
  hashlock: t(32),
1239
1260
  htlcVout: e,
1240
- referralCode: Mt,
1241
- depositorPayoutBtcAddress: t(is),
1261
+ referralCode: Ut,
1262
+ depositorPayoutBtcAddress: t(as),
1242
1263
  depositorWotsPkHash: t(32)
1243
1264
  };
1244
1265
  }
1245
- async function As(s) {
1266
+ async function Cs(s) {
1246
1267
  const {
1247
1268
  publicClient: e,
1248
1269
  btcVaultRegistry: t,
@@ -1261,14 +1282,14 @@ async function As(s) {
1261
1282
  args: [n]
1262
1283
  }) * BigInt(r), c = Array.from(
1263
1284
  { length: r },
1264
- (l, m) => cs(o, m)
1265
- ), u = j({
1285
+ (l, m) => ls(o, m)
1286
+ ), u = Q({
1266
1287
  abi: H,
1267
1288
  functionName: "submitPeginRequestBatch",
1268
1289
  args: [
1269
1290
  o,
1270
1291
  n,
1271
- J,
1292
+ Ft,
1272
1293
  c
1273
1294
  ]
1274
1295
  });
@@ -1281,9 +1302,9 @@ async function As(s) {
1281
1302
  }
1282
1303
  export {
1283
1304
  Ss as P,
1284
- Te as b,
1285
- Ye as c,
1286
- ze as d,
1287
- As as e
1305
+ Be as b,
1306
+ je as c,
1307
+ Ye as d,
1308
+ Cs as e
1288
1309
  };
1289
- //# sourceMappingURL=PeginManager-DbMFLh-1.js.map
1310
+ //# sourceMappingURL=PeginManager-C8ixWlUM.js.map