@babylonlabs-io/ts-sdk 0.52.0 → 0.55.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 (160) hide show
  1. package/dist/ApplicationRegistry.abi-CLaa6E99.cjs +2 -0
  2. package/dist/ApplicationRegistry.abi-CLaa6E99.cjs.map +1 -0
  3. package/dist/{ApplicationRegistry.abi-Dn2qk6JG.js → ApplicationRegistry.abi-w5prf7Ig.js} +14 -1
  4. package/dist/ApplicationRegistry.abi-w5prf7Ig.js.map +1 -0
  5. package/dist/PayoutManager-BJmPnyRP.js +260 -0
  6. package/dist/PayoutManager-BJmPnyRP.js.map +1 -0
  7. package/dist/PayoutManager-aqtsj60t.cjs +2 -0
  8. package/dist/PayoutManager-aqtsj60t.cjs.map +1 -0
  9. package/dist/{PeginManager-BGWNJYPk.js → PeginManager-D22MLWfM.js} +132 -144
  10. package/dist/PeginManager-D22MLWfM.js.map +1 -0
  11. package/dist/PeginManager-vUUfZCzj.cjs +2 -0
  12. package/dist/PeginManager-vUUfZCzj.cjs.map +1 -0
  13. package/dist/{buildAndBroadcastRefund-BAT5A6MP.js → buildAndBroadcastRefund-BiSO4zg2.js} +358 -360
  14. package/dist/buildAndBroadcastRefund-BiSO4zg2.js.map +1 -0
  15. package/dist/buildAndBroadcastRefund-Bwi1I5we.cjs +2 -0
  16. package/dist/buildAndBroadcastRefund-Bwi1I5we.cjs.map +1 -0
  17. package/dist/{challengeAssert-HNbugpqL.cjs → challengeAssert-DLQfNcfU.cjs} +2 -2
  18. package/dist/{challengeAssert-HNbugpqL.cjs.map → challengeAssert-DLQfNcfU.cjs.map} +1 -1
  19. package/dist/{challengeAssert-csvYXBJB.js → challengeAssert-DvdbpEDY.js} +2 -2
  20. package/dist/{challengeAssert-csvYXBJB.js.map → challengeAssert-DvdbpEDY.js.map} +1 -1
  21. package/dist/constants-BhclpREj.js +19 -0
  22. package/dist/constants-BhclpREj.js.map +1 -0
  23. package/dist/constants-CvbARMl-.cjs +2 -0
  24. package/dist/constants-CvbARMl-.cjs.map +1 -0
  25. package/dist/{fundPeginTransaction-96FxwYYJ.js → fundPeginTransaction-B2wyjqp0.js} +21 -22
  26. package/dist/fundPeginTransaction-B2wyjqp0.js.map +1 -0
  27. package/dist/fundPeginTransaction-BLD8FRL9.cjs +2 -0
  28. package/dist/fundPeginTransaction-BLD8FRL9.cjs.map +1 -0
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.js +192 -190
  31. package/dist/index.js.map +1 -1
  32. package/dist/{mempoolApi-Dc1KSVNI.js → mempoolApi-CB7bHuwi.js} +106 -101
  33. package/dist/mempoolApi-CB7bHuwi.js.map +1 -0
  34. package/dist/mempoolApi-DqJByvqR.cjs +2 -0
  35. package/dist/mempoolApi-DqJByvqR.cjs.map +1 -0
  36. package/dist/noPayout-CNMqNNpc.cjs +2 -0
  37. package/dist/noPayout-CNMqNNpc.cjs.map +1 -0
  38. package/dist/{noPayout-DVx3zxUz.js → noPayout-CfBg3HzC.js} +30 -30
  39. package/dist/noPayout-CfBg3HzC.js.map +1 -0
  40. package/dist/{peginInput-B5XDDHpy.js → peginInput-BKD_b3gq.js} +10 -11
  41. package/dist/peginInput-BKD_b3gq.js.map +1 -0
  42. package/dist/{peginInput-De0C6aSj.cjs → peginInput-CAiiDZeO.cjs} +2 -2
  43. package/dist/peginInput-CAiiDZeO.cjs.map +1 -0
  44. package/dist/primeVpAuth-CF4cH5_e.cjs +2 -0
  45. package/dist/primeVpAuth-CF4cH5_e.cjs.map +1 -0
  46. package/dist/{primeVpAuth-DxMuWQCi.js → primeVpAuth-l-5x_2UV.js} +91 -85
  47. package/dist/{primeVpAuth-yTddDmGy.cjs.map → primeVpAuth-l-5x_2UV.js.map} +1 -1
  48. package/dist/tbv/core/clients/eth/protocol-params-reader.d.ts.map +1 -1
  49. package/dist/tbv/core/clients/eth/protocol-params-validation.d.ts.map +1 -1
  50. package/dist/tbv/core/clients/eth/types.d.ts +8 -0
  51. package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
  52. package/dist/tbv/core/clients/index.cjs +1 -1
  53. package/dist/tbv/core/clients/index.js +2 -2
  54. package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts +10 -0
  55. package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts.map +1 -1
  56. package/dist/tbv/core/contracts/index.cjs +1 -1
  57. package/dist/tbv/core/contracts/index.js +1 -1
  58. package/dist/tbv/core/index.cjs +1 -1
  59. package/dist/tbv/core/index.js +190 -188
  60. package/dist/tbv/core/index.js.map +1 -1
  61. package/dist/tbv/core/managers/PayoutManager.d.ts +6 -0
  62. package/dist/tbv/core/managers/PayoutManager.d.ts.map +1 -1
  63. package/dist/tbv/core/managers/PeginManager.d.ts +10 -2
  64. package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
  65. package/dist/tbv/core/managers/index.cjs +1 -1
  66. package/dist/tbv/core/managers/index.js +2 -2
  67. package/dist/tbv/core/managers/pegin/signPsbtsWithFallback.d.ts +10 -6
  68. package/dist/tbv/core/managers/pegin/signPsbtsWithFallback.d.ts.map +1 -1
  69. package/dist/tbv/core/primitives/__tests__/vaultCoreVersion.test.d.ts +8 -0
  70. package/dist/tbv/core/primitives/__tests__/vaultCoreVersion.test.d.ts.map +1 -0
  71. package/dist/tbv/core/primitives/index.cjs +1 -1
  72. package/dist/tbv/core/primitives/index.d.ts +3 -3
  73. package/dist/tbv/core/primitives/index.d.ts.map +1 -1
  74. package/dist/tbv/core/primitives/index.js +40 -37
  75. package/dist/tbv/core/primitives/index.js.map +1 -1
  76. package/dist/tbv/core/primitives/psbt/__tests__/assertPeginTxShape.test.d.ts +11 -0
  77. package/dist/tbv/core/primitives/psbt/__tests__/assertPeginTxShape.test.d.ts.map +1 -0
  78. package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts +11 -10
  79. package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts.map +1 -1
  80. package/dist/tbv/core/primitives/psbt/payout.d.ts +6 -0
  81. package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
  82. package/dist/tbv/core/primitives/psbt/pegin.d.ts +17 -2
  83. package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
  84. package/dist/tbv/core/primitives/psbt/peginInput.d.ts +6 -0
  85. package/dist/tbv/core/primitives/psbt/peginInput.d.ts.map +1 -1
  86. package/dist/tbv/core/primitives/psbt/refund.d.ts.map +1 -1
  87. package/dist/tbv/core/primitives/scripts/payout.d.ts +6 -0
  88. package/dist/tbv/core/primitives/scripts/payout.d.ts.map +1 -1
  89. package/dist/tbv/core/primitives/vaultCoreVersion.d.ts +26 -0
  90. package/dist/tbv/core/primitives/vaultCoreVersion.d.ts.map +1 -0
  91. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts +7 -0
  92. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -1
  93. package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts +6 -0
  94. package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts.map +1 -1
  95. package/dist/tbv/core/services/deposit/verifyRegisteredVaultVersions.d.ts +8 -0
  96. package/dist/tbv/core/services/deposit/verifyRegisteredVaultVersions.d.ts.map +1 -1
  97. package/dist/tbv/core/services/index.cjs +1 -1
  98. package/dist/tbv/core/services/index.js +2 -2
  99. package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts +6 -0
  100. package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts.map +1 -1
  101. package/dist/tbv/core/utils/fee/constants.d.ts +6 -14
  102. package/dist/tbv/core/utils/fee/constants.d.ts.map +1 -1
  103. package/dist/tbv/core/utils/index.cjs +1 -1
  104. package/dist/tbv/core/utils/index.js +35 -36
  105. package/dist/tbv/index.cjs +1 -1
  106. package/dist/tbv/index.js +190 -188
  107. package/dist/tbv/index.js.map +1 -1
  108. package/dist/testing/MockBitcoinWallet.d.ts +1 -1
  109. package/dist/testing/MockBitcoinWallet.d.ts.map +1 -1
  110. package/dist/testing/index.cjs +1 -1
  111. package/dist/testing/index.cjs.map +1 -1
  112. package/dist/testing/index.js +3 -3
  113. package/dist/testing/index.js.map +1 -1
  114. package/dist/verifyScriptPathSchnorrSignature-BDznSCOR.cjs +2 -0
  115. package/dist/verifyScriptPathSchnorrSignature-BDznSCOR.cjs.map +1 -0
  116. package/dist/verifyScriptPathSchnorrSignature-DA4Z4yZ3.js +658 -0
  117. package/dist/verifyScriptPathSchnorrSignature-DA4Z4yZ3.js.map +1 -0
  118. package/dist/{waitForTransactionReceiptSmartAware-U706oKTc.cjs → waitForTransactionReceiptSmartAware-AgZ-3WV_.cjs} +2 -2
  119. package/dist/{waitForTransactionReceiptSmartAware-U706oKTc.cjs.map → waitForTransactionReceiptSmartAware-AgZ-3WV_.cjs.map} +1 -1
  120. package/dist/{waitForTransactionReceiptSmartAware-Ckg_oZAo.js → waitForTransactionReceiptSmartAware-lobLm0q0.js} +2 -2
  121. package/dist/{waitForTransactionReceiptSmartAware-Ckg_oZAo.js.map → waitForTransactionReceiptSmartAware-lobLm0q0.js.map} +1 -1
  122. package/package.json +2 -2
  123. package/dist/ApplicationRegistry.abi-BAPhJch3.cjs +0 -2
  124. package/dist/ApplicationRegistry.abi-BAPhJch3.cjs.map +0 -1
  125. package/dist/ApplicationRegistry.abi-Dn2qk6JG.js.map +0 -1
  126. package/dist/PayoutManager-BwrV3xFW.js +0 -241
  127. package/dist/PayoutManager-BwrV3xFW.js.map +0 -1
  128. package/dist/PayoutManager-CBfHfLfz.cjs +0 -2
  129. package/dist/PayoutManager-CBfHfLfz.cjs.map +0 -1
  130. package/dist/PeginManager-BGWNJYPk.js.map +0 -1
  131. package/dist/PeginManager-DDp-ZRIa.cjs +0 -2
  132. package/dist/PeginManager-DDp-ZRIa.cjs.map +0 -1
  133. package/dist/buildAndBroadcastRefund-3MLyCOtv.cjs +0 -2
  134. package/dist/buildAndBroadcastRefund-3MLyCOtv.cjs.map +0 -1
  135. package/dist/buildAndBroadcastRefund-BAT5A6MP.js.map +0 -1
  136. package/dist/constants-CSG2XeD8.cjs +0 -2
  137. package/dist/constants-CSG2XeD8.cjs.map +0 -1
  138. package/dist/constants-Cd_fN8VT.js +0 -12
  139. package/dist/constants-Cd_fN8VT.js.map +0 -1
  140. package/dist/fundPeginTransaction-96FxwYYJ.js.map +0 -1
  141. package/dist/fundPeginTransaction-DuMwnytD.cjs +0 -2
  142. package/dist/fundPeginTransaction-DuMwnytD.cjs.map +0 -1
  143. package/dist/mempoolApi-Dc1KSVNI.js.map +0 -1
  144. package/dist/mempoolApi-NMiYQAXI.cjs +0 -2
  145. package/dist/mempoolApi-NMiYQAXI.cjs.map +0 -1
  146. package/dist/noPayout-ChPNKTbm.cjs +0 -2
  147. package/dist/noPayout-ChPNKTbm.cjs.map +0 -1
  148. package/dist/noPayout-DVx3zxUz.js.map +0 -1
  149. package/dist/peginInput-B5XDDHpy.js.map +0 -1
  150. package/dist/peginInput-De0C6aSj.cjs.map +0 -1
  151. package/dist/primeVpAuth-DxMuWQCi.js.map +0 -1
  152. package/dist/primeVpAuth-yTddDmGy.cjs +0 -2
  153. package/dist/tbv/core/primitives/__tests__/txGraphVersion.test.d.ts +0 -7
  154. package/dist/tbv/core/primitives/__tests__/txGraphVersion.test.d.ts.map +0 -1
  155. package/dist/tbv/core/primitives/txGraphVersion.d.ts +0 -11
  156. package/dist/tbv/core/primitives/txGraphVersion.d.ts.map +0 -1
  157. package/dist/verifyScriptPathSchnorrSignature-BKECXOpa.js +0 -572
  158. package/dist/verifyScriptPathSchnorrSignature-BKECXOpa.js.map +0 -1
  159. package/dist/verifyScriptPathSchnorrSignature-CVPh04ZI.cjs +0 -2
  160. package/dist/verifyScriptPathSchnorrSignature-CVPh04ZI.cjs.map +0 -1
