@babylonlabs-io/ts-sdk 0.72.1 → 0.74.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 (165) hide show
  1. package/README.md +56 -13
  2. package/dist/BTCVaultRegistryKeyEpochs.abi-CrQiTLfA.cjs +2 -0
  3. package/dist/BTCVaultRegistryKeyEpochs.abi-CrQiTLfA.cjs.map +1 -0
  4. package/dist/BTCVaultRegistryKeyEpochs.abi-D8cIbMtH.js +229 -0
  5. package/dist/BTCVaultRegistryKeyEpochs.abi-D8cIbMtH.js.map +1 -0
  6. package/dist/PeginManager-C9RPOd0L.js +1216 -0
  7. package/dist/PeginManager-C9RPOd0L.js.map +1 -0
  8. package/dist/PeginManager-E-UHA1un.cjs +2 -0
  9. package/dist/PeginManager-E-UHA1un.cjs.map +1 -0
  10. package/dist/bip322Verify-B7_gIhRk.cjs +2 -0
  11. package/dist/bip322Verify-B7_gIhRk.cjs.map +1 -0
  12. package/dist/bip322Verify-D6sBBUHE.js +79 -0
  13. package/dist/bip322Verify-D6sBBUHE.js.map +1 -0
  14. package/dist/{buildAndBroadcastReclaim-QIN8Mcwq.js → buildAndBroadcastReclaim-BXclIcu_.js} +3 -3
  15. package/dist/{buildAndBroadcastReclaim-QIN8Mcwq.js.map → buildAndBroadcastReclaim-BXclIcu_.js.map} +1 -1
  16. package/dist/{buildAndBroadcastReclaim-HX2xQlbM.cjs → buildAndBroadcastReclaim-U-PyFfDg.cjs} +2 -2
  17. package/dist/{buildAndBroadcastReclaim-HX2xQlbM.cjs.map → buildAndBroadcastReclaim-U-PyFfDg.cjs.map} +1 -1
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.js +237 -228
  20. package/dist/index.js.map +1 -1
  21. package/dist/onChainBtcPubkey-BbxRrbvg.cjs +2 -0
  22. package/dist/onChainBtcPubkey-BbxRrbvg.cjs.map +1 -0
  23. package/dist/onChainBtcPubkey-C-6UWpD8.js +34 -0
  24. package/dist/onChainBtcPubkey-C-6UWpD8.js.map +1 -0
  25. package/dist/{parseFundingOutpoints-BkgGihaY.cjs → parseFundingOutpoints-B4iQeX6q.cjs} +2 -2
  26. package/dist/{parseFundingOutpoints-BkgGihaY.cjs.map → parseFundingOutpoints-B4iQeX6q.cjs.map} +1 -1
  27. package/dist/{parseFundingOutpoints-DlINgQ3X.js → parseFundingOutpoints-B67CoXpF.js} +2 -2
  28. package/dist/{parseFundingOutpoints-DlINgQ3X.js.map → parseFundingOutpoints-B67CoXpF.js.map} +1 -1
  29. package/dist/pegin-registration-client-6vLk2itL.cjs +2 -0
  30. package/dist/pegin-registration-client-6vLk2itL.cjs.map +1 -0
  31. package/dist/pegin-registration-client-BdRiR8br.js +2635 -0
  32. package/dist/pegin-registration-client-BdRiR8br.js.map +1 -0
  33. package/dist/primeVpAuth-DBHohVKM.cjs +2 -0
  34. package/dist/primeVpAuth-DBHohVKM.cjs.map +1 -0
  35. package/dist/primeVpAuth-DvaD45q_.js +745 -0
  36. package/dist/primeVpAuth-DvaD45q_.js.map +1 -0
  37. package/dist/psbtInputFields-B3e05Xe6.js +171 -0
  38. package/dist/psbtInputFields-B3e05Xe6.js.map +1 -0
  39. package/dist/psbtInputFields-BIxBpPj2.cjs +2 -0
  40. package/dist/psbtInputFields-BIxBpPj2.cjs.map +1 -0
  41. package/dist/sha2-CrlWM5S8.js +312 -0
  42. package/dist/{sha2-BYVxyZzX.js.map → sha2-CrlWM5S8.js.map} +1 -1
  43. package/dist/sha2-DI0-0SHr.cjs +2 -0
  44. package/dist/{sha2-DsrLC4NM.cjs.map → sha2-DI0-0SHr.cjs.map} +1 -1
  45. package/dist/{signPsbtsWithFallback-CCFTzE0o.js → signPsbtsWithFallback-0VBALhjS.js} +2 -2
  46. package/dist/{signPsbtsWithFallback-CCFTzE0o.js.map → signPsbtsWithFallback-0VBALhjS.js.map} +1 -1
  47. package/dist/{signPsbtsWithFallback-CrkvpSJz.cjs → signPsbtsWithFallback-DMSpIQWH.cjs} +2 -2
  48. package/dist/{signPsbtsWithFallback-CrkvpSJz.cjs.map → signPsbtsWithFallback-DMSpIQWH.cjs.map} +1 -1
  49. package/dist/tbv/core/clients/eth/__tests__/eth-import-boundary.test.d.ts +2 -0
  50. package/dist/tbv/core/clients/eth/__tests__/eth-import-boundary.test.d.ts.map +1 -0
  51. package/dist/tbv/core/clients/eth/__tests__/onChainBtcPubkey.test.d.ts +2 -0
  52. package/dist/tbv/core/clients/eth/__tests__/onChainBtcPubkey.test.d.ts.map +1 -0
  53. package/dist/tbv/core/clients/eth/__tests__/payout-script.test.d.ts +2 -0
  54. package/dist/tbv/core/clients/eth/__tests__/payout-script.test.d.ts.map +1 -0
  55. package/dist/tbv/core/clients/eth/__tests__/pegin-registration-calldata.test.d.ts +2 -0
  56. package/dist/tbv/core/clients/eth/__tests__/pegin-registration-calldata.test.d.ts.map +1 -0
  57. package/dist/tbv/core/clients/eth/__tests__/pegin-registration-client.test.d.ts +2 -0
  58. package/dist/tbv/core/clients/eth/__tests__/pegin-registration-client.test.d.ts.map +1 -0
  59. package/dist/tbv/core/clients/eth/__tests__/pegin-transaction.test.d.ts +2 -0
  60. package/dist/tbv/core/clients/eth/__tests__/pegin-transaction.test.d.ts.map +1 -0
  61. package/dist/tbv/core/clients/eth/index.cjs +2 -0
  62. package/dist/tbv/core/clients/eth/index.cjs.map +1 -0
  63. package/dist/tbv/core/clients/eth/index.d.ts +4 -0
  64. package/dist/tbv/core/clients/eth/index.d.ts.map +1 -1
  65. package/dist/tbv/core/clients/eth/index.js +22 -0
  66. package/dist/tbv/core/clients/eth/index.js.map +1 -0
  67. package/dist/tbv/core/clients/eth/onChainBtcPubkey.d.ts.map +1 -1
  68. package/dist/tbv/core/clients/eth/payout-script.d.ts +4 -0
  69. package/dist/tbv/core/clients/eth/payout-script.d.ts.map +1 -0
  70. package/dist/tbv/core/clients/eth/pegin-registration-client.d.ts +99 -0
  71. package/dist/tbv/core/clients/eth/pegin-registration-client.d.ts.map +1 -0
  72. package/dist/tbv/core/clients/eth/pegin-transaction.d.ts +14 -0
  73. package/dist/tbv/core/clients/eth/pegin-transaction.d.ts.map +1 -0
  74. package/dist/tbv/core/clients/index.cjs +1 -1
  75. package/dist/tbv/core/clients/index.js +55 -48
  76. package/dist/tbv/core/clients/index.js.map +1 -1
  77. package/dist/tbv/core/clients/mempool/index.cjs +2 -0
  78. package/dist/tbv/core/clients/mempool/index.cjs.map +1 -0
  79. package/dist/tbv/core/clients/mempool/index.js +222 -0
  80. package/dist/tbv/core/clients/mempool/index.js.map +1 -0
  81. package/dist/tbv/core/contracts/index.cjs +1 -1
  82. package/dist/tbv/core/contracts/index.cjs.map +1 -1
  83. package/dist/tbv/core/contracts/index.js +491 -12
  84. package/dist/tbv/core/contracts/index.js.map +1 -1
  85. package/dist/tbv/core/index.cjs +1 -1
  86. package/dist/tbv/core/index.d.ts +4 -0
  87. package/dist/tbv/core/index.d.ts.map +1 -1
  88. package/dist/tbv/core/index.js +235 -226
  89. package/dist/tbv/core/index.js.map +1 -1
  90. package/dist/tbv/core/managers/PeginManager.d.ts +38 -30
  91. package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
  92. package/dist/tbv/core/managers/index.cjs +1 -1
  93. package/dist/tbv/core/managers/index.d.ts +2 -1
  94. package/dist/tbv/core/managers/index.d.ts.map +1 -1
  95. package/dist/tbv/core/managers/index.js +2 -2
  96. package/dist/tbv/core/pegin-fingerprint/__tests__/peginFingerprint.golden.test.d.ts +62 -0
  97. package/dist/tbv/core/pegin-fingerprint/__tests__/peginFingerprint.golden.test.d.ts.map +1 -0
  98. package/dist/tbv/core/pegin-fingerprint/__tests__/peginFingerprint.test.d.ts +15 -0
  99. package/dist/tbv/core/pegin-fingerprint/__tests__/peginFingerprint.test.d.ts.map +1 -0
  100. package/dist/tbv/core/pegin-fingerprint/index.d.ts +14 -0
  101. package/dist/tbv/core/pegin-fingerprint/index.d.ts.map +1 -0
  102. package/dist/tbv/core/pegin-fingerprint/peginFingerprint.d.ts +141 -0
  103. package/dist/tbv/core/pegin-fingerprint/peginFingerprint.d.ts.map +1 -0
  104. package/dist/tbv/core/services/index.cjs +1 -1
  105. package/dist/tbv/core/services/index.js +2 -2
  106. package/dist/tbv/core/utils/eth/index.cjs +2 -0
  107. package/dist/tbv/core/utils/eth/index.cjs.map +1 -0
  108. package/dist/tbv/core/utils/eth/index.js +109 -0
  109. package/dist/tbv/core/utils/eth/index.js.map +1 -0
  110. package/dist/tbv/core/utils/index.cjs +1 -1
  111. package/dist/tbv/core/utils/index.js +41 -40
  112. package/dist/tbv/core/utils/index.js.map +1 -1
  113. package/dist/tbv/core/vault-secrets/index.cjs +1 -1
  114. package/dist/tbv/core/vault-secrets/index.js +1 -1
  115. package/dist/tbv/index.cjs +1 -1
  116. package/dist/tbv/index.js +235 -226
  117. package/dist/tbv/index.js.map +1 -1
  118. package/dist/testing/index.cjs +1 -1
  119. package/dist/testing/index.js +1 -1
  120. package/dist/toRefundInputs-BwG6T0PP.cjs +2 -0
  121. package/dist/toRefundInputs-BwG6T0PP.cjs.map +1 -0
  122. package/dist/{toRefundInputs-BG-qHCEu.js → toRefundInputs-C3oIN0aW.js} +237 -139
  123. package/dist/toRefundInputs-C3oIN0aW.js.map +1 -0
  124. package/dist/types-CPDLZm3l.js +430 -0
  125. package/dist/types-CPDLZm3l.js.map +1 -0
  126. package/dist/types-DSlcXtog.cjs +2 -0
  127. package/dist/types-DSlcXtog.cjs.map +1 -0
  128. package/package.json +32 -3
  129. package/dist/BTCVaultRegistryKeyEpochs.abi-CXjhRZbm.js +0 -111
  130. package/dist/BTCVaultRegistryKeyEpochs.abi-CXjhRZbm.js.map +0 -1
  131. package/dist/BTCVaultRegistryKeyEpochs.abi-_NERAdc5.cjs +0 -2
  132. package/dist/BTCVaultRegistryKeyEpochs.abi-_NERAdc5.cjs.map +0 -1
  133. package/dist/PeginManager-Bwjqb0_6.cjs +0 -2
  134. package/dist/PeginManager-Bwjqb0_6.cjs.map +0 -1
  135. package/dist/PeginManager-DjatPUPS.js +0 -1503
  136. package/dist/PeginManager-DjatPUPS.js.map +0 -1
  137. package/dist/ProtocolParams.abi-C0TSRaHV.js +0 -486
  138. package/dist/ProtocolParams.abi-C0TSRaHV.js.map +0 -1
  139. package/dist/ProtocolParams.abi-CYZoV2EI.cjs +0 -2
  140. package/dist/ProtocolParams.abi-CYZoV2EI.cjs.map +0 -1
  141. package/dist/errors-Blc-JWnI.js +0 -121
  142. package/dist/errors-Blc-JWnI.js.map +0 -1
  143. package/dist/errors-CGcNP0rV.cjs +0 -2
  144. package/dist/errors-CGcNP0rV.cjs.map +0 -1
  145. package/dist/mempoolApi-BJvC9nPF.cjs +0 -2
  146. package/dist/mempoolApi-BJvC9nPF.cjs.map +0 -1
  147. package/dist/mempoolApi-_CoQH5vH.js +0 -612
  148. package/dist/mempoolApi-_CoQH5vH.js.map +0 -1
  149. package/dist/onChainBtcPubkey-B5ZvWCCF.cjs +0 -2
  150. package/dist/onChainBtcPubkey-B5ZvWCCF.cjs.map +0 -1
  151. package/dist/onChainBtcPubkey-DATNfAAl.js +0 -19
  152. package/dist/onChainBtcPubkey-DATNfAAl.js.map +0 -1
  153. package/dist/primeVpAuth-BI63kgdd.js +0 -1171
  154. package/dist/primeVpAuth-BI63kgdd.js.map +0 -1
  155. package/dist/primeVpAuth-D3xbar3j.cjs +0 -2
  156. package/dist/primeVpAuth-D3xbar3j.cjs.map +0 -1
  157. package/dist/sha2-BYVxyZzX.js +0 -274
  158. package/dist/sha2-DsrLC4NM.cjs +0 -2
  159. package/dist/toRefundInputs-BG-qHCEu.js.map +0 -1
  160. package/dist/toRefundInputs-kVR-3EdD.cjs +0 -2
  161. package/dist/toRefundInputs-kVR-3EdD.cjs.map +0 -1
  162. package/dist/waitForTransactionReceiptSmartAware-DpQ69ySe.cjs +0 -2
  163. package/dist/waitForTransactionReceiptSmartAware-DpQ69ySe.cjs.map +0 -1
  164. package/dist/waitForTransactionReceiptSmartAware-z3Xfmo44.js +0 -277
  165. package/dist/waitForTransactionReceiptSmartAware-z3Xfmo44.js.map +0 -1
