@babylonlabs-io/ts-sdk 0.70.0 → 0.71.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 (202) hide show
  1. package/dist/PeginManager-BIKAnZ-X.cjs +2 -0
  2. package/dist/PeginManager-BIKAnZ-X.cjs.map +1 -0
  3. package/dist/{PeginManager-erlaJqpN.js → PeginManager-Byvmccdd.js} +10 -10
  4. package/dist/PeginManager-Byvmccdd.js.map +1 -0
  5. package/dist/abortSignals-BPpAUL1Z.js +18 -0
  6. package/dist/abortSignals-BPpAUL1Z.js.map +1 -0
  7. package/dist/abortSignals-msbmbqFe.cjs +2 -0
  8. package/dist/abortSignals-msbmbqFe.cjs.map +1 -0
  9. package/dist/{bitcoin-Ch_jxnDa.js → bitcoin-C-TuHb-v.js} +21 -22
  10. package/dist/bitcoin-C-TuHb-v.js.map +1 -0
  11. package/dist/bitcoin-D-O2GjbC.cjs +2 -0
  12. package/dist/bitcoin-D-O2GjbC.cjs.map +1 -0
  13. package/dist/{buildAndBroadcastReclaim-CBPDgfj7.js → buildAndBroadcastReclaim-C0TdwO2M.js} +62 -61
  14. package/dist/buildAndBroadcastReclaim-C0TdwO2M.js.map +1 -0
  15. package/dist/buildAndBroadcastReclaim-kRx7-o2y.cjs +2 -0
  16. package/dist/buildAndBroadcastReclaim-kRx7-o2y.cjs.map +1 -0
  17. package/dist/{challengeAssert-BNQ8sToz.js → challengeAssert-Cp_GeRg8.js} +3 -3
  18. package/dist/challengeAssert-Cp_GeRg8.js.map +1 -0
  19. package/dist/challengeAssert-Z7_YULBb.cjs +2 -0
  20. package/dist/challengeAssert-Z7_YULBb.cjs.map +1 -0
  21. package/dist/constants-Bh38W9mq.cjs +2 -0
  22. package/dist/constants-Bh38W9mq.cjs.map +1 -0
  23. package/dist/constants-CPzppOdq.js +17 -0
  24. package/dist/constants-CPzppOdq.js.map +1 -0
  25. package/dist/index-Cs7_Evtk.cjs +2 -0
  26. package/dist/index-Cs7_Evtk.cjs.map +1 -0
  27. package/dist/index-LgmJhdEN.js +505 -0
  28. package/dist/index-LgmJhdEN.js.map +1 -0
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.js +230 -226
  31. package/dist/index.js.map +1 -1
  32. package/dist/mempoolApi-BQllf-ji.cjs +2 -0
  33. package/dist/{mempoolApi-BJN9fGEd.cjs.map → mempoolApi-BQllf-ji.cjs.map} +1 -1
  34. package/dist/{mempoolApi-71R_CNZa.js → mempoolApi-CRNMOsbC.js} +36 -35
  35. package/dist/{mempoolApi-71R_CNZa.js.map → mempoolApi-CRNMOsbC.js.map} +1 -1
  36. package/dist/noPayout--lxo7qe4.js +300 -0
  37. package/dist/noPayout--lxo7qe4.js.map +1 -0
  38. package/dist/noPayout-CegnEwfp.cjs +2 -0
  39. package/dist/noPayout-CegnEwfp.cjs.map +1 -0
  40. package/dist/{onChainBtcPubkey-C_a2L3kL.cjs → onChainBtcPubkey-B5ZvWCCF.cjs} +2 -2
  41. package/dist/{onChainBtcPubkey-C_a2L3kL.cjs.map → onChainBtcPubkey-B5ZvWCCF.cjs.map} +1 -1
  42. package/dist/{onChainBtcPubkey-BAHZyKQL.js → onChainBtcPubkey-DATNfAAl.js} +2 -2
  43. package/dist/{onChainBtcPubkey-BAHZyKQL.js.map → onChainBtcPubkey-DATNfAAl.js.map} +1 -1
  44. package/dist/parseFundingOutpoints-BkgGihaY.cjs +2 -0
  45. package/dist/parseFundingOutpoints-BkgGihaY.cjs.map +1 -0
  46. package/dist/{parseFundingOutpoints-CO-f6IHK.js → parseFundingOutpoints-DlINgQ3X.js} +30 -29
  47. package/dist/parseFundingOutpoints-DlINgQ3X.js.map +1 -0
  48. package/dist/{batchPoll-Bc_UKaTz.js → primeVpAuth-D1qbOkhb.js} +311 -803
  49. package/dist/primeVpAuth-D1qbOkhb.js.map +1 -0
  50. package/dist/primeVpAuth-tEXx9TGx.cjs +2 -0
  51. package/dist/primeVpAuth-tEXx9TGx.cjs.map +1 -0
  52. package/dist/{reservation-CBAvoF3U.js → reservation-Cj9F0rP9.js} +2 -2
  53. package/dist/{reservation-CBAvoF3U.js.map → reservation-Cj9F0rP9.js.map} +1 -1
  54. package/dist/{reservation-CDbInVw0.cjs → reservation-Dr2HLCxx.cjs} +2 -2
  55. package/dist/{reservation-CDbInVw0.cjs.map → reservation-Dr2HLCxx.cjs.map} +1 -1
  56. package/dist/{signPsbtsWithFallback-DVyK-9A-.js → signPsbtsWithFallback-BjXdnI0X.js} +56 -48
  57. package/dist/signPsbtsWithFallback-BjXdnI0X.js.map +1 -0
  58. package/dist/signPsbtsWithFallback-zOQWokmk.cjs +2 -0
  59. package/dist/signPsbtsWithFallback-zOQWokmk.cjs.map +1 -0
  60. package/dist/tbv/core/clients/index.cjs +1 -1
  61. package/dist/tbv/core/clients/index.js +36 -35
  62. package/dist/tbv/core/clients/index.js.map +1 -1
  63. package/dist/tbv/core/clients/vault-provider/auth/serverIdentity.d.ts.map +1 -1
  64. package/dist/tbv/core/clients/vault-provider/auth/verifyDepositorCwt.d.ts.map +1 -1
  65. package/dist/tbv/core/clients/vault-provider/status/index.cjs +2 -0
  66. package/dist/tbv/core/clients/vault-provider/status/index.cjs.map +1 -0
  67. package/dist/tbv/core/clients/vault-provider/status/index.d.ts +18 -0
  68. package/dist/tbv/core/clients/vault-provider/status/index.d.ts.map +1 -0
  69. package/dist/tbv/core/clients/vault-provider/status/index.js +17 -0
  70. package/dist/tbv/core/clients/vault-provider/status/index.js.map +1 -0
  71. package/dist/tbv/core/clients/vault-provider/validators.d.ts.map +1 -1
  72. package/dist/tbv/core/deposit-terms/rebuildDepositTermsCore.d.ts +1 -1
  73. package/dist/tbv/core/deposit-terms/rebuildDepositTermsCore.d.ts.map +1 -1
  74. package/dist/tbv/core/index.cjs +1 -1
  75. package/dist/tbv/core/index.js +224 -220
  76. package/dist/tbv/core/index.js.map +1 -1
  77. package/dist/tbv/core/managers/PayoutManager.d.ts.map +1 -1
  78. package/dist/tbv/core/managers/index.cjs +1 -1
  79. package/dist/tbv/core/managers/index.js +2 -2
  80. package/dist/tbv/core/primitives/index.cjs +1 -1
  81. package/dist/tbv/core/primitives/index.d.ts +2 -2
  82. package/dist/tbv/core/primitives/index.d.ts.map +1 -1
  83. package/dist/tbv/core/primitives/index.js +7 -7
  84. package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts +1 -1
  85. package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts.map +1 -1
  86. package/dist/tbv/core/primitives/psbt/challengeAssert.d.ts +1 -1
  87. package/dist/tbv/core/primitives/psbt/challengeAssert.d.ts.map +1 -1
  88. package/dist/tbv/core/primitives/psbt/constants.d.ts +7 -0
  89. package/dist/tbv/core/primitives/psbt/constants.d.ts.map +1 -1
  90. package/dist/tbv/core/primitives/psbt/noPayout.d.ts +1 -1
  91. package/dist/tbv/core/primitives/psbt/noPayout.d.ts.map +1 -1
  92. package/dist/tbv/core/primitives/psbt/payout.d.ts +1 -1
  93. package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
  94. package/dist/tbv/core/primitives/psbt/pegin.d.ts +1 -1
  95. package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
  96. package/dist/tbv/core/primitives/psbt/peginInput.d.ts +1 -1
  97. package/dist/tbv/core/primitives/psbt/peginInput.d.ts.map +1 -1
  98. package/dist/tbv/core/primitives/psbt/refund.d.ts.map +1 -1
  99. package/dist/tbv/core/primitives/scripts/payout.d.ts +1 -1
  100. package/dist/tbv/core/primitives/scripts/payout.d.ts.map +1 -1
  101. package/dist/tbv/core/primitives/utils/bitcoin.d.ts +0 -10
  102. package/dist/tbv/core/primitives/utils/bitcoin.d.ts.map +1 -1
  103. package/dist/tbv/core/recovery/reconstructPeginParams.d.ts.map +1 -1
  104. package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts.map +1 -1
  105. package/dist/tbv/core/services/index.cjs +1 -1
  106. package/dist/tbv/core/services/index.js +2 -2
  107. package/dist/tbv/core/utils/index.cjs +1 -1
  108. package/dist/tbv/core/utils/index.js +47 -44
  109. package/dist/tbv/core/utils/index.js.map +1 -1
  110. package/dist/tbv/core/utils/utxo/reservation.d.ts.map +1 -1
  111. package/dist/tbv/core/utils/validation.d.ts +4 -0
  112. package/dist/tbv/core/utils/validation.d.ts.map +1 -1
  113. package/dist/tbv/core/vault-secrets/deriveVaultRoot.d.ts.map +1 -1
  114. package/dist/tbv/core/vault-secrets/index.cjs +1 -1
  115. package/dist/tbv/core/vault-secrets/index.d.ts +1 -1
  116. package/dist/tbv/core/vault-secrets/index.d.ts.map +1 -1
  117. package/dist/tbv/core/vault-secrets/index.js +2 -2
  118. package/dist/tbv/core/wasm/__tests__/constants.test.d.ts +2 -0
  119. package/dist/tbv/core/wasm/__tests__/constants.test.d.ts.map +1 -0
  120. package/dist/tbv/core/wasm/__tests__/loader.test.d.ts +2 -0
  121. package/dist/tbv/core/wasm/__tests__/loader.test.d.ts.map +1 -0
  122. package/dist/tbv/core/wasm/__tests__/value-guards.test.d.ts +2 -0
  123. package/dist/tbv/core/wasm/__tests__/value-guards.test.d.ts.map +1 -0
  124. package/dist/tbv/core/wasm/constants.d.ts +11 -0
  125. package/dist/tbv/core/wasm/constants.d.ts.map +1 -0
  126. package/dist/tbv/core/wasm/index.cjs +2 -0
  127. package/dist/tbv/core/wasm/index.cjs.map +1 -0
  128. package/dist/tbv/core/wasm/index.d.ts +191 -0
  129. package/dist/tbv/core/wasm/index.d.ts.map +1 -0
  130. package/dist/tbv/core/wasm/index.js +144 -0
  131. package/dist/tbv/core/wasm/index.js.map +1 -0
  132. package/dist/tbv/core/wasm/value-guards.d.ts +30 -0
  133. package/dist/tbv/core/wasm/value-guards.d.ts.map +1 -0
  134. package/dist/tbv/index.cjs +1 -1
  135. package/dist/tbv/index.js +224 -220
  136. package/dist/tbv/index.js.map +1 -1
  137. package/dist/testing/index.cjs +1 -1
  138. package/dist/testing/index.js +1 -1
  139. package/dist/toRefundInputs-Bdtz8p27.cjs +2 -0
  140. package/dist/toRefundInputs-Bdtz8p27.cjs.map +1 -0
  141. package/dist/{toRefundInputs-ZkvoR5Df.js → toRefundInputs-CgXMcHrk.js} +7 -7
  142. package/dist/toRefundInputs-CgXMcHrk.js.map +1 -0
  143. package/dist/validation-C6XTfZak.cjs +2 -0
  144. package/dist/validation-C6XTfZak.cjs.map +1 -0
  145. package/dist/validation-OSC0xTHB.js +17 -0
  146. package/dist/validation-OSC0xTHB.js.map +1 -0
  147. package/dist/vaultCoreVersion-DYfw3qed.cjs +2 -0
  148. package/dist/vaultCoreVersion-DYfw3qed.cjs.map +1 -0
  149. package/dist/vaultCoreVersion-D_fP9P3C.js +10 -0
  150. package/dist/vaultCoreVersion-D_fP9P3C.js.map +1 -0
  151. package/dist/verifyKeyPathSchnorrSignature-BedSbH2D.cjs +2 -0
  152. package/dist/verifyKeyPathSchnorrSignature-BedSbH2D.cjs.map +1 -0
  153. package/dist/{verifyKeyPathSchnorrSignature-C6Cmk0R1.js → verifyKeyPathSchnorrSignature-BrgUJmV0.js} +3 -3
  154. package/dist/verifyKeyPathSchnorrSignature-BrgUJmV0.js.map +1 -0
  155. package/dist/{verifyScriptPathSchnorrSignature-B7MhJmhy.js → verifyScriptPathSchnorrSignature-ZAZfFJ6S.js} +35 -34
  156. package/dist/verifyScriptPathSchnorrSignature-ZAZfFJ6S.js.map +1 -0
  157. package/dist/verifyScriptPathSchnorrSignature-mzYCzaSy.cjs +2 -0
  158. package/dist/verifyScriptPathSchnorrSignature-mzYCzaSy.cjs.map +1 -0
  159. package/package.json +12 -2
  160. package/dist/PeginManager-BpouMHkS.cjs +0 -2
  161. package/dist/PeginManager-BpouMHkS.cjs.map +0 -1
  162. package/dist/PeginManager-erlaJqpN.js.map +0 -1
  163. package/dist/batchPoll-Bc_UKaTz.js.map +0 -1
  164. package/dist/batchPoll-C9cZ5usJ.cjs +0 -2
  165. package/dist/batchPoll-C9cZ5usJ.cjs.map +0 -1
  166. package/dist/bitcoin-Ch_jxnDa.js.map +0 -1
  167. package/dist/bitcoin-m84N5a8o.cjs +0 -2
  168. package/dist/bitcoin-m84N5a8o.cjs.map +0 -1
  169. package/dist/buildAndBroadcastReclaim-CBPDgfj7.js.map +0 -1
  170. package/dist/buildAndBroadcastReclaim-DsJ5CB_H.cjs +0 -2
  171. package/dist/buildAndBroadcastReclaim-DsJ5CB_H.cjs.map +0 -1
  172. package/dist/challengeAssert-BNQ8sToz.js.map +0 -1
  173. package/dist/challengeAssert-BrpC3-cQ.cjs +0 -2
  174. package/dist/challengeAssert-BrpC3-cQ.cjs.map +0 -1
  175. package/dist/constants-DU5CGcqO.cjs +0 -2
  176. package/dist/constants-DU5CGcqO.cjs.map +0 -1
  177. package/dist/constants-GjWXdaqV.js +0 -23
  178. package/dist/constants-GjWXdaqV.js.map +0 -1
  179. package/dist/mempoolApi-BJN9fGEd.cjs +0 -2
  180. package/dist/noPayout-CDi6f5-I.js +0 -280
  181. package/dist/noPayout-CDi6f5-I.js.map +0 -1
  182. package/dist/noPayout-Cbi9TCRz.cjs +0 -2
  183. package/dist/noPayout-Cbi9TCRz.cjs.map +0 -1
  184. package/dist/parseFundingOutpoints-CIO9Ok1L.cjs +0 -2
  185. package/dist/parseFundingOutpoints-CIO9Ok1L.cjs.map +0 -1
  186. package/dist/parseFundingOutpoints-CO-f6IHK.js.map +0 -1
  187. package/dist/signPsbtsWithFallback-DVyK-9A-.js.map +0 -1
  188. package/dist/signPsbtsWithFallback-DY2jBtNB.cjs +0 -2
  189. package/dist/signPsbtsWithFallback-DY2jBtNB.cjs.map +0 -1
  190. package/dist/toRefundInputs-Cn6z5_Ko.cjs +0 -2
  191. package/dist/toRefundInputs-Cn6z5_Ko.cjs.map +0 -1
  192. package/dist/toRefundInputs-ZkvoR5Df.js.map +0 -1
  193. package/dist/validation-CDbOaDj7.cjs +0 -2
  194. package/dist/validation-CDbOaDj7.cjs.map +0 -1
  195. package/dist/validation-Dj3dqYtl.js +0 -30
  196. package/dist/validation-Dj3dqYtl.js.map +0 -1
  197. package/dist/verifyKeyPathSchnorrSignature-C6Cmk0R1.js.map +0 -1
  198. package/dist/verifyKeyPathSchnorrSignature-Cr5T4Aym.cjs +0 -2
  199. package/dist/verifyKeyPathSchnorrSignature-Cr5T4Aym.cjs.map +0 -1
  200. package/dist/verifyScriptPathSchnorrSignature-B7MhJmhy.js.map +0 -1
  201. package/dist/verifyScriptPathSchnorrSignature-BBS9oCPO.cjs +0 -2
  202. package/dist/verifyScriptPathSchnorrSignature-BBS9oCPO.cjs.map +0 -1
