@babylonlabs-io/ts-sdk 2.0.1 → 3.0.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 (121) hide show
  1. package/dist/{PayoutManager-CpfQjtL0.cjs → PayoutManager-B6GFbG3X.cjs} +2 -2
  2. package/dist/{PayoutManager-CpfQjtL0.cjs.map → PayoutManager-B6GFbG3X.cjs.map} +1 -1
  3. package/dist/{PayoutManager-CHTOwj0E.js → PayoutManager-BSwbUQeF.js} +2 -2
  4. package/dist/{PayoutManager-CHTOwj0E.js.map → PayoutManager-BSwbUQeF.js.map} +1 -1
  5. package/dist/{PeginManager-DEldv_Ro.js → PeginManager-CKf7Bjmj.js} +6 -6
  6. package/dist/PeginManager-CKf7Bjmj.js.map +1 -0
  7. package/dist/{PeginManager-6tjlGd0t.cjs → PeginManager-Dt2Z5ljw.cjs} +2 -2
  8. package/dist/PeginManager-Dt2Z5ljw.cjs.map +1 -0
  9. package/dist/{bip322Verify-DSco3Yhl.js → bip322Verify-BXYrHBh8.js} +2 -2
  10. package/dist/{bip322Verify-DSco3Yhl.js.map → bip322Verify-BXYrHBh8.js.map} +1 -1
  11. package/dist/{bip322Verify-B7_gIhRk.cjs → bip322Verify-DLxJR9CQ.cjs} +2 -2
  12. package/dist/{bip322Verify-B7_gIhRk.cjs.map → bip322Verify-DLxJR9CQ.cjs.map} +1 -1
  13. package/dist/buildAndBroadcastReclaim-BDc-SK9i.cjs +2 -0
  14. package/dist/buildAndBroadcastReclaim-BDc-SK9i.cjs.map +1 -0
  15. package/dist/{buildAndBroadcastReclaim-CqO2DoP8.js → buildAndBroadcastReclaim-T5ZFPUpM.js} +943 -732
  16. package/dist/buildAndBroadcastReclaim-T5ZFPUpM.js.map +1 -0
  17. package/dist/{deriveVaultRoot-BwbXmN0x.js → deriveVaultRoot-BcvmER1E.js} +2 -2
  18. package/dist/{deriveVaultRoot-BwbXmN0x.js.map → deriveVaultRoot-BcvmER1E.js.map} +1 -1
  19. package/dist/{deriveVaultRoot-DvhkHzNb.cjs → deriveVaultRoot-C3uqnJto.cjs} +2 -2
  20. package/dist/{deriveVaultRoot-DvhkHzNb.cjs.map → deriveVaultRoot-C3uqnJto.cjs.map} +1 -1
  21. package/dist/{index-DQ5bfoT3.js → index-B6w5MM-8.js} +147 -124
  22. package/dist/index-B6w5MM-8.js.map +1 -0
  23. package/dist/index-EHLYplSd.cjs +2 -0
  24. package/dist/index-EHLYplSd.cjs.map +1 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.js +163 -158
  27. package/dist/{onChainBtcPubkey-BXry_CM4.cjs → onChainBtcPubkey-BlzxYImF.cjs} +2 -2
  28. package/dist/{onChainBtcPubkey-BXry_CM4.cjs.map → onChainBtcPubkey-BlzxYImF.cjs.map} +1 -1
  29. package/dist/{onChainBtcPubkey-C1WqyxPM.js → onChainBtcPubkey-CCTdl53s.js} +2 -2
  30. package/dist/{onChainBtcPubkey-C1WqyxPM.js.map → onChainBtcPubkey-CCTdl53s.js.map} +1 -1
  31. package/dist/{pegin-registration-client-BNV44jzw.cjs → pegin-registration-client-BdJ6c7si.cjs} +2 -2
  32. package/dist/{pegin-registration-client-BNV44jzw.cjs.map → pegin-registration-client-BdJ6c7si.cjs.map} +1 -1
  33. package/dist/{pegin-registration-client-1sZ-74UC.js → pegin-registration-client-C5Hktrja.js} +3 -3
  34. package/dist/{pegin-registration-client-1sZ-74UC.js.map → pegin-registration-client-C5Hktrja.js.map} +1 -1
  35. package/dist/peginState-BU2ONFXF.js +68 -0
  36. package/dist/{peginState-CxDiaKuk.js.map → peginState-BU2ONFXF.js.map} +1 -1
  37. package/dist/peginState-DUv10EJR.cjs +2 -0
  38. package/dist/{peginState-eaQ4IO_R.cjs.map → peginState-DUv10EJR.cjs.map} +1 -1
  39. package/dist/{primeVpAuth-DdfHSC53.js → primeVpAuth-Bdy_B_Sq.js} +5 -5
  40. package/dist/{primeVpAuth-DdfHSC53.js.map → primeVpAuth-Bdy_B_Sq.js.map} +1 -1
  41. package/dist/primeVpAuth-CQRsu6VB.cjs +2 -0
  42. package/dist/{primeVpAuth-BOGKniTl.cjs.map → primeVpAuth-CQRsu6VB.cjs.map} +1 -1
  43. package/dist/{reservation-Cj9F0rP9.js → reservation-DOAHVT3B.js} +2 -2
  44. package/dist/{reservation-Cj9F0rP9.js.map → reservation-DOAHVT3B.js.map} +1 -1
  45. package/dist/{reservation-Dr2HLCxx.cjs → reservation-ECxjZi5t.cjs} +2 -2
  46. package/dist/{reservation-Dr2HLCxx.cjs.map → reservation-ECxjZi5t.cjs.map} +1 -1
  47. package/dist/sha2-Ce6KewYx.cjs +2 -0
  48. package/dist/{sha2-DI0-0SHr.cjs.map → sha2-Ce6KewYx.cjs.map} +1 -1
  49. package/dist/{sha2-CLpQd0Rd.js → sha2-YqVHJiFj.js} +91 -77
  50. package/dist/{sha2-CLpQd0Rd.js.map → sha2-YqVHJiFj.js.map} +1 -1
  51. package/dist/state-DMFlvLL3.cjs +2 -0
  52. package/dist/state-DMFlvLL3.cjs.map +1 -0
  53. package/dist/{json-rpc-client-DuUARJvV.js → state-mE-QfITd.js} +91 -69
  54. package/dist/state-mE-QfITd.js.map +1 -0
  55. package/dist/tbv/core/clients/eth/index.cjs +1 -1
  56. package/dist/tbv/core/clients/eth/index.js +3 -3
  57. package/dist/tbv/core/clients/index.cjs +1 -1
  58. package/dist/tbv/core/clients/index.js +27 -26
  59. package/dist/tbv/core/clients/vault-provider/api.d.ts +2 -1
  60. package/dist/tbv/core/clients/vault-provider/api.d.ts.map +1 -1
  61. package/dist/tbv/core/clients/vault-provider/index.d.ts +1 -1
  62. package/dist/tbv/core/clients/vault-provider/index.d.ts.map +1 -1
  63. package/dist/tbv/core/clients/vault-provider/status/index.cjs +1 -1
  64. package/dist/tbv/core/clients/vault-provider/status/index.d.ts +1 -1
  65. package/dist/tbv/core/clients/vault-provider/status/index.d.ts.map +1 -1
  66. package/dist/tbv/core/clients/vault-provider/status/index.js +10 -9
  67. package/dist/tbv/core/clients/vault-provider/types.d.ts +7 -3
  68. package/dist/tbv/core/clients/vault-provider/types.d.ts.map +1 -1
  69. package/dist/tbv/core/clients/vault-provider/validators.d.ts +8 -0
  70. package/dist/tbv/core/clients/vault-provider/validators.d.ts.map +1 -1
  71. package/dist/tbv/core/index.cjs +1 -1
  72. package/dist/tbv/core/index.js +163 -158
  73. package/dist/tbv/core/managers/index.cjs +1 -1
  74. package/dist/tbv/core/managers/index.js +2 -2
  75. package/dist/tbv/core/services/deposit/__tests__/graphFingerprint.test.d.ts +2 -0
  76. package/dist/tbv/core/services/deposit/__tests__/graphFingerprint.test.d.ts.map +1 -0
  77. package/dist/tbv/core/services/deposit/graphFingerprint.d.ts +115 -0
  78. package/dist/tbv/core/services/deposit/graphFingerprint.d.ts.map +1 -0
  79. package/dist/tbv/core/services/deposit/index.d.ts +2 -1
  80. package/dist/tbv/core/services/deposit/index.d.ts.map +1 -1
  81. package/dist/tbv/core/services/deposit/peginState.d.ts +23 -0
  82. package/dist/tbv/core/services/deposit/peginState.d.ts.map +1 -1
  83. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts +11 -0
  84. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -1
  85. package/dist/tbv/core/services/index.cjs +1 -1
  86. package/dist/tbv/core/services/index.js +52 -47
  87. package/dist/tbv/core/services/index.js.map +1 -1
  88. package/dist/tbv/core/services/pegout/state.d.ts +8 -3
  89. package/dist/tbv/core/services/pegout/state.d.ts.map +1 -1
  90. package/dist/tbv/core/utils/index.cjs +1 -1
  91. package/dist/tbv/core/utils/index.js +1 -1
  92. package/dist/tbv/core/vault-secrets/index.cjs +1 -1
  93. package/dist/tbv/core/vault-secrets/index.js +1 -1
  94. package/dist/tbv/index.cjs +1 -1
  95. package/dist/tbv/index.js +163 -158
  96. package/dist/testing/index.cjs +1 -1
  97. package/dist/testing/index.js +1 -1
  98. package/dist/{toRefundInputs-BaN9XluU.cjs → toRefundInputs-B_GlIXjk.cjs} +2 -2
  99. package/dist/{toRefundInputs-BaN9XluU.cjs.map → toRefundInputs-B_GlIXjk.cjs.map} +1 -1
  100. package/dist/{toRefundInputs-mtuuYezp.js → toRefundInputs-DIIdhjvu.js} +5 -5
  101. package/dist/{toRefundInputs-mtuuYezp.js.map → toRefundInputs-DIIdhjvu.js.map} +1 -1
  102. package/dist/{types-BuxreSq4.cjs → types-DJxOEU3P.cjs} +2 -2
  103. package/dist/{types-BuxreSq4.cjs.map → types-DJxOEU3P.cjs.map} +1 -1
  104. package/dist/{types-BdCEoANP.js → types-Dz1kVqn6.js} +2 -2
  105. package/dist/{types-BdCEoANP.js.map → types-Dz1kVqn6.js.map} +1 -1
  106. package/package.json +1 -1
  107. package/dist/PeginManager-6tjlGd0t.cjs.map +0 -1
  108. package/dist/PeginManager-DEldv_Ro.js.map +0 -1
  109. package/dist/buildAndBroadcastReclaim-BwT6Jxp5.cjs +0 -2
  110. package/dist/buildAndBroadcastReclaim-BwT6Jxp5.cjs.map +0 -1
  111. package/dist/buildAndBroadcastReclaim-CqO2DoP8.js.map +0 -1
  112. package/dist/index-CK1Xvq4K.cjs +0 -2
  113. package/dist/index-CK1Xvq4K.cjs.map +0 -1
  114. package/dist/index-DQ5bfoT3.js.map +0 -1
  115. package/dist/json-rpc-client-BiAmg_ho.cjs +0 -2
  116. package/dist/json-rpc-client-BiAmg_ho.cjs.map +0 -1
  117. package/dist/json-rpc-client-DuUARJvV.js.map +0 -1
  118. package/dist/peginState-CxDiaKuk.js +0 -63
  119. package/dist/peginState-eaQ4IO_R.cjs +0 -2
  120. package/dist/primeVpAuth-BOGKniTl.cjs +0 -2
  121. package/dist/sha2-DI0-0SHr.cjs +0 -2