package/dist/tbv/index.js CHANGED
@@ -1,266 +1,275 @@
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 E, g as d } from "../verifyScriptPathSchnorrSignature-Ciq_xZhw.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 f, validatePeginP2aAnchor as I } 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, f as B, r as H } from "../noPayout-DpGRzidi.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 E, d as c, e as u, g as d } from "../verifyScriptPathSchnorrSignature-Ciq_xZhw.js";
2
+ import { a as R } from "../vaultCoreVersion-D_fP9P3C.js";
3
+ import { computeMinClaimValue as _, computeMinPeginFee as g, deriveVaultId as T, expandAuthAnchor as m, expandHashlockSecret as S, expandWotsSeed as I, peginP2aAnchorOutput as C, supportedTxGraphVersions as O, validatePeginP2aAnchor as f } from "./core/wasm/index.js";
4
+ import { a as N, c as b, b as V, e as h, f as v } from "../verifyKeyPathSchnorrSignature-BrgUJmV0.js";
5
+ import { c as F, a as D, b as y, e as U, f as B, r as H } from "../noPayout-DpGRzidi.js";
6
6
  import { b as K } from "../challengeAssert-Cp_GeRg8.js";
7
- import { c as k, d as W, a as w, b as G, e as j, f as Y, k as z, g as J, h as Z, i as q, j as Q, p as $, s as aa, t as ea, u as sa, v as ta } from "../bitcoin-C-TuHb-v.js";
7
+ import { c as k, d as G, a as W, b as w, e as Y, f as j, k as z, g as J, h as Z, i as q, j as Q, p as $, s as aa, t as ea, u as sa, v as ta } from "../bitcoin-C-TuHb-v.js";
8
8
  import { c as ia } from "../abortSignals-BPpAUL1Z.js";