package/dist/tbv/index.js CHANGED
@@ -1,261 +1,265 @@
1
- import { P as s, h as t, i as r, j as i, f as o, b as n, a as P, c as p, k as c, d as u, e as d, g as l } from "../verifyScriptPathSchnorrSignature-B7MhJmhy.js";
2
- import { a as A } from "../constants-GjWXdaqV.js";
3
- import { computeMinClaimValue as g, computeMinPeginFee as T, deriveVaultId as _, expandAuthAnchor as S, expandHashlockSecret as m, expandWotsSeed as C, peginP2aAnchorOutput as O, supportedTxGraphVersions as I, validatePeginP2aAnchor as f } from "@babylonlabs-io/babylon-tbv-rust-wasm";
4
- import { a as x, c as h, b as V, e as v, f as M } from "../verifyKeyPathSchnorrSignature-C6Cmk0R1.js";
5
- import { c as F, a as y, b as D, e as U, r as B } from "../noPayout-CDi6f5-I.js";
6
- import { b as L } from "../challengeAssert-BNQ8sToz.js";
7
- import { c as k, d as X, a as w, b as W, e as G, f as j, k as J, g as z, h as Y, i as Z, j as q, p as Q, s as $, t as aa, u as ea, v as sa } from "../bitcoin-Ch_jxnDa.js";
8
- import { B as ra, H as ia, K as oa, M as na, T as Pa, c as pa } from "../validation-Dj3dqYtl.js";
9
- import { c as ua } from "../signing-DaLvGwQe.js";
10
- import { C as la, M as Ea, P as Aa, b as Ra, a as ga, c as Ta, d as _a, f as Sa, e as ma } from "../PeginManager-erlaJqpN.js";
11
- import { P as Oa, c as Ia, f as fa, r as ba, s as xa, v as ha } from "../signPsbtsWithFallback-DVyK-9A-.js";
12
- import { A as va, P as Ma } from "../ProtocolParams.abi-C0TSRaHV.js";
13
- import { B as Fa } from "../BTCVaultRegistry.abi-CJwWI2EO.js";
14
- import { B as Da } from "../BTCVaultRegistryKeyEpochs.abi-CXjhRZbm.js";
15
- import { C as Ba, e as Ha, g as La, h as Ka, i as ka } from "../errors-Blc-JWnI.js";
16
- import { V as wa, b as Wa, a as Ga, d as ja, f as Ja, p as za } from "../parseFundingOutpoints-CO-f6IHK.js";
17
- import { B as Za, a as qa, f as Qa, c as $a, b as ae, d as ee, g as se, i as te, h as re, s as ie, e as oe, w as ne } from "../waitForTransactionReceiptSmartAware-B6oYRdFO.js";
18
- import { B as pe, D as ce, L as ue, M as de, c as le, P as Ee, b as Ae, a as Re, S as ge, T as Te, W as _e, f as Se, d as me, p as Ce, r as Oe } from "../fundPeginTransaction-B2wyjqp0.js";
19
- import { U as fe, a as be, e as xe, f as he, v as Ve } from "../reservation-CBAvoF3U.js";
20
- import { M as Me, V as Ne, g as Fe, a as ye, b as De, c as Ue, d as Be, e as He, f as Le, h as Ke, i as ke, p as Xe, v as we, j as We, k as Ge } from "../mempoolApi-71R_CNZa.js";
21
- import { O as Je, S as ze, V as Ye, g as Ze, h as qe, i as Qe, j as $e, a as as, d as es, b as ss, f as ts, p as rs, r as is, v as os, c as ns, e as Ps } from "../batchPoll-Bc_UKaTz.js";
22
- import { A as cs, D as us, J as ds, a as ls, b as Es, d as As, P as Rs, R as gs, e as Ts, c as _s, V as Ss, i as ms } from "../json-rpc-client-DuUARJvV.js";
23
- import { a as Os } from "../onChainBtcPubkey-BAHZyKQL.js";
24
- import { D as fs, a as bs, h as xs, j as hs, P as Vs, k as vs, U as Ms, V as Ns, c as Fs, d as ys, f as Ds, e as Us, b as Bs, i as Hs, r as Ls, g as Ks, t as ks } from "../toRefundInputs-ZkvoR5Df.js";
25
- import { H as ws, E as Ws, P as Gs, o as js, c as Js, d as zs, S as Ys, T as Zs, U as qs, V as Qs, K as $s, L as at, M as et, N as st, O as tt, R as rt, a as it, b as ot, y as nt, Q as Pt, I as pt, J as ct, g as ut, z as dt, p as lt, i as Et, e as At, G as Rt, F as gt, t as Tt, A as _t, B as St, C as mt, D as Ct, r as Ot, s as It, f as ft, h as bt, j as xt, v as ht, k as Vt, l as vt, m as Mt, n as Nt, q as Ft, u as yt, w as Dt, x as Ut } from "../buildAndBroadcastReclaim-CBPDgfj7.js";
26
- import { C as Ht, P as Lt, c as Kt, g as kt, i as Xt } from "../peginState-CxDiaKuk.js";
1
+ import { P as s, h as t, i as r, j as i, f as o, b as n, a as P, c as p, k as c, d as E, e as u, g as d } from "../verifyScriptPathSchnorrSignature-ZAZfFJ6S.js";
2
+ import { a as A } from "../vaultCoreVersion-D_fP9P3C.js";
3
+ import { computeMinClaimValue as _, computeMinPeginFee as g, deriveVaultId as T, expandAuthAnchor as S, expandHashlockSecret as m, expandWotsSeed as C, peginP2aAnchorOutput as O, supportedTxGraphVersions as I, validatePeginP2aAnchor as f } from "./core/wasm/index.js";
4
+ import { a as x, c as h, b as V, e as v, f as M } from "../verifyKeyPathSchnorrSignature-BrgUJmV0.js";
5
+ import { c as F, a as y, b as D, e as U, r as B } from "../noPayout--lxo7qe4.js";
6
+ import { b as L } from "../challengeAssert-Cp_GeRg8.js";
7
+ import { c as X, d as k, a as w, b as W, e as G, f as j, k as Y, g as J, h as z, i as Z, j as q, p as Q, s as $, t as aa, u as ea, v as sa } from "../bitcoin-C-TuHb-v.js";
8
+ import { c as ra } from "../abortSignals-BPpAUL1Z.js";
9
+ import { c as oa } from "../signing-DaLvGwQe.js";
10
+ import { B as Pa, C as pa, H as ca, K as Ea, M as ua, T as da, X as la } from "../validation-OSC0xTHB.js";
11
+ import { C as Ra, M as _a, P as ga, b as Ta, a as Sa, c as ma, d as Ca, f as Oa, e as Ia } from "../PeginManager-Byvmccdd.js";
12
+ import { P as ba, c as xa, f as ha, r as Va, s as va, v as Ma } from "../signPsbtsWithFallback-BjXdnI0X.js";
13
+ import { A as Fa, P as ya } from "../ProtocolParams.abi-C0TSRaHV.js";
14
+ import { B as Ua } from "../BTCVaultRegistry.abi-CJwWI2EO.js";
15
+ import { B as Ha } from "../BTCVaultRegistryKeyEpochs.abi-CXjhRZbm.js";
16
+ import { C as Ka, e as Xa, g as ka, h as wa, i as Wa } from "../errors-Blc-JWnI.js";
17
+ import { V as ja, b as Ya, a as Ja, d as za, f as Za, p as qa } from "../parseFundingOutpoints-DlINgQ3X.js";
18
+ import { B as $a, a as ae, f as ee, c as se, b as te, d as re, g as ie, i as oe, h as ne, s as Pe, e as pe, w as ce } from "../waitForTransactionReceiptSmartAware-B6oYRdFO.js";
19
+ import { B as ue, D as de, L as le, M as Ae, c as Re, P as _e, b as ge, a as Te, S as Se, T as me, W as Ce, f as Oe, d as Ie, p as fe, r as be } from "../fundPeginTransaction-B2wyjqp0.js";
20
+ import { U as he, a as Ve, e as ve, f as Me, v as Ne } from "../reservation-Cj9F0rP9.js";
21
+ import { M as ye, V as De, g as Ue, a as Be, b as He, c as Le, d as Ke, e as Xe, f as ke, h as we, i as We, p as Ge, v as je, j as Ye, k as Je } from "../mempoolApi-CRNMOsbC.js";
22
+ import { V as Ze, a as qe, b as Qe, v as $e } from "../index-LgmJhdEN.js";
23
+ import { A as es, D as ss, J as ts, a as rs, b as is, d as os, P as ns, R as Ps, e as ps, c as cs, V as Es, i as us } from "../json-rpc-client-DuUARJvV.js";
24
+ import { O as ls, S as As, b as Rs, d as _s, e as gs, f as Ts, V as Ss, c as ms, p as Cs, r as Os, v as Is, a as fs } from "../primeVpAuth-D1qbOkhb.js";
25
+ import { a as xs } from "../onChainBtcPubkey-DATNfAAl.js";
26
+ import { D as Vs, a as vs, h as Ms, j as Ns, P as Fs, k as ys, U as Ds, V as Us, c as Bs, d as Hs, f as Ls, e as Ks, b as Xs, i as ks, r as ws, g as Ws, t as Gs } from "../toRefundInputs-CgXMcHrk.js";
27
+ import { H as Ys, E as Js, P as zs, o as Zs, c as qs, d as Qs, S as $s, T as at, U as et, V as st, K as tt, L as rt, M as it, N as ot, O as nt, R as Pt, a as pt, b as ct, y as Et, Q as ut, I as dt, J as lt, g as At, z as Rt, p as _t, i as gt, e as Tt, G as St, F as mt, t as Ct, A as Ot, B as It, C as ft, D as bt, r as xt, s as ht, f as Vt, h as vt, j as Mt, v as Nt, k as Ft, l as yt, m as Dt, n as Ut, q as Bt, u as Ht, w as Lt, x as Kt } from "../buildAndBroadcastReclaim-C0TdwO2M.js";
28
+ import { C as kt, P as wt, c as Wt, g as Gt, i as jt } from "../peginState-CxDiaKuk.js";
27
29
  export {
28
- cs as AUTH_REJECTED_RPC_CODE,
29
- va as ApplicationRegistryABI,
30
- ws as BIP68NotMatureError,
31
- ra as BITCOIN_ADDRESS_RE,
32
- Fa as BTCVaultRegistryABI,
33
- Da as BTCVaultRegistryKeyEpochsABI,
34
- pe as BTC_DUST_SAT,
35
- Za as BitcoinScriptType,
36
- la as COMMISSION_BPS_HEADROOM,
37
- Ba as CONTRACT_ERRORS,
38
- Ws as ClaimerPegoutStatusValue,
39
- Ht as ContractStatus,
40
- fs as DEPOSIT_TERMS_REJECTED_ERROR_NAME,
41
- ce as DUST_THRESHOLD,
42
- us as DaemonStatus,
43
- bs as DepositTermsRejectedError,
44
- ia as HEX_RE,
45
- ds as JSON_RPC_ERROR_CODES,
46
- ls as JsonRpcClient,
47
- Es as JsonRpcError,
48
- oa as KNOWN_SCRIPT_PREFIXES,
49
- ue as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
50
- Ea as MAX_ACCEPTABLE_COMMISSION_BPS_CAP,
51
- de as MAX_NON_LEGACY_OUTPUT_SIZE,
52
- na as MAX_REASONABLE_FEE_SATS,
53
- le as MAX_REASONABLE_PEGIN_VBYTES,
54
- Me as MEMPOOL_API_URLS,
55
- Je as OnChainBtcVaultStatus,
56
- Ee as P2TR_INPUT_SIZE,
57
- Ae as PEGIN_AUTH_ANCHOR_OUTPUTS,
30
+ es as AUTH_REJECTED_RPC_CODE,
31
+ Fa as ApplicationRegistryABI,
32
+ Ys as BIP68NotMatureError,
33
+ Pa as BITCOIN_ADDRESS_RE,
34
+ Ua as BTCVaultRegistryABI,
35
+ Ha as BTCVaultRegistryKeyEpochsABI,
36
+ ue as BTC_DUST_SAT,
37
+ $a as BitcoinScriptType,
38
+ Ra as COMMISSION_BPS_HEADROOM,
39
+ pa as COMPRESSED_PUBKEY_HEX_LEN,
40
+ Ka as CONTRACT_ERRORS,
41
+ Js as ClaimerPegoutStatusValue,
42
+ kt as ContractStatus,
43
+ Vs as DEPOSIT_TERMS_REJECTED_ERROR_NAME,
44
+ de as DUST_THRESHOLD,
45
+ ss as DaemonStatus,
46
+ vs as DepositTermsRejectedError,
47
+ ca as HEX_RE,
48
+ ts as JSON_RPC_ERROR_CODES,
49
+ rs as JsonRpcClient,
50
+ is as JsonRpcError,
51
+ Ea as KNOWN_SCRIPT_PREFIXES,
52
+ le as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
53
+ _a as MAX_ACCEPTABLE_COMMISSION_BPS_CAP,
54
+ Ae as MAX_NON_LEGACY_OUTPUT_SIZE,
55
+ ua as MAX_REASONABLE_FEE_SATS,
56
+ Re as MAX_REASONABLE_PEGIN_VBYTES,
57
+ ye as MEMPOOL_API_URLS,
58
+ ls as OnChainBtcVaultStatus,
59
+ _e as P2TR_INPUT_SIZE,
60
+ ge as PEGIN_AUTH_ANCHOR_OUTPUTS,
58
61
  s as PEGIN_DEPOSITOR_CLAIM_VOUT,
59
- Gs as PEGIN_ETH_CONFIRMATIONS,
60
- Re as PEGIN_FIXED_OUTPUTS,
61
- As as POST_WOTS_STATUSES,
62
- Rs as PRE_DEPOSITOR_SIGNATURES_STATES,
63
- js as ParticipantKeyDriftError,
64
- Oa as PayoutManager,
65
- Lt as PeginAction,
66
- Aa as PeginManager,
67
- xs as PeginParamsAmbiguousError,
68
- hs as PeginParamsIncompleteSpaceError,
69
- Vs as PeginParamsNotFoundError,
70
- Js as PeginRegistrationMissingError,
71
- zs as PeginRegistrationNotFinalError,
72
- vs as PeginSizingIntegrityError,
73
- Ma as ProtocolParamsABI,
62
+ zs as PEGIN_ETH_CONFIRMATIONS,
63
+ Te as PEGIN_FIXED_OUTPUTS,
64
+ os as POST_WOTS_STATUSES,
65
+ ns as PRE_DEPOSITOR_SIGNATURES_STATES,
66
+ Zs as ParticipantKeyDriftError,
67
+ ba as PayoutManager,
68
+ wt as PeginAction,
69
+ ga as PeginManager,
70
+ Ms as PeginParamsAmbiguousError,
71
+ Ns as PeginParamsIncompleteSpaceError,
72
+ Fs as PeginParamsNotFoundError,
73
+ qs as PeginRegistrationMissingError,
74
+ Qs as PeginRegistrationNotFinalError,
75
+ ys as PeginSizingIntegrityError,
76
+ ya as ProtocolParamsABI,
74
77
  t as PsbtSubstitutionError,
75
- Ys as RECLAIM_MAX_FEE_FRACTION_DENOMINATOR,
76
- Zs as RECLAIM_MAX_FEE_FRACTION_NUMERATOR,
77
- qs as RECLAIM_MAX_FEE_RATE_SATS_VB,
78
- Qs as RECLAIM_WARN_FEE_FRACTION_NUMERATOR,
79
- $s as REFUND_MAX_FEE_FRACTION_DENOMINATOR,
80
- at as REFUND_MAX_FEE_FRACTION_NUMERATOR,
81
- et as REFUND_MAX_FEE_RATE_SATS_VB,
82
- st as REFUND_VSIZE,
83
- tt as ReclaimUneconomicalError,
84
- rt as RegisteredVaultVersionMismatchError,
85
- gs as RpcErrorCode,
86
- ge as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
87
- ze as ServerIdentityError,
88
- Pa as TXID_RE,
89
- Te as TX_BUFFER_SIZE_OVERHEAD,
90
- Ms as UnanchoredPrePeginError,
91
- fe as UtxoNotAvailableError,
92
- wa as VAULT_APP_NAME,
93
- Ts as VP_BATCH_MAX_SIZE,
94
- _s as VP_TERMINAL_FAILURE_STATUSES,
95
- Ss as VP_TRANSIENT_STATUSES,
96
- Ye as VaultProviderRpcClient,
97
- Ns as VaultRootMismatchError,
98
- Ze as ViemOperationKeyReader,
99
- qe as ViemProtocolParamsReader,
100
- Qe as ViemUniversalChallengerReader,
101
- $e as ViemVaultKeeperReader,
102
- Ne as ViemVaultRegistryReader,
103
- as as VpResponseValidationError,
104
- es as VpTokenRegistry,
105
- _e as WALLET_RELAY_FEE_RATE_THRESHOLD,
106
- it as activateVault,
107
- ot as activateVaultAndRedeem,
108
- qa as applyChangeOutputPolicy,
78
+ $s as RECLAIM_MAX_FEE_FRACTION_DENOMINATOR,
79
+ at as RECLAIM_MAX_FEE_FRACTION_NUMERATOR,
80
+ et as RECLAIM_MAX_FEE_RATE_SATS_VB,
81
+ st as RECLAIM_WARN_FEE_FRACTION_NUMERATOR,
82
+ tt as REFUND_MAX_FEE_FRACTION_DENOMINATOR,
83
+ rt as REFUND_MAX_FEE_FRACTION_NUMERATOR,
84
+ it as REFUND_MAX_FEE_RATE_SATS_VB,
85
+ ot as REFUND_VSIZE,
86
+ nt as ReclaimUneconomicalError,
87
+ Pt as RegisteredVaultVersionMismatchError,
88
+ Ps as RpcErrorCode,
89
+ Se as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
90
+ As as ServerIdentityError,
91
+ da as TXID_RE,
92
+ me as TX_BUFFER_SIZE_OVERHEAD,
93
+ Ds as UnanchoredPrePeginError,
94
+ he as UtxoNotAvailableError,
95
+ ja as VAULT_APP_NAME,
96
+ ps as VP_BATCH_MAX_SIZE,
97
+ cs as VP_TERMINAL_FAILURE_STATUSES,
98
+ Es as VP_TRANSIENT_STATUSES,
99
+ Ze as VaultProviderRpcClient,
100
+ Us as VaultRootMismatchError,
101
+ Rs as ViemOperationKeyReader,
102
+ _s as ViemProtocolParamsReader,
103
+ gs as ViemUniversalChallengerReader,
104
+ Ts as ViemVaultKeeperReader,
105
+ De as ViemVaultRegistryReader,
106
+ qe as VpResponseValidationError,
107
+ Ss as VpTokenRegistry,
108
+ Ce as WALLET_RELAY_FEE_RATE_THRESHOLD,
109
+ la as X_ONLY_PUBKEY_HEX_LEN,
110
+ pt as activateVault,
111
+ ct as activateVaultAndRedeem,
112
+ ae as applyChangeOutputPolicy,
109
113
  x as assertKeyPathSchnorrSignature,
110
- Os as assertOnChainBtcPubkey,
114
+ xs as assertOnChainBtcPubkey,
111
115
  r as assertPsbtUnsignedTxMatches,
112
116
  h as assertReturnedKeyPathSignatures,
113
117
  i as assertScriptPathSchnorrSignature,
114
- be as assertUtxosAvailable,
118
+ Ve as assertUtxosAvailable,
115
119
  A as assertValidVaultCoreVersion,
116
- nt as assertVaultProviderHintAccepted,
117
- ss as batchPollByProvider,
118
- Pt as buildAndBroadcastReclaim,
119
- pt as buildAndBroadcastRefund,
120
+ Et as assertVaultProviderHintAccepted,
121
+ Qe as batchPollByProvider,
122
+ ut as buildAndBroadcastReclaim,
123
+ dt as buildAndBroadcastRefund,
120
124
  L as buildChallengeAssertPsbt,
121
- Ra as buildDepositTerms,
122
- Wa as buildFundingOutpointsCommitment,
125
+ Ta as buildDepositTerms,
126
+ Ya as buildFundingOutpointsCommitment,
123
127
  F as buildNoPayoutPsbt,
124
128
  o as buildPayoutPsbt,
125
129
  V as buildPeginInputPsbt,
126
- Fs as buildPeginParamsCandidates,
130
+ Bs as buildPeginParamsCandidates,
127
131
  n as buildPeginTxFromFundedPrePegin,
128
132
  P as buildPrePeginPsbt,
129
133
  y as buildReclaimPsbt,
130
134
  D as buildRefundPsbt,
131
- Ga as buildVaultContext,
132
- Qa as calculateBtcTxHash,
133
- Kt as canPerformAction,
134
- k as canonicalizeBtcPubkey,
135
- ga as capMaxAcceptableCommissionBps,
136
- pa as combineAbortSignals,
137
- $a as computeChangeOutputFeeSats,
138
- Ia as computeHashlock,
139
- ae as computeMaxDeposit,
140
- g as computeMinClaimValue,
141
- T as computeMinPeginFee,
135
+ Ja as buildVaultContext,
136
+ ee as calculateBtcTxHash,
137
+ Wt as canPerformAction,
138
+ X as canonicalizeBtcPubkey,
139
+ Sa as capMaxAcceptableCommissionBps,
140
+ ra as combineAbortSignals,
141
+ se as computeChangeOutputFeeSats,
142
+ xa as computeHashlock,
143
+ te as computeMaxDeposit,
144
+ _ as computeMinClaimValue,
145
+ g as computeMinPeginFee,
142
146
  p as computeNumLocalChallengers,
143
- ee as computePeginBaseFeeSats,
144
- Ta as computeWotsBlockPublicKeysHash,
145
- ts as createAuthenticatedVpClient,
147
+ re as computePeginBaseFeeSats,
148
+ ma as computeWotsBlockPublicKeysHash,
149
+ ms as createAuthenticatedVpClient,
146
150
  c as createPayoutScript,
147
- ua as createTaprootScriptPathSignOptions,
148
- X as deriveBip86ScriptPubKeyHex,
149
- u as deriveDepositorClaimDescriptor,
150
- d as deriveDepositorClaimScriptPubKey,
151
- ys as deriveHashlocksFromPrePegin,
151
+ oa as createTaprootScriptPathSignOptions,
152
+ k as deriveBip86ScriptPubKeyHex,
153
+ E as deriveDepositorClaimDescriptor,
154
+ u as deriveDepositorClaimScriptPubKey,
155
+ Hs as deriveHashlocksFromPrePegin,
152
156
  w as deriveNativeSegwitAddress,
153
157
  W as deriveTaprootAddress,
154
- _ as deriveVaultId,
155
- ja as deriveVaultRoot,
156
- _a as deriveWotsBlocksFromSeed,
157
- Ds as describePeginParamsCandidate,
158
- Us as describeUnresolvedVersion,
158
+ T as deriveVaultId,
159
+ za as deriveVaultRoot,
160
+ Ca as deriveWotsBlocksFromSeed,
161
+ Ls as describePeginParamsCandidate,
162
+ Ks as describeUnresolvedVersion,
159
163
  G as ensureHexPrefix,
160
- Sa as ensurePrePeginTermsApproval,
164
+ Oa as ensurePrePeginTermsApproval,
161
165
  U as estimateReclaimFeeSats,
162
- ct as estimateRefundFeeSats,
163
- ma as estimateSubmitPeginRequestBatchGas,
166
+ lt as estimateRefundFeeSats,
167
+ Ia as estimateSubmitPeginRequestBatchGas,
164
168
  S as expandAuthAnchor,
165
169
  m as expandHashlockSecret,
166
170
  C as expandWotsSeed,
167
- Ha as extractErrorData,
168
- xe as extractInputsFromTransaction,
169
- l as extractPayoutSignature,
171
+ Xa as extractErrorData,
172
+ ve as extractInputsFromTransaction,
173
+ d as extractPayoutSignature,
170
174
  v as extractPeginInputSignature,
171
175
  M as finalizePeginInputPsbt,
172
- he as findOverlappingPendingVaults,
176
+ Me as findOverlappingPendingVaults,
173
177
  j as formatSatoshisToBtc,
174
- fa as forwardDepositApproval,
175
- Ja as forwardDeriveContextHash,
176
- Se as fundPeginTransaction,
177
- Fe as getAddressTxs,
178
- ye as getAddressUtxos,
179
- La as getContractErrorMessage,
180
- se as getDustThreshold,
181
- De as getMempoolApiUrl,
182
- J as getNetwork,
183
- Ue as getNetworkFees,
184
- Be as getOutspend,
185
- kt as getPeginProtocolState,
186
- te as getPsbtInputFields,
187
- re as getScriptType,
188
- z as getSortedXOnlyPubkeys,
189
- He as getTipHeight,
190
- Le as getTxHex,
191
- Ke as getTxInfo,
192
- ke as getUtxoInfo,
193
- Ka as handleContractError,
194
- Y as hexToUint8Array,
195
- Xt as isActivationDeadlinePassedOnChain,
178
+ ha as forwardDepositApproval,
179
+ Za as forwardDeriveContextHash,
180
+ Oe as fundPeginTransaction,
181
+ Ue as getAddressTxs,
182
+ Be as getAddressUtxos,
183
+ ka as getContractErrorMessage,
184
+ ie as getDustThreshold,
185
+ He as getMempoolApiUrl,
186
+ Y as getNetwork,
187
+ Le as getNetworkFees,
188
+ Ke as getOutspend,
189
+ Gt as getPeginProtocolState,
190
+ oe as getPsbtInputFields,
191
+ ne as getScriptType,
192
+ J as getSortedXOnlyPubkeys,
193
+ Xe as getTipHeight,
194
+ ke as getTxHex,
195
+ we as getTxInfo,
196
+ We as getUtxoInfo,
197
+ wa as handleContractError,
198
+ z as hexToUint8Array,
199
+ jt as isActivationDeadlinePassedOnChain,
196
200
  Z as isAddressFromPublicKey,
197
- ms as isAuthRejectedError,
198
- ut as isDepositAmountValid,
199
- Bs as isDepositTermsRejectedError,
200
- dt as isHintAccepted,
201
- ka as isKnownContractError,
202
- lt as isParticipantKeyDriftError,
203
- Et as isPeginRegistrationMissingError,
204
- At as isPeginRegistrationNotFinalError,
205
- Rt as isPegoutTerminalStatus,
206
- gt as isRecognizedPegoutStatus,
207
- Tt as isRegisteredVaultVersionMismatchError,
201
+ us as isAuthRejectedError,
202
+ At as isDepositAmountValid,
203
+ Xs as isDepositTermsRejectedError,
204
+ Rt as isHintAccepted,
205
+ Wa as isKnownContractError,
206
+ _t as isParticipantKeyDriftError,
207
+ gt as isPeginRegistrationMissingError,
208
+ Tt as isPeginRegistrationNotFinalError,
209
+ St as isPegoutTerminalStatus,
210
+ mt as isRecognizedPegoutStatus,
211
+ Ct as isRegisteredVaultVersionMismatchError,
208
212
  q as isValidHex,
209
- Hs as isWotsMismatchError,
210
- _t as matchKeyHint,
211
- St as matchKeySetHint,
212
- za as parseFundingOutpointsFromTx,
213
- me as parseUnfundedWasmTransaction,
214
- Ce as peginOutputCount,
213
+ ks as isWotsMismatchError,
214
+ Ot as matchKeyHint,
215
+ It as matchKeySetHint,
216
+ qa as parseFundingOutpointsFromTx,
217
+ Ie as parseUnfundedWasmTransaction,
218
+ fe as peginOutputCount,
215
219
  O as peginP2aAnchorOutput,
216
- rs as primeVpTokenRegistry,
220
+ Cs as primeVpTokenRegistry,
217
221
  Q as processPublicKeyToXOnly,
218
- Xe as pushTx,
219
- Oe as rateBasedTxBufferFee,
220
- Ls as rebuildDepositTermsCore,
222
+ Ge as pushTx,
223
+ be as rateBasedTxBufferFee,
224
+ ws as rebuildDepositTermsCore,
221
225
  B as reclaimVsize,
222
- Ks as reconstructPeginParams,
223
- ba as requireChangeAddress,
224
- mt as resolveCurrentParticipantKeys,
225
- Ct as resolveParticipantKeysAtEpochs,
226
- is as resolveProtocolAddresses,
227
- Ot as runDepositorPresignFlow,
228
- ie as selectUtxosForPegin,
229
- oe as shouldAddChangeOutput,
230
- It as signDepositorGraph,
226
+ Ws as reconstructPeginParams,
227
+ Va as requireChangeAddress,
228
+ ft as resolveCurrentParticipantKeys,
229
+ bt as resolveParticipantKeysAtEpochs,
230
+ Os as resolveProtocolAddresses,
231
+ xt as runDepositorPresignFlow,
232
+ Pe as selectUtxosForPegin,
233
+ pe as shouldAddChangeOutput,
234
+ ht as signDepositorGraph,
231
235
  $ as stripHexPrefix,
232
- ft as submitWotsPublicKey,
236
+ Vt as submitWotsPublicKey,
233
237
  I as supportedTxGraphVersions,
234
- xa as supportsDepositApproval,
235
- ks as toRefundInputs,
238
+ va as supportsDepositApproval,
239
+ Gs as toRefundInputs,
236
240
  aa as toXOnly,
237
241
  ea as uint8ArrayToHex,
238
- bt as validateDepositAmount,
239
- xt as validateMultiVaultDepositInputs,
240
- we as validateOffchainParams,
241
- ht as validateOnChainParticipantKeys,
242
- We as validatePegInConfiguration,
242
+ vt as validateDepositAmount,
243
+ Mt as validateMultiVaultDepositInputs,
244
+ je as validateOffchainParams,
245
+ Nt as validateOnChainParticipantKeys,
246
+ Ye as validatePegInConfiguration,
243
247
  f as validatePeginP2aAnchor,
244
- Vt as validateProviderSelection,
245
- vt as validateRemainingCapacity,
246
- os as validateRequestDepositorClaimerArtifactsResponse,
247
- ha as validateSecretAgainstHashlock,
248
- Ge as validateTBVProtocolParams,
249
- Ve as validateUtxosAvailable,
250
- Mt as validateVaultAmounts,
251
- Nt as validateVaultProviderPubkey,
248
+ Ft as validateProviderSelection,
249
+ yt as validateRemainingCapacity,
250
+ $e as validateRequestDepositorClaimerArtifactsResponse,
251
+ Ma as validateSecretAgainstHashlock,
252
+ Je as validateTBVProtocolParams,
253
+ Ne as validateUtxosAvailable,
254
+ Dt as validateVaultAmounts,
255
+ Ut as validateVaultProviderPubkey,
252
256
  sa as validateWalletPubkey,
253
- Ft as verifyRegisteredParticipantKeys,
254
- yt as verifyRegisteredVaultVersions,
255
- ns as verifyServerIdentity,
256
- Ps as vpTokenRegistry,
257
- Dt as waitForPeginRegistrationDepth,
258
- Ut as waitForPeginStatus,
259
- ne as waitForTransactionReceiptSmartAware
257
+ Bt as verifyRegisteredParticipantKeys,
258
+ Ht as verifyRegisteredVaultVersions,
259
+ Is as verifyServerIdentity,
260
+ fs as vpTokenRegistry,
261
+ Lt as waitForPeginRegistrationDepth,
262
+ Kt as waitForPeginStatus,
263
+ ce as waitForTransactionReceiptSmartAware
260
264
  };