package/dist/tbv/index.js CHANGED
@@ -1,60 +1,61 @@
1
- import { P as s, h as r, i as t, j as i, f as o, b as n, a as P, c as p, k as E, d as l, e as c, g as u } from "../verifyScriptPathSchnorrSignature-CpjSTfMj.js";
1
+ import { P as s, h as r, i as t, j as i, f as o, b as n, a as p, c as P, k as E, d as l, e as c, g as u } from "../verifyScriptPathSchnorrSignature-CpjSTfMj.js";
2
2
  import { a as g } from "../secp256k1-D-H9jmd7.js";
3
- import { attachFinalizedAssert as R, computeMinClaimValue as _, computeMinPeginFee as m, deriveVaultId as T, expandAuthAnchor as S, expandHashlockSecret as C, expandWotsSeed as I, finalizePayout as O, finalizeWronglyChallenged as f, peginP2aAnchorOutput as h, pinPegoutProof as N, supportedTxGraphVersions as b, validatePeginP2aAnchor as V } from "./core/wasm/index.js";
3
+ import { attachFinalizedAssert as A, computeMinClaimValue as _, computeMinPeginFee as m, deriveVaultId as T, expandAuthAnchor as S, expandHashlockSecret as C, expandWotsSeed as I, finalizePayout as f, finalizeWronglyChallenged as h, peginP2aAnchorOutput as O, pinPegoutProof as N, supportedTxGraphVersions as b, validatePeginP2aAnchor as V } from "./core/wasm/index.js";
4
4
  import { a as F, c as M, b as v, e as y, f as D } from "../verifyKeyPathSchnorrSignature-BQHNhRj6.js";
5
- import { c as B, a as H, b as L, e as K, f as X, r as k } from "../noPayout-qBXWKwav.js";
5
+ import { c as B, a as H, b as L, e as K, f as X, r as G } from "../noPayout-qBXWKwav.js";
6
6
  import { b as W } from "../challengeAssert-Cp_GeRg8.js";
7
7
  import { c as z, d as Y, a as j, b as J, e as Z, f as q, k as Q, g as $, h as aa, i as ea, j as sa, p as ra, s as ta, t as ia, u as oa, v as na } from "../bitcoin-C-TuHb-v.js";
8
- import { c as pa } from "../abortSignals-BPpAUL1Z.js";
8
+ import { c as Pa } from "../abortSignals-BPpAUL1Z.js";
9
9
  import { c as la, a as ca, b as ua } from "../signing-Dhr2t0Z6.js";
10
- import { B as ga, C as Aa, H as Ra, K as _a, M as ma, T as Ta, X as Sa } from "../validation-OSC0xTHB.js";
10
+ import { B as ga, C as Ra, H as Aa, K as _a, M as ma, T as Ta, X as Sa } from "../validation-OSC0xTHB.js";
11
11
  import { waitForTransactionReceiptSmartAware as Ia } from "./core/utils/eth/index.js";