@@ -9,29 +9,29 @@ import { isAddressEqual as ft, encodeFunctionData as tt, zeroAddress as Jt } fro
9
9
  import { B as A } from "./BTCVaultRegistry.abi-Chs4AFBj.js";
10
10
  import { h as H } from "./errors-Blc-JWnI.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 { a as mt, b as se, d as Pt, f as oe } from "./verifyScriptPathSchnorrSignature-BKECXOpa.js";
13
- import { b as re, e as ie, f as ae } from "./peginInput-B5XDDHpy.js";
14
- import { u as X, h as et, e as S, p as ce, i as bt, s as T, j as wt, X as le } from "./bitcoin-B5aNKtsk.js";
12
+ import { a as mt, b as se, d as bt, f as oe } from "./verifyScriptPathSchnorrSignature-DA4Z4yZ3.js";
13
+ import { b as re, e as ie, f as ae } from "./peginInput-BKD_b3gq.js";
14
+ import { u as X, h as et, e as v, p as ce, i as Pt, s as T, j as wt, X as le } from "./bitcoin-B5aNKtsk.js";
15
15
  import { c as ue } from "./signing-DaLvGwQe.js";
16
16
  import { M as yt } from "./validation-CxqROCno.js";
17
- import { c as he, a as de } from "./PayoutManager-BwrV3xFW.js";
18
- import { s as ge, f as q, i as fe, w as xt } from "./waitForTransactionReceiptSmartAware-Ckg_oZAo.js";
19
- import { p as pe, f as me } from "./fundPeginTransaction-96FxwYYJ.js";
20
- import { p as Pe, V as be, i as we } from "./mempoolApi-Dc1KSVNI.js";
17
+ import { c as he, a as de, s as ge } from "./PayoutManager-BJmPnyRP.js";
18
+ import { s as fe, f as q, i as pe, w as xt } from "./waitForTransactionReceiptSmartAware-lobLm0q0.js";
19
+ import { p as me, f as be } from "./fundPeginTransaction-B2wyjqp0.js";
20
+ import { p as Pe, V as we, i as ye } from "./mempoolApi-CB7bHuwi.js";
21
21
  const M = /* @__PURE__ */ BigInt(2 ** 32 - 1), kt = /* @__PURE__ */ BigInt(32);