9
9
  import { c as na, a as Pa } from "../signing-Cm-McVR2.js";
10
- import { B as ca, C as ua, H as Ea, K as da, M as la, T as Aa, X as Ra } from "../validation-OSC0xTHB.js";
11
- import { C as ga, M as Ta, P as Sa, b as ma, a as Ca, c as Oa, d as fa, f as Ia, e as ba } from "../PeginManager-DjatPUPS.js";
12
- import { P as ha, c as Va, f as va, r as Ma, s as Na, v as Fa } from "../signPsbtsWithFallback-CCFTzE0o.js";
13
- import { A as Da, P as Ua } from "../ProtocolParams.abi-C0TSRaHV.js";
14
- import { B as Ha } from "../BTCVaultRegistry.abi-CJwWI2EO.js";
15
- import { B as Ka } from "../BTCVaultRegistryKeyEpochs.abi-CXjhRZbm.js";
16
- import { C as ka, e as Wa, g as wa, h as Ga, i as ja } from "../errors-Blc-JWnI.js";
17
- import { V as za, b as Ja, a as Za, d as qa, f as Qa, p as $a } from "../parseFundingOutpoints-DlINgQ3X.js";
18
- import { B as ee, a as se, c as te, b as re, d as ie, g as oe, h as ne, f as Pe, s as pe, e as ce, w as ue } from "../waitForTransactionReceiptSmartAware-z3Xfmo44.js";
19
- import { B as de, D as le, L as Ae, M as Re, c as _e, P as ge, b as Te, a as Se, S as me, T as Ce, W as Oe, f as fe, d as Ie, p as be, r as xe } from "../fundPeginTransaction-B2wyjqp0.js";
20
- import { U as Ve, a as ve, e as Me, f as Ne, v as Fe } from "../reservation-Cj9F0rP9.js";
21
- import { M as De, V as Ue, g as Be, a as He, b as Le, c as Ke, d as Xe, e as ke, f as We, h as we, i as Ge, p as je, v as Ye, j as ze, k as Je } from "../mempoolApi-_CoQH5vH.js";
22
- import { V as qe, a as Qe, b as $e, v as as } from "../index-LgmJhdEN.js";
23
- import { A as ss, D as ts, J as rs, a as is, b as os, d as ns, P as Ps, R as ps, e as cs, c as us, V as Es, i as ds } from "../json-rpc-client-DuUARJvV.js";
24
- import { O as As, S as Rs, b as _s, d as gs, e as Ts, f as Ss, V as ms, c as Cs, p as Os, r as fs, v as Is, a as bs } from "../primeVpAuth-BI63kgdd.js";
25
- import { a as hs } from "../onChainBtcPubkey-DATNfAAl.js";
26
- import { D as vs, a as Ms, h as Ns, j as Fs, P as ys, k as Ds, U as Us, V as Bs, c as Hs, d as Ls, f as Ks, e as Xs, b as ks, i as Ws, r as ws, g as Gs, t as js } from "../toRefundInputs-BG-qHCEu.js";
27
- import { H as zs, E as Js, P as Zs, o as qs, c as Qs, d as $s, S as at, T as et, U as st, V as tt, K as rt, L as it, M as ot, N as nt, O as Pt, R as pt, a as ct, b as ut, y as Et, Q as dt, I as lt, J as At, g as Rt, z as _t, p as gt, i as Tt, e as St, G as mt, F as Ct, t as Ot, A as ft, B as It, C as bt, D as xt, r as ht, s as Vt, f as vt, h as Mt, j as Nt, v as Ft, k as yt, l as Dt, m as Ut, n as Bt, q as Ht, u as Lt, w as Kt, x as Xt } from "../buildAndBroadcastReclaim-QIN8Mcwq.js";
28
- import { C as Wt, P as wt, c as Gt, g as jt, i as Yt } from "../peginState-CxDiaKuk.js";
10
+ import { B as Ea, C as ca, H as ua, K as da, M as la, T as Ra, X as Aa } from "../validation-OSC0xTHB.js";
11
+ import { waitForTransactionReceiptSmartAware as ga } from "./core/utils/eth/index.js";
12
+ import { P as ma, b as Sa, c as Ia, d as Ca, a as Oa, e as fa } from "../PeginManager-C9RPOd0L.js";
13
+ import { P as Na, c as ba, f as Va, r as ha, s as va, v as Ma } from "../signPsbtsWithFallback-0VBALhjS.js";
14
+ import { MEMPOOL_API_URLS as Da, getAddressTxs as ya, getAddressUtxos as Ua, getMempoolApiUrl as Ba, getNetworkFees as Ha, getOutspend as La, getTipHeight as Ka, getTxHex as Xa, getTxInfo as ka, getUtxoInfo as Ga, pushTx as Wa } from "./core/clients/mempool/index.js";
15
+ import { O as Ya, V as ja, a as za, b as Ja, c as Za, r as qa } from "../types-CPDLZm3l.js";
16
+ import { a as $a } from "../onChainBtcPubkey-C-6UWpD8.js";
17
+ import { C as ee, M as se, V as te, c as re, e as ie, d as oe, v as ne, a as Pe, b as pe } from "../pegin-registration-client-BdRiR8br.js";
18
+ import { ApplicationRegistryABI as ce, ProtocolParamsABI as ue } from "./core/contracts/index.js";
19
+ import { B as le } from "../BTCVaultRegistry.abi-CJwWI2EO.js";
20
+ import { B as Ae, C as _e, e as ge, g as Te, h as me, i as Se } from "../BTCVaultRegistryKeyEpochs.abi-D8cIbMtH.js";
21
+ import { V as Ce, b as Oe, a as fe, d as xe, f as Ne, p as be } from "../parseFundingOutpoints-B67CoXpF.js";
22
+ import { B as he, a as ve, c as Me, b as Fe, d as De, g as ye, h as Ue, f as Be, s as He, e as Le } from "../psbtInputFields-B3e05Xe6.js";
23
+ import { B as Xe, D as ke, L as Ge, M as We, c as we, P as Ye, b as je, a as ze, S as Je, T as Ze, W as qe, f as Qe, d as $e, p as as, r as es } from "../fundPeginTransaction-B2wyjqp0.js";
24
+ import { U as ts, a as rs, e as is, f as os, v as ns } from "../reservation-Cj9F0rP9.js";
25
+ import { V as ps, a as Es, b as cs, v as us } from "../index-LgmJhdEN.js";
26
+ import { A as ls, D as Rs, J as As, a as _s, b as gs, d as Ts, P as ms, R as Ss, e as Is, c as Cs, V as Os, i as fs } from "../json-rpc-client-DuUARJvV.js";
27
+ import { S as Ns, V as bs, c as Vs, p as hs, v as vs, a as Ms } from "../primeVpAuth-DvaD45q_.js";
28
+ import { D as Ds, d as ys, P as Us, a as Bs, b as Hs, n as Ls, o as Ks, m as Xs, p as ks, U as Gs, V as Ws, h as ws, c as Ys, g as js, k as zs, j as Js, e as Zs, f as qs, i as Qs, r as $s, l as at, t as et } from "../toRefundInputs-C3oIN0aW.js";
29
+ import { H as tt, E as rt, P as it, o as ot, c as nt, d as Pt, S as pt, T as Et, U as ct, V as ut, K as dt, L as lt, M as Rt, N as At, O as _t, R as gt, a as Tt, b as mt, y as St, Q as It, I as Ct, J as Ot, g as ft, z as xt, p as Nt, i as bt, e as Vt, G as ht, F as vt, t as Mt, A as Ft, B as Dt, C as yt, D as Ut, r as Bt, s as Ht, f as Lt, h as Kt, j as Xt, v as kt, k as Gt, l as Wt, m as wt, n as Yt, q as jt, u as zt, w as Jt, x as Zt } from "../buildAndBroadcastReclaim-BXclIcu_.js";
30
+ import { C as Qt, P as $t, c as ar, g as er, i as sr } from "../peginState-CxDiaKuk.js";
29
31
  export {
30
- ss as AUTH_REJECTED_RPC_CODE,
31
- Da as ApplicationRegistryABI,
32
- zs as BIP68NotMatureError,
33
- ca as BITCOIN_ADDRESS_RE,
34
- Ha as BTCVaultRegistryABI,
35
- Ka as BTCVaultRegistryKeyEpochsABI,
36
- de as BTC_DUST_SAT,
37
- ee as BitcoinScriptType,
38
- ga as COMMISSION_BPS_HEADROOM,
39
- ua as COMPRESSED_PUBKEY_HEX_LEN,
40
- ka as CONTRACT_ERRORS,
41
- Js as ClaimerPegoutStatusValue,
42
- Wt as ContractStatus,
43
- vs as DEPOSIT_TERMS_REJECTED_ERROR_NAME,
44
- le as DUST_THRESHOLD,
45
- ts as DaemonStatus,
46
- Ms as DepositTermsRejectedError,
47
- Ea as HEX_RE,
48
- rs as JSON_RPC_ERROR_CODES,
49
- is as JsonRpcClient,
50
- os as JsonRpcError,
32
+ ls as AUTH_REJECTED_RPC_CODE,
33
+ ce as ApplicationRegistryABI,
34
+ tt as BIP68NotMatureError,
35
+ Ea as BITCOIN_ADDRESS_RE,
36
+ le as BTCVaultRegistryABI,
37
+ Ae as BTCVaultRegistryKeyEpochsABI,
38
+ Xe as BTC_DUST_SAT,
39
+ he as BitcoinScriptType,
40
+ ee as COMMISSION_BPS_HEADROOM,
41
+ ca as COMPRESSED_PUBKEY_HEX_LEN,
42
+ _e as CONTRACT_ERRORS,
43
+ rt as ClaimerPegoutStatusValue,
44
+ Qt as ContractStatus,
45
+ Ds as DEPOSIT_TERMS_REJECTED_ERROR_NAME,
46
+ ke as DUST_THRESHOLD,
47
+ Rs as DaemonStatus,
48
+ ys as DepositTermsRejectedError,
49
+ ua as HEX_RE,
50
+ As as JSON_RPC_ERROR_CODES,
51
+ _s as JsonRpcClient,
52
+ gs as JsonRpcError,
51
53
  da as KNOWN_SCRIPT_PREFIXES,
52
- Ae as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
53
- Ta as MAX_ACCEPTABLE_COMMISSION_BPS_CAP,
54
- Re as MAX_NON_LEGACY_OUTPUT_SIZE,
54
+ Ge as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
55
+ se as MAX_ACCEPTABLE_COMMISSION_BPS_CAP,
56
+ We as MAX_NON_LEGACY_OUTPUT_SIZE,
55
57
  la as MAX_REASONABLE_FEE_SATS,
56
- _e as MAX_REASONABLE_PEGIN_VBYTES,
57
- De as MEMPOOL_API_URLS,
58
- As as OnChainBtcVaultStatus,
59
- ge as P2TR_INPUT_SIZE,
60
- Te as PEGIN_AUTH_ANCHOR_OUTPUTS,
58
+ we as MAX_REASONABLE_PEGIN_VBYTES,
59
+ Da as MEMPOOL_API_URLS,
60
+ Ya as OnChainBtcVaultStatus,
61
+ Ye as P2TR_INPUT_SIZE,
62
+ je as PEGIN_AUTH_ANCHOR_OUTPUTS,
61
63
  s as PEGIN_DEPOSITOR_CLAIM_VOUT,
62
- Zs as PEGIN_ETH_CONFIRMATIONS,
63
- Se as PEGIN_FIXED_OUTPUTS,
64
- ns as POST_WOTS_STATUSES,
65
- Ps as PRE_DEPOSITOR_SIGNATURES_STATES,
66
- qs as ParticipantKeyDriftError,
67
- ha as PayoutManager,
68
- wt as PeginAction,
69
- Sa as PeginManager,
70
- Ns as PeginParamsAmbiguousError,
71
- Fs as PeginParamsIncompleteSpaceError,
72
- ys as PeginParamsNotFoundError,
73
- Qs as PeginRegistrationMissingError,
74
- $s as PeginRegistrationNotFinalError,
75
- Ds as PeginSizingIntegrityError,
76
- Ua as ProtocolParamsABI,
64
+ it as PEGIN_ETH_CONFIRMATIONS,
65
+ Us as PEGIN_FINGERPRINT_DOMAIN,
66
+ Bs as PEGIN_FINGERPRINT_DOMAIN_PREIMAGE,
67
+ ze as PEGIN_FIXED_OUTPUTS,
68
+ Ts as POST_WOTS_STATUSES,
69
+ ms as PRE_DEPOSITOR_SIGNATURES_STATES,
70
+ ot as ParticipantKeyDriftError,
71
+ Na as PayoutManager,
72
+ $t as PeginAction,
73
+ Hs as PeginFingerprintInputError,
74
+ ma as PeginManager,
75
+ Ls as PeginParamsAmbiguousError,
76
+ Ks as PeginParamsIncompleteSpaceError,
77
+ Xs as PeginParamsNotFoundError,
78
+ nt as PeginRegistrationMissingError,
79
+ Pt as PeginRegistrationNotFinalError,
80
+ ks as PeginSizingIntegrityError,
81
+ ue as ProtocolParamsABI,
77
82
  t as PsbtSubstitutionError,
78
- at as RECLAIM_MAX_FEE_FRACTION_DENOMINATOR,
79
- et as RECLAIM_MAX_FEE_FRACTION_NUMERATOR,
80
- st as RECLAIM_MAX_FEE_RATE_SATS_VB,
81
- tt as RECLAIM_WARN_FEE_FRACTION_NUMERATOR,
82
- rt as REFUND_MAX_FEE_FRACTION_DENOMINATOR,
83
- it as REFUND_MAX_FEE_FRACTION_NUMERATOR,
84
- ot as REFUND_MAX_FEE_RATE_SATS_VB,
85
- nt as REFUND_VSIZE,
86
- Pt as ReclaimUneconomicalError,
87
- pt as RegisteredVaultVersionMismatchError,
88
- ps as RpcErrorCode,
89
- me as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
90
- Rs as ServerIdentityError,
91
- Aa as TXID_RE,
92
- Ce as TX_BUFFER_SIZE_OVERHEAD,
93
- Us as UnanchoredPrePeginError,
94
- Ve as UtxoNotAvailableError,
95
- za as VAULT_APP_NAME,
96
- cs as VP_BATCH_MAX_SIZE,
97
- us as VP_TERMINAL_FAILURE_STATUSES,
98
- Es as VP_TRANSIENT_STATUSES,
99
- qe as VaultProviderRpcClient,
100
- Bs as VaultRootMismatchError,
101
- _s as ViemOperationKeyReader,
102
- gs as ViemProtocolParamsReader,
103
- Ts as ViemUniversalChallengerReader,
104
- Ss as ViemVaultKeeperReader,
105
- Ue as ViemVaultRegistryReader,
106
- Qe as VpResponseValidationError,
107
- ms as VpTokenRegistry,
108
- Oe as WALLET_RELAY_FEE_RATE_THRESHOLD,
109
- Ra as X_ONLY_PUBKEY_HEX_LEN,
110
- ct as activateVault,
111
- ut as activateVaultAndRedeem,
112
- se as applyChangeOutputPolicy,
113
- x as assertKeyPathSchnorrSignature,
114
- hs as assertOnChainBtcPubkey,
83
+ pt as RECLAIM_MAX_FEE_FRACTION_DENOMINATOR,
84
+ Et as RECLAIM_MAX_FEE_FRACTION_NUMERATOR,
85
+ ct as RECLAIM_MAX_FEE_RATE_SATS_VB,
86
+ ut as RECLAIM_WARN_FEE_FRACTION_NUMERATOR,
87
+ dt as REFUND_MAX_FEE_FRACTION_DENOMINATOR,
88
+ lt as REFUND_MAX_FEE_FRACTION_NUMERATOR,
89
+ Rt as REFUND_MAX_FEE_RATE_SATS_VB,
90
+ At as REFUND_VSIZE,
91
+ _t as ReclaimUneconomicalError,
92
+ gt as RegisteredVaultVersionMismatchError,
93
+ Ss as RpcErrorCode,
94
+ Je as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
95
+ Ns as ServerIdentityError,
96
+ Ra as TXID_RE,
97
+ Ze as TX_BUFFER_SIZE_OVERHEAD,
98
+ Gs as UnanchoredPrePeginError,
99
+ ts as UtxoNotAvailableError,
100
+ Ce as VAULT_APP_NAME,
101
+ Is as VP_BATCH_MAX_SIZE,
102
+ Cs as VP_TERMINAL_FAILURE_STATUSES,
103
+ Os as VP_TRANSIENT_STATUSES,
104
+ ps as VaultProviderRpcClient,
105
+ Ws as VaultRootMismatchError,
106
+ ja as ViemOperationKeyReader,
107
+ te as ViemPeginRegistrationClient,
108
+ za as ViemProtocolParamsReader,
109
+ Ja as ViemUniversalChallengerReader,
110
+ Za as ViemVaultKeeperReader,
111
+ re as ViemVaultRegistryReader,
112
+ Es as VpResponseValidationError,
113
+ bs as VpTokenRegistry,
114
+ qe as WALLET_RELAY_FEE_RATE_THRESHOLD,
115
+ Aa as X_ONLY_PUBKEY_HEX_LEN,
116
+ Tt as activateVault,
117
+ mt as activateVaultAndRedeem,
118
+ ve as applyChangeOutputPolicy,
119
+ N as assertKeyPathSchnorrSignature,
120
+ $a as assertOnChainBtcPubkey,
115
121
  r as assertPsbtUnsignedTxMatches,
116
- h as assertReturnedKeyPathSignatures,
122
+ b as assertReturnedKeyPathSignatures,
117
123
  i as assertScriptPathSchnorrSignature,
118
- ve as assertUtxosAvailable,
119
- A as assertValidVaultCoreVersion,
120
- Et as assertVaultProviderHintAccepted,
121
- $e as batchPollByProvider,
122
- dt as buildAndBroadcastReclaim,
123
- lt as buildAndBroadcastRefund,
124
+ rs as assertUtxosAvailable,
125
+ R as assertValidVaultCoreVersion,
126
+ St as assertVaultProviderHintAccepted,
127
+ cs as batchPollByProvider,
128
+ It as buildAndBroadcastReclaim,
129
+ Ct as buildAndBroadcastRefund,
124
130
  K as buildChallengeAssertPsbt,
125
- ma as buildDepositTerms,
126
- Ja as buildFundingOutpointsCommitment,
131
+ Sa as buildDepositTerms,
132
+ Oe as buildFundingOutpointsCommitment,
127
133
  F as buildNoPayoutPsbt,
128
134
  o as buildPayoutPsbt,
129
135
  V as buildPeginInputPsbt,
130
- Hs as buildPeginParamsCandidates,
136
+ ws as buildPeginParamsCandidates,
131
137
  n as buildPeginTxFromFundedPrePegin,
132
138
  P as buildPrePeginPsbt,
133
- y as buildReclaimPsbt,
134
- D as buildRefundPsbt,
135
- Za as buildVaultContext,
139
+ D as buildReclaimPsbt,
140
+ y as buildRefundPsbt,
141
+ fe as buildVaultContext,
136
142
  na as calculateBtcTxHash,
137
- Gt as canPerformAction,
143
+ ar as canPerformAction,
138
144
  k as canonicalizeBtcPubkey,
139
- Ca as capMaxAcceptableCommissionBps,
145
+ ie as capMaxAcceptableCommissionBps,
140
146
  ia as combineAbortSignals,
141
- te as computeChangeOutputFeeSats,
142
- Va as computeHashlock,
143
- re as computeMaxDeposit,
147
+ Me as computeChangeOutputFeeSats,
148
+ ba as computeHashlock,
149
+ Fe as computeMaxDeposit,
144
150
  _ as computeMinClaimValue,
145
151
  g as computeMinPeginFee,
146
152
  p as computeNumLocalChallengers,
147
- ie as computePeginBaseFeeSats,
148
- Oa as computeWotsBlockPublicKeysHash,
149
- Cs as createAuthenticatedVpClient,
150
- c as createPayoutScript,
153
+ De as computePeginBaseFeeSats,
154
+ Ys as computePeginFingerprint,
155
+ Ia as computeWotsBlockPublicKeysHash,
156
+ Vs as createAuthenticatedVpClient,
157
+ E as createPayoutScript,
151
158
  Pa as createTaprootScriptPathSignOptions,
152
- W as deriveBip86ScriptPubKeyHex,
153
- u as deriveDepositorClaimDescriptor,
154
- E as deriveDepositorClaimScriptPubKey,
155
- Ls as deriveHashlocksFromPrePegin,
156
- w as deriveNativeSegwitAddress,
157
- G as deriveTaprootAddress,
159
+ G as deriveBip86ScriptPubKeyHex,
160
+ c as deriveDepositorClaimDescriptor,
161
+ u as deriveDepositorClaimScriptPubKey,
162
+ js as deriveHashlocksFromPrePegin,
163
+ W as deriveNativeSegwitAddress,
164
+ oe as derivePeginVaultId,
165
+ w as deriveTaprootAddress,
158
166
  T as deriveVaultId,
159
- qa as deriveVaultRoot,
160
- fa as deriveWotsBlocksFromSeed,
161
- Ks as describePeginParamsCandidate,
162
- Xs as describeUnresolvedVersion,
163
- j as ensureHexPrefix,
164
- Ia as ensurePrePeginTermsApproval,
167
+ xe as deriveVaultRoot,
168
+ Ca as deriveWotsBlocksFromSeed,
169
+ zs as describePeginParamsCandidate,
170
+ Js as describeUnresolvedVersion,
171
+ Zs as encodePeginFingerprintPreimage,
172
+ Y as ensureHexPrefix,
173
+ Oa as ensurePrePeginTermsApproval,
165
174
  U as estimateReclaimFeeSats,
166
- At as estimateRefundFeeSats,
167
- ba as estimateSubmitPeginRequestBatchGas,
168
- S as expandAuthAnchor,
169
- m as expandHashlockSecret,
170
- C as expandWotsSeed,
171
- Wa as extractErrorData,
172
- Me as extractInputsFromTransaction,
175
+ Ot as estimateRefundFeeSats,
176
+ fa as estimateSubmitPeginRequestBatchGas,
177
+ m as expandAuthAnchor,
178
+ S as expandHashlockSecret,
179
+ I as expandWotsSeed,
180
+ ge as extractErrorData,
181
+ is as extractInputsFromTransaction,
173
182
  d as extractPayoutSignature,
174
- v as extractPeginInputSignature,
175
- M as finalizePeginInputPsbt,
183
+ h as extractPeginInputSignature,
184
+ v as finalizePeginInputPsbt,
176
185
  B as finalizeScriptPathWithSignatures,
177
- Ne as findOverlappingPendingVaults,
178
- Y as formatSatoshisToBtc,
179
- va as forwardDepositApproval,
180
- Qa as forwardDeriveContextHash,
181
- fe as fundPeginTransaction,
182
- Be as getAddressTxs,
183
- He as getAddressUtxos,
184
- wa as getContractErrorMessage,
185
- oe as getDustThreshold,
186
- Le as getMempoolApiUrl,
186
+ os as findOverlappingPendingVaults,
187
+ j as formatSatoshisToBtc,
188
+ Va as forwardDepositApproval,
189
+ Ne as forwardDeriveContextHash,
190
+ Qe as fundPeginTransaction,
191
+ ya as getAddressTxs,
192
+ Ua as getAddressUtxos,
193
+ Te as getContractErrorMessage,
194
+ ye as getDustThreshold,
195
+ Ba as getMempoolApiUrl,
187
196
  z as getNetwork,
188
- Ke as getNetworkFees,
189
- Xe as getOutspend,
190
- jt as getPeginProtocolState,
191
- ne as getPsbtInputFields,
192
- Pe as getScriptType,
197
+ Ha as getNetworkFees,
198
+ La as getOutspend,
199
+ er as getPeginProtocolState,
200
+ Ue as getPsbtInputFields,
201
+ Be as getScriptType,
193
202
  J as getSortedXOnlyPubkeys,
194
- ke as getTipHeight,
195
- We as getTxHex,
196
- we as getTxInfo,
197
- Ge as getUtxoInfo,
198
- Ga as handleContractError,
203
+ Ka as getTipHeight,
204
+ Xa as getTxHex,
205
+ ka as getTxInfo,
206
+ Ga as getUtxoInfo,
207
+ me as handleContractError,
199
208
  Z as hexToUint8Array,
200
- Yt as isActivationDeadlinePassedOnChain,
209
+ sr as isActivationDeadlinePassedOnChain,
201
210
  q as isAddressFromPublicKey,
202
- ds as isAuthRejectedError,
203
- Rt as isDepositAmountValid,
204
- ks as isDepositTermsRejectedError,
205
- _t as isHintAccepted,
206
- ja as isKnownContractError,
207
- gt as isParticipantKeyDriftError,
208
- Tt as isPeginRegistrationMissingError,
209
- St as isPeginRegistrationNotFinalError,
210
- mt as isPegoutTerminalStatus,
211
- Ct as isRecognizedPegoutStatus,
212
- Ot as isRegisteredVaultVersionMismatchError,
211
+ fs as isAuthRejectedError,
212
+ ft as isDepositAmountValid,
213
+ qs as isDepositTermsRejectedError,
214
+ xt as isHintAccepted,
215
+ Se as isKnownContractError,
216
+ Nt as isParticipantKeyDriftError,
217
+ bt as isPeginRegistrationMissingError,
218
+ Vt as isPeginRegistrationNotFinalError,
219
+ ht as isPegoutTerminalStatus,
220
+ vt as isRecognizedPegoutStatus,
221
+ Mt as isRegisteredVaultVersionMismatchError,
213
222
  Q as isValidHex,
214
- Ws as isWotsMismatchError,
215
- ft as matchKeyHint,
216
- It as matchKeySetHint,
217
- $a as parseFundingOutpointsFromTx,
218
- Ie as parseUnfundedWasmTransaction,
219
- be as peginOutputCount,
220
- O as peginP2aAnchorOutput,
221
- Os as primeVpTokenRegistry,
223
+ Qs as isWotsMismatchError,
224
+ Ft as matchKeyHint,
225
+ Dt as matchKeySetHint,
226
+ be as parseFundingOutpointsFromTx,
227
+ $e as parseUnfundedWasmTransaction,
228
+ as as peginOutputCount,
229
+ C as peginP2aAnchorOutput,
230
+ hs as primeVpTokenRegistry,
222
231
  $ as processPublicKeyToXOnly,
223
- je as pushTx,
224
- xe as rateBasedTxBufferFee,
225
- ws as rebuildDepositTermsCore,
232
+ Wa as pushTx,
233
+ es as rateBasedTxBufferFee,
234
+ $s as rebuildDepositTermsCore,
226
235
  H as reclaimVsize,
227
- Gs as reconstructPeginParams,
228
- Ma as requireChangeAddress,
229
- bt as resolveCurrentParticipantKeys,
230
- xt as resolveParticipantKeysAtEpochs,
231
- fs as resolveProtocolAddresses,
232
- ht as runDepositorPresignFlow,
233
- pe as selectUtxosForPegin,
234
- ce as shouldAddChangeOutput,
235
- Vt as signDepositorGraph,
236
+ at as reconstructPeginParams,
237
+ ha as requireChangeAddress,
238
+ yt as resolveCurrentParticipantKeys,
239
+ Ut as resolveParticipantKeysAtEpochs,
240
+ qa as resolveProtocolAddresses,
241
+ Bt as runDepositorPresignFlow,
242
+ He as selectUtxosForPegin,
243
+ Le as shouldAddChangeOutput,
244
+ Ht as signDepositorGraph,
236
245
  aa as stripHexPrefix,
237
- vt as submitWotsPublicKey,
238
- f as supportedTxGraphVersions,
239
- Na as supportsDepositApproval,
240
- js as toRefundInputs,
246
+ Lt as submitWotsPublicKey,
247
+ O as supportedTxGraphVersions,
248
+ va as supportsDepositApproval,
249
+ et as toRefundInputs,
241
250
  ea as toXOnly,
242
251
  sa as uint8ArrayToHex,
243
- Mt as validateDepositAmount,
244
- Nt as validateMultiVaultDepositInputs,
245
- Ye as validateOffchainParams,
246
- Ft as validateOnChainParticipantKeys,
247
- ze as validatePegInConfiguration,
248
- I as validatePeginP2aAnchor,
249
- yt as validateProviderSelection,
250
- Dt as validateRemainingCapacity,
251
- as as validateRequestDepositorClaimerArtifactsResponse,
252
- Fa as validateSecretAgainstHashlock,
253
- Je as validateTBVProtocolParams,
254
- Fe as validateUtxosAvailable,
255
- Ut as validateVaultAmounts,
256
- Bt as validateVaultProviderPubkey,
252
+ Kt as validateDepositAmount,
253
+ Xt as validateMultiVaultDepositInputs,
254
+ ne as validateOffchainParams,
255
+ kt as validateOnChainParticipantKeys,
256
+ Pe as validatePegInConfiguration,
257
+ f as validatePeginP2aAnchor,
258
+ Gt as validateProviderSelection,
259
+ Wt as validateRemainingCapacity,
260
+ us as validateRequestDepositorClaimerArtifactsResponse,
261
+ Ma as validateSecretAgainstHashlock,
262
+ pe as validateTBVProtocolParams,
263
+ ns as validateUtxosAvailable,
264
+ wt as validateVaultAmounts,
265
+ Yt as validateVaultProviderPubkey,
257
266
  ta as validateWalletPubkey,
258
- Ht as verifyRegisteredParticipantKeys,
259
- Lt as verifyRegisteredVaultVersions,
260
- Is as verifyServerIdentity,
261
- bs as vpTokenRegistry,
262
- Kt as waitForPeginRegistrationDepth,
263
- Xt as waitForPeginStatus,
264
- ue as waitForTransactionReceiptSmartAware
267
+ jt as verifyRegisteredParticipantKeys,
268
+ zt as verifyRegisteredVaultVersions,
269
+ vs as verifyServerIdentity,
270
+ Ms as vpTokenRegistry,
271
+ Jt as waitForPeginRegistrationDepth,
272
+ Zt as waitForPeginStatus,
273
+ ga as waitForTransactionReceiptSmartAware
265
274
  };