12
- import { P as fa, b as ha, c as Na, d as ba, e as Va } from "../PeginManager-DEldv_Ro.js";
13
- import { P as Fa, c as Ma, f as va, r as ya, s as Da, v as Ua } from "../PayoutManager-CHTOwj0E.js";
14
- import { MEMPOOL_API_URLS as Ha, getAddressTxs as La, getAddressUtxos as Ka, getMempoolApiUrl as Xa, getNetworkFees as ka, getOutspend as Ga, getTipHeight as Wa, getTxHex as wa, getTxInfo as za, getUtxoInfo as Ya, pushTx as ja } from "./core/clients/mempool/index.js";
15
- import { O as Za, V as qa, a as Qa, b as $a, c as ae, r as ee } from "../types-BdCEoANP.js";
16
- import { a as re, d as te } from "../onChainBtcPubkey-C1WqyxPM.js";
17
- import { C as oe, M as ne, R as Pe, V as pe, c as Ee, d as le, i as ce, v as ue, a as de, b as ge } from "../pegin-registration-client-1sZ-74UC.js";
18
- import { A as Re, P as _e } from "../ProtocolParams.abi-q0AidvYX.js";
12
+ import { P as ha, b as Oa, c as Na, d as ba, e as Va } from "../PeginManager-CKf7Bjmj.js";
13
+ import { P as Fa, c as Ma, f as va, r as ya, s as Da, v as Ua } from "../PayoutManager-BSwbUQeF.js";
14
+ import { MEMPOOL_API_URLS as Ha, getAddressTxs as La, getAddressUtxos as Ka, getMempoolApiUrl as Xa, getNetworkFees as Ga, getOutspend as ka, getTipHeight as Wa, getTxHex as wa, getTxInfo as za, getUtxoInfo as Ya, pushTx as ja } from "./core/clients/mempool/index.js";
15
+ import { O as Za, V as qa, a as Qa, b as $a, c as ae, r as ee } from "../types-Dz1kVqn6.js";
16
+ import { a as re, d as te } from "../onChainBtcPubkey-CCTdl53s.js";
17
+ import { C as oe, M as ne, R as pe, V as Pe, c as Ee, d as le, i as ce, v as ue, a as de, b as ge } from "../pegin-registration-client-C5Hktrja.js";
18
+ import { A as Ae, P as _e } from "../ProtocolParams.abi-q0AidvYX.js";
19
19
  import { B as Te } from "../BTCVaultRegistry.abi-B0x9_Bza.js";
20
- import { B as Ce, C as Ie, P as Oe, a as fe, e as he, g as Ne, h as be, i as Ve, b as xe } from "../BTCVaultRegistryKeyEpochs.abi-BWoxwPQv.js";
21
- import { V as Me, b as ve, a as ye, d as De, f as Ue } from "../deriveVaultRoot-BwbXmN0x.js";
20
+ import { B as Ce, C as Ie, P as fe, a as he, e as Oe, g as Ne, h as be, i as Ve, b as xe } from "../BTCVaultRegistryKeyEpochs.abi-BWoxwPQv.js";
21
+ import { V as Me, b as ve, a as ye, d as De, f as Ue } from "../deriveVaultRoot-BcvmER1E.js";
22
22
  import { p as He } from "../parseFundingOutpoints-GSM-IaaK.js";