22
- function ye(n, t = !1) {
22
+ function xe(n, t = !1) {
23
23
  return t ? { h: Number(n & M), l: Number(n >> kt & M) } : { h: Number(n >> kt & M) | 0, l: Number(n & M) | 0 };
24
24
  }
25
- function xe(n, t = !1) {
25
+ function ke(n, t = !1) {
26
26
  const e = n.length;
27
27
  let s = new Uint32Array(e), o = new Uint32Array(e);
28
28
  for (let r = 0; r < e; r++) {
29
- const { h: i, l: a } = ye(n[r], t);
29
+ const { h: i, l: a } = xe(n[r], t);
30
30
  [s[r], o[r]] = [i, a];
31
31
  }
32
32
  return [s, o];
33
33
  }
34
- const ke = (n, t, e) => n << e | t >>> 32 - e, Ee = (n, t, e) => t << e | n >>> 32 - e, Te = (n, t, e) => t << e - 32 | n >>> 64 - e, _e = (n, t, e) => n << e - 32 | t >>> 64 - e, U = 32, z = 32, nt = 36, Ht = 32, K = 4, Be = K + U + K + Ht;
34
+ const Ee = (n, t, e) => n << e | t >>> 32 - e, Te = (n, t, e) => t << e | n >>> 32 - e, _e = (n, t, e) => t << e - 32 | n >>> 64 - e, Be = (n, t, e) => n << e - 32 | t >>> 64 - e, U = 32, z = 32, nt = 36, Ht = 32, K = 4, ve = 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
  }
@@ -51,7 +51,7 @@ function Et(n, t) {
51
51
  if (n[s] !== t[s]) return n[s] - t[s];
52
52
  return n.length - t.length;
53
53
  }
54
- function ve(n) {
54
+ function Ie(n) {
55
55
  if (n.length === 0)
56
56
  throw new Error(
57
57
  "buildFundingOutpointsCommitment: outpoints must be non-empty"
@@ -68,18 +68,18 @@ function ve(n) {
68
68
  e.set(t[s], s * nt);
69
69
  return it(e);
70
70
  }
71
- function Ie(n) {
71
+ function Ae(n) {
72
72
  if (n.depositorBtcPubkey.length !== U)
73
73
  throw new Error(
74
74
  `vaultContext: depositorBtcPubkey must be exactly ${U} bytes, got ${n.depositorBtcPubkey.length}`
75
75
  );
76
- const t = ve(n.fundingOutpoints), e = new Uint8Array(Be);
76
+ const t = Ie(n.fundingOutpoints), e = new Uint8Array(ve);
77
77
  let s = 0;
78
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
- const Ae = "babylon-btc-vault", Ot = 32, Tt = Ot * 2, Ce = /^[0-9a-f]+$/;
81
- async function He(n, t) {
82
- const e = Ie(t), s = X(e), o = await n.deriveContextHash(Ae, s);
80
+ const Ce = "babylon-btc-vault", Ot = 32, Tt = Ot * 2, He = /^[0-9a-f]+$/;
81
+ async function Oe(n, t) {
82
+ const e = Ae(t), s = X(e), o = await n.deriveContextHash(Ce, s);
83
83
  if (typeof o != "string")
84
84
  throw new Error(
85
85
  `deriveVaultRoot: wallet must return a string, got ${typeof o}`
@@ -88,13 +88,13 @@ async function He(n, t) {
88
88
  throw new Error(
89
89
  `deriveVaultRoot: wallet must return a ${Tt}-character hex string (${Ot} bytes), got length ${o.length}`
90
90
  );
91
- if (!Ce.test(o))
91
+ if (!He.test(o))
92
92
  throw new Error(
93
93
  "deriveVaultRoot: wallet must return lowercase hex per derive-context-hash.md §2.1; got value with non-lowercase or non-hex characters"
94
94
  );
95
95
  return et(o);
96
96
  }
97
- const Oe = /* @__PURE__ */ Uint8Array.from([
97
+ const Re = /* @__PURE__ */ Uint8Array.from([
98
98
  7,
99
99
  4,
100
100
  13,
@@ -111,11 +111,11 @@ const Oe = /* @__PURE__ */ Uint8Array.from([
111
111
  14,
112
112
  11,
113
113
  8
114
- ]), Rt = Uint8Array.from(new Array(16).fill(0).map((n, t) => t)), Re = Rt.map((n) => (9 * n + 5) % 16), $t = /* @__PURE__ */ (() => {
115
- const e = [[Rt], [Re]];
114
+ ]), Rt = Uint8Array.from(new Array(16).fill(0).map((n, t) => t)), $e = Rt.map((n) => (9 * n + 5) % 16), $t = /* @__PURE__ */ (() => {
115
+ const e = [[Rt], [$e]];
116
116
  for (let s = 0; s < 4; s++)
117
117
  for (let o of e)
118
- o.push(o[s].map((r) => Oe[r]));
118
+ o.push(o[s].map((r) => Re[r]));
119
119
  return e;
120
120
  })(), Ut = $t[0], Vt = $t[1], Mt = /* @__PURE__ */ [
121
121
  [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
@@ -123,13 +123,13 @@ const Oe = /* @__PURE__ */ Uint8Array.from([
123
123
  [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
124
124
  [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
125
125
  [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
126
- ].map((n) => Uint8Array.from(n)), $e = /* @__PURE__ */ Ut.map((n, t) => n.map((e) => Mt[t][e])), Ue = /* @__PURE__ */ Vt.map((n, t) => n.map((e) => Mt[t][e])), Ve = /* @__PURE__ */ Uint32Array.from([
126
+ ].map((n) => Uint8Array.from(n)), Ue = /* @__PURE__ */ Ut.map((n, t) => n.map((e) => Mt[t][e])), Ve = /* @__PURE__ */ Vt.map((n, t) => n.map((e) => Mt[t][e])), Me = /* @__PURE__ */ Uint32Array.from([
127
127
  0,
128
128
  1518500249,
129
129
  1859775393,
130
130
  2400959708,
131
131
  2840853838
132
- ]), Me = /* @__PURE__ */ Uint32Array.from([
132
+ ]), Ne = /* @__PURE__ */ Uint32Array.from([
133
133
  1352829926,
134
134
  1548603684,
135
135
  1836072691,
@@ -140,7 +140,7 @@ function _t(n, t, e, s) {
140
140
  return n === 0 ? t ^ e ^ s : n === 1 ? t & e | ~t & s : n === 2 ? (t | ~e) ^ s : n === 3 ? t & s | e & ~s : t ^ (e | ~s);
141
141
  }
142
142
  const N = /* @__PURE__ */ new Uint32Array(16);
143
- class Ne extends Yt {
143
+ class Fe extends Yt {
144
144
  constructor() {
145
145
  super(64, 20, 8, !0);
146
146
  x(this, "h0", 1732584193);
@@ -159,19 +159,19 @@ class Ne extends Yt {
159
159
  process(e, s) {
160
160
  for (let g = 0; g < 16; g++, s += 4)
161
161
  N[g] = e.getUint32(s, !0);
162
- let o = this.h0 | 0, r = o, i = this.h1 | 0, a = i, c = this.h2 | 0, h = c, l = this.h3 | 0, m = l, P = this.h4 | 0, b = P;
162
+ let o = this.h0 | 0, r = o, i = this.h1 | 0, a = i, c = this.h2 | 0, h = c, l = this.h3 | 0, m = l, b = this.h4 | 0, P = b;
163
163
  for (let g = 0; g < 5; g++) {
164
- const f = 4 - g, k = Ve[g], v = Me[g], E = Ut[g], p = Vt[g], w = $e[g], y = Ue[g];
164
+ const f = 4 - g, k = Me[g], S = Ne[g], E = Ut[g], p = Vt[g], w = Ue[g], y = Ve[g];
165
165
  for (let d = 0; d < 16; d++) {
166
- const u = V(o + _t(g, i, c, l) + N[E[d]] + k, w[d]) + P | 0;
167
- o = P, P = l, l = V(c, 10) | 0, c = i, i = u;
166
+ const u = V(o + _t(g, i, c, l) + N[E[d]] + k, w[d]) + b | 0;
167
+ o = b, b = l, l = V(c, 10) | 0, c = i, i = u;
168
168
  }
169
169
  for (let d = 0; d < 16; d++) {
170
- const u = V(r + _t(f, a, h, m) + N[p[d]] + v, y[d]) + b | 0;
171
- r = b, b = m, m = V(h, 10) | 0, h = a, a = u;
170
+ const u = V(r + _t(f, a, h, m) + N[p[d]] + S, y[d]) + P | 0;
171
+ r = P, P = m, m = V(h, 10) | 0, h = a, a = u;
172
172
  }
173
173
  }
174
- this.set(this.h1 + c + m | 0, this.h2 + l + b | 0, this.h3 + P + r | 0, this.h4 + o + a | 0, this.h0 + i + h | 0);
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 + h | 0);
175
175
  }
176
176
  roundClean() {
177
177
  W(N);
@@ -180,28 +180,28 @@ class Ne extends Yt {
180
180
  this.destroyed = !0, W(this.buffer), this.set(0, 0, 0, 0, 0);
181
181
  }
182
182
  }
183
- const Fe = /* @__PURE__ */ At(() => new Ne()), Le = BigInt(0), R = BigInt(1), We = BigInt(2), Xe = BigInt(7), Ke = BigInt(256), De = BigInt(113), Nt = [], Ft = [], Lt = [];
183
+ const Le = /* @__PURE__ */ At(() => new Fe()), We = BigInt(0), R = BigInt(1), Xe = BigInt(2), Ke = BigInt(7), De = BigInt(256), Ge = BigInt(113), Nt = [], Ft = [], Lt = [];
184
184
  for (let n = 0, t = R, e = 1, s = 0; n < 24; n++) {
185
185
  [e, s] = [s, (2 * e + 3 * s) % 5], Nt.push(2 * (5 * s + e)), Ft.push((n + 1) * (n + 2) / 2 % 64);
186
- let o = Le;
186
+ let o = We;
187
187
  for (let r = 0; r < 7; r++)
188
- t = (t << R ^ (t >> Xe) * De) % Ke, t & We && (o ^= R << (R << BigInt(r)) - R);
188
+ t = (t << R ^ (t >> Ke) * Ge) % De, t & Xe && (o ^= R << (R << BigInt(r)) - R);
189
189
  Lt.push(o);
190
190
  }
191
- const Wt = xe(Lt, !0), Ge = Wt[0], qe = Wt[1], Bt = (n, t, e) => e > 32 ? Te(n, t, e) : ke(n, t, e), St = (n, t, e) => e > 32 ? _e(n, t, e) : Ee(n, t, e);
192
- function ze(n, t = 24) {
191
+ const Wt = ke(Lt, !0), qe = Wt[0], ze = Wt[1], Bt = (n, t, e) => e > 32 ? _e(n, t, e) : Ee(n, t, e), vt = (n, t, e) => e > 32 ? Be(n, t, e) : Te(n, t, e);
192
+ function Ye(n, t = 24) {
193
193
  const e = new Uint32Array(10);
194
194
  for (let s = 24 - t; s < 24; s++) {
195
195
  for (let i = 0; i < 10; i++)
196
196
  e[i] = n[i] ^ n[i + 10] ^ n[i + 20] ^ n[i + 30] ^ n[i + 40];
197
197
  for (let i = 0; i < 10; i += 2) {
198
- const a = (i + 8) % 10, c = (i + 2) % 10, h = e[c], l = e[c + 1], m = Bt(h, l, 1) ^ e[a], P = St(h, l, 1) ^ e[a + 1];
199
- for (let b = 0; b < 50; b += 10)
200
- n[i + b] ^= m, n[i + b + 1] ^= P;
198
+ const a = (i + 8) % 10, c = (i + 2) % 10, h = e[c], l = e[c + 1], m = Bt(h, l, 1) ^ e[a], b = vt(h, l, 1) ^ e[a + 1];
199
+ for (let P = 0; P < 50; P += 10)
200
+ n[i + P] ^= m, n[i + P + 1] ^= b;
201
201
  }
202
202
  let o = n[2], r = n[3];
203
203
  for (let i = 0; i < 24; i++) {
204
- const a = Ft[i], c = Bt(o, r, a), h = St(o, r, a), l = Nt[i];
204
+ const a = Ft[i], c = Bt(o, r, a), h = vt(o, r, a), l = Nt[i];
205
205
  o = n[l], r = n[l + 1], n[l] = c, n[l + 1] = h;
206
206
  }
207
207
  for (let i = 0; i < 50; i += 10) {
@@ -210,7 +210,7 @@ function ze(n, t = 24) {
210
210
  for (let a = 0; a < 10; a++)
211
211
  n[i + a] ^= ~e[(a + 2) % 10] & e[(a + 4) % 10];
212
212
  }
213
- n[0] ^= Ge[s], n[1] ^= qe[s];
213
+ n[0] ^= qe[s], n[1] ^= ze[s];
214
214
  }
215
215
  W(e);
216
216
  }
@@ -236,7 +236,7 @@ class at {
236
236
  return this._cloneInto();
237
237
  }
238
238
  keccak() {
239
- ut(this.state32), ze(this.state32, this.rounds), ut(this.state32), this.posOut = 0, this.pos = 0;
239
+ ut(this.state32), Ye(this.state32, this.rounds), ut(this.state32), this.posOut = 0, this.pos = 0;
240
240
  }
241
241
  update(t) {
242
242
  ht(this), dt(t);
@@ -290,21 +290,21 @@ class at {
290
290
  return t || (t = new at(e, s, o, i, r)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = s, t.outputLen = o, t.enableXOF = i, t.destroyed = this.destroyed, t;
291
291
  }
292
292
  }
293
- const Ye = (n, t, e, s = {}) => At(() => new at(t, n, e), s), je = /* @__PURE__ */ Ye(1, 136, 32), vt = 64, _ = 20, ot = 4, Xt = 2, Ze = 0, Qe = 1, F = [64, 64], Je = (n) => Array.from(n).map((t) => t.toString(16).padStart(2, "0")).join("");
293
+ const je = (n, t, e, s = {}) => At(() => new at(t, n, e), s), Ze = /* @__PURE__ */ je(1, 136, 32), St = 64, _ = 20, ot = 4, Xt = 2, Qe = 0, Je = 1, F = [64, 64], tn = (n) => Array.from(n).map((t) => t.toString(16).padStart(2, "0")).join("");
294
294
  function ct(n) {
295
- return Fe(it(n));
295
+ return Le(it(n));
296
296
  }
297
297
  function Kt(n) {
298
298
  return (1 << n) - 1;
299
299
  }
300
- function tn(n) {
300
+ function en(n) {
301
301
  let t = 1;
302
302
  for (; t * t < n + 1; ) t++;
303
303
  return Math.max(t, 2);
304
304
  }
305
- function en(n) {
305
+ function nn(n) {
306
306
  const t = ot, e = n * Kt(t);
307
- return { d: t, n, checksum_radix: tn(e) };
307
+ return { d: t, n, checksum_radix: en(e) };
308
308
  }
309
309
  function Y(n, t) {
310
310
  const e = [];
@@ -323,21 +323,21 @@ function j(n, t) {
323
323
  e = ct(e);
324
324
  return e;
325
325
  }
326
- function nn(n, t) {
326
+ function sn(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 = Y(n, l + Xt), P = j(m, e);
330
- r.push(Array.from(P));
329
+ const m = Y(n, l + Xt), b = j(m, e);
330
+ r.push(Array.from(b));
331
331
  }
332
332
  const i = Y(
333
333
  n,
334
- Ze
334
+ Qe
335
335
  ), a = j(
336
336
  i,
337
337
  s
338
338
  ), c = Y(
339
339
  n,
340
- Qe
340
+ Je
341
341
  ), h = j(
342
342
  c,
343
343
  o
@@ -349,19 +349,19 @@ function nn(n, t) {
349
349
  checksum_minor_terminal: Array.from(a)
350
350
  };
351
351
  }
352
- async function sn(n) {
352
+ async function on(n) {
353
353
  try {
354
- if (n.length !== vt)
354
+ if (n.length !== St)
355
355
  throw new Error(
356
- `WOTS seed must be exactly ${vt} bytes, got ${n.length}`
356
+ `WOTS seed must be exactly ${St} bytes, got ${n.length}`
357
357
  );
358
358
  const t = [];
359
359
  for (let e = 0; e < F.length; e++) {
360
- const s = F[e], o = en(s), r = new Uint8Array(n.length + 1);
360
+ const s = F[e], o = nn(s), r = new Uint8Array(n.length + 1);
361
361
  r.set(n), r[n.length] = e;
362
362
  const i = ct(r);
363
363
  try {
364
- const a = nn(i, o);
364
+ const a = sn(i, o);
365
365
  if (a.config.d !== ot)
366
366
  throw new Error(
367
367
  `Block ${e}: expected d=${ot}, got d=${a.config.d}`
@@ -414,7 +414,7 @@ function Z(n, t, e) {
414
414
  );
415
415
  }
416
416
  }
417
- function on(n) {
417
+ function rn(n) {
418
418
  if (n.length === 0)
419
419
  throw new Error("Public keys array must not be empty");
420
420
  for (let r = 0; r < n.length; r++) {
@@ -433,24 +433,24 @@ function on(n) {
433
433
  for (const i of r.message_terminals)
434
434
  e.set(i, s), s += _;
435
435
  }
436
- const o = je(e);
437
- return `0x${Je(o)}`;
436
+ const o = Ze(e);
437
+ return `0x${tn(o)}`;
438
438
  }
439
- async function rn(n, t) {
439
+ async function an(n, t) {
440
440
  const e = [], s = [], o = [], r = [];
441
441
  try {
442
442
  for (let i = 0; i < t; i++) {
443
443
  const a = await te(n, i);
444
444
  try {
445
- const h = await sn(a);
446
- e.push(h), s.push(on(h));
445
+ const h = await on(a);
446
+ e.push(h), s.push(rn(h));
447
447
  } finally {
448
448
  a.fill(0);
449
449
  }
450
450
  const c = await ee(n, i);
451
451
  try {
452
452
  const h = X(c);
453
- o.push(h), r.push(he(S(h)).slice(2));
453
+ o.push(h), r.push(he(v(h)).slice(2));
454
454
  } finally {
455
455
  c.fill(0);
456
456
  }
@@ -460,48 +460,32 @@ async function rn(n, t) {
460
460
  }
461
461
  return { perVaultWotsKeys: e, wotsPkHashes: s, htlcSecretHexes: o, hashlocks: r };
462
462
  }
463
- const an = /^0x[0-9a-f]+$/i, cn = /^[0-9a-f]+$/i, ln = /^[A-Za-z0-9+/]+={0,2}$/;
463
+ const cn = /^0x[0-9a-f]+$/i, ln = /^[0-9a-f]+$/i, un = /^[A-Za-z0-9+/]+={0,2}$/;
464
464
  function $(n) {
465
465
  if (typeof n != "string" || n.length === 0)
466
466
  throw new Error("BTC wallet returned empty public key");
467
467
  return ce(n).toLowerCase();
468
468
  }
469
- function un(n) {
469
+ function hn(n) {
470
470
  if (typeof n != "string" || n.length === 0)
471
471
  throw new Error("BTC wallet returned empty BIP-322 signature");
472
472
  if (n.startsWith("0x") || n.startsWith("0X")) {
473
- if (!an.test(n) || n.length < 4 || n.length % 2 !== 0)
473
+ if (!cn.test(n) || n.length < 4 || n.length % 2 !== 0)
474
474
  throw new Error("BTC wallet returned malformed hex BIP-322 signature");
475
475
  return n.toLowerCase();
476
476
  }
477
- if (cn.test(n)) {
477
+ if (ln.test(n)) {
478
478
  if (n.length % 2 !== 0)
479
479
  throw new Error("BTC wallet returned malformed hex BIP-322 signature");
480
480
  return `0x${n.toLowerCase()}`;
481
481
  }
482
- if (!ln.test(n) || n.length % 4 !== 0)
482
+ if (!un.test(n) || n.length % 4 !== 0)
483
483
  throw new Error("BTC wallet returned malformed base64 BIP-322 signature");
484
484
  const t = J.from(n, "base64");
485
485
  if (t.length === 0 || t.toString("base64") !== n)
486
486
  throw new Error("BTC wallet returned malformed base64 BIP-322 signature");
487
487
  return `0x${t.toString("hex")}`;
488
488
  }
489
- async function hn(n, t, e) {
490
- if (typeof n.signPsbts == "function") {
491
- const o = await n.signPsbts(t, e);
492
- if (o.length !== t.length)
493
- throw new Error(
494
- `Expected ${t.length} signed PSBTs but received ${o.length}`
495
- );
496
- return o;
497
- }
498
- const s = [];
499
- for (let o = 0; o < t.length; o++) {
500
- const r = await n.signPsbt(t[o], e[o]);
501
- s.push(r);
502
- }
503
- return s;
504
- }
505
489
  const Dt = 0, L = 25, rt = 9999, Q = "00".repeat(32);
506
490
  function dn(n, t) {
507
491
  const e = {
@@ -524,7 +508,7 @@ function gn(n, t, e, s) {
524
508
  vout: t,
525
509
  value: o.value,
526
510
  scriptPubKey: o.scriptPubKey
527
- }) : we(n, t, s);
511
+ }) : ye(n, t, s);
528
512
  }
529
513
  const It = 12e4;
530
514
  class Vn {
@@ -540,8 +524,9 @@ class Vn {
540
524
  /**
541
525
  * Prepare a peg-in: sizing pass → vault-root derivation (one wallet
542
526
  * popup) → per-vault WOTS / hashlock derivation → commit pass with
543
- * batch PSBT signing (one popup). Returns broadcast-ready txs, the
544
- * pubkey snapshot, and the sensitive derived material.
527
+ * PSBT signing (signPsbt for a single vault, one batch popup for a
528
+ * split). Returns broadcast-ready txs, the pubkey snapshot, and the
529
+ * sensitive derived material.
545
530
  *
546
531
  * @throws If the wallet rejects, insufficient funds, or an internal
547
532
  * invariant violation.
@@ -550,7 +535,7 @@ class Vn {
550
535
  if (t.amounts.length === 0)
551
536
  throw new Error("amounts must contain at least one entry");
552
537
  const e = await this.config.btcWallet.getPublicKeyHex(), s = $(e);
553
- if (!bt(
538
+ if (!Pt(
554
539
  t.changeAddress,
555
540
  e,
556
541
  this.config.btcNetwork
@@ -563,7 +548,7 @@ class Vn {
563
548
  txid: et(f.txid),
564
549
  vout: f.vout
565
550
  })
566
- ), i = await He(this.config.btcWallet, {
551
+ ), i = await Oe(this.config.btcWallet, {
567
552
  depositorBtcPubkey: et(s),
568
553
  fundingOutpoints: r
569
554
  });
@@ -578,10 +563,10 @@ class Vn {
578
563
  } catch (f) {
579
564
  throw i.fill(0), f;
580
565
  }
581
- const h = await rn(i, t.amounts.length), { perVaultWotsKeys: l, wotsPkHashes: m, htlcSecretHexes: P, hashlocks: b } = h, g = await this.preparePeginCommit({
566
+ const h = await an(i, t.amounts.length), { perVaultWotsKeys: l, wotsPkHashes: m, htlcSecretHexes: b, hashlocks: P } = h, g = await this.preparePeginCommit({
582
567
  depositorBtcPubkeyRaw: e,
583
568
  depositorBtcPubkey: s,
584
- hashlocks: b,
569
+ hashlocks: P,
585
570
  authAnchorHash: c,
586
571
  sizing: o,
587
572
  params: t
@@ -606,7 +591,7 @@ class Vn {
606
591
  derivedSecrets: {
607
592
  perVaultWotsKeys: l,
608
593
  wotsPkHashes: m,
609
- htlcSecretHexes: P,
594
+ htlcSecretHexes: b,
610
595
  authAnchorHex: a
611
596
  }
612
597
  };
@@ -631,6 +616,7 @@ class Vn {
631
616
  const s = e.amounts.map(
632
617
  () => Q
633
618
  ), o = e.vaultKeeperBtcPubkeys.length, r = await mt({
619
+ vaultCoreVersion: e.vaultCoreVersion,
634
620
  depositorPubkey: t,
635
621
  vaultProviderPubkey: T(e.vaultProviderBtcPubkey),
636
622
  vaultKeeperPubkeys: e.vaultKeeperBtcPubkeys.map(T),
@@ -645,11 +631,11 @@ class Vn {
645
631
  councilSize: e.councilSize,
646
632
  network: this.config.btcNetwork,
647
633
  authAnchorHash: Q
648
- }), i = ge(
634
+ }), i = fe(
649
635
  [...e.availableUTXOs],
650
636
  r.totalOutputValue,
651
637
  e.mempoolFeeRate,
652
- pe(r.htlcValues.length, !0)
638
+ me(r.htlcValues.length, !0)
653
639
  );
654
640
  return {
655
641
  selectedUTXOs: i.selectedUTXOs,
@@ -678,7 +664,8 @@ class Vn {
678
664
  );
679
665
  const h = T(
680
666
  a.vaultProviderBtcPubkey
681
- ), l = a.vaultKeeperBtcPubkeys.map(T), m = a.universalChallengerBtcPubkeys.map(T), P = l.length, b = {
667
+ ), l = a.vaultKeeperBtcPubkeys.map(T), m = a.universalChallengerBtcPubkeys.map(T), b = l.length, P = {
668
+ vaultCoreVersion: a.vaultCoreVersion,
682
669
  depositorPubkey: s,
683
670
  vaultProviderPubkey: h,
684
671
  vaultKeeperPubkeys: l,
@@ -688,27 +675,28 @@ class Vn {
688
675
  pegInAmounts: a.amounts,
689
676
  feeRate: a.protocolFeeRate,
690
677
  minPeginFeeRate: a.minPeginFeeRate,
691
- numLocalChallengers: P,
678
+ numLocalChallengers: b,
692
679
  councilQuorum: a.councilQuorum,
693
680
  councilSize: a.councilSize,
694
681
  network: this.config.btcNetwork,
695
682
  authAnchorHash: r
696
- }, g = await mt(b), f = wt(this.config.btcNetwork), k = me({
683
+ }, g = await mt(P), f = wt(this.config.btcNetwork), k = be({
697
684
  unfundedTxHex: g.psbtHex,
698
685
  selectedUTXOs: i.selectedUTXOs,
699
686
  changeAddress: a.changeAddress,
700
687
  changeAmount: i.changeAmount,
701
688
  network: f
702
- }), v = T(
689
+ }), S = T(
703
690
  q(k)
704
691
  ), E = [], p = [], w = [];
705
692
  for (let u = 0; u < o.length; u++) {
706
693
  const B = await se({
707
- prePeginParams: b,
694
+ prePeginParams: P,
708
695
  timelockPegin: a.timelockPegin,
709
696
  fundedPrePeginTxHex: k,
710
697
  htlcVout: u
711
698
  }), I = await re({
699
+ vaultCoreVersion: a.vaultCoreVersion,
712
700
  peginTxHex: B.txHex,
713
701
  fundedPrePeginTxHex: k,
714
702
  depositorPubkey: s,
@@ -723,13 +711,13 @@ class Vn {
723
711
  ue(e, 1)
724
712
  );
725
713
  }
726
- const y = await hn(
714
+ const y = await ge(
727
715
  this.config.btcWallet,
728
716
  p,
729
717
  w
730
718
  ), d = [];
731
719
  for (let u = 0; u < y.length; u++) {
732
- Pt({
720
+ bt({
733
721
  requestedPsbtHex: p[u],
734
722
  returnedPsbtHex: y[u]
735
723
  });
@@ -755,7 +743,7 @@ class Vn {
755
743
  }
756
744
  return {
757
745
  fundedPrePeginTxHex: k,
758
- prePeginTxid: v,
746
+ prePeginTxid: S,
759
747
  perVault: d
760
748
  };
761
749
  }
@@ -791,21 +779,21 @@ class Vn {
791
779
  }), l = await Promise.all(h), m = l.reduce(
792
780
  (p, w) => p + BigInt(w.utxoData.value),
793
781
  0n
794
- ), P = r.outs.reduce(
782
+ ), b = r.outs.reduce(
795
783
  (p, w) => p + BigInt(w.value),
796
784
  0n
797
785
  );
798
- if (m < P)
786
+ if (m < b)
799
787
  throw new Error(
800
- `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.`
788
+ `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.`
801
789
  );
802
- const b = m - P;
803
- if (b > yt)
790
+ const P = m - b;
791
+ if (P > yt)
804
792
  throw new Error(
805
- `Implied transaction fee (${b} sat) exceeds maximum reasonable fee (${yt} sat). This may indicate manipulated UTXO data.`
793
+ `Implied transaction fee (${P} sat) exceeds maximum reasonable fee (${yt} sat). This may indicate manipulated UTXO data.`
806
794
  );
807
795
  for (const { input: p, utxoData: w, txid: y, vout: d } of l) {
808
- const u = fe(
796
+ const u = pe(
809
797
  {
810
798
  value: w.value,
811
799
  scriptPubKey: w.scriptPubKey
@@ -825,7 +813,7 @@ class Vn {
825
813
  value: p.value
826
814
  });
827
815
  const g = i.toHex(), f = await this.config.btcWallet.signPsbt(g);
828
- Pt({
816
+ bt({
829
817
  requestedPsbtHex: g,
830
818
  returnedPsbtHex: f
831
819
  });
@@ -840,8 +828,8 @@ class Vn {
840
828
  `PSBT finalization failed and wallet did not auto-finalize: ${p}`
841
829
  );
842
830
  }
843
- const v = k.extractTransaction().toHex();
844
- return await Pe(v, c);
831
+ const S = k.extractTransaction().toHex();
832
+ return await Pe(S, c);
845
833
  }
846
834
  /**
847
835
  * Registers a peg-in on Ethereum by calling the BTCVaultRegistry contract.
@@ -885,15 +873,15 @@ class Vn {
885
873
  throw new Error(
886
874
  `Proof of possession was signed for ${h.depositorEthAddress} but the Ethereum wallet is currently connected to ${l}. Reconnect the original account or call signProofOfPossession() again.`
887
875
  );
888
- const m = await this.assertPopMatchesBtcWallet(h), P = h.btcPopSignature, b = S(
876
+ const m = await this.assertPopMatchesBtcWallet(h), b = h.btcPopSignature, P = v(
889
877
  h.depositorBtcPubkey
890
- ), g = S(e), f = S(s), k = a ?? await this.config.btcWallet.getAddress(), v = this.resolvePayoutScriptPubKey(
878
+ ), g = v(e), f = v(s), k = a ?? await this.config.btcWallet.getAddress(), S = this.resolvePayoutScriptPubKey(
891
879
  m,
892
880
  k
893
881
  ), E = q(f), p = await pt(
894
882
  T(E),
895
883
  T(l)
896
- ), w = S(p);
884
+ ), w = v(p);
897
885
  if (await this.checkVaultExists(w))
898
886
  throw new Error(
899
887
  `Vault already exists (ID: ${w}, peginTxHash: ${E}). 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.`
@@ -921,15 +909,15 @@ class Vn {
921
909
  functionName: "submitPeginRequest",
922
910
  args: [
923
911
  l,
924
- b,
925
912
  P,
913
+ b,
926
914
  g,
927
915
  f,
928
916
  o,
929
917
  B,
930
918
  r,
931
919
  i,
932
- v,
920
+ S,
933
921
  c
934
922
  ]
935
923
  });
@@ -1001,12 +989,12 @@ class Vn {
1001
989
  )
1002
990
  ), l = [];
1003
991
  for (const d of o) {
1004
- const u = S(
992
+ const u = v(
1005
993
  d.depositorSignedPeginTx
1006
994
  ), B = q(u), I = await pt(
1007
995
  T(B),
1008
996
  T(i)
1009
- ), C = S(I);
997
+ ), C = v(I);
1010
998
  if (await this.checkVaultExists(C))
1011
999
  throw new Error(
1012
1000
  `Vault already exists (ID: ${C}, peginTxHash: ${B}). To create a new vault, use different UTXOs or a different amount.`
@@ -1014,9 +1002,9 @@ class Vn {
1014
1002
  l.push({ vaultId: C, peginTxHash: B });
1015
1003
  }
1016
1004
  const m = this.config.publicClient;
1017
- let P;
1005
+ let b;
1018
1006
  try {
1019
- P = await m.readContract({
1007
+ b = await m.readContract({
1020
1008
  address: this.config.vaultContracts.btcVaultRegistry,
1021
1009
  abi: A,
1022
1010
  functionName: "getPegInFee",
@@ -1028,16 +1016,16 @@ class Vn {
1028
1016
  { cause: d }
1029
1017
  );
1030
1018
  }
1031
- const b = P * BigInt(o.length), g = await this.resolveMaxAcceptableCommissionBps(
1019
+ const P = b * BigInt(o.length), g = await this.resolveMaxAcceptableCommissionBps(
1032
1020
  e,
1033
1021
  t.quotedCommissionBps
1034
- ), f = S(
1022
+ ), f = v(
1035
1023
  r.depositorBtcPubkey
1036
- ), k = S(s), v = o.map((d, u) => ({
1024
+ ), k = v(s), S = o.map((d, u) => ({
1037
1025
  depositorBtcPubKey: f,
1038
1026
  btcPopSignature: c,
1039
1027
  unsignedPrePeginTx: k,
1040
- depositorSignedPeginTx: S(
1028
+ depositorSignedPeginTx: v(
1041
1029
  d.depositorSignedPeginTx
1042
1030
  ),
1043
1031
  hashlock: d.hashlock,
@@ -1052,7 +1040,7 @@ class Vn {
1052
1040
  i,
1053
1041
  e,
1054
1042
  g,
1055
- v
1043
+ S
1056
1044
  ]
1057
1045
  });
1058
1046
  let p;
@@ -1060,7 +1048,7 @@ class Vn {
1060
1048
  p = await m.estimateGas({
1061
1049
  to: this.config.vaultContracts.btcVaultRegistry,
1062
1050
  data: E,
1063
- value: b,
1051
+ value: P,
1064
1052
  account: this.config.ethWallet.account.address
1065
1053
  });
1066
1054
  } catch (d) {
@@ -1071,7 +1059,7 @@ class Vn {
1071
1059
  w = await this.config.ethWallet.sendTransaction({
1072
1060
  to: this.config.vaultContracts.btcVaultRegistry,
1073
1061
  data: E,
1074
- value: b,
1062
+ value: P,
1075
1063
  account: this.config.ethWallet.account,
1076
1064
  chain: this.config.ethChain,
1077
1065
  gas: p
@@ -1099,7 +1087,7 @@ class Vn {
1099
1087
  async resolveMaxAcceptableCommissionBps(t, e) {
1100
1088
  let s;
1101
1089
  try {
1102
- s = await new be(
1090
+ s = await new we(
1103
1091
  this.config.publicClient,
1104
1092
  this.config.vaultContracts.btcVaultRegistry
1105
1093
  ).getVaultProviderCommission(t);
@@ -1162,7 +1150,7 @@ class Vn {
1162
1150
  * on-chain payout-script registration.
1163
1151
  */
1164
1152
  resolvePayoutScriptPubKey(t, e) {
1165
- if (!bt(
1153
+ if (!Pt(
1166
1154
  e,
1167
1155
  t,
1168
1156
  this.config.btcNetwork
@@ -1197,7 +1185,7 @@ class Vn {
1197
1185
  "bip322-simple"
1198
1186
  );
1199
1187
  return {
1200
- btcPopSignature: un(r),
1188
+ btcPopSignature: hn(r),
1201
1189
  depositorEthAddress: t,
1202
1190
  depositorBtcPubkey: e
1203
1191
  };
@@ -1235,8 +1223,8 @@ class Vn {
1235
1223
  return this.config.vaultContracts.btcVaultRegistry;
1236
1224
  }
1237
1225
  }
1238
- const fn = 80, pn = 250, mn = 300, Pn = 22, Gt = "ab";
1239
- function bn(n, t) {
1226
+ const fn = 80, pn = 250, mn = 300, bn = 22, Gt = "ab";
1227
+ function Pn(n, t) {
1240
1228
  const e = Gt.repeat(mn), s = T(n).toLowerCase(), o = t.toString(16).padStart(8, "0"), r = `${s}${o}`, i = e.slice(r.length);
1241
1229
  return `0x${r}${i}`;
1242
1230
  }
@@ -1246,14 +1234,14 @@ function wn(n, t) {
1246
1234
  depositorBtcPubKey: e(32),
1247
1235
  btcPopSignature: e(fn),
1248
1236
  unsignedPrePeginTx: e(pn),
1249
- depositorSignedPeginTx: bn(
1237
+ depositorSignedPeginTx: Pn(
1250
1238
  n,
1251
1239
  t
1252
1240
  ),
1253
1241
  hashlock: e(32),
1254
1242
  htlcVout: t,
1255
1243
  referralCode: Dt,
1256
- depositorPayoutBtcAddress: e(Pn),
1244
+ depositorPayoutBtcAddress: e(bn),
1257
1245
  depositorWotsPkHash: e(32)
1258
1246
  };
1259
1247
  }
@@ -1296,12 +1284,12 @@ async function Mn(n) {
1296
1284
  }
1297
1285
  export {
1298
1286
  Vn as P,
1299
- Ae as V,
1300
- Ie as a,
1301
- ve as b,
1302
- on as c,
1303
- sn as d,
1287
+ Ce as V,
1288
+ Ae as a,
1289
+ Ie as b,
1290
+ rn as c,
1291
+ on as d,
1304
1292
  Mn as e,
1305
- He as f
1293
+ Oe as f
1306
1294
  };
1307
- //# sourceMappingURL=PeginManager-BGWNJYPk.js.map
1295
+ //# sourceMappingURL=PeginManager-D22MLWfM.js.map