261
265
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";var S=Object.defineProperty;var O=(i,e,t)=>e in i?S(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var c=(i,e,t)=>O(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("@bitcoin-js/tiny-secp256k1-asmjs"),y=require("../sha2-DsrLC4NM.cjs"),o=require("buffer"),u=require("../bitcoin-m84N5a8o.cjs"),l=require("bitcoinjs-lib"),k=require("../shared/index.cjs");function B(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const b=B(v),I="BIP0322-signed-message",E=1,g=0,K=71,D=100,H=0,T=0,_=0,N=32,F=4294967295,M=0,U=0,A=32,C=106,W=2,R=32,$=0;function G(i,e){const t=b.pointFromScalar(e,!0);if(!t)throw new Error("signBip322P2wpkhWitness: invalid private key");const n=y.sha256(new TextEncoder().encode(I)),s=y.sha256(o.Buffer.concat([n,n,o.Buffer.from(i)])),r=l.payments.p2wpkh({pubkey:o.Buffer.from(t)});if(!r.output||!r.hash)throw new Error("signBip322P2wpkhWitness: could not derive P2WPKH script");const a=new l.Transaction;a.version=H,a.locktime=T,a.addInput(o.Buffer.alloc(N,0),F,_,o.Buffer.concat([o.Buffer.from([U,A]),o.Buffer.from(s)])),a.addOutput(r.output,g);const h=new l.Transaction;h.version=H,h.locktime=T,h.addInput(a.getHash(),M,_),h.addOutput(o.Buffer.from([C]),g);const q=l.payments.p2pkh({hash:r.hash}).output;if(!q)throw new Error("signBip322P2wpkhWitness: could not build scriptCode");const P=h.hashForWitnessV0(0,q,g,E);let d;for(let f=0;f<D;f++){const w=o.Buffer.alloc(R,0);w.writeUInt32LE(f,$);const x=l.script.signature.encode(o.Buffer.from(b.sign(P,e,w)),E);if(x.length>=K){d=x;break}}if(!d)throw new Error("signBip322P2wpkhWitness: could not grind a 71/72-byte signature");return Uint8Array.from([W,d.length,...d,t.length,...t])}const X=async(i,e)=>{const t=new TextEncoder,n=t.encode(i),s=t.encode(e),r=new Uint8Array(4+n.length+4+s.length),a=new DataView(r.buffer);return a.setUint32(0,n.length),r.set(n,4),a.setUint32(4+n.length,s.length),r.set(s,4+n.length+4),u.uint8ArrayToHex(y.sha256(r))},j=`${"00".repeat(31)}01`;function p(i){return u.uint8ArrayToHex(b.xOnlyPointFromScalar(Uint8Array.from(o.Buffer.from(i,"hex"))))}const m={publicKeyHex:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",address:"tb1pqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkx6jks",network:k.BitcoinNetworks.SIGNET,shouldFailSigning:!1,privateKeyHex:j,deriveContextHash:X};class L{constructor(e={}){c(this,"config");this.config={...m,...e.publicKeyHex?{publicKeyHex:e.publicKeyHex}:{},...e.address?{address:e.address}:{},...e.network!==void 0?{network:e.network}:{},...e.shouldFailSigning!==void 0?{shouldFailSigning:e.shouldFailSigning}:{},...e.privateKeyHex?{privateKeyHex:e.privateKeyHex}:{},...e.deriveContextHash?{deriveContextHash:e.deriveContextHash}:{}},e.privateKeyHex&&!e.publicKeyHex&&(this.config.publicKeyHex=p(e.privateKeyHex))}async getPublicKeyHex(){return this.config.publicKeyHex}async getAddress(){return this.config.address}async signPsbt(e,t){if(this.config.shouldFailSigning)throw new Error("Mock signing failed");if(!e||e.length===0)throw new Error("Invalid PSBT: empty hex string");return e+"deadbeef"}async signPsbts(e,t){const n=[];for(const s of e){const r=await this.signPsbt(s);n.push(r)}return n}async signMessage(e,t){if(t!=="bip322-simple")throw new Error("MockBitcoinWallet.signMessage: only bip322-simple is implemented");if(this.config.shouldFailSigning)throw new Error("Mock signing failed");if(!e||e.length===0)throw new Error("Invalid message: empty string");const n=p(this.config.privateKeyHex);let s;try{s=u.canonicalizeBtcPubkey(this.config.publicKeyHex)}catch{s=void 0}if(s!==n)throw new Error(`MockBitcoinWallet.signMessage: privateKeyHex signs as x-only pubkey ${n}, but publicKeyHex is ${this.config.publicKeyHex}. Pass a matching publicKeyHex/privateKeyHex pair.`);const r=G(new TextEncoder().encode(e),Uint8Array.from(o.Buffer.from(this.config.privateKeyHex,"hex")));return`0x${u.uint8ArrayToHex(r)}`}async getNetwork(){return this.config.network}async deriveContextHash(e,t){return this.config.deriveContextHash(e,t)}updateConfig(e){this.config={...this.config,...e},e.privateKeyHex&&!e.publicKeyHex&&(this.config.publicKeyHex=p(e.privateKeyHex))}reset(){this.config={...m}}}class V{constructor(e={}){c(this,"account");c(this,"chain");c(this,"shouldFailOperations");c(this,"transactionDelay");c(this,"nonce",0);this.account={address:e.address||"0x742d35cc6634c0532925a3b844bc9e7595f0beb0"},this.chain={id:e.chainId??11155111},this.shouldFailOperations=e.shouldFailOperations??!1,this.transactionDelay=e.transactionDelay??0,this.signMessage=this.signMessage.bind(this),this.sendTransaction=this.sendTransaction.bind(this)}async signMessage(e){const t=e.message,n=e.account||this.account.address;if(this.shouldFailOperations)throw new Error("Mock signing failed");if(!t||t.length===0)throw new Error("Invalid message: empty string");const s=`personal_sign:${t}-${n}-${this.chain.id}`;return`0x${o.Buffer.from(s).toString("hex").slice(0,130).padEnd(130,"0")}`}async sendTransaction(e){var s;if(this.shouldFailOperations)throw new Error("Mock transaction failed");if(!e.to)throw new Error("Invalid transaction: missing 'to' address");this.transactionDelay>0&&await new Promise(r=>setTimeout(r,this.transactionDelay)),this.nonce++;const t=JSON.stringify({from:this.account.address,to:e.to,value:((s=e.value)==null?void 0:s.toString())||"0",nonce:this.nonce,chainId:this.chain.id});return`0x${o.Buffer.from(t).toString("hex").slice(0,64).padEnd(64,"0")}`}updateConfig(e){e.address!==void 0&&(this.account.address=e.address),e.chainId!==void 0&&(this.chain.id=e.chainId),e.shouldFailOperations!==void 0&&(this.shouldFailOperations=e.shouldFailOperations),e.transactionDelay!==void 0&&(this.transactionDelay=e.transactionDelay)}reset(){this.account.address="0x742d35cc6634c0532925a3b844bc9e7595f0beb0",this.chain.id=11155111,this.shouldFailOperations=!1,this.transactionDelay=0,this.nonce=0}getCurrentNonce(){return this.nonce}}exports.MockBitcoinWallet=L;exports.MockEthereumWallet=V;
1
+ "use strict";var S=Object.defineProperty;var O=(i,e,t)=>e in i?S(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var c=(i,e,t)=>O(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("@bitcoin-js/tiny-secp256k1-asmjs"),y=require("../sha2-DsrLC4NM.cjs"),o=require("buffer"),u=require("../bitcoin-D-O2GjbC.cjs"),l=require("bitcoinjs-lib"),k=require("../shared/index.cjs");function B(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const b=B(v),I="BIP0322-signed-message",E=1,g=0,K=71,D=100,H=0,T=0,_=0,N=32,F=4294967295,M=0,U=0,A=32,C=106,W=2,R=32,$=0;function G(i,e){const t=b.pointFromScalar(e,!0);if(!t)throw new Error("signBip322P2wpkhWitness: invalid private key");const n=y.sha256(new TextEncoder().encode(I)),s=y.sha256(o.Buffer.concat([n,n,o.Buffer.from(i)])),r=l.payments.p2wpkh({pubkey:o.Buffer.from(t)});if(!r.output||!r.hash)throw new Error("signBip322P2wpkhWitness: could not derive P2WPKH script");const a=new l.Transaction;a.version=H,a.locktime=T,a.addInput(o.Buffer.alloc(N,0),F,_,o.Buffer.concat([o.Buffer.from([U,A]),o.Buffer.from(s)])),a.addOutput(r.output,g);const h=new l.Transaction;h.version=H,h.locktime=T,h.addInput(a.getHash(),M,_),h.addOutput(o.Buffer.from([C]),g);const q=l.payments.p2pkh({hash:r.hash}).output;if(!q)throw new Error("signBip322P2wpkhWitness: could not build scriptCode");const P=h.hashForWitnessV0(0,q,g,E);let d;for(let f=0;f<D;f++){const w=o.Buffer.alloc(R,0);w.writeUInt32LE(f,$);const x=l.script.signature.encode(o.Buffer.from(b.sign(P,e,w)),E);if(x.length>=K){d=x;break}}if(!d)throw new Error("signBip322P2wpkhWitness: could not grind a 71/72-byte signature");return Uint8Array.from([W,d.length,...d,t.length,...t])}const X=async(i,e)=>{const t=new TextEncoder,n=t.encode(i),s=t.encode(e),r=new Uint8Array(4+n.length+4+s.length),a=new DataView(r.buffer);return a.setUint32(0,n.length),r.set(n,4),a.setUint32(4+n.length,s.length),r.set(s,4+n.length+4),u.uint8ArrayToHex(y.sha256(r))},j=`${"00".repeat(31)}01`;function p(i){return u.uint8ArrayToHex(b.xOnlyPointFromScalar(Uint8Array.from(o.Buffer.from(i,"hex"))))}const m={publicKeyHex:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",address:"tb1pqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkx6jks",network:k.BitcoinNetworks.SIGNET,shouldFailSigning:!1,privateKeyHex:j,deriveContextHash:X};class L{constructor(e={}){c(this,"config");this.config={...m,...e.publicKeyHex?{publicKeyHex:e.publicKeyHex}:{},...e.address?{address:e.address}:{},...e.network!==void 0?{network:e.network}:{},...e.shouldFailSigning!==void 0?{shouldFailSigning:e.shouldFailSigning}:{},...e.privateKeyHex?{privateKeyHex:e.privateKeyHex}:{},...e.deriveContextHash?{deriveContextHash:e.deriveContextHash}:{}},e.privateKeyHex&&!e.publicKeyHex&&(this.config.publicKeyHex=p(e.privateKeyHex))}async getPublicKeyHex(){return this.config.publicKeyHex}async getAddress(){return this.config.address}async signPsbt(e,t){if(this.config.shouldFailSigning)throw new Error("Mock signing failed");if(!e||e.length===0)throw new Error("Invalid PSBT: empty hex string");return e+"deadbeef"}async signPsbts(e,t){const n=[];for(const s of e){const r=await this.signPsbt(s);n.push(r)}return n}async signMessage(e,t){if(t!=="bip322-simple")throw new Error("MockBitcoinWallet.signMessage: only bip322-simple is implemented");if(this.config.shouldFailSigning)throw new Error("Mock signing failed");if(!e||e.length===0)throw new Error("Invalid message: empty string");const n=p(this.config.privateKeyHex);let s;try{s=u.canonicalizeBtcPubkey(this.config.publicKeyHex)}catch{s=void 0}if(s!==n)throw new Error(`MockBitcoinWallet.signMessage: privateKeyHex signs as x-only pubkey ${n}, but publicKeyHex is ${this.config.publicKeyHex}. Pass a matching publicKeyHex/privateKeyHex pair.`);const r=G(new TextEncoder().encode(e),Uint8Array.from(o.Buffer.from(this.config.privateKeyHex,"hex")));return`0x${u.uint8ArrayToHex(r)}`}async getNetwork(){return this.config.network}async deriveContextHash(e,t){return this.config.deriveContextHash(e,t)}updateConfig(e){this.config={...this.config,...e},e.privateKeyHex&&!e.publicKeyHex&&(this.config.publicKeyHex=p(e.privateKeyHex))}reset(){this.config={...m}}}class V{constructor(e={}){c(this,"account");c(this,"chain");c(this,"shouldFailOperations");c(this,"transactionDelay");c(this,"nonce",0);this.account={address:e.address||"0x742d35cc6634c0532925a3b844bc9e7595f0beb0"},this.chain={id:e.chainId??11155111},this.shouldFailOperations=e.shouldFailOperations??!1,this.transactionDelay=e.transactionDelay??0,this.signMessage=this.signMessage.bind(this),this.sendTransaction=this.sendTransaction.bind(this)}async signMessage(e){const t=e.message,n=e.account||this.account.address;if(this.shouldFailOperations)throw new Error("Mock signing failed");if(!t||t.length===0)throw new Error("Invalid message: empty string");const s=`personal_sign:${t}-${n}-${this.chain.id}`;return`0x${o.Buffer.from(s).toString("hex").slice(0,130).padEnd(130,"0")}`}async sendTransaction(e){var s;if(this.shouldFailOperations)throw new Error("Mock transaction failed");if(!e.to)throw new Error("Invalid transaction: missing 'to' address");this.transactionDelay>0&&await new Promise(r=>setTimeout(r,this.transactionDelay)),this.nonce++;const t=JSON.stringify({from:this.account.address,to:e.to,value:((s=e.value)==null?void 0:s.toString())||"0",nonce:this.nonce,chainId:this.chain.id});return`0x${o.Buffer.from(t).toString("hex").slice(0,64).padEnd(64,"0")}`}updateConfig(e){e.address!==void 0&&(this.account.address=e.address),e.chainId!==void 0&&(this.chain.id=e.chainId),e.shouldFailOperations!==void 0&&(this.shouldFailOperations=e.shouldFailOperations),e.transactionDelay!==void 0&&(this.transactionDelay=e.transactionDelay)}reset(){this.account.address="0x742d35cc6634c0532925a3b844bc9e7595f0beb0",this.chain.id=11155111,this.shouldFailOperations=!1,this.transactionDelay=0,this.nonce=0}getCurrentNonce(){return this.nonce}}exports.MockBitcoinWallet=L;exports.MockEthereumWallet=V;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -4,7 +4,7 @@ var c = (r, t, e) => k(r, typeof t != "symbol" ? t + "" : t, e);
4
4
  import * as p from "@bitcoin-js/tiny-secp256k1-asmjs";
5
5
  import { s as f } from "../sha2-BYVxyZzX.js";
6
6
  import { Buffer as o } from "buffer";
7
- import { c as I, u as y } from "../bitcoin-Ch_jxnDa.js";
7
+ import { c as I, u as y } from "../bitcoin-C-TuHb-v.js";
8
8
  import { payments as q, Transaction as b, script as O } from "bitcoinjs-lib";
9
9
  import { BitcoinNetworks as K } from "../shared/index.js";
10
10
  const D = "BIP0322-signed-message", m = 1, g = 0, N = 71, B = 100, H = 0, _ = 0, T = 0, F = 32, M = 4294967295, U = 0, C = 0, A = 32, W = 106, R = 2, G = 32, X = 0;
@@ -0,0 +1,2 @@
1
+ "use strict";var te=Object.defineProperty;var re=(e,t,r)=>t in e?te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var K=(e,t,r)=>re(e,typeof t!="symbol"?t+"":t,r);const ne=require("./sha2-DsrLC4NM.cjs"),S=require("./signPsbtsWithFallback-zOQWokmk.cjs"),q=require("./PeginManager-BIKAnZ-X.cjs"),p=require("./bitcoin-D-O2GjbC.cjs"),f=require("./tbv/core/wasm/index.cjs"),N=require("./parseFundingOutpoints-BkgGihaY.cjs"),U=require("bitcoinjs-lib"),H=require("./verifyScriptPathSchnorrSignature-mzYCzaSy.cjs"),z=require("./fundPeginTransaction-BLD8FRL9.cjs"),j=require("./waitForTransactionReceiptSmartAware-Ct7LPwPI.cjs"),M="DepositTermsRejectedError";class L extends Error{constructor(r,n="device-envelope"){super(r);K(this,"reason");this.name=M,this.reason=n}}function oe(e){if(e instanceof L)return!0;if(typeof e!="object"||e===null)return!1;const t=e;return t.name===M&&t.reason==="device-envelope"}async function W(e){const t=e.siblings.length;if(t===0)throw new Error("rebuildDepositTermsCore: at least one sibling is required");for(const[o,b]of e.siblings.entries())if(b.amount<=0n)throw new Error(`rebuildDepositTermsCore: sibling[${o}] has non-positive on-chain pegin amount ${b.amount}; the chain-read vault record is invalid. Resume refused.`);if(e.prepeginMaxFee<=0n)throw new Error(`rebuildDepositTermsCore: prepeginMaxFee must be > 0, got ${e.prepeginMaxFee}`);const r=p.stripHexPrefix(e.prepeginTxid).toLowerCase(),n=p.stripHexPrefix(j.calculateBtcTxHash(e.fundedPrePeginTxHex)).toLowerCase();if(n!==r)throw new Error(`Funded Pre-PegIn tx hashes to ${n}, expected ${r} (on-chain prepeginTxid). Resume refused.`);const h=S.findAuthAnchorOpReturn(p.stripHexPrefix(e.fundedPrePeginTxHex));if(h===void 0)throw new Error("Funded Pre-PegIn carries no single, unambiguous auth-anchor OP_RETURN commitment — it either predates auth anchoring or is malformed. The intent resume path requires the anchor to prove sibling completeness. Resume refused.");if(h.vout!==t)throw new Error(`Auth-anchor OP_RETURN at vout ${h.vout} does not match the discovered sibling count ${t}; the discovered sibling set does not cover this transaction's HTLC outputs (a lagging index can cause this — retry later). Resume refused.`);const c=e.vaultKeeperBtcPubkeys.length,u=e.universalChallengerBtcPubkeys.length,l=await f.computeMinClaimValue(e.vaultCoreVersion,c,u,e.councilQuorum,e.councilSize,e.protocolFeeRate),a=await f.computeMinPeginFee(e.vaultCoreVersion,c,u,e.minPeginFeeRate),d=await f.peginP2aAnchorOutput(e.vaultCoreVersion),s=(d==null?void 0:d.value)??0n;if(l<=0n)throw new Error(`WASM returned non-positive depositorClaimValue ${l}; expected > 0. Resume refused.`);if(a<=0n)throw new Error(`WASM returned non-positive peginMaxFee ${a}; expected > 0. Resume refused.`);if(s<0n)throw new Error(`WASM returned negative P2A anchor value ${s}. Resume refused.`);const i=a+s,v=e.minPeginFeeRate*z.MAX_REASONABLE_PEGIN_VBYTES;if(i<=0n||i>v)throw new Error(`WASM implied PegIn reserve ${i} sat is outside (0, ${v}] (minPeginFeeRate=${e.minPeginFeeRate} × ${z.MAX_REASONABLE_PEGIN_VBYTES} vbytes). Resume refused.`);const x=e.siblings.map(o=>o.amount+l+a+s),R=await Promise.all(e.siblings.map(async o=>(await f.getPrePeginHtlcConnectorInfo({txGraphVersion:e.vaultCoreVersion,depositorPubkey:e.depositorBtcPubkey,vaultProviderPubkey:e.vaultProviderBtcPubkey,vaultKeeperPubkeys:[...e.vaultKeeperBtcPubkeys],universalChallengerPubkeys:[...e.universalChallengerBtcPubkeys],hashlock:p.stripHexPrefix(o.hashlock),timelockRefund:e.timelockRefund,network:e.network})).scriptPubKey)),E=U.Transaction.fromHex(p.stripHexPrefix(e.fundedPrePeginTxHex)).outs.map(o=>({value:o.value,script:o.script}));return H.assertEncodedHtlcOutputsMatch(E,x,R),q.buildDepositTerms({vaultCoreVersion:e.vaultCoreVersion,protocolFeeRate:e.protocolFeeRate,timelockPegin:e.timelockPegin,timelockAssert:e.timelockAssert,timelockRefund:e.timelockRefund,prepeginTxid:e.prepeginTxid,prepeginMaxFee:e.prepeginMaxFee,vaultProviderBtcPubkey:e.vaultProviderBtcPubkey,vaultKeeperBtcPubkeys:e.vaultKeeperBtcPubkeys,universalChallengerBtcPubkeys:e.universalChallengerBtcPubkeys,maxAcceptableCommissionBps:e.maxAcceptableCommissionBps,peginAmounts:e.siblings.map(o=>o.amount),depositorClaimValue:l,peginMaxFee:a})}function se(e){const t=(e instanceof Error?e.message:typeof e=="string"?e:"").toLowerCase();return t.includes("wots")&&t.includes("hash")&&t.includes("does not match")}class Q extends Error{constructor(t,r){super(`Re-derived vault root does not match this Pre-PegIn: derived auth-anchor hash ${t}, transaction commits to ${r}. Connect the same wallet, on the same account and the same network, that created the deposit.`),this.derivedAuthAnchorHash=t,this.onChainAuthAnchorHash=r,this.name="VaultRootMismatchError"}}class A extends Error{constructor(t){super(t),this.name="UnanchoredPrePeginError"}}class X extends Error{constructor(t,r,n=[]){super(`No candidate parameter set reproduces this Pre-PegIn's HTLC outputs (${t} candidate(s) tried). `+(n.length>0?`${n.length} version(s) could not be resolved and may hold the answer: ${n.join(" | ")}. `:"")+`Sample rejections: ${r.join(" | ")}`),this.candidatesTried=t,this.sampleRejections=r,this.unresolvedLabels=n,this.name="PeginParamsNotFoundError"}}class J extends Error{constructor(t){super(`${t.length} candidate parameter sets reproduce this Pre-PegIn's HTLC outputs, so the vault's stamped versions cannot be determined: ${t.join(" | ")}. Reconstruction refused.`),this.survivorLabels=t,this.name="PeginParamsAmbiguousError"}}class G extends Error{constructor(t,r){super(`A candidate matched this Pre-PegIn (${t}), but ${r.length} version(s) could not be resolved, so the search space did not provably contain the true parameters: ${r.join(" | ")}. A version sharing the matched timelockRefund and participants is indistinguishable from the true one, so the match cannot be trusted. Reconstruction refused.`),this.matchedLabel=t,this.unresolvedLabels=r,this.name="PeginParamsIncompleteSpaceError"}}class T extends Error{constructor(t){super(`${t}. Reconstruction refused.`),this.name="PeginSizingIntegrityError"}}async function ie(e){const{wallet:t,depositorBtcPubkey:r,fundedPrePeginTxHex:n}=e,h=p.stripHexPrefix(n),c=S.findAuthAnchorOpReturn(h);if(c===void 0)throw new A("Pre-PegIn carries no single, unambiguous auth-anchor OP_RETURN, so the number of HTLC outputs it funds cannot be determined. Legacy pre-anchor deposits are not recoverable by this path.");const u=c.vout;if(u===0)throw new A("Pre-PegIn's auth-anchor OP_RETURN is at vout 0, implying zero HTLC outputs; there is nothing to recover.");const l=N.parseFundingOutpointsFromTx(h),a=await N.deriveVaultRoot(t,{depositorBtcPubkey:p.hexToUint8Array(p.processPublicKeyToXOnly(r)),fundingOutpoints:l});try{const s=await f.expandAuthAnchor(a);let i;try{i=p.uint8ArrayToHex(ne.sha256(s))}finally{s.fill(0)}if(i!==c.hash)throw new Q(i,c.hash)}catch(s){throw a.fill(0),s}const{hashlocks:d}=await q.expandPerVaultSecrets(a,u);return{vaultCount:u,hashlocks:d,authAnchorHash:c.hash}}function ae(e){const{vaultCoreVersion:t,offchainParams:r,participantKeySets:n}=e;if(!Number.isInteger(t)||t<1)throw new Error(`buildPeginParamsCandidates: vaultCoreVersion must be a positive integer, got ${t}`);if(r.length===0)throw new Error("buildPeginParamsCandidates: at least one offchain-params version is required");if(n.length===0)throw new Error("buildPeginParamsCandidates: at least one participant key set is required");const h=[];for(const c of r)for(const u of n)h.push({vaultCoreVersion:t,offchainParams:c,participants:u});return h}function Y(e){return`${e.axis} v${e.version} (${e.reason})`}function $(e){const{participants:t}=e;return`core=${e.vaultCoreVersion} offchain=${e.offchainParams.version} keepers=${t.appVaultKeepersVersion} challengers=${t.universalChallengersVersion} vp=${t.vaultProvider}`}const D=5;function ce(e,t){return JSON.stringify({terms:e,peginAmounts:t},(r,n)=>typeof n=="bigint"?`${n}`:n)}function ue(e){const{offchainParams:t,participants:r}=e;return[e.vaultCoreVersion,r.vaultKeeperBtcPubkeys.length,r.universalChallengerBtcPubkeys.length,t.councilQuorum,t.councilSize,t.protocolFeeRate,t.minPeginFeeRate].join("|")}async function le(e){const{offchainParams:t,participants:r}=e,n=r.vaultKeeperBtcPubkeys.length,h=r.universalChallengerBtcPubkeys.length,[c,u,l]=await Promise.all([f.computeMinClaimValue(e.vaultCoreVersion,n,h,t.councilQuorum,t.councilSize,t.protocolFeeRate),f.computeMinPeginFee(e.vaultCoreVersion,n,h,t.minPeginFeeRate),f.peginP2aAnchorOutput(e.vaultCoreVersion)]),a=(l==null?void 0:l.value)??0n;if(c<=0n)throw new T(`WASM returned non-positive depositorClaimValue ${c} for graph version ${e.vaultCoreVersion}`);if(u<=0n)throw new T(`WASM returned non-positive peginMaxFee ${u} for graph version ${e.vaultCoreVersion}`);if(a<0n)throw new T(`WASM returned negative P2A anchor value ${a} for graph version ${e.vaultCoreVersion}`);return{depositorClaimValue:c,peginMaxFee:u,p2aAnchorValue:a}}async function he(e){const{hashlocks:t,fundedPrePeginTxHex:r,depositorBtcPubkey:n,prepeginMaxFee:h,maxAcceptableCommissionBps:c,network:u,candidates:l,unresolvedVersions:a}=e;if(t.length===0)throw new Error("reconstructPeginParams: at least one hashlock is required");if(l.length===0)throw new Error("reconstructPeginParams: candidate space is empty");const d=p.processPublicKeyToXOnly(n),s=p.stripHexPrefix(r),i=S.findAuthAnchorOpReturn(s);if(i===void 0)throw new A("Pre-PegIn carries no single, unambiguous auth-anchor OP_RETURN; the sibling set cannot be proven complete. Reconstruction refused.");if(i.vout!==t.length)throw new Error(`reconstructPeginParams: ${t.length} hashlock(s) supplied but the auth-anchor OP_RETURN sits at vout ${i.vout}, so the transaction funds ${i.vout} HTLC output(s). Reconstruction refused.`);const v=U.Transaction.fromHex(s).outs,x=t.map((m,g)=>BigInt(v[g].value)),R=p.stripHexPrefix(j.calculateBtcTxHash(s)).toLowerCase(),E=new Map,o=[],b=[],F=[];let I=0;for(const m of l)try{const g=ue(m);let P=E.get(g);P===void 0&&(P=await le(m),E.set(g,P));const k=P.depositorClaimValue+P.peginMaxFee+P.p2aAnchorValue,C=x.map(y=>y-k),V=C.findIndex(y=>y<=0n);if(V!==-1)throw new H.HtlcOutputMismatchError(`HTLC output[${V}] value ${x[V]} is not above this candidate's reserve ${k}, so it implies a non-positive pegin amount ${C[V]}.`);const{offchainParams:w,participants:B}=m,_=await W({vaultCoreVersion:m.vaultCoreVersion,siblings:t.map((y,ee)=>({hashlock:y,amount:C[ee]})),fundedPrePeginTxHex:s,depositorBtcPubkey:d,vaultProviderBtcPubkey:B.vaultProviderBtcPubkey,vaultKeeperBtcPubkeys:B.vaultKeeperBtcPubkeys,universalChallengerBtcPubkeys:B.universalChallengerBtcPubkeys,protocolFeeRate:w.protocolFeeRate,minPeginFeeRate:w.minPeginFeeRate,councilQuorum:w.councilQuorum,councilSize:w.councilSize,timelockPegin:w.timelockPegin,timelockAssert:w.timelockAssert,timelockRefund:w.timelockRefund,prepeginTxid:R,prepeginMaxFee:h,maxAcceptableCommissionBps:c,network:u});o.push({candidate:m,terms:_,peginAmounts:C,fingerprint:ce(_,C)})}catch(g){if(g instanceof T)throw g;const P=$(m),k=g instanceof Error?g.message:String(g);g instanceof H.HtlcOutputMismatchError?b.length<D&&b.push(`[${P}] ${k}`):(I++,F.length<D&&F.push(`${P} (${k})`))}const Z=a.length+I,O=[...a.map(Y),...F];if(o.length===0)throw new X(l.length,b,O);if(new Set(o.map(m=>m.fingerprint)).size>1)throw new J(o.map(m=>$(m.candidate)));if(Z>0)throw new G($(o[0].candidate),O);return{candidate:o[0].candidate,terms:o[0].terms,peginAmounts:o[0].peginAmounts,authAnchorHash:i.hash,candidatesTried:l.length,matchedCandidates:o.map(m=>m.candidate)}}function de(e,t){const{htlcVout:r,depositorBtcPubkey:n,applicationEntryPoint:h,fundedPrePeginTxHex:c,hashlocks:u,network:l}=t,{candidate:a,peginAmounts:d}=e,{offchainParams:s,participants:i}=a;if(u.length!==d.length)throw new Error(`toRefundInputs: ${u.length} hashlock(s) but ${d.length} reconstructed amount(s); the reconstruction and the hashlock vector describe different transactions.`);if(!Number.isInteger(r)||r<0||r>=d.length)throw new Error(`toRefundInputs: htlcVout ${r} is outside the reconstructed batch of ${d.length} vault(s).`);const v=d.map((E,o)=>({hashlock:p.ensureHexPrefix(u[o]),amount:E,htlcVout:o})),x={vaultCoreVersion:a.vaultCoreVersion,hashlock:v[r].hashlock,htlcVout:r,offchainParamsVersion:s.version,appVaultKeepersVersion:i.appVaultKeepersVersion,universalChallengersVersion:i.universalChallengersVersion,vaultProvider:i.vaultProvider,applicationEntryPoint:h,amount:d[r],unsignedPrePeginTxHex:c,depositorBtcPubkey:n,batch:v},R={vaultProviderPubkey:i.vaultProviderBtcPubkey,vaultKeeperPubkeys:i.vaultKeeperBtcPubkeys,universalChallengerPubkeys:i.universalChallengerBtcPubkeys,timelockRefund:s.timelockRefund,feeRate:s.protocolFeeRate,minPeginFeeRate:s.minPeginFeeRate,numLocalChallengers:i.vaultKeeperBtcPubkeys.length,councilQuorum:s.councilQuorum,councilSize:s.councilSize,network:l};return{vault:x,context:R}}exports.DEPOSIT_TERMS_REJECTED_ERROR_NAME=M;exports.DepositTermsRejectedError=L;exports.PeginParamsAmbiguousError=J;exports.PeginParamsIncompleteSpaceError=G;exports.PeginParamsNotFoundError=X;exports.PeginSizingIntegrityError=T;exports.UnanchoredPrePeginError=A;exports.VaultRootMismatchError=Q;exports.buildPeginParamsCandidates=ae;exports.deriveHashlocksFromPrePegin=ie;exports.describePeginParamsCandidate=$;exports.describeUnresolvedVersion=Y;exports.isDepositTermsRejectedError=oe;exports.isWotsMismatchError=se;exports.rebuildDepositTermsCore=W;exports.reconstructPeginParams=he;exports.toRefundInputs=de;
2
+ //# sourceMappingURL=toRefundInputs-Bdtz8p27.cjs.map