23
- import { B as Ke, a as Xe, c as ke, b as Ge, d as We, g as we, h as ze, f as Ye, s as je, e as Je } from "../psbtInputFields-CCVyaQMi.js";
24
- import { B as qe, D as Qe, L as $e, M as as, c as es, P as ss, b as rs, a as ts, S as is, T as os, W as ns, f as Ps, d as ps, p as Es, r as ls } from "../fundPeginTransaction-CwhRbCQC.js";
25
- import { U as us, a as ds, e as gs, f as As, v as Rs } from "../reservation-Cj9F0rP9.js";
26
- import { V as ms, a as Ts, b as Ss, v as Cs } from "../index-DQ5bfoT3.js";
27
- import { A as Os, D as fs, J as hs, a as Ns, b as bs, d as Vs, P as xs, R as Fs, e as Ms, c as vs, V as ys, i as Ds } from "../json-rpc-client-DuUARJvV.js";
28
- import { S as Bs, V as Hs, c as Ls, p as Ks, v as Xs, a as ks } from "../primeVpAuth-DdfHSC53.js";
29
- import { D as Ws, f as ws, P as zs, a as Ys, b as js, o as Js, p as Zs, n as qs, q as Qs, U as $s, V as ar, j as er, c as sr, h as rr, l as tr, k as ir, e as or, g as nr, d as Pr, i as pr, r as Er, m as lr, t as cr } from "../toRefundInputs-mtuuYezp.js";
30
- import { p as dr, A as gr, X as Ar, C as Rr, T as _r, D as mr, i as Tr, F as Sr, P as Cr, j as Ir, k as Or, a4 as fr, a5 as hr, a6 as Nr, a7 as br, _ as Vr, $ as xr, a0 as Fr, a1 as Mr, a2 as vr, R as yr, V as Dr, a as Ur, b as Br, c as Hr, e as Lr, f as Kr, h as Xr, g as kr, L as Gr, a3 as Wr, Y as wr, d as zr, Z as Yr, q as jr, t as Jr, M as Zr, G as qr, l as Qr, m as $r, W as at, U as et, I as st, N as rt, O as tt, Q as it, S as ot, r as nt, n as Pt, o as pt, s as Et, u as lt, x as ct, v as ut, y as dt, z as gt, B as At, E as Rt, H as _t, J as mt, w as Tt, K as St } from "../buildAndBroadcastReclaim-CqO2DoP8.js";
31
- import { C as It, P as Ot, c as ft, g as ht, i as Nt } from "../peginState-CxDiaKuk.js";
23
+ import { B as Ke, a as Xe, c as Ge, b as ke, d as We, g as we, h as ze, f as Ye, s as je, e as Je } from "../psbtInputFields-CCVyaQMi.js";
24
+ import { B as qe, D as Qe, L as $e, M as as, c as es, P as ss, b as rs, a as ts, S as is, T as os, W as ns, f as ps, d as Ps, p as Es, r as ls } from "../fundPeginTransaction-CwhRbCQC.js";
25
+ import { U as us, a as ds, e as gs, f as Rs, v as As } from "../reservation-DOAHVT3B.js";
26
+ import { V as ms, a as Ts, b as Ss, i as Cs, v as Is } from "../index-B6w5MM-8.js";
27
+ import { A as hs, C as Os, D as Ns, J as bs, a as Vs, b as xs, d as Fs, P as Ms, R as vs, e as ys, c as Ds, V as Us, i as Bs, g as Hs, f as Ls } from "../state-mE-QfITd.js";
28
+ import { S as Xs, V as Gs, c as ks, p as Ws, v as ws, a as zs } from "../primeVpAuth-Bdy_B_Sq.js";
29
+ import { D as js, f as Js, P as Zs, a as qs, b as Qs, o as $s, p as ar, n as er, q as sr, U as rr, V as tr, j as ir, c as or, h as nr, l as pr, k as Pr, e as Er, g as lr, d as cr, i as ur, r as dr, m as gr, t as Rr } from "../toRefundInputs-DIIdhjvu.js";
30
+ import { t as _r, A as mr, X as Tr, C as Sr, D as Cr, G as Ir, i as fr, I as hr, P as Or, j as Nr, k as br, a4 as Vr, a5 as xr, a6 as Fr, a7 as Mr, _ as vr, $ as yr, a0 as Dr, a1 as Ur, a2 as Br, R as Hr, V as Lr, a as Kr, b as Xr, c as Gr, e as kr, f as Wr, h as wr, g as zr, n as Yr, O as jr, a3 as Jr, Y as Zr, d as qr, Z as Qr, o as $r, u as at, x as et, Q as st, J as rt, l as tt, m as it, L as ot, S as nt, T as pt, U as Pt, W as Et, r as lt, p as ct, q as ut, s as dt, y as gt, z as Rt, v as At, B as _t, E as mt, F as Tt, H as St, K as Ct, M as It, w as ft, N as ht } from "../buildAndBroadcastReclaim-T5ZFPUpM.js";
31
+ import { C as Nt, P as bt, a as Vt, c as xt, g as Ft, i as Mt } from "../peginState-BU2ONFXF.js";
32
32
  export {
33
- Os as AUTH_REJECTED_RPC_CODE,
34
- dr as ApplicationEntryPointMismatchError,
35
- Re as ApplicationRegistryABI,
36
- gr as ArtifactsVaultMismatchError,
37
- Ar as BIP68NotMatureError,
33
+ hs as AUTH_REJECTED_RPC_CODE,
34
+ _r as ApplicationEntryPointMismatchError,
35
+ Ae as ApplicationRegistryABI,
36
+ mr as ArtifactsVaultMismatchError,
37
+ Tr as BIP68NotMatureError,
38
38
  ga as BITCOIN_ADDRESS_RE,
39
39
  Te as BTCVaultRegistryABI,
40
40
  Ce as BTCVaultRegistryKeyEpochsABI,
41
41
  qe as BTC_DUST_SAT,
42
42
  Ke as BitcoinScriptType,
43
43
  oe as COMMISSION_BPS_HEADROOM,
44
- Aa as COMPRESSED_PUBKEY_HEX_LEN,
44
+ Ra as COMPRESSED_PUBKEY_HEX_LEN,
45
45
  Ie as CONTRACT_ERRORS,
46
- Rr as ChallengerSetMismatchError,
47
- _r as ClaimerPegoutStatusValue,
48
- It as ContractStatus,
49
- mr as DELEGATED_CLAIM_TX_GRAPH_VERSION,
50
- Ws as DEPOSIT_TERMS_REJECTED_ERROR_NAME,
46
+ Sr as ChallengerSetMismatchError,
47
+ Os as ClaimerPegoutStatusValue,
48
+ Nt as ContractStatus,
49
+ Cr as DELEGATED_CLAIM_TX_GRAPH_VERSION,
50
+ js as DEPOSIT_TERMS_REJECTED_ERROR_NAME,
51
51
  Qe as DUST_THRESHOLD,
52
- fs as DaemonStatus,
53
- ws as DepositTermsRejectedError,
54
- Ra as HEX_RE,
55
- hs as JSON_RPC_ERROR_CODES,
56
- Ns as JsonRpcClient,
57
- bs as JsonRpcError,
52
+ Ns as DaemonStatus,
53
+ Js as DepositTermsRejectedError,
54
+ Ir as GraphFingerprintError,
55
+ Aa as HEX_RE,
56
+ bs as JSON_RPC_ERROR_CODES,
57
+ Vs as JsonRpcClient,
58
+ xs as JsonRpcError,
58
59
  _a as KNOWN_SCRIPT_PREFIXES,
59
60
  $e as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
60
61
  ne as MAX_ACCEPTABLE_COMMISSION_BPS_CAP,
@@ -66,156 +67,159 @@ export {
66
67
  ss as P2TR_INPUT_SIZE,
67
68
  rs as PEGIN_AUTH_ANCHOR_OUTPUTS,
68
69
  s as PEGIN_DEPOSITOR_CLAIM_VOUT,
69
- Tr as PEGIN_ETH_CONFIRMATIONS,
70
- Oe as PEGIN_FINGERPRINT_CHANGED_SELECTOR,
71
- zs as PEGIN_FINGERPRINT_DOMAIN,
72
- Ys as PEGIN_FINGERPRINT_DOMAIN_PREIMAGE,
70
+ fr as PEGIN_ETH_CONFIRMATIONS,
71
+ fe as PEGIN_FINGERPRINT_CHANGED_SELECTOR,
72
+ Zs as PEGIN_FINGERPRINT_DOMAIN,
73
+ qs as PEGIN_FINGERPRINT_DOMAIN_PREIMAGE,
73
74
  ts as PEGIN_FIXED_OUTPUTS,
74
- Vs as POST_WOTS_STATUSES,
75
- xs as PRE_DEPOSITOR_SIGNATURES_STATES,
76
- Sr as ParticipantKeyDriftError,
77
- Cr as PayoutDestinationError,
75
+ Fs as POST_WOTS_STATUSES,
76
+ Ms as PRE_DEPOSITOR_SIGNATURES_STATES,
77
+ hr as ParticipantKeyDriftError,
78
+ Or as PayoutDestinationError,
78
79
  Fa as PayoutManager,
79
- Ot as PeginAction,
80
- fe as PeginFingerprintChangedError,
81
- js as PeginFingerprintInputError,
82
- fa as PeginManager,
83
- Js as PeginParamsAmbiguousError,
84
- Zs as PeginParamsIncompleteSpaceError,
85
- qs as PeginParamsNotFoundError,
86
- Ir as PeginRegistrationMissingError,
87
- Or as PeginRegistrationNotFinalError,
88
- Qs as PeginSizingIntegrityError,
80
+ bt as PeginAction,
81
+ he as PeginFingerprintChangedError,
82
+ Qs as PeginFingerprintInputError,
83
+ ha as PeginManager,
84
+ $s as PeginParamsAmbiguousError,
85
+ ar as PeginParamsIncompleteSpaceError,
86
+ er as PeginParamsNotFoundError,
87
+ Nr as PeginRegistrationMissingError,
88
+ br as PeginRegistrationNotFinalError,
89
+ sr as PeginSizingIntegrityError,
89
90
  _e as ProtocolParamsABI,
90
91
  r as PsbtSubstitutionError,
91
- fr as RECLAIM_MAX_FEE_FRACTION_DENOMINATOR,
92
- hr as RECLAIM_MAX_FEE_FRACTION_NUMERATOR,
93
- Nr as RECLAIM_MAX_FEE_RATE_SATS_VB,
94
- br as RECLAIM_WARN_FEE_FRACTION_NUMERATOR,
95
- Vr as REFUND_MAX_FEE_FRACTION_DENOMINATOR,
96
- xr as REFUND_MAX_FEE_FRACTION_NUMERATOR,
97
- Fr as REFUND_MAX_FEE_RATE_SATS_VB,
98
- Mr as REFUND_VSIZE,
99
- vr as ReclaimUneconomicalError,
100
- yr as RegisteredVaultVersionMismatchError,
101
- Pe as RegistrationLogsUnavailableError,
102
- Fs as RpcErrorCode,
92
+ Vr as RECLAIM_MAX_FEE_FRACTION_DENOMINATOR,
93
+ xr as RECLAIM_MAX_FEE_FRACTION_NUMERATOR,
94
+ Fr as RECLAIM_MAX_FEE_RATE_SATS_VB,
95
+ Mr as RECLAIM_WARN_FEE_FRACTION_NUMERATOR,
96
+ vr as REFUND_MAX_FEE_FRACTION_DENOMINATOR,
97
+ yr as REFUND_MAX_FEE_FRACTION_NUMERATOR,
98
+ Dr as REFUND_MAX_FEE_RATE_SATS_VB,
99
+ Ur as REFUND_VSIZE,
100
+ Br as ReclaimUneconomicalError,
101
+ Hr as RegisteredVaultVersionMismatchError,
102
+ pe as RegistrationLogsUnavailableError,
103
+ vs as RpcErrorCode,
103
104
  is as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
104
- Bs as ServerIdentityError,
105
+ Xs as ServerIdentityError,
105
106
  Ta as TXID_RE,
106
107
  os as TX_BUFFER_SIZE_OVERHEAD,
107
- $s as UnanchoredPrePeginError,
108
+ rr as UnanchoredPrePeginError,
108
109
  us as UtxoNotAvailableError,
109
110
  Me as VAULT_APP_NAME,
110
- Ms as VP_BATCH_MAX_SIZE,
111
- vs as VP_TERMINAL_FAILURE_STATUSES,
112
- ys as VP_TRANSIENT_STATUSES,
113
- Dr as VaultIdBindingError,
111
+ ys as VP_BATCH_MAX_SIZE,
112
+ Ds as VP_TERMINAL_FAILURE_STATUSES,
113
+ Us as VP_TRANSIENT_STATUSES,
114
+ Lr as VaultIdBindingError,
114
115
  ms as VaultProviderRpcClient,
115
- ar as VaultRootMismatchError,
116
+ tr as VaultRootMismatchError,
116
117
  qa as ViemOperationKeyReader,
117
- pe as ViemPeginRegistrationClient,
118
+ Pe as ViemPeginRegistrationClient,
118
119
  Qa as ViemProtocolParamsReader,
119
120
  $a as ViemUniversalChallengerReader,
120
121
  ae as ViemVaultKeeperReader,
121
122
  Ee as ViemVaultRegistryReader,
122
123
  Ts as VpResponseValidationError,
123
- Hs as VpTokenRegistry,
124
+ Gs as VpTokenRegistry,
124
125
  ns as WALLET_RELAY_FEE_RATE_THRESHOLD,
125
126
  Sa as X_ONLY_PUBKEY_HEX_LEN,
126
- Ur as activateVault,
127
- Br as activateVaultAndRedeem,
127
+ Kr as activateVault,
128
+ Xr as activateVaultAndRedeem,
129
+ Vt as activationDeadlineBlocksRemaining,
128
130
  Xe as applyChangeOutputPolicy,
129
- Hr as assembleWatchtowerArtifacts,
130
- Lr as assertArtifactsUsableForVault,
131
- Kr as assertChallengerSetMatchesVault,
132
- Xr as assertClaimSpendsVault,
131
+ Gr as assembleWatchtowerArtifacts,
132
+ kr as assertArtifactsUsableForVault,
133
+ Wr as assertChallengerSetMatchesVault,
134
+ wr as assertClaimSpendsVault,
133
135
  F as assertKeyPathSchnorrSignature,
134
136
  re as assertOnChainBtcPubkey,
135
- kr as assertPayoutPaysRegisteredScript,
137
+ zr as assertPayoutPaysRegisteredScript,
136
138
  t as assertPsbtUnsignedTxMatches,
139
+ Yr as assertReturnedGraphMatchesFingerprint,
137
140
  M as assertReturnedKeyPathSignatures,
138
141
  i as assertScriptPathSchnorrSignature,
139
142
  ds as assertUtxosAvailable,
140
143
  g as assertValidVaultCoreVersion,
141
- Gr as assertVaultProviderHintAccepted,
142
- R as attachFinalizedAssert,
144
+ jr as assertVaultProviderHintAccepted,
145
+ A as attachFinalizedAssert,
143
146
  Ss as batchPollByProvider,
144
- Wr as buildAndBroadcastReclaim,
145
- wr as buildAndBroadcastRefund,
147
+ Jr as buildAndBroadcastReclaim,
148
+ Zr as buildAndBroadcastRefund,
146
149
  W as buildChallengeAssertPsbt,
147
- ha as buildDepositTerms,
150
+ Oa as buildDepositTerms,
148
151
  ve as buildFundingOutpointsCommitment,
149
152
  B as buildNoPayoutPsbt,
150
153
  o as buildPayoutPsbt,
151
154
  v as buildPeginInputPsbt,
152
- er as buildPeginParamsCandidates,
155
+ ir as buildPeginParamsCandidates,
153
156
  n as buildPeginTxFromFundedPrePegin,
154
- P as buildPrePeginPsbt,
157
+ p as buildPrePeginPsbt,
155
158
  H as buildReclaimPsbt,
156
159
  L as buildRefundPsbt,
157
160
  ye as buildVaultContext,
158
161
  la as calculateBtcTxHash,
159
- ft as canPerformAction,
162
+ xt as canPerformAction,
160
163
  z as canonicalizeBtcPubkey,
161
164
  le as capMaxAcceptableCommissionBps,
162
- pa as combineAbortSignals,
163
- ke as computeChangeOutputFeeSats,
165
+ Pa as combineAbortSignals,
166
+ Ge as computeChangeOutputFeeSats,
164
167
  Ma as computeHashlock,
165
- Ge as computeMaxDeposit,
168
+ ke as computeMaxDeposit,
166
169
  _ as computeMinClaimValue,
167
170
  m as computeMinPeginFee,
168
- p as computeNumLocalChallengers,
171
+ P as computeNumLocalChallengers,
169
172
  We as computePeginBaseFeeSats,
170
- sr as computePeginFingerprint,
173
+ or as computePeginFingerprint,
171
174
  Na as computeWotsBlockPublicKeysHash,
172
- Ls as createAuthenticatedVpClient,
175
+ ks as createAuthenticatedVpClient,
173
176
  E as createPayoutScript,
174
177
  ca as createTaprootScriptPathSignOptions,
175
178
  ua as createTaprootScriptPathSignOptionsForInput,
176
179
  Y as deriveBip86ScriptPubKeyHex,
177
- zr as deriveClaimerWotsKeypair,
180
+ qr as deriveClaimerWotsKeypair,
178
181
  l as deriveDepositorClaimDescriptor,
179
182
  c as deriveDepositorClaimScriptPubKey,
180
- rr as deriveHashlocksFromPrePegin,
183
+ nr as deriveHashlocksFromPrePegin,
181
184
  j as deriveNativeSegwitAddress,
182
185
  te as derivePeginVaultId,
183
186
  J as deriveTaprootAddress,
184
187
  T as deriveVaultId,
185
188
  De as deriveVaultRoot,
186
189
  ba as deriveWotsBlocksFromSeed,
187
- tr as describePeginParamsCandidate,
188
- ir as describeUnresolvedVersion,
189
- or as encodePeginFingerprintPreimage,
190
+ pr as describePeginParamsCandidate,
191
+ Pr as describeUnresolvedVersion,
192
+ Er as encodePeginFingerprintPreimage,
190
193
  Z as ensureHexPrefix,
191
194
  Va as ensurePrePeginTermsApproval,
192
195
  K as estimateReclaimFeeSats,
193
- Yr as estimateRefundFeeSats,
196
+ Qr as estimateRefundFeeSats,
194
197
  S as expandAuthAnchor,
195
198
  C as expandHashlockSecret,
196
199
  I as expandWotsSeed,
197
- he as extractErrorData,
200
+ Oe as extractErrorData,
198
201
  gs as extractInputsFromTransaction,
199
202
  u as extractPayoutSignature,
200
203
  y as extractPeginInputSignature,
201
- O as finalizePayout,
204
+ f as finalizePayout,
202
205
  D as finalizePeginInputPsbt,
203
206
  X as finalizeScriptPathWithSignatures,
204
- f as finalizeWronglyChallenged,
205
- As as findOverlappingPendingVaults,
207
+ h as finalizeWronglyChallenged,
208
+ Rs as findOverlappingPendingVaults,
209
+ $r as fingerprintReturnedGraph,
206
210
  q as formatSatoshisToBtc,
207
211
  va as forwardDepositApproval,
208
212
  Ue as forwardDeriveContextHash,
209
- Ps as fundPeginTransaction,
213
+ ps as fundPeginTransaction,
210
214
  La as getAddressTxs,
211
215
  Ka as getAddressUtxos,
212
216
  Ne as getContractErrorMessage,
213
217
  we as getDustThreshold,
214
218
  Xa as getMempoolApiUrl,
215
219
  Q as getNetwork,
216
- ka as getNetworkFees,
217
- Ga as getOutspend,
218
- ht as getPeginProtocolState,
220
+ Ga as getNetworkFees,
221
+ ka as getOutspend,
222
+ Ft as getPeginProtocolState,
219
223
  ze as getPsbtInputFields,
220
224
  Ye as getScriptType,
221
225
  $ as getSortedXOnlyPubkeys,
@@ -225,76 +229,77 @@ export {
225
229
  Ya as getUtxoInfo,
226
230
  be as handleContractError,
227
231
  aa as hexToUint8Array,
228
- Nt as isActivationDeadlinePassedOnChain,
232
+ Mt as isActivationDeadlinePassedOnChain,
229
233
  ea as isAddressFromPublicKey,
230
- jr as isApplicationEntryPointMismatchError,
231
- Ds as isAuthRejectedError,
232
- Jr as isDepositAmountValid,
233
- nr as isDepositTermsRejectedError,
234
- Zr as isHintAccepted,
234
+ at as isApplicationEntryPointMismatchError,
235
+ Bs as isAuthRejectedError,
236
+ et as isDepositAmountValid,
237
+ lr as isDepositTermsRejectedError,
238
+ st as isHintAccepted,
235
239
  Ve as isKnownContractError,
236
- qr as isParticipantKeyDriftError,
240
+ rt as isParticipantKeyDriftError,
237
241
  xe as isPeginFingerprintChangedError,
238
- Pr as isPeginFingerprintInputError,
239
- Qr as isPeginRegistrationMissingError,
240
- $r as isPeginRegistrationNotFinalError,
241
- at as isPegoutTerminalStatus,
242
- et as isRecognizedPegoutStatus,
243
- st as isRegisteredVaultVersionMismatchError,
242
+ cr as isPeginFingerprintInputError,
243
+ tt as isPeginRegistrationMissingError,
244
+ it as isPeginRegistrationNotFinalError,
245
+ Hs as isPegoutTerminalStatus,
246
+ Ls as isRecognizedPegoutStatus,
247
+ ot as isRegisteredVaultVersionMismatchError,
244
248
  ce as isRegistrationLogsUnavailableError,
249
+ Cs as isUnrecognizedDaemonStatusError,
245
250
  sa as isValidHex,
246
- pr as isWotsMismatchError,
247
- rt as matchKeyHint,
248
- tt as matchKeySetHint,
251
+ ur as isWotsMismatchError,
252
+ nt as matchKeyHint,
253
+ pt as matchKeySetHint,
249
254
  He as parseFundingOutpointsFromTx,
250
- ps as parseUnfundedWasmTransaction,
255
+ Ps as parseUnfundedWasmTransaction,
251
256
  Es as peginOutputCount,
252
- h as peginP2aAnchorOutput,
257
+ O as peginP2aAnchorOutput,
253
258
  N as pinPegoutProof,
254
- Ks as primeVpTokenRegistry,
259
+ Ws as primeVpTokenRegistry,
255
260
  ra as processPublicKeyToXOnly,
256
261
  ja as pushTx,
257
262
  ls as rateBasedTxBufferFee,
258
- Er as rebuildDepositTermsCore,
259
- k as reclaimVsize,
260
- lr as reconstructPeginParams,
263
+ dr as rebuildDepositTermsCore,
264
+ G as reclaimVsize,
265
+ gr as reconstructPeginParams,
261
266
  ya as requireChangeAddress,
262
- it as resolveCurrentParticipantKeys,
263
- ot as resolveParticipantKeysAtEpochs,
267
+ Pt as resolveCurrentParticipantKeys,
268
+ Et as resolveParticipantKeysAtEpochs,
264
269
  ee as resolveProtocolAddresses,
265
- nt as runDepositorPresignFlow,
270
+ lt as runDepositorPresignFlow,
266
271
  je as selectUtxosForPegin,
267
272
  Je as shouldAddChangeOutput,
268
- Pt as signDepositorGraph,
273
+ ct as signDepositorGraph,
269
274
  ta as stripHexPrefix,
270
- pt as submitWotsPublicKey,
271
- Et as summarizeWatchtowerArtifacts,
275
+ ut as submitWotsPublicKey,
276
+ dt as summarizeWatchtowerArtifacts,
272
277
  b as supportedTxGraphVersions,
273
278
  Da as supportsDepositApproval,
274
- cr as toRefundInputs,
279
+ Rr as toRefundInputs,
275
280
  ia as toXOnly,
276
281
  oa as uint8ArrayToHex,
277
- lt as validateDepositAmount,
278
- ct as validateMultiVaultDepositInputs,
282
+ gt as validateDepositAmount,
283
+ Rt as validateMultiVaultDepositInputs,
279
284
  ue as validateOffchainParams,
280
- ut as validateOnChainParticipantKeys,
285
+ At as validateOnChainParticipantKeys,
281
286
  de as validatePegInConfiguration,
282
287
  V as validatePeginP2aAnchor,
283
- dt as validateProviderSelection,
284
- gt as validateRemainingCapacity,
285
- Cs as validateRequestDepositorClaimerArtifactsResponse,
288
+ _t as validateProviderSelection,
289
+ mt as validateRemainingCapacity,
290
+ Is as validateRequestDepositorClaimerArtifactsResponse,
286
291
  Ua as validateSecretAgainstHashlock,
287
292
  ge as validateTBVProtocolParams,
288
- Rs as validateUtxosAvailable,
289
- At as validateVaultAmounts,
290
- Rt as validateVaultProviderPubkey,
293
+ As as validateUtxosAvailable,
294
+ Tt as validateVaultAmounts,
295
+ St as validateVaultProviderPubkey,
291
296
  na as validateWalletPubkey,
292
- _t as verifyRegisteredParticipantKeys,
293
- mt as verifyRegisteredVaultVersions,
294
- Xs as verifyServerIdentity,
295
- ks as vpTokenRegistry,
296
- Tt as waitForPeginRegistrationDepth,
297
- St as waitForPeginStatus,
297
+ Ct as verifyRegisteredParticipantKeys,
298
+ It as verifyRegisteredVaultVersions,
299
+ ws as verifyServerIdentity,
300
+ zs as vpTokenRegistry,
301
+ ft as waitForPeginRegistrationDepth,
302
+ ht as waitForPeginStatus,
298
303
  Ia as waitForTransactionReceiptSmartAware
299
304
  };
300
305
  //# sourceMappingURL=index.js.map
@@ -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-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;
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-Ce6KewYx.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-CLpQd0Rd.js";
5
+ import { s as f } from "../sha2-YqVHJiFj.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";
@@ -1,2 +1,2 @@
1
- "use strict";var le=Object.defineProperty;var he=(e,r,t)=>r in e?le(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var U=(e,r,t)=>he(e,typeof r!="symbol"?r+"":r,t);const x=require("viem"),de=require("./sha2-DI0-0SHr.cjs"),H=require("./PayoutManager-CpfQjtL0.cjs"),X=require("./PeginManager-6tjlGd0t.cjs"),g=require("./bitcoin-D-O2GjbC.cjs"),v=require("./tbv/core/wasm/index.cjs"),pe=require("./deriveVaultRoot-DvhkHzNb.cjs"),ge=require("./parseFundingOutpoints-C_-PT9BT.cjs"),Q=require("bitcoinjs-lib"),S=require("./verifyScriptPathSchnorrSignature-BKZihCjk.cjs"),q=require("./fundPeginTransaction-54-Rwb2k.cjs"),J=require("./signing-3l5Aqd-H.cjs"),K="DepositTermsRejectedError";class Y extends Error{constructor(t,n="device-envelope"){super(t);U(this,"reason");this.name=K,this.reason=n}}function me(e){if(e instanceof Y)return!0;if(typeof e!="object"||e===null)return!1;const r=e;return r.name===K&&r.reason==="device-envelope"}async function Z(e){const r=e.siblings.length;if(r===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 t=g.stripHexPrefix(e.prepeginTxid).toLowerCase(),n=g.stripHexPrefix(J.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(g.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,E=e.minPeginFeeRate*q.MAX_REASONABLE_PEGIN_VBYTES;if(i<=0n||i>E)throw new Error(`WASM implied PegIn reserve ${i} sat is outside (0, ${E}] (minPeginFeeRate=${e.minPeginFeeRate} × ${q.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:g.stripHexPrefix(o.hashlock),timelockRefund:e.timelockRefund,network:e.network})).scriptPubKey)),R=Q.Transaction.fromHex(g.stripHexPrefix(e.fundedPrePeginTxHex)).outs.map(o=>({value:o.value,script:o.script}));return S.assertEncodedHtlcOutputsMatch(R,w,C),X.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 Pe(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 ee="TBV.PeginFingerprint.v1",re=x.keccak256(x.toHex(ee)),G=65535,L=2n**64n-1n,fe=2n**256n-1n,ve=/^0x[0-9a-fA-F]{64}$/,j=1;class P extends Error{constructor(r){super(r),this.name="PeginFingerprintInputError"}}function Ee(e){return e instanceof P||e instanceof Error&&e.name==="PeginFingerprintInputError"}function N(e,r,t,n){if(typeof r!="bigint")throw new P(`${e} must be a bigint (Solidity ${n}), got ${typeof r}`);if(r<0n||r>t)throw new P(`${e} must fit Solidity ${n} (0..${t}), got ${r}`)}function I(e,r){if(!Number.isInteger(r)||r<0||r>G)throw new P(`${e} must be an integer fitting Solidity uint16 (0..${G}), got ${r}`)}function be(e,r){if(!ve.test(r))throw new P(`${e} must be 32 bytes as 0x-prefixed hex (66 characters), got "${r}"`);return r.toLowerCase()}function ye(e){if(!x.isAddress(e,{strict:!1}))throw new P(`registryAddress must be a 20-byte 0x-prefixed address, got "${e}"`);const r=e.toLowerCase();if(r===x.zeroAddress)throw new P("registryAddress must not be the zero address; a zero here means the registry address was never resolved");return r}const we=[{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 te(e){if(N("chainId",e.chainId,fe,"uint256"),e.chainId===0n)throw new P("chainId must not be 0; a zero here means the chain id was never resolved");const r=ye(e.registryAddress),t=be("vaultProviderBtcKey",e.vaultProviderBtcKey);if(N("appKeeperKeyEpoch",e.appKeeperKeyEpoch,L,"uint64"),N("ucKeyEpoch",e.ucKeyEpoch,L,"uint64"),I("appVaultKeepersVersion",e.appVaultKeepersVersion),I("universalChallengersVersion",e.universalChallengersVersion),I("offchainParamsVersion",e.offchainParamsVersion),I("vaultCoreVersion",e.vaultCoreVersion),e.vaultCoreVersion<j)throw new P(`vaultCoreVersion must be at least ${j}; ${e.vaultCoreVersion} means the version was never resolved`);return x.encodeAbiParameters(we,[re,e.chainId,r,t,e.appKeeperKeyEpoch,e.ucKeyEpoch,e.appVaultKeepersVersion,e.universalChallengersVersion,e.offchainParamsVersion,e.vaultCoreVersion])}function Re(e){return x.keccak256(te(e))}class ne 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 oe 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 se 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 ie 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 xe(e){const{wallet:r,depositorBtcPubkey:t,fundedPrePeginTxHex:n}=e,h=g.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=ge.parseFundingOutpointsFromTx(h),a=await pe.deriveVaultRoot(r,{depositorBtcPubkey:g.hexToUint8Array(g.processPublicKeyToXOnly(t)),fundingOutpoints:l});try{const s=await v.expandAuthAnchor(a);let i;try{i=g.uint8ArrayToHex(de.sha256(s))}finally{s.fill(0)}if(i!==c.hash)throw new ne(i,c.hash)}catch(s){throw a.fill(0),s}const{hashlocks:d}=await X.expandPerVaultSecrets(a,u);return{vaultCount:u,hashlocks:d,authAnchorHash:c.hash}}function Ce(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 ae(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 W=5;function Ve(e,r){return JSON.stringify({terms:e,peginAmounts:r},(t,n)=>typeof n=="bigint"?`${n}`:n)}function ke(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 Te(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 Ae(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=g.processPublicKeyToXOnly(n),s=g.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 E=Q.Transaction.fromHex(s).outs,w=r.map((p,m)=>BigInt(E[m].value)),C=g.stripHexPrefix(J.calculateBtcTxHash(s)).toLowerCase(),R=new Map,o=[],b=[],M=[];let O=0;for(const p of l)try{const m=ke(p);let f=R.get(m);f===void 0&&(f=await Te(p),R.set(m,f));const V=f.depositorClaimValue+f.peginMaxFee+f.p2aAnchorValue,k=w.map(T=>T-V),$=k.findIndex(T=>T<=0n);if($!==-1)throw new S.HtlcOutputMismatchError(`HTLC output[${$}] value ${w[$]} is not above this candidate's reserve ${V}, so it implies a non-positive pegin amount ${k[$]}.`);const{offchainParams:y,participants:_}=p,D=await Z({vaultCoreVersion:p.vaultCoreVersion,siblings:r.map((T,ue)=>({hashlock:T,amount:k[ue]})),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:k,fingerprint:Ve(D,k)})}catch(m){if(m instanceof A)throw m;const f=F(p),V=m instanceof Error?m.message:String(m);m instanceof S.HtlcOutputMismatchError?b.length<W&&b.push(`[${f}] ${V}`):(O++,M.length<W&&M.push(`${f} (${V})`))}const ce=a.length+O,z=[...a.map(ae),...M];if(o.length===0)throw new oe(l.length,b,z);if(new Set(o.map(p=>p.fingerprint)).size>1)throw new se(o.map(p=>F(p.candidate)));if(ce>0)throw new ie(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 $e(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 E=d.map((R,o)=>({hashlock:g.ensureHexPrefix(u[o]),amount:R,htlcVout:o})),w={vaultCoreVersion:a.vaultCoreVersion,hashlock:E[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:E},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=Y;exports.PEGIN_FINGERPRINT_DOMAIN=re;exports.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE=ee;exports.PeginFingerprintInputError=P;exports.PeginParamsAmbiguousError=se;exports.PeginParamsIncompleteSpaceError=ie;exports.PeginParamsNotFoundError=oe;exports.PeginSizingIntegrityError=A;exports.UnanchoredPrePeginError=B;exports.VaultRootMismatchError=ne;exports.buildPeginParamsCandidates=Ce;exports.computePeginFingerprint=Re;exports.deriveHashlocksFromPrePegin=xe;exports.describePeginParamsCandidate=F;exports.describeUnresolvedVersion=ae;exports.encodePeginFingerprintPreimage=te;exports.isDepositTermsRejectedError=me;exports.isPeginFingerprintInputError=Ee;exports.isWotsMismatchError=Pe;exports.rebuildDepositTermsCore=Z;exports.reconstructPeginParams=Ae;exports.toRefundInputs=$e;
2
- //# sourceMappingURL=toRefundInputs-BaN9XluU.cjs.map
1
+ "use strict";var le=Object.defineProperty;var he=(e,r,t)=>r in e?le(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var U=(e,r,t)=>he(e,typeof r!="symbol"?r+"":r,t);const x=require("viem"),de=require("./sha2-Ce6KewYx.cjs"),H=require("./PayoutManager-B6GFbG3X.cjs"),X=require("./PeginManager-Dt2Z5ljw.cjs"),g=require("./bitcoin-D-O2GjbC.cjs"),v=require("./tbv/core/wasm/index.cjs"),pe=require("./deriveVaultRoot-C3uqnJto.cjs"),ge=require("./parseFundingOutpoints-C_-PT9BT.cjs"),Q=require("bitcoinjs-lib"),S=require("./verifyScriptPathSchnorrSignature-BKZihCjk.cjs"),q=require("./fundPeginTransaction-54-Rwb2k.cjs"),J=require("./signing-3l5Aqd-H.cjs"),K="DepositTermsRejectedError";class Y extends Error{constructor(t,n="device-envelope"){super(t);U(this,"reason");this.name=K,this.reason=n}}function me(e){if(e instanceof Y)return!0;if(typeof e!="object"||e===null)return!1;const r=e;return r.name===K&&r.reason==="device-envelope"}async function Z(e){const r=e.siblings.length;if(r===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 t=g.stripHexPrefix(e.prepeginTxid).toLowerCase(),n=g.stripHexPrefix(J.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(g.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,E=e.minPeginFeeRate*q.MAX_REASONABLE_PEGIN_VBYTES;if(i<=0n||i>E)throw new Error(`WASM implied PegIn reserve ${i} sat is outside (0, ${E}] (minPeginFeeRate=${e.minPeginFeeRate} × ${q.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:g.stripHexPrefix(o.hashlock),timelockRefund:e.timelockRefund,network:e.network})).scriptPubKey)),R=Q.Transaction.fromHex(g.stripHexPrefix(e.fundedPrePeginTxHex)).outs.map(o=>({value:o.value,script:o.script}));return S.assertEncodedHtlcOutputsMatch(R,w,C),X.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 Pe(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 ee="TBV.PeginFingerprint.v1",re=x.keccak256(x.toHex(ee)),G=65535,L=2n**64n-1n,fe=2n**256n-1n,ve=/^0x[0-9a-fA-F]{64}$/,j=1;class P extends Error{constructor(r){super(r),this.name="PeginFingerprintInputError"}}function Ee(e){return e instanceof P||e instanceof Error&&e.name==="PeginFingerprintInputError"}function N(e,r,t,n){if(typeof r!="bigint")throw new P(`${e} must be a bigint (Solidity ${n}), got ${typeof r}`);if(r<0n||r>t)throw new P(`${e} must fit Solidity ${n} (0..${t}), got ${r}`)}function I(e,r){if(!Number.isInteger(r)||r<0||r>G)throw new P(`${e} must be an integer fitting Solidity uint16 (0..${G}), got ${r}`)}function be(e,r){if(!ve.test(r))throw new P(`${e} must be 32 bytes as 0x-prefixed hex (66 characters), got "${r}"`);return r.toLowerCase()}function ye(e){if(!x.isAddress(e,{strict:!1}))throw new P(`registryAddress must be a 20-byte 0x-prefixed address, got "${e}"`);const r=e.toLowerCase();if(r===x.zeroAddress)throw new P("registryAddress must not be the zero address; a zero here means the registry address was never resolved");return r}const we=[{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 te(e){if(N("chainId",e.chainId,fe,"uint256"),e.chainId===0n)throw new P("chainId must not be 0; a zero here means the chain id was never resolved");const r=ye(e.registryAddress),t=be("vaultProviderBtcKey",e.vaultProviderBtcKey);if(N("appKeeperKeyEpoch",e.appKeeperKeyEpoch,L,"uint64"),N("ucKeyEpoch",e.ucKeyEpoch,L,"uint64"),I("appVaultKeepersVersion",e.appVaultKeepersVersion),I("universalChallengersVersion",e.universalChallengersVersion),I("offchainParamsVersion",e.offchainParamsVersion),I("vaultCoreVersion",e.vaultCoreVersion),e.vaultCoreVersion<j)throw new P(`vaultCoreVersion must be at least ${j}; ${e.vaultCoreVersion} means the version was never resolved`);return x.encodeAbiParameters(we,[re,e.chainId,r,t,e.appKeeperKeyEpoch,e.ucKeyEpoch,e.appVaultKeepersVersion,e.universalChallengersVersion,e.offchainParamsVersion,e.vaultCoreVersion])}function Re(e){return x.keccak256(te(e))}class ne 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 oe 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 se 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 ie 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 xe(e){const{wallet:r,depositorBtcPubkey:t,fundedPrePeginTxHex:n}=e,h=g.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=ge.parseFundingOutpointsFromTx(h),a=await pe.deriveVaultRoot(r,{depositorBtcPubkey:g.hexToUint8Array(g.processPublicKeyToXOnly(t)),fundingOutpoints:l});try{const s=await v.expandAuthAnchor(a);let i;try{i=g.uint8ArrayToHex(de.sha256(s))}finally{s.fill(0)}if(i!==c.hash)throw new ne(i,c.hash)}catch(s){throw a.fill(0),s}const{hashlocks:d}=await X.expandPerVaultSecrets(a,u);return{vaultCount:u,hashlocks:d,authAnchorHash:c.hash}}function Ce(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 ae(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 W=5;function Ve(e,r){return JSON.stringify({terms:e,peginAmounts:r},(t,n)=>typeof n=="bigint"?`${n}`:n)}function ke(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 Te(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 Ae(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=g.processPublicKeyToXOnly(n),s=g.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 E=Q.Transaction.fromHex(s).outs,w=r.map((p,m)=>BigInt(E[m].value)),C=g.stripHexPrefix(J.calculateBtcTxHash(s)).toLowerCase(),R=new Map,o=[],b=[],M=[];let O=0;for(const p of l)try{const m=ke(p);let f=R.get(m);f===void 0&&(f=await Te(p),R.set(m,f));const V=f.depositorClaimValue+f.peginMaxFee+f.p2aAnchorValue,k=w.map(T=>T-V),$=k.findIndex(T=>T<=0n);if($!==-1)throw new S.HtlcOutputMismatchError(`HTLC output[${$}] value ${w[$]} is not above this candidate's reserve ${V}, so it implies a non-positive pegin amount ${k[$]}.`);const{offchainParams:y,participants:_}=p,D=await Z({vaultCoreVersion:p.vaultCoreVersion,siblings:r.map((T,ue)=>({hashlock:T,amount:k[ue]})),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:k,fingerprint:Ve(D,k)})}catch(m){if(m instanceof A)throw m;const f=F(p),V=m instanceof Error?m.message:String(m);m instanceof S.HtlcOutputMismatchError?b.length<W&&b.push(`[${f}] ${V}`):(O++,M.length<W&&M.push(`${f} (${V})`))}const ce=a.length+O,z=[...a.map(ae),...M];if(o.length===0)throw new oe(l.length,b,z);if(new Set(o.map(p=>p.fingerprint)).size>1)throw new se(o.map(p=>F(p.candidate)));if(ce>0)throw new ie(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 $e(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 E=d.map((R,o)=>({hashlock:g.ensureHexPrefix(u[o]),amount:R,htlcVout:o})),w={vaultCoreVersion:a.vaultCoreVersion,hashlock:E[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:E},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=Y;exports.PEGIN_FINGERPRINT_DOMAIN=re;exports.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE=ee;exports.PeginFingerprintInputError=P;exports.PeginParamsAmbiguousError=se;exports.PeginParamsIncompleteSpaceError=ie;exports.PeginParamsNotFoundError=oe;exports.PeginSizingIntegrityError=A;exports.UnanchoredPrePeginError=B;exports.VaultRootMismatchError=ne;exports.buildPeginParamsCandidates=Ce;exports.computePeginFingerprint=Re;exports.deriveHashlocksFromPrePegin=xe;exports.describePeginParamsCandidate=F;exports.describeUnresolvedVersion=ae;exports.encodePeginFingerprintPreimage=te;exports.isDepositTermsRejectedError=me;exports.isPeginFingerprintInputError=Ee;exports.isWotsMismatchError=Pe;exports.rebuildDepositTermsCore=Z;exports.reconstructPeginParams=Ae;exports.toRefundInputs=$e;
2
+ //# sourceMappingURL=toRefundInputs-B_GlIXjk.cjs.map