@babylonlabs-io/ts-sdk 3.3.1 → 4.1.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 (197) hide show
  1. package/dist/{BTCVaultRegistry.abi-BzNTa_EU.js → BTCVaultRegistry.abi-DnP4UkB5.js} +9 -140
  2. package/dist/BTCVaultRegistry.abi-DnP4UkB5.js.map +1 -0
  3. package/dist/{BTCVaultRegistry.abi-BH2-LHxN.cjs → BTCVaultRegistry.abi-DzbfZ9_s.cjs} +2 -2
  4. package/dist/BTCVaultRegistry.abi-DzbfZ9_s.cjs.map +1 -0
  5. package/dist/{PayoutManager-xEGvTbhL.js → PayoutManager-BUWP-H-q.js} +3 -3
  6. package/dist/PayoutManager-BUWP-H-q.js.map +1 -0
  7. package/dist/{PayoutManager-B1Ev0r7o.cjs → PayoutManager-Dopxq_Jv.cjs} +2 -2
  8. package/dist/PayoutManager-Dopxq_Jv.cjs.map +1 -0
  9. package/dist/{PeginManager-D2R4Q1bN.cjs → PeginManager-CMbRRTnr.cjs} +2 -2
  10. package/dist/PeginManager-CMbRRTnr.cjs.map +1 -0
  11. package/dist/{PeginManager-CQ9bVPR3.js → PeginManager-Cas6_j7t.js} +7 -7
  12. package/dist/PeginManager-Cas6_j7t.js.map +1 -0
  13. package/dist/{ProtocolParams.abi-Cv77fsUe.js → ProtocolParams.abi-CuDl7AuC.js} +3 -3
  14. package/dist/{ProtocolParams.abi-Cv77fsUe.js.map → ProtocolParams.abi-CuDl7AuC.js.map} +1 -1
  15. package/dist/{ProtocolParams.abi-BgEZaQ2I.cjs → ProtocolParams.abi-DWfIh6VH.cjs} +2 -2
  16. package/dist/{ProtocolParams.abi-BgEZaQ2I.cjs.map → ProtocolParams.abi-DWfIh6VH.cjs.map} +1 -1
  17. package/dist/VaultErrors.abi-Dc3UnB_h.js +5 -0
  18. package/dist/{VaultErrors.abi-Boz4w97c.js.map → VaultErrors.abi-Dc3UnB_h.js.map} +1 -1
  19. package/dist/VaultErrors.abi-Hjn1CdLs.cjs +2 -0
  20. package/dist/{VaultErrors.abi-DQ18kM0L.cjs.map → VaultErrors.abi-Hjn1CdLs.cjs.map} +1 -1
  21. package/dist/{buildAndBroadcastReclaim-CQANDXVJ.js → buildAndBroadcastReclaim-ByXYSUwj.js} +372 -337
  22. package/dist/buildAndBroadcastReclaim-ByXYSUwj.js.map +1 -0
  23. package/dist/buildAndBroadcastReclaim-OBWjvzuC.cjs +2 -0
  24. package/dist/buildAndBroadcastReclaim-OBWjvzuC.cjs.map +1 -0
  25. package/dist/challengeAssert-eUMgmpMk.cjs +2 -0
  26. package/dist/challengeAssert-eUMgmpMk.cjs.map +1 -0
  27. package/dist/{challengeAssert-B2otuf7y.js → challengeAssert-pJP7MKhG.js} +164 -164
  28. package/dist/challengeAssert-pJP7MKhG.js.map +1 -0
  29. package/dist/constants-BCg6O0PX.cjs +2 -0
  30. package/dist/constants-BCg6O0PX.cjs.map +1 -0
  31. package/dist/constants-CmDDuM3L.js +50 -0
  32. package/dist/constants-CmDDuM3L.js.map +1 -0
  33. package/dist/{index-BRsWXDlv.js → index-B-9aXMxk.js} +6 -6
  34. package/dist/{index-BRsWXDlv.js.map → index-B-9aXMxk.js.map} +1 -1
  35. package/dist/{index-C6avwx1s.cjs → index-Dn7RlsKK.cjs} +2 -2
  36. package/dist/{index-C6avwx1s.cjs.map → index-Dn7RlsKK.cjs.map} +1 -1
  37. package/dist/index.cjs +1 -1
  38. package/dist/index.js +68 -67
  39. package/dist/pegin-registration-client-DLlaZbsZ.cjs +2 -0
  40. package/dist/pegin-registration-client-DLlaZbsZ.cjs.map +1 -0
  41. package/dist/{pegin-registration-client-Cvjk4ILq.js → pegin-registration-client-ZI0k10_3.js} +90 -96
  42. package/dist/pegin-registration-client-ZI0k10_3.js.map +1 -0
  43. package/dist/{primeVpAuth-D4UWXQ76.js → primeVpAuth-C-ET0XF4.js} +2 -2
  44. package/dist/{primeVpAuth-D4UWXQ76.js.map → primeVpAuth-C-ET0XF4.js.map} +1 -1
  45. package/dist/{primeVpAuth-CXNXYKrh.cjs → primeVpAuth-Ch-ig2My.cjs} +2 -2
  46. package/dist/{primeVpAuth-CXNXYKrh.cjs.map → primeVpAuth-Ch-ig2My.cjs.map} +1 -1
  47. package/dist/registration-records-CKc0OVuK.cjs +2 -0
  48. package/dist/registration-records-CKc0OVuK.cjs.map +1 -0
  49. package/dist/{registration-records-DJJC2NiO.js → registration-records-D39ApuHS.js} +141 -141
  50. package/dist/registration-records-D39ApuHS.js.map +1 -0
  51. package/dist/{signer-set-reader-GrFe_rsW.cjs → signer-set-reader-CJfV-GDz.cjs} +2 -2
  52. package/dist/signer-set-reader-CJfV-GDz.cjs.map +1 -0
  53. package/dist/{signer-set-reader-CSUe92zE.js → signer-set-reader-DiwLeqik.js} +3 -3
  54. package/dist/signer-set-reader-DiwLeqik.js.map +1 -0
  55. package/dist/tbv/core/clients/eth/index.cjs +1 -1
  56. package/dist/tbv/core/clients/eth/index.js +4 -4
  57. package/dist/tbv/core/clients/eth/operation-key-reader.d.ts +5 -1
  58. package/dist/tbv/core/clients/eth/operation-key-reader.d.ts.map +1 -1
  59. package/dist/tbv/core/clients/eth/protocol-params-validation.d.ts.map +1 -1
  60. package/dist/tbv/core/clients/eth/registration-logs-error.d.ts +6 -6
  61. package/dist/tbv/core/clients/eth/registration-records.d.ts +1 -1
  62. package/dist/tbv/core/clients/eth/signer-set-reader.d.ts.map +1 -1
  63. package/dist/tbv/core/clients/eth/types.d.ts +32 -13
  64. package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
  65. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +1 -1
  66. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
  67. package/dist/tbv/core/clients/index.cjs +1 -1
  68. package/dist/tbv/core/clients/index.d.ts +4 -2
  69. package/dist/tbv/core/clients/index.d.ts.map +1 -1
  70. package/dist/tbv/core/clients/index.js +6 -6
  71. package/dist/tbv/core/clients/vault-provider/status/index.cjs +1 -1
  72. package/dist/tbv/core/clients/vault-provider/status/index.js +1 -1
  73. package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +5 -111
  74. package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
  75. package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts +2 -2
  76. package/dist/tbv/core/contracts/abis/vaultErrors.abi.json.d.ts +1 -1
  77. package/dist/tbv/core/contracts/index.cjs +1 -1
  78. package/dist/tbv/core/contracts/index.js +3 -3
  79. package/dist/tbv/core/deposit-terms/__tests__/rebuildDepositTermsCore.test.d.ts +1 -1
  80. package/dist/tbv/core/deposit-terms/commissionCeiling.d.ts +1 -1
  81. package/dist/tbv/core/deposit-terms/depositTerms.d.ts +11 -9
  82. package/dist/tbv/core/deposit-terms/depositTerms.d.ts.map +1 -1
  83. package/dist/tbv/core/deposit-terms/rebuildDepositTermsCore.d.ts.map +1 -1
  84. package/dist/tbv/core/index.cjs +1 -1
  85. package/dist/tbv/core/index.js +69 -68
  86. package/dist/tbv/core/managers/PayoutManager.d.ts +9 -3
  87. package/dist/tbv/core/managers/PayoutManager.d.ts.map +1 -1
  88. package/dist/tbv/core/managers/PeginManager.d.ts +13 -3
  89. package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
  90. package/dist/tbv/core/managers/index.cjs +1 -1
  91. package/dist/tbv/core/managers/index.js +2 -2
  92. package/dist/tbv/core/primitives/__tests__/vaultCoreVersion.test.d.ts +1 -1
  93. package/dist/tbv/core/primitives/challengers.d.ts +12 -5
  94. package/dist/tbv/core/primitives/challengers.d.ts.map +1 -1
  95. package/dist/tbv/core/primitives/index.cjs +1 -1
  96. package/dist/tbv/core/primitives/index.d.ts +1 -1
  97. package/dist/tbv/core/primitives/index.js +3 -3
  98. package/dist/tbv/core/primitives/psbt/__tests__/deriveExpectedPeginPayoutScriptPubKey.test.d.ts +1 -1
  99. package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts.map +1 -1
  100. package/dist/tbv/core/primitives/psbt/constants.d.ts +38 -13
  101. package/dist/tbv/core/primitives/psbt/constants.d.ts.map +1 -1
  102. package/dist/tbv/core/primitives/psbt/depositorClaim.d.ts +3 -6
  103. package/dist/tbv/core/primitives/psbt/depositorClaim.d.ts.map +1 -1
  104. package/dist/tbv/core/primitives/psbt/pegin.d.ts +29 -9
  105. package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
  106. package/dist/tbv/core/primitives/psbt/refund.d.ts.map +1 -1
  107. package/dist/tbv/core/recovery/peginParamsCandidates.d.ts +1 -1
  108. package/dist/tbv/core/recovery/reconstructPeginParams.d.ts.map +1 -1
  109. package/dist/tbv/core/services/delegated-claim/__tests__/realWasmWatchtowerArtifacts.test.d.ts +2 -2
  110. package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifacts.d.ts +2 -1
  111. package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifacts.d.ts.map +1 -1
  112. package/dist/tbv/core/services/delegated-claim/challengerBinding.d.ts +3 -3
  113. package/dist/tbv/core/services/delegated-claim/challengerBinding.d.ts.map +1 -1
  114. package/dist/tbv/core/services/delegated-claim/deriveClaimerWotsKeypair.d.ts +1 -1
  115. package/dist/tbv/core/services/delegated-claim/deriveClaimerWotsKeypair.d.ts.map +1 -1
  116. package/dist/tbv/core/services/delegated-claim/planDelegatedClaimSigning.d.ts +2 -1
  117. package/dist/tbv/core/services/delegated-claim/planDelegatedClaimSigning.d.ts.map +1 -1
  118. package/dist/tbv/core/services/delegated-claim/readDelegatedClaimVaultContext.d.ts +1 -1
  119. package/dist/tbv/core/services/delegated-claim/readDelegatedClaimVaultContext.d.ts.map +1 -1
  120. package/dist/tbv/core/services/delegated-claim/readWatchtowerArtifacts.d.ts +3 -3
  121. package/dist/tbv/core/services/delegated-claim/readWatchtowerArtifacts.d.ts.map +1 -1
  122. package/dist/tbv/core/services/delegated-claim/types.d.ts +8 -9
  123. package/dist/tbv/core/services/delegated-claim/types.d.ts.map +1 -1
  124. package/dist/tbv/core/services/deposit/__tests__/signDepositorGraph.realGraph.test.d.ts +3 -3
  125. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts +19 -4
  126. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -1
  127. package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts +17 -3
  128. package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts.map +1 -1
  129. package/dist/tbv/core/services/index.cjs +1 -1
  130. package/dist/tbv/core/services/index.js +44 -43
  131. package/dist/tbv/core/services/participants/readStampedParticipantKeys.d.ts +19 -7
  132. package/dist/tbv/core/services/participants/readStampedParticipantKeys.d.ts.map +1 -1
  133. package/dist/tbv/core/services/refund/__tests__/readRefundPrePeginContext.test.d.ts +12 -0
  134. package/dist/tbv/core/services/refund/__tests__/readRefundPrePeginContext.test.d.ts.map +1 -0
  135. package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts +41 -12
  136. package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts.map +1 -1
  137. package/dist/tbv/core/services/refund/index.d.ts +1 -0
  138. package/dist/tbv/core/services/refund/index.d.ts.map +1 -1
  139. package/dist/tbv/core/services/refund/readRefundPrePeginContext.d.ts +41 -0
  140. package/dist/tbv/core/services/refund/readRefundPrePeginContext.d.ts.map +1 -0
  141. package/dist/tbv/core/wasm/index.cjs.map +1 -1
  142. package/dist/tbv/core/wasm/index.d.ts +8 -11
  143. package/dist/tbv/core/wasm/index.d.ts.map +1 -1
  144. package/dist/tbv/core/wasm/index.js.map +1 -1
  145. package/dist/tbv/index.cjs +1 -1
  146. package/dist/tbv/index.js +69 -68
  147. package/dist/toRefundInputs-BSQjDOK9.cjs +2 -0
  148. package/dist/toRefundInputs-BSQjDOK9.cjs.map +1 -0
  149. package/dist/{toRefundInputs-DH-1bRNY.js → toRefundInputs-BbbvPb2A.js} +175 -173
  150. package/dist/toRefundInputs-BbbvPb2A.js.map +1 -0
  151. package/dist/{types-BC2TGzcp.cjs → types-BnZIbDHb.cjs} +2 -2
  152. package/dist/types-BnZIbDHb.cjs.map +1 -0
  153. package/dist/{types-24A9Qoxb.js → types-K_aM5GZO.js} +39 -39
  154. package/dist/types-K_aM5GZO.js.map +1 -0
  155. package/dist/{verifyKeyPathSchnorrSignature-IIj3Z2se.js → verifyKeyPathSchnorrSignature-DPXOFOol.js} +2 -2
  156. package/dist/{verifyKeyPathSchnorrSignature-IIj3Z2se.js.map → verifyKeyPathSchnorrSignature-DPXOFOol.js.map} +1 -1
  157. package/dist/{verifyKeyPathSchnorrSignature-BRTpEH9X.cjs → verifyKeyPathSchnorrSignature-DcxCojp0.cjs} +2 -2
  158. package/dist/{verifyKeyPathSchnorrSignature-BRTpEH9X.cjs.map → verifyKeyPathSchnorrSignature-DcxCojp0.cjs.map} +1 -1
  159. package/dist/verifyScriptPathSchnorrSignature-CgDa9Rcg.cjs +2 -0
  160. package/dist/verifyScriptPathSchnorrSignature-CgDa9Rcg.cjs.map +1 -0
  161. package/dist/{verifyScriptPathSchnorrSignature-owu3BfyT.js → verifyScriptPathSchnorrSignature-D-fdi-sG.js} +462 -459
  162. package/dist/verifyScriptPathSchnorrSignature-D-fdi-sG.js.map +1 -0
  163. package/package.json +3 -3
  164. package/dist/BTCVaultRegistry.abi-BH2-LHxN.cjs.map +0 -1
  165. package/dist/BTCVaultRegistry.abi-BzNTa_EU.js.map +0 -1
  166. package/dist/PayoutManager-B1Ev0r7o.cjs.map +0 -1
  167. package/dist/PayoutManager-xEGvTbhL.js.map +0 -1
  168. package/dist/PeginManager-CQ9bVPR3.js.map +0 -1
  169. package/dist/PeginManager-D2R4Q1bN.cjs.map +0 -1
  170. package/dist/VaultErrors.abi-Boz4w97c.js +0 -5
  171. package/dist/VaultErrors.abi-DQ18kM0L.cjs +0 -2
  172. package/dist/buildAndBroadcastReclaim-CQANDXVJ.js.map +0 -1
  173. package/dist/buildAndBroadcastReclaim-DPk36Uhp.cjs +0 -2
  174. package/dist/buildAndBroadcastReclaim-DPk36Uhp.cjs.map +0 -1
  175. package/dist/challengeAssert-B2otuf7y.js.map +0 -1
  176. package/dist/challengeAssert-C3eMcM5Y.cjs +0 -2
  177. package/dist/challengeAssert-C3eMcM5Y.cjs.map +0 -1
  178. package/dist/constants-CAm10Qwp.cjs +0 -2
  179. package/dist/constants-CAm10Qwp.cjs.map +0 -1
  180. package/dist/constants-CvQZuxKv.js +0 -48
  181. package/dist/constants-CvQZuxKv.js.map +0 -1
  182. package/dist/pegin-registration-client-CdRyXP3j.cjs +0 -2
  183. package/dist/pegin-registration-client-CdRyXP3j.cjs.map +0 -1
  184. package/dist/pegin-registration-client-Cvjk4ILq.js.map +0 -1
  185. package/dist/registration-records-DJJC2NiO.js.map +0 -1
  186. package/dist/registration-records-XQMIKjGV.cjs +0 -2
  187. package/dist/registration-records-XQMIKjGV.cjs.map +0 -1
  188. package/dist/signer-set-reader-CSUe92zE.js.map +0 -1
  189. package/dist/signer-set-reader-GrFe_rsW.cjs.map +0 -1
  190. package/dist/toRefundInputs-DH-1bRNY.js.map +0 -1
  191. package/dist/toRefundInputs-DRmK83fv.cjs +0 -2
  192. package/dist/toRefundInputs-DRmK83fv.cjs.map +0 -1
  193. package/dist/types-24A9Qoxb.js.map +0 -1
  194. package/dist/types-BC2TGzcp.cjs.map +0 -1
  195. package/dist/verifyScriptPathSchnorrSignature-CahYx5Td.cjs +0 -2
  196. package/dist/verifyScriptPathSchnorrSignature-CahYx5Td.cjs.map +0 -1
  197. package/dist/verifyScriptPathSchnorrSignature-owu3BfyT.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  var se = Object.defineProperty;
2
2
  var ie = (e, t, o) => t in e ? se(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
3
  var z = (e, t, o) => ie(e, typeof t != "symbol" ? t + "" : t, o);
4
- import { r as S } from "./registration-records-DJJC2NiO.js";
5
- import { s as g, c as ae, h as ce, p as q, u as ue, e as le } from "./bitcoin-C-TuHb-v.js";
4
+ import { r as S } from "./registration-records-D39ApuHS.js";
5
+ import { s as f, c as ae, h as ce, p as q, u as ue, e as le } from "./bitcoin-C-TuHb-v.js";
6
6
  import { c as H } from "./btcTxHash-BRZ8_EZq.js";
7
7
  import { Transaction as M } from "bitcoinjs-lib";
8
8
  import { Buffer as he } from "buffer";
@@ -10,12 +10,12 @@ import { getUtxoInfo as de } from "./tbv/core/clients/mempool/index.js";
10
10
  import { M as D } from "./validation-OSC0xTHB.js";
11
11
  import { keccak256 as J, toHex as me, encodeAbiParameters as pe, isAddress as ge, zeroAddress as fe } from "viem";
12
12
  import { s as Pe } from "./sha2-YqVHJiFj.js";
13
- import { d as _ } from "./PayoutManager-xEGvTbhL.js";
14
- import { b as ve, a as be } from "./PeginManager-CQ9bVPR3.js";
13
+ import { d as _ } from "./PayoutManager-BUWP-H-q.js";
14
+ import { b as ve, a as be } from "./PeginManager-Cas6_j7t.js";
15
15
  import { computeMinClaimValue as Y, computeMinPeginFee as Z, peginP2aAnchorOutput as ee, getPrePeginHtlcConnectorInfo as we, expandAuthAnchor as ye } from "./tbv/core/wasm/index.js";
16
16
  import { d as Ce } from "./deriveVaultRoot-BcvmER1E.js";
17
17
  import { p as xe } from "./parseFundingOutpoints-GSM-IaaK.js";
18
- import { o as Ee, H as U } from "./verifyScriptPathSchnorrSignature-owu3BfyT.js";
18
+ import { o as Ee, H as U } from "./verifyScriptPathSchnorrSignature-D-fdi-sG.js";
19
19
  import { c as j } from "./fundPeginTransaction-CwhRbCQC.js";
20
20
  const Re = [
21
21
  "vaultCoreVersion",
@@ -79,18 +79,18 @@ function dt(e) {
79
79
  return t.name === te && t.reason === "device-envelope";
80
80
  }
81
81
  async function Be(e, t) {
82
- const o = M.fromHex(g(e)), n = (await Promise.all(
82
+ const o = M.fromHex(f(e)), n = (await Promise.all(
83
83
  o.ins.map(
84
- (i) => (
84
+ (a) => (
85
85
  // Bitcoin stores the prev-txid in reverse (internal) byte order.
86
86
  de(
87
- he.from(i.hash).reverse().toString("hex"),
88
- i.index,
87
+ he.from(a.hash).reverse().toString("hex"),
88
+ a.index,
89
89
  t
90
90
  )
91
91
  )
92
92
  )
93
- )).reduce((i, a) => i + BigInt(a.value), 0n), u = o.outs.reduce((i, a) => i + BigInt(a.value), 0n), s = n - u;
93
+ )).reduce((a, i) => a + BigInt(i.value), 0n), c = o.outs.reduce((a, i) => a + BigInt(i.value), 0n), s = n - c;
94
94
  if (s <= 0n)
95
95
  throw new Error(
96
96
  `The funded Pre-PegIn transaction's inputs do not cover its outputs plus a fee (computed fee: ${s} sats).`
@@ -107,16 +107,16 @@ async function oe(e) {
107
107
  throw new Error(
108
108
  "rebuildDepositTermsCore: at least one sibling is required"
109
109
  );
110
- for (const [l, b] of e.siblings.entries())
111
- if (b.amount <= 0n)
110
+ for (const [m, d] of e.siblings.entries())
111
+ if (d.amount <= 0n)
112
112
  throw new Error(
113
- `rebuildDepositTermsCore: sibling[${l}] has non-positive on-chain pegin amount ${b.amount}; the chain-read vault record is invalid. Resume refused.`
113
+ `rebuildDepositTermsCore: sibling[${m}] has non-positive on-chain pegin amount ${d.amount}; the chain-read vault record is invalid. Resume refused.`
114
114
  );
115
115
  if (e.prepeginMaxFee <= 0n)
116
116
  throw new Error(
117
117
  `rebuildDepositTermsCore: prepeginMaxFee must be > 0, got ${e.prepeginMaxFee}`
118
118
  );
119
- const o = g(e.prepeginTxid).toLowerCase(), r = g(
119
+ const o = f(e.prepeginTxid).toLowerCase(), r = f(
120
120
  H(e.fundedPrePeginTxHex)
121
121
  ).toLowerCase();
122
122
  if (r !== o)
@@ -124,7 +124,7 @@ async function oe(e) {
124
124
  `Funded Pre-PegIn tx hashes to ${r}, expected ${o} (on-chain prepeginTxid). Resume refused.`
125
125
  );
126
126
  const n = _(
127
- g(e.fundedPrePeginTxHex)
127
+ f(e.fundedPrePeginTxHex)
128
128
  );
129
129
  if (n === void 0)
130
130
  throw new Error(
@@ -134,56 +134,58 @@ async function oe(e) {
134
134
  throw new Error(
135
135
  `Auth-anchor OP_RETURN at vout ${n.vout} does not match the discovered sibling count ${t}; the discovered sibling set does not cover this transaction's HTLC outputs (a lagging index can cause this — retry later). Resume refused.`
136
136
  );
137
- const u = e.vaultKeeperBtcPubkeys.length, s = e.universalChallengerBtcPubkeys.length, i = await Y(
137
+ const c = e.vaultKeeperBtcPubkeys.length, s = e.universalChallengerBtcPubkeys.length, a = await Y(
138
138
  e.vaultCoreVersion,
139
- u,
139
+ c,
140
140
  s,
141
141
  e.councilQuorum,
142
142
  e.councilSize,
143
143
  e.protocolFeeRate
144
- ), a = await Z(
144
+ ), i = await Z(
145
145
  e.vaultCoreVersion,
146
- u,
146
+ c,
147
147
  s,
148
148
  e.minPeginFeeRate
149
- ), d = await ee(e.vaultCoreVersion), c = (d == null ? void 0 : d.value) ?? 0n;
150
- if (i <= 0n)
149
+ ), { value: l } = await ee(
150
+ e.vaultCoreVersion
151
+ );
152
+ if (a <= 0n)
151
153
  throw new Error(
152
- `WASM returned non-positive depositorClaimValue ${i}; expected > 0. Resume refused.`
154
+ `WASM returned non-positive depositorClaimValue ${a}; expected > 0. Resume refused.`
153
155
  );
154
- if (a <= 0n)
156
+ if (i <= 0n)
155
157
  throw new Error(
156
- `WASM returned non-positive peginMaxFee ${a}; expected > 0. Resume refused.`
158
+ `WASM returned non-positive peginMaxFee ${i}; expected > 0. Resume refused.`
157
159
  );
158
- if (c < 0n)
160
+ if (l < 0n)
159
161
  throw new Error(
160
- `WASM returned negative P2A anchor value ${c}. Resume refused.`
162
+ `WASM returned negative P2A anchor value ${l}. Resume refused.`
161
163
  );
162
- const h = a + c, v = e.minPeginFeeRate * j;
163
- if (h <= 0n || h > v)
164
+ const u = i + l, h = e.minPeginFeeRate * j;
165
+ if (u <= 0n || u > h)
164
166
  throw new Error(
165
- `WASM implied PegIn reserve ${h} sat is outside (0, ${v}] (minPeginFeeRate=${e.minPeginFeeRate} × ${j} vbytes). Resume refused.`
167
+ `WASM implied PegIn reserve ${u} sat is outside (0, ${h}] (minPeginFeeRate=${e.minPeginFeeRate} × ${j} vbytes). Resume refused.`
166
168
  );
167
- const y = e.siblings.map(
168
- (l) => l.amount + i + a + c
169
- ), x = await Promise.all(
170
- e.siblings.map(async (l) => (await we({
169
+ const w = e.siblings.map(
170
+ (m) => m.amount + a + i + l
171
+ ), y = await Promise.all(
172
+ e.siblings.map(async (m) => (await we({
171
173
  txGraphVersion: e.vaultCoreVersion,
172
174
  depositorPubkey: e.depositorBtcPubkey,
173
175
  vaultProviderPubkey: e.vaultProviderBtcPubkey,
174
176
  vaultKeeperPubkeys: [...e.vaultKeeperBtcPubkeys],
175
177
  universalChallengerPubkeys: [...e.universalChallengerBtcPubkeys],
176
- hashlock: g(l.hashlock),
178
+ hashlock: f(m.hashlock),
177
179
  timelockRefund: e.timelockRefund,
178
180
  network: e.network
179
181
  })).scriptPubKey)
180
182
  ), C = M.fromHex(
181
- g(e.fundedPrePeginTxHex)
182
- ).outs.map((l) => ({ value: l.value, script: l.script }));
183
+ f(e.fundedPrePeginTxHex)
184
+ ).outs.map((m) => ({ value: m.value, script: m.script }));
183
185
  return Ee(
184
186
  C,
185
- y,
186
- x
187
+ w,
188
+ y
187
189
  ), ve({
188
190
  vaultCoreVersion: e.vaultCoreVersion,
189
191
  protocolFeeRate: e.protocolFeeRate,
@@ -196,9 +198,9 @@ async function oe(e) {
196
198
  vaultKeeperBtcPubkeys: e.vaultKeeperBtcPubkeys,
197
199
  universalChallengerBtcPubkeys: e.universalChallengerBtcPubkeys,
198
200
  maxAcceptableCommissionBps: e.maxAcceptableCommissionBps,
199
- peginAmounts: e.siblings.map((l) => l.amount),
200
- depositorClaimValue: i,
201
- peginMaxFee: a
201
+ peginAmounts: e.siblings.map((m) => m.amount),
202
+ depositorClaimValue: a,
203
+ peginMaxFee: i
202
204
  });
203
205
  }
204
206
  async function mt(e) {
@@ -207,40 +209,40 @@ async function mt(e) {
207
209
  throw new Error(
208
210
  "Connected wallet key is not the vault's depositor key; select the account that made the deposit."
209
211
  );
210
- const r = g(t.prePeginTxHash).toLowerCase(), n = g(
212
+ const r = f(t.prePeginTxHash).toLowerCase(), n = f(
211
213
  H(e.fundedPrePeginTxHex)
212
214
  ).toLowerCase();
213
215
  if (n !== r)
214
216
  throw new Error(
215
217
  `Funded Pre-PegIn tx hashes to ${n}, expected ${r} (on-chain prePeginTxHash).`
216
218
  );
217
- const u = await Promise.all(
219
+ const c = await Promise.all(
218
220
  Ve(
219
221
  t.registrationRecords,
220
222
  t.registrationRecord
221
- ).map(async (d) => {
222
- const c = await e.siblingReader.getVaultData(d.vaultId);
223
- if (c.protocol.prePeginTxHash.toLowerCase() !== S(d).toLowerCase())
223
+ ).map(async (l) => {
224
+ const u = await e.siblingReader.getVaultData(l.vaultId);
225
+ if (u.protocol.prePeginTxHash.toLowerCase() !== S(l).toLowerCase())
224
226
  throw new Error(
225
- `Sibling ${d.vaultId} is registered against a different Pre-PegIn on chain than its registration log records; refusing an inconsistent node.`
227
+ `Sibling ${l.vaultId} is registered against a different Pre-PegIn on chain than its registration log records; refusing an inconsistent node.`
226
228
  );
227
229
  return {
228
- vault: c,
229
- maxAcceptableCommissionBps: d.maxAcceptableCommissionBps
230
+ vault: u,
231
+ maxAcceptableCommissionBps: l.maxAcceptableCommissionBps
230
232
  };
231
233
  })
232
234
  ), s = {
233
235
  vault: t.vault,
234
236
  maxAcceptableCommissionBps: t.registrationRecord.maxAcceptableCommissionBps
235
237
  };
236
- $e(s, u);
237
- const i = Ae([s, ...u]), a = await Be(
238
+ $e(s, c);
239
+ const a = Ae([s, ...c]), i = await Be(
238
240
  e.fundedPrePeginTxHex,
239
241
  e.mempoolApiUrl
240
242
  );
241
243
  return oe({
242
244
  vaultCoreVersion: t.vault.protocol.vaultCoreVersion,
243
- siblings: i,
245
+ siblings: a,
244
246
  fundedPrePeginTxHex: e.fundedPrePeginTxHex,
245
247
  depositorBtcPubkey: o,
246
248
  vaultProviderBtcPubkey: t.participantKeys.vaultProvider.operationBtcPubkey,
@@ -254,7 +256,7 @@ async function mt(e) {
254
256
  timelockAssert: t.context.timelockAssert,
255
257
  timelockRefund: t.offchainParams.tRefund,
256
258
  prepeginTxid: r,
257
- prepeginMaxFee: a,
259
+ prepeginMaxFee: i,
258
260
  // The submitted ceiling, verbatim: the device must see the terms the
259
261
  // depositor originally approved.
260
262
  maxAcceptableCommissionBps: t.registrationRecord.maxAcceptableCommissionBps,
@@ -268,45 +270,45 @@ function pt(e) {
268
270
  const Ie = "TBV.PeginFingerprint.v1", Fe = J(
269
271
  me(Ie)
270
272
  ), G = 65535, Q = 2n ** 64n - 1n, Se = 2n ** 256n - 1n, Ke = /^0x[0-9a-fA-F]{64}$/, W = 1;
271
- class P extends Error {
273
+ class v extends Error {
272
274
  constructor(t) {
273
275
  super(t), this.name = "PeginFingerprintInputError";
274
276
  }
275
277
  }
276
278
  function gt(e) {
277
- return e instanceof P || e instanceof Error && e.name === "PeginFingerprintInputError";
279
+ return e instanceof v || e instanceof Error && e.name === "PeginFingerprintInputError";
278
280
  }
279
281
  function I(e, t, o, r) {
280
282
  if (typeof t != "bigint")
281
- throw new P(
283
+ throw new v(
282
284
  `${e} must be a bigint (Solidity ${r}), got ${typeof t}`
283
285
  );
284
286
  if (t < 0n || t > o)
285
- throw new P(
287
+ throw new v(
286
288
  `${e} must fit Solidity ${r} (0..${o}), got ${t}`
287
289
  );
288
290
  }
289
- function $(e, t) {
291
+ function V(e, t) {
290
292
  if (!Number.isInteger(t) || t < 0 || t > G)
291
- throw new P(
293
+ throw new v(
292
294
  `${e} must be an integer fitting Solidity uint16 (0..${G}), got ${t}`
293
295
  );
294
296
  }
295
297
  function He(e, t) {
296
298
  if (!Ke.test(t))
297
- throw new P(
299
+ throw new v(
298
300
  `${e} must be 32 bytes as 0x-prefixed hex (66 characters), got "${t}"`
299
301
  );
300
302
  return t.toLowerCase();
301
303
  }
302
304
  function Me(e) {
303
305
  if (!ge(e, { strict: !1 }))
304
- throw new P(
306
+ throw new v(
305
307
  `registryAddress must be a 20-byte 0x-prefixed address, got "${e}"`
306
308
  );
307
309
  const t = e.toLowerCase();
308
310
  if (t === fe)
309
- throw new P(
311
+ throw new v(
310
312
  "registryAddress must not be the zero address; a zero here means the registry address was never resolved"
311
313
  );
312
314
  return t;
@@ -325,7 +327,7 @@ const _e = [
325
327
  ];
326
328
  function Ne(e) {
327
329
  if (I("chainId", e.chainId, Se, "uint256"), e.chainId === 0n)
328
- throw new P(
330
+ throw new v(
329
331
  "chainId must not be 0; a zero here means the chain id was never resolved"
330
332
  );
331
333
  const t = Me(e.registryAddress), o = He(
@@ -337,11 +339,11 @@ function Ne(e) {
337
339
  e.appKeeperKeyEpoch,
338
340
  Q,
339
341
  "uint64"
340
- ), I("ucKeyEpoch", e.ucKeyEpoch, Q, "uint64"), $("appVaultKeepersVersion", e.appVaultKeepersVersion), $(
342
+ ), I("ucKeyEpoch", e.ucKeyEpoch, Q, "uint64"), V("appVaultKeepersVersion", e.appVaultKeepersVersion), V(
341
343
  "universalChallengersVersion",
342
344
  e.universalChallengersVersion
343
- ), $("offchainParamsVersion", e.offchainParamsVersion), $("vaultCoreVersion", e.vaultCoreVersion), e.vaultCoreVersion < W)
344
- throw new P(
345
+ ), V("offchainParamsVersion", e.offchainParamsVersion), V("vaultCoreVersion", e.vaultCoreVersion), e.vaultCoreVersion < W)
346
+ throw new v(
345
347
  `vaultCoreVersion must be at least ${W}; ${e.vaultCoreVersion} means the version was never resolved`
346
348
  );
347
349
  return pe(_e, [
@@ -393,46 +395,46 @@ class De extends Error {
393
395
  ), this.matchedLabel = t, this.unresolvedLabels = o, this.name = "PeginParamsIncompleteSpaceError";
394
396
  }
395
397
  }
396
- class A extends Error {
398
+ class $ extends Error {
397
399
  constructor(t) {
398
400
  super(`${t}. Reconstruction refused.`), this.name = "PeginSizingIntegrityError";
399
401
  }
400
402
  }
401
403
  async function Pt(e) {
402
- const { wallet: t, depositorBtcPubkey: o, fundedPrePeginTxHex: r } = e, n = g(r), u = _(n);
403
- if (u === void 0)
404
+ const { wallet: t, depositorBtcPubkey: o, fundedPrePeginTxHex: r } = e, n = f(r), c = _(n);
405
+ if (c === void 0)
404
406
  throw new K(
405
407
  "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."
406
408
  );
407
- const s = u.vout;
409
+ const s = c.vout;
408
410
  if (s === 0)
409
411
  throw new K(
410
412
  "Pre-PegIn's auth-anchor OP_RETURN is at vout 0, implying zero HTLC outputs; there is nothing to recover."
411
413
  );
412
- const i = xe(n), a = await Ce(t, {
414
+ const a = xe(n), i = await Ce(t, {
413
415
  // The vault context takes the 32-byte x-only key; a wallet's compressed
414
416
  // key would otherwise fail a byte-length check deep in the encoder with
415
417
  // nothing pointing back at the caller.
416
418
  depositorBtcPubkey: ce(
417
419
  q(o)
418
420
  ),
419
- fundingOutpoints: i
421
+ fundingOutpoints: a
420
422
  });
421
423
  try {
422
- const c = await ye(a);
424
+ const u = await ye(i);
423
425
  let h;
424
426
  try {
425
- h = ue(Pe(c));
427
+ h = ue(Pe(u));
426
428
  } finally {
427
- c.fill(0);
429
+ u.fill(0);
428
430
  }
429
- if (h !== u.hash)
430
- throw new Oe(h, u.hash);
431
- } catch (c) {
432
- throw a.fill(0), c;
431
+ if (h !== c.hash)
432
+ throw new Oe(h, c.hash);
433
+ } catch (u) {
434
+ throw i.fill(0), u;
433
435
  }
434
- const { hashlocks: d } = await be(a, s);
435
- return { vaultCount: s, hashlocks: d, authAnchorHash: u.hash };
436
+ const { hashlocks: l } = await be(i, s);
437
+ return { vaultCount: s, hashlocks: l, authAnchorHash: c.hash };
436
438
  }
437
439
  function vt(e) {
438
440
  const { vaultCoreVersion: t, offchainParams: o, participantKeySets: r } = e;
@@ -449,11 +451,11 @@ function vt(e) {
449
451
  "buildPeginParamsCandidates: at least one participant key set is required"
450
452
  );
451
453
  const n = [];
452
- for (const u of o)
454
+ for (const c of o)
453
455
  for (const s of r)
454
456
  n.push({
455
457
  vaultCoreVersion: t,
456
- offchainParams: u,
458
+ offchainParams: c,
457
459
  participants: s
458
460
  });
459
461
  return n;
@@ -485,7 +487,7 @@ function Ge(e) {
485
487
  ].join("|");
486
488
  }
487
489
  async function Qe(e) {
488
- const { offchainParams: t, participants: o } = e, r = o.vaultKeeperBtcPubkeys.length, n = o.universalChallengerBtcPubkeys.length, [u, s, i] = await Promise.all([
490
+ const { offchainParams: t, participants: o } = e, r = o.vaultKeeperBtcPubkeys.length, n = o.universalChallengerBtcPubkeys.length, [c, s, a] = await Promise.all([
489
491
  Y(
490
492
  e.vaultCoreVersion,
491
493
  r,
@@ -501,20 +503,20 @@ async function Qe(e) {
501
503
  t.minPeginFeeRate
502
504
  ),
503
505
  ee(e.vaultCoreVersion)
504
- ]), a = (i == null ? void 0 : i.value) ?? 0n;
505
- if (u <= 0n)
506
- throw new A(
507
- `WASM returned non-positive depositorClaimValue ${u} for graph version ${e.vaultCoreVersion}`
506
+ ]), i = a.value;
507
+ if (c <= 0n)
508
+ throw new $(
509
+ `WASM returned non-positive depositorClaimValue ${c} for graph version ${e.vaultCoreVersion}`
508
510
  );
509
511
  if (s <= 0n)
510
- throw new A(
512
+ throw new $(
511
513
  `WASM returned non-positive peginMaxFee ${s} for graph version ${e.vaultCoreVersion}`
512
514
  );
513
- if (a < 0n)
514
- throw new A(
515
- `WASM returned negative P2A anchor value ${a} for graph version ${e.vaultCoreVersion}`
515
+ if (i < 0n)
516
+ throw new $(
517
+ `WASM returned negative P2A anchor value ${i} for graph version ${e.vaultCoreVersion}`
516
518
  );
517
- return { depositorClaimValue: u, peginMaxFee: s, p2aAnchorValue: a };
519
+ return { depositorClaimValue: c, peginMaxFee: s, p2aAnchorValue: i };
518
520
  }
519
521
  async function bt(e) {
520
522
  const {
@@ -522,18 +524,18 @@ async function bt(e) {
522
524
  fundedPrePeginTxHex: o,
523
525
  depositorBtcPubkey: r,
524
526
  prepeginMaxFee: n,
525
- maxAcceptableCommissionBps: u,
527
+ maxAcceptableCommissionBps: c,
526
528
  network: s,
527
- candidates: i,
528
- unresolvedVersions: a
529
+ candidates: a,
530
+ unresolvedVersions: i
529
531
  } = e;
530
532
  if (t.length === 0)
531
533
  throw new Error(
532
534
  "reconstructPeginParams: at least one hashlock is required"
533
535
  );
534
- if (i.length === 0)
536
+ if (a.length === 0)
535
537
  throw new Error("reconstructPeginParams: candidate space is empty");
536
- const d = q(r), c = g(o), h = _(c);
538
+ const l = q(r), u = f(o), h = _(u);
537
539
  if (h === void 0)
538
540
  throw new K(
539
541
  "Pre-PegIn carries no single, unambiguous auth-anchor OP_RETURN; the sibling set cannot be proven complete. Reconstruction refused."
@@ -542,77 +544,77 @@ async function bt(e) {
542
544
  throw new Error(
543
545
  `reconstructPeginParams: ${t.length} hashlock(s) supplied but the auth-anchor OP_RETURN sits at vout ${h.vout}, so the transaction funds ${h.vout} HTLC output(s). Reconstruction refused.`
544
546
  );
545
- const v = M.fromHex(c).outs, y = t.map((m, p) => BigInt(v[p].value)), x = g(
546
- H(c)
547
- ).toLowerCase(), C = /* @__PURE__ */ new Map(), l = [], b = [], T = [];
547
+ const w = M.fromHex(u).outs, y = t.map((p, g) => BigInt(w[g].value)), C = f(
548
+ H(u)
549
+ ).toLowerCase(), m = /* @__PURE__ */ new Map(), d = [], A = [], T = [];
548
550
  let N = 0;
549
- for (const m of i)
551
+ for (const p of a)
550
552
  try {
551
- const p = Ge(m);
552
- let f = C.get(p);
553
- f === void 0 && (f = await Qe(m), C.set(p, f));
554
- const E = f.depositorClaimValue + f.peginMaxFee + f.p2aAnchorValue, R = y.map((k) => k - E), V = R.findIndex((k) => k <= 0n);
555
- if (V !== -1)
553
+ const g = Ge(p);
554
+ let P = m.get(g);
555
+ P === void 0 && (P = await Qe(p), m.set(g, P));
556
+ const x = P.depositorClaimValue + P.peginMaxFee + P.p2aAnchorValue, E = y.map((R) => R - x), k = E.findIndex((R) => R <= 0n);
557
+ if (k !== -1)
556
558
  throw new U(
557
- `HTLC output[${V}] value ${y[V]} is not above this candidate's reserve ${E}, so it implies a non-positive pegin amount ${R[V]}.`
559
+ `HTLC output[${k}] value ${y[k]} is not above this candidate's reserve ${x}, so it implies a non-positive pegin amount ${E[k]}.`
558
560
  );
559
- const { offchainParams: w, participants: B } = m, L = await oe({
560
- vaultCoreVersion: m.vaultCoreVersion,
561
- siblings: t.map((k, ne) => ({
562
- hashlock: k,
563
- amount: R[ne]
561
+ const { offchainParams: b, participants: B } = p, L = await oe({
562
+ vaultCoreVersion: p.vaultCoreVersion,
563
+ siblings: t.map((R, ne) => ({
564
+ hashlock: R,
565
+ amount: E[ne]
564
566
  })),
565
- fundedPrePeginTxHex: c,
566
- depositorBtcPubkey: d,
567
+ fundedPrePeginTxHex: u,
568
+ depositorBtcPubkey: l,
567
569
  vaultProviderBtcPubkey: B.vaultProviderBtcPubkey,
568
570
  vaultKeeperBtcPubkeys: B.vaultKeeperBtcPubkeys,
569
571
  universalChallengerBtcPubkeys: B.universalChallengerBtcPubkeys,
570
- protocolFeeRate: w.protocolFeeRate,
571
- minPeginFeeRate: w.minPeginFeeRate,
572
- councilQuorum: w.councilQuorum,
573
- councilSize: w.councilSize,
574
- timelockPegin: w.timelockPegin,
575
- timelockAssert: w.timelockAssert,
576
- timelockRefund: w.timelockRefund,
577
- prepeginTxid: x,
572
+ protocolFeeRate: b.protocolFeeRate,
573
+ minPeginFeeRate: b.minPeginFeeRate,
574
+ councilQuorum: b.councilQuorum,
575
+ councilSize: b.councilSize,
576
+ timelockPegin: b.timelockPegin,
577
+ timelockAssert: b.timelockAssert,
578
+ timelockRefund: b.timelockRefund,
579
+ prepeginTxid: C,
578
580
  prepeginMaxFee: n,
579
- maxAcceptableCommissionBps: u,
581
+ maxAcceptableCommissionBps: c,
580
582
  network: s
581
583
  });
582
- l.push({
583
- candidate: m,
584
+ d.push({
585
+ candidate: p,
584
586
  terms: L,
585
- peginAmounts: R,
586
- fingerprint: je(L, R)
587
+ peginAmounts: E,
588
+ fingerprint: je(L, E)
587
589
  });
588
- } catch (p) {
589
- if (p instanceof A)
590
- throw p;
591
- const f = F(m), E = p instanceof Error ? p.message : String(p);
592
- p instanceof U ? b.length < X && b.push(`[${f}] ${E}`) : (N++, T.length < X && T.push(`${f} (${E})`));
590
+ } catch (g) {
591
+ if (g instanceof $)
592
+ throw g;
593
+ const P = F(p), x = g instanceof Error ? g.message : String(g);
594
+ g instanceof U ? A.length < X && A.push(`[${P}] ${x}`) : (N++, T.length < X && T.push(`${P} (${x})`));
593
595
  }
594
- const re = a.length + N, O = [
595
- ...a.map(Ue),
596
+ const re = i.length + N, O = [
597
+ ...i.map(Ue),
596
598
  ...T
597
599
  ];
598
- if (l.length === 0)
599
- throw new Le(i.length, b, O);
600
- if (new Set(l.map((m) => m.fingerprint)).size > 1)
600
+ if (d.length === 0)
601
+ throw new Le(a.length, A, O);
602
+ if (new Set(d.map((p) => p.fingerprint)).size > 1)
601
603
  throw new ze(
602
- l.map((m) => F(m.candidate))
604
+ d.map((p) => F(p.candidate))
603
605
  );
604
606
  if (re > 0)
605
607
  throw new De(
606
- F(l[0].candidate),
608
+ F(d[0].candidate),
607
609
  O
608
610
  );
609
611
  return {
610
- candidate: l[0].candidate,
611
- terms: l[0].terms,
612
- peginAmounts: l[0].peginAmounts,
612
+ candidate: d[0].candidate,
613
+ terms: d[0].terms,
614
+ peginAmounts: d[0].peginAmounts,
613
615
  authAnchorHash: h.hash,
614
- candidatesTried: i.length,
615
- matchedCandidates: l.map((m) => m.candidate)
616
+ candidatesTried: a.length,
617
+ matchedCandidates: d.map((p) => p.candidate)
616
618
  };
617
619
  }
618
620
  function wt(e, t) {
@@ -620,50 +622,50 @@ function wt(e, t) {
620
622
  htlcVout: o,
621
623
  depositorBtcPubkey: r,
622
624
  applicationEntryPoint: n,
623
- fundedPrePeginTxHex: u,
625
+ fundedPrePeginTxHex: c,
624
626
  hashlocks: s,
625
- network: i
626
- } = t, { candidate: a, peginAmounts: d } = e, { offchainParams: c, participants: h } = a;
627
- if (s.length !== d.length)
627
+ network: a
628
+ } = t, { candidate: i, peginAmounts: l } = e, { offchainParams: u, participants: h } = i;
629
+ if (s.length !== l.length)
628
630
  throw new Error(
629
- `toRefundInputs: ${s.length} hashlock(s) but ${d.length} reconstructed amount(s); the reconstruction and the hashlock vector describe different transactions.`
631
+ `toRefundInputs: ${s.length} hashlock(s) but ${l.length} reconstructed amount(s); the reconstruction and the hashlock vector describe different transactions.`
630
632
  );
631
- if (!Number.isInteger(o) || o < 0 || o >= d.length)
633
+ if (!Number.isInteger(o) || o < 0 || o >= l.length)
632
634
  throw new Error(
633
- `toRefundInputs: htlcVout ${o} is outside the reconstructed batch of ${d.length} vault(s).`
635
+ `toRefundInputs: htlcVout ${o} is outside the reconstructed batch of ${l.length} vault(s).`
634
636
  );
635
- const v = d.map((C, l) => ({
636
- hashlock: le(s[l]),
637
- amount: C,
638
- htlcVout: l
637
+ const w = l.map((m, d) => ({
638
+ hashlock: le(s[d]),
639
+ amount: m,
640
+ htlcVout: d
639
641
  })), y = {
640
- vaultCoreVersion: a.vaultCoreVersion,
641
- hashlock: v[o].hashlock,
642
+ vaultCoreVersion: i.vaultCoreVersion,
643
+ hashlock: w[o].hashlock,
642
644
  htlcVout: o,
643
- offchainParamsVersion: c.version,
645
+ offchainParamsVersion: u.version,
644
646
  appVaultKeepersVersion: h.appVaultKeepersVersion,
645
647
  universalChallengersVersion: h.universalChallengersVersion,
646
648
  vaultProvider: h.vaultProvider,
647
649
  applicationEntryPoint: n,
648
- amount: d[o],
649
- unsignedPrePeginTxHex: u,
650
+ amount: l[o],
651
+ unsignedPrePeginTxHex: c,
650
652
  depositorBtcPubkey: r,
651
- batch: v
652
- }, x = {
653
+ batch: w
654
+ }, C = {
653
655
  vaultProviderPubkey: h.vaultProviderBtcPubkey,
654
656
  vaultKeeperPubkeys: h.vaultKeeperBtcPubkeys,
655
657
  universalChallengerPubkeys: h.universalChallengerBtcPubkeys,
656
- timelockRefund: c.timelockRefund,
657
- feeRate: c.protocolFeeRate,
658
- minPeginFeeRate: c.minPeginFeeRate,
658
+ timelockRefund: u.timelockRefund,
659
+ feeRate: u.protocolFeeRate,
660
+ minPeginFeeRate: u.minPeginFeeRate,
659
661
  // Depositor-as-claimer: the local-challenger count is the keeper count,
660
662
  // the vault provider excluded — btc-vault graph.rs derive_challengers.
661
663
  numLocalChallengers: h.vaultKeeperBtcPubkeys.length,
662
- councilQuorum: c.councilQuorum,
663
- councilSize: c.councilSize,
664
- network: i
664
+ councilQuorum: u.councilQuorum,
665
+ councilSize: u.councilSize,
666
+ network: a
665
667
  };
666
- return { vault: y, context: x };
668
+ return { vault: y, context: C };
667
669
  }
668
670
  export {
669
671
  te as D,
@@ -671,7 +673,7 @@ export {
671
673
  K as U,
672
674
  Oe as V,
673
675
  Ie as a,
674
- P as b,
676
+ v as b,
675
677
  ft as c,
676
678
  gt as d,
677
679
  Ne as e,
@@ -692,7 +694,7 @@ export {
692
694
  Le as t,
693
695
  ze as u,
694
696
  De as v,
695
- A as w,
697
+ $ as w,
696
698
  wt as x
697
699
  };
698
- //# sourceMappingURL=toRefundInputs-DH-1bRNY.js.map
700
+ //# sourceMappingURL=toRefundInputs-BbbvPb2A.js.map