266
275
  //# 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-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;
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-DI0-0SHr.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
@@ -2,7 +2,7 @@ var v = Object.defineProperty;
2
2
  var k = (r, t, e) => t in r ? v(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
3
  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
- import { s as f } from "../sha2-BYVxyZzX.js";
5
+ import { s as f } from "../sha2-CrlWM5S8.js";
6
6
  import { Buffer as o } from "buffer";
7
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";
@@ -0,0 +1,2 @@
1
+ "use strict";var he=Object.defineProperty;var de=(e,r,t)=>r in e?he(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var U=(e,r,t)=>de(e,typeof r!="symbol"?r+"":r,t);const x=require("viem"),pe=require("./sha2-DI0-0SHr.cjs"),H=require("./signPsbtsWithFallback-DMSpIQWH.cjs"),Q=require("./PeginManager-E-UHA1un.cjs"),m=require("./bitcoin-D-O2GjbC.cjs"),v=require("./tbv/core/wasm/index.cjs"),q=require("./parseFundingOutpoints-B4iQeX6q.cjs"),J=require("bitcoinjs-lib"),S=require("./verifyScriptPathSchnorrSignature-BfNUSgA7.cjs"),G=require("./fundPeginTransaction-BLD8FRL9.cjs"),Y=require("./signing-BJ3X66b-.cjs"),K="DepositTermsRejectedError";class Z extends Error{constructor(t,n="device-envelope"){super(t);U(this,"reason");this.name=K,this.reason=n}}function me(e){if(e instanceof Z)return!0;if(typeof e!="object"||e===null)return!1;const r=e;return r.name===K&&r.reason==="device-envelope"}async function ee(e){const r=e.siblings.length;if(r===0)throw new Error("rebuildDepositTermsCore: at least one sibling is required");for(const[o,E]of e.siblings.entries())if(E.amount<=0n)throw new Error(`rebuildDepositTermsCore: sibling[${o}] has non-positive on-chain pegin amount ${E.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 t=m.stripHexPrefix(e.prepeginTxid).toLowerCase(),n=m.stripHexPrefix(Y.calculateBtcTxHash(e.fundedPrePeginTxHex)).toLowerCase();if(n!==t)throw new Error(`Funded Pre-PegIn tx hashes to ${n}, expected ${t} (on-chain prepeginTxid). Resume refused.`);const h=H.findAuthAnchorOpReturn(m.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!==r)throw new Error(`Auth-anchor OP_RETURN at vout ${h.vout} does not match the discovered sibling count ${r}; 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 v.computeMinClaimValue(e.vaultCoreVersion,c,u,e.councilQuorum,e.councilSize,e.protocolFeeRate),a=await v.computeMinPeginFee(e.vaultCoreVersion,c,u,e.minPeginFeeRate),d=await v.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,b=e.minPeginFeeRate*G.MAX_REASONABLE_PEGIN_VBYTES;if(i<=0n||i>b)throw new Error(`WASM implied PegIn reserve ${i} sat is outside (0, ${b}] (minPeginFeeRate=${e.minPeginFeeRate} × ${G.MAX_REASONABLE_PEGIN_VBYTES} vbytes). Resume refused.`);const w=e.siblings.map(o=>o.amount+l+a+s),C=await Promise.all(e.siblings.map(async o=>(await v.getPrePeginHtlcConnectorInfo({txGraphVersion:e.vaultCoreVersion,depositorPubkey:e.depositorBtcPubkey,vaultProviderPubkey:e.vaultProviderBtcPubkey,vaultKeeperPubkeys:[...e.vaultKeeperBtcPubkeys],universalChallengerPubkeys:[...e.universalChallengerBtcPubkeys],hashlock:m.stripHexPrefix(o.hashlock),timelockRefund:e.timelockRefund,network:e.network})).scriptPubKey)),R=J.Transaction.fromHex(m.stripHexPrefix(e.fundedPrePeginTxHex)).outs.map(o=>({value:o.value,script:o.script}));return S.assertEncodedHtlcOutputsMatch(R,w,C),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 ge(e){const r=(e instanceof Error?e.message:typeof e=="string"?e:"").toLowerCase();return r.includes("wots")&&r.includes("hash")&&r.includes("does not match")}const re="TBV.PeginFingerprint.v1",te=x.keccak256(x.toHex(re)),L=65535,j=2n**64n-1n,Pe=2n**256n-1n,fe=/^0x[0-9a-fA-F]{64}$/,W=1;class f extends Error{constructor(r){super(r),this.name="PeginFingerprintInputError"}}function N(e,r,t,n){if(typeof r!="bigint")throw new f(`${e} must be a bigint (Solidity ${n}), got ${typeof r}`);if(r<0n||r>t)throw new f(`${e} must fit Solidity ${n} (0..${t}), got ${r}`)}function I(e,r){if(!Number.isInteger(r)||r<0||r>L)throw new f(`${e} must be an integer fitting Solidity uint16 (0..${L}), got ${r}`)}function ve(e,r){if(!fe.test(r))throw new f(`${e} must be 32 bytes as 0x-prefixed hex (66 characters), got "${r}"`);return r.toLowerCase()}function be(e){if(!x.isAddress(e,{strict:!1}))throw new f(`registryAddress must be a 20-byte 0x-prefixed address, got "${e}"`);const r=e.toLowerCase();if(r===x.zeroAddress)throw new f("registryAddress must not be the zero address; a zero here means the registry address was never resolved");return r}const Ee=[{name:"domain",type:"bytes32"},{name:"chainId",type:"uint256"},{name:"registry",type:"address"},{name:"vaultProviderBtcKey",type:"bytes32"},{name:"appKeeperKeyEpoch",type:"uint64"},{name:"ucKeyEpoch",type:"uint64"},{name:"appVaultKeepersVersion",type:"uint16"},{name:"universalChallengersVersion",type:"uint16"},{name:"offchainParamsVersion",type:"uint16"},{name:"vaultCoreVersion",type:"uint16"}];function ne(e){if(N("chainId",e.chainId,Pe,"uint256"),e.chainId===0n)throw new f("chainId must not be 0; a zero here means the chain id was never resolved");const r=be(e.registryAddress),t=ve("vaultProviderBtcKey",e.vaultProviderBtcKey);if(N("appKeeperKeyEpoch",e.appKeeperKeyEpoch,j,"uint64"),N("ucKeyEpoch",e.ucKeyEpoch,j,"uint64"),I("appVaultKeepersVersion",e.appVaultKeepersVersion),I("universalChallengersVersion",e.universalChallengersVersion),I("offchainParamsVersion",e.offchainParamsVersion),I("vaultCoreVersion",e.vaultCoreVersion),e.vaultCoreVersion<W)throw new f(`vaultCoreVersion must be at least ${W}; ${e.vaultCoreVersion} means the version was never resolved`);return x.encodeAbiParameters(Ee,[te,e.chainId,r,t,e.appKeeperKeyEpoch,e.ucKeyEpoch,e.appVaultKeepersVersion,e.universalChallengersVersion,e.offchainParamsVersion,e.vaultCoreVersion])}function ye(e){return x.keccak256(ne(e))}class oe extends Error{constructor(r,t){super(`Re-derived vault root does not match this Pre-PegIn: derived auth-anchor hash ${r}, transaction commits to ${t}. Connect the same wallet, on the same account and the same network, that created the deposit.`),this.derivedAuthAnchorHash=r,this.onChainAuthAnchorHash=t,this.name="VaultRootMismatchError"}}class B extends Error{constructor(r){super(r),this.name="UnanchoredPrePeginError"}}class se extends Error{constructor(r,t,n=[]){super(`No candidate parameter set reproduces this Pre-PegIn's HTLC outputs (${r} candidate(s) tried). `+(n.length>0?`${n.length} version(s) could not be resolved and may hold the answer: ${n.join(" | ")}. `:"")+`Sample rejections: ${t.join(" | ")}`),this.candidatesTried=r,this.sampleRejections=t,this.unresolvedLabels=n,this.name="PeginParamsNotFoundError"}}class ie extends Error{constructor(r){super(`${r.length} candidate parameter sets reproduce this Pre-PegIn's HTLC outputs, so the vault's stamped versions cannot be determined: ${r.join(" | ")}. Reconstruction refused.`),this.survivorLabels=r,this.name="PeginParamsAmbiguousError"}}class ae extends Error{constructor(r,t){super(`A candidate matched this Pre-PegIn (${r}), but ${t.length} version(s) could not be resolved, so the search space did not provably contain the true parameters: ${t.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=r,this.unresolvedLabels=t,this.name="PeginParamsIncompleteSpaceError"}}class A extends Error{constructor(r){super(`${r}. Reconstruction refused.`),this.name="PeginSizingIntegrityError"}}async function we(e){const{wallet:r,depositorBtcPubkey:t,fundedPrePeginTxHex:n}=e,h=m.stripHexPrefix(n),c=H.findAuthAnchorOpReturn(h);if(c===void 0)throw new B("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 B("Pre-PegIn's auth-anchor OP_RETURN is at vout 0, implying zero HTLC outputs; there is nothing to recover.");const l=q.parseFundingOutpointsFromTx(h),a=await q.deriveVaultRoot(r,{depositorBtcPubkey:m.hexToUint8Array(m.processPublicKeyToXOnly(t)),fundingOutpoints:l});try{const s=await v.expandAuthAnchor(a);let i;try{i=m.uint8ArrayToHex(pe.sha256(s))}finally{s.fill(0)}if(i!==c.hash)throw new oe(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 Re(e){const{vaultCoreVersion:r,offchainParams:t,participantKeySets:n}=e;if(!Number.isInteger(r)||r<1)throw new Error(`buildPeginParamsCandidates: vaultCoreVersion must be a positive integer, got ${r}`);if(t.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 t)for(const u of n)h.push({vaultCoreVersion:r,offchainParams:c,participants:u});return h}function ce(e){return`${e.axis} v${e.version} (${e.reason})`}function F(e){const{participants:r}=e;return`core=${e.vaultCoreVersion} offchain=${e.offchainParams.version} keepers=${r.appVaultKeepersVersion} challengers=${r.universalChallengersVersion} vp=${r.vaultProvider}`}const X=5;function xe(e,r){return JSON.stringify({terms:e,peginAmounts:r},(t,n)=>typeof n=="bigint"?`${n}`:n)}function Ce(e){const{offchainParams:r,participants:t}=e;return[e.vaultCoreVersion,t.vaultKeeperBtcPubkeys.length,t.universalChallengerBtcPubkeys.length,r.councilQuorum,r.councilSize,r.protocolFeeRate,r.minPeginFeeRate].join("|")}async function ke(e){const{offchainParams:r,participants:t}=e,n=t.vaultKeeperBtcPubkeys.length,h=t.universalChallengerBtcPubkeys.length,[c,u,l]=await Promise.all([v.computeMinClaimValue(e.vaultCoreVersion,n,h,r.councilQuorum,r.councilSize,r.protocolFeeRate),v.computeMinPeginFee(e.vaultCoreVersion,n,h,r.minPeginFeeRate),v.peginP2aAnchorOutput(e.vaultCoreVersion)]),a=(l==null?void 0:l.value)??0n;if(c<=0n)throw new A(`WASM returned non-positive depositorClaimValue ${c} for graph version ${e.vaultCoreVersion}`);if(u<=0n)throw new A(`WASM returned non-positive peginMaxFee ${u} for graph version ${e.vaultCoreVersion}`);if(a<0n)throw new A(`WASM returned negative P2A anchor value ${a} for graph version ${e.vaultCoreVersion}`);return{depositorClaimValue:c,peginMaxFee:u,p2aAnchorValue:a}}async function Ve(e){const{hashlocks:r,fundedPrePeginTxHex:t,depositorBtcPubkey:n,prepeginMaxFee:h,maxAcceptableCommissionBps:c,network:u,candidates:l,unresolvedVersions:a}=e;if(r.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=m.processPublicKeyToXOnly(n),s=m.stripHexPrefix(t),i=H.findAuthAnchorOpReturn(s);if(i===void 0)throw new B("Pre-PegIn carries no single, unambiguous auth-anchor OP_RETURN; the sibling set cannot be proven complete. Reconstruction refused.");if(i.vout!==r.length)throw new Error(`reconstructPeginParams: ${r.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 b=J.Transaction.fromHex(s).outs,w=r.map((p,g)=>BigInt(b[g].value)),C=m.stripHexPrefix(Y.calculateBtcTxHash(s)).toLowerCase(),R=new Map,o=[],E=[],M=[];let O=0;for(const p of l)try{const g=Ce(p);let P=R.get(g);P===void 0&&(P=await ke(p),R.set(g,P));const k=P.depositorClaimValue+P.peginMaxFee+P.p2aAnchorValue,V=w.map(T=>T-k),$=V.findIndex(T=>T<=0n);if($!==-1)throw new S.HtlcOutputMismatchError(`HTLC output[${$}] value ${w[$]} is not above this candidate's reserve ${k}, so it implies a non-positive pegin amount ${V[$]}.`);const{offchainParams:y,participants:_}=p,D=await ee({vaultCoreVersion:p.vaultCoreVersion,siblings:r.map((T,le)=>({hashlock:T,amount:V[le]})),fundedPrePeginTxHex:s,depositorBtcPubkey:d,vaultProviderBtcPubkey:_.vaultProviderBtcPubkey,vaultKeeperBtcPubkeys:_.vaultKeeperBtcPubkeys,universalChallengerBtcPubkeys:_.universalChallengerBtcPubkeys,protocolFeeRate:y.protocolFeeRate,minPeginFeeRate:y.minPeginFeeRate,councilQuorum:y.councilQuorum,councilSize:y.councilSize,timelockPegin:y.timelockPegin,timelockAssert:y.timelockAssert,timelockRefund:y.timelockRefund,prepeginTxid:C,prepeginMaxFee:h,maxAcceptableCommissionBps:c,network:u});o.push({candidate:p,terms:D,peginAmounts:V,fingerprint:xe(D,V)})}catch(g){if(g instanceof A)throw g;const P=F(p),k=g instanceof Error?g.message:String(g);g instanceof S.HtlcOutputMismatchError?E.length<X&&E.push(`[${P}] ${k}`):(O++,M.length<X&&M.push(`${P} (${k})`))}const ue=a.length+O,z=[...a.map(ce),...M];if(o.length===0)throw new se(l.length,E,z);if(new Set(o.map(p=>p.fingerprint)).size>1)throw new ie(o.map(p=>F(p.candidate)));if(ue>0)throw new ae(F(o[0].candidate),z);return{candidate:o[0].candidate,terms:o[0].terms,peginAmounts:o[0].peginAmounts,authAnchorHash:i.hash,candidatesTried:l.length,matchedCandidates:o.map(p=>p.candidate)}}function Te(e,r){const{htlcVout:t,depositorBtcPubkey:n,applicationEntryPoint:h,fundedPrePeginTxHex:c,hashlocks:u,network:l}=r,{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(t)||t<0||t>=d.length)throw new Error(`toRefundInputs: htlcVout ${t} is outside the reconstructed batch of ${d.length} vault(s).`);const b=d.map((R,o)=>({hashlock:m.ensureHexPrefix(u[o]),amount:R,htlcVout:o})),w={vaultCoreVersion:a.vaultCoreVersion,hashlock:b[t].hashlock,htlcVout:t,offchainParamsVersion:s.version,appVaultKeepersVersion:i.appVaultKeepersVersion,universalChallengersVersion:i.universalChallengersVersion,vaultProvider:i.vaultProvider,applicationEntryPoint:h,amount:d[t],unsignedPrePeginTxHex:c,depositorBtcPubkey:n,batch:b},C={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:w,context:C}}exports.DEPOSIT_TERMS_REJECTED_ERROR_NAME=K;exports.DepositTermsRejectedError=Z;exports.PEGIN_FINGERPRINT_DOMAIN=te;exports.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE=re;exports.PeginFingerprintInputError=f;exports.PeginParamsAmbiguousError=ie;exports.PeginParamsIncompleteSpaceError=ae;exports.PeginParamsNotFoundError=se;exports.PeginSizingIntegrityError=A;exports.UnanchoredPrePeginError=B;exports.VaultRootMismatchError=oe;exports.buildPeginParamsCandidates=Re;exports.computePeginFingerprint=ye;exports.deriveHashlocksFromPrePegin=we;exports.describePeginParamsCandidate=F;exports.describeUnresolvedVersion=ce;exports.encodePeginFingerprintPreimage=ne;exports.isDepositTermsRejectedError=me;exports.isWotsMismatchError=ge;exports.rebuildDepositTermsCore=ee;exports.reconstructPeginParams=Ve;exports.toRefundInputs=Te;
2
+ //# sourceMappingURL=toRefundInputs-BwG6T0PP.cjs.map