@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 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/tbv/core/wasm/constants.ts","../../../../src/tbv/core/wasm/index.ts"],"sourcesContent":["/**\n * Protocol constants that do not require loading the vault WASM module.\n *\n * Keeping these values local lets Bitcoin builders construct PSBT metadata\n * without resolving or evaluating the WASM engine at module-import\n * time. The hex value is the BIP-341 nothing-up-my-sleeve internal key and is\n * pinned by the vault protocol.\n */\nexport const TAP_INTERNAL_KEY =\n \"50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0\";\n\nconst HEX_CHARS_PER_BYTE = 2;\n\nexport const tapInternalPubkey = Uint8Array.from(\n { length: TAP_INTERNAL_KEY.length / HEX_CHARS_PER_BYTE },\n (_, index) =>\n Number.parseInt(\n TAP_INTERNAL_KEY.slice(\n index * HEX_CHARS_PER_BYTE,\n index * HEX_CHARS_PER_BYTE + HEX_CHARS_PER_BYTE,\n ),\n 16,\n ),\n);\n","/**\n * Explicit lazy boundary around the vault-WASM engine package.\n *\n * Importing the SDK (including its legacy root barrels) does not resolve the\n * WASM package or generated binary. The engine is loaded only when a caller\n * invokes an operation that actually needs the Bitcoin transaction graph.\n * ETH-only entry points never import this module.\n *\n * @module tbv/core/wasm\n */\n\nimport type {\n AssertNoPayoutScriptInfo,\n AssertPayoutNoPayoutConnectorParams,\n AssertPayoutScriptInfo,\n ChallengeAssertConnectorParams,\n ChallengeAssertOutputConnectorParams,\n ChallengeAssertScriptInfo,\n HtlcConnectorInfo,\n HtlcConnectorParams,\n Network,\n PayoutConnectorInfo,\n PayoutConnectorParams,\n PeginP2aAnchorInfo,\n PeginTxResult,\n PrePeginParams,\n PrePeginResult,\n WatchtowerArtifactsInputs,\n WotsKeypairDerivation,\n WronglyChallengedPsbts,\n WronglyChallengedSigs,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\n\nexport { TAP_INTERNAL_KEY, tapInternalPubkey } from \"./constants\";\n\ntype TbvWasmModule = typeof import(\"@babylonlabs-io/babylon-tbv-rust-wasm\");\n\nlet wasmModulePromise: Promise<TbvWasmModule> | undefined;\n\n/**\n * Load and initialize the WASM engine on first use. Concurrent callers share\n * one load. The returned module is already initialized, so a caller does not\n * call `initWasm()`. A load or initialization failure rejects with an error\n * that names the engine package. The original error is its cause. A failure\n * clears this cache, so the next call loads again. The engine keeps a failed\n * binary initialization rejected, so only a failed import or binary read can\n * succeed on a later call.\n *\n * The module also contains the wasm-bindgen classes. The classes have no value\n * guards. A caller that uses a class must cross-check its output at the call\n * site.\n */\nexport function loadTbvWasm(): Promise<TbvWasmModule> {\n wasmModulePromise ??= import(\"@babylonlabs-io/babylon-tbv-rust-wasm\")\n .catch((error: unknown) => {\n wasmModulePromise = undefined;\n throw new Error(\n \"The vault-WASM engine @babylonlabs-io/babylon-tbv-rust-wasm failed \" +\n \"to load. The module could not be resolved, or it threw while \" +\n \"evaluating, commonly a missing or stale generated WASM build. \" +\n \"See the cause for the underlying error.\",\n { cause: error },\n );\n })\n .then(async (wasm) => {\n try {\n await wasm.initWasm();\n } catch (error: unknown) {\n wasmModulePromise = undefined;\n throw new Error(\n \"The vault-WASM engine @babylonlabs-io/babylon-tbv-rust-wasm \" +\n \"resolved, but its WebAssembly binary failed to initialize, \" +\n \"commonly a missing or stale generated WASM build. See the \" +\n \"cause for the underlying error.\",\n { cause: error },\n );\n }\n return wasm;\n });\n return wasmModulePromise;\n}\n\n/**\n * Creates an unfunded Pre-PegIn transaction with no inputs and HTLC output(s).\n *\n * The HTLC output value (htlcValue) covers the peg-in amount, depositor claim value,\n * and minimum pegin fee — all computed internally from the provided contract parameters.\n *\n * After building the Pre-PegIn transaction, the caller must:\n * 1. Select UTXOs covering htlcValue + network fees\n * 2. Fund the transaction (add inputs and change output)\n * 3. Call reconstructFromFundedTx() with the funded tx hex\n * 4. Call buildPeginTx() to derive the PegIn transaction\n * 5. Sign the PegIn input using the HTLC hashlock leaf (leaf 0)\n *\n * @param params - Pre-PegIn parameters from contract and depositor wallet\n * @returns Unfunded transaction details with HTLC output information\n */\nexport async function createPrePeginTransaction(\n params: PrePeginParams,\n): Promise<PrePeginResult> {\n return (await loadTbvWasm()).createPrePeginTransaction(params);\n}\n\n/**\n * Derives the PegIn transaction from a funded Pre-PegIn transaction.\n *\n * The PegIn transaction has a single input spending the Pre-PegIn HTLC output\n * at `htlcVout` via the hashlock + all-party script (leaf 0).\n *\n * @param params - Same PrePeginParams used to create the Pre-PegIn transaction\n * @param timelockPegin - CSV timelock in blocks for the PegIn vault output\n * @param fundedPrePeginTxHex - Hex-encoded funded Pre-PegIn transaction\n * @param htlcVout - Index of the HTLC output to spend\n * @returns PegIn transaction details including vault output information\n */\nexport async function buildPeginTxFromPrePegin(\n params: PrePeginParams,\n timelockPegin: number,\n fundedPrePeginTxHex: string,\n htlcVout: number,\n): Promise<PeginTxResult> {\n return (await loadTbvWasm()).buildPeginTxFromPrePegin(\n params,\n timelockPegin,\n fundedPrePeginTxHex,\n htlcVout,\n );\n}\n\n/**\n * Returns HTLC connector script info for signing the PegIn transaction input.\n *\n * The depositor signs PegIn input 0 using the hashlock leaf (leaf 0) of the\n * Pre-PegIn HTLC output. Use getHashlockScript() and getHashlockControlBlock()\n * to construct the tapLeafScript entry in the PSBT.\n *\n * @param params - HTLC connector parameters (subset of PrePeginParams)\n * @returns Hashlock and refund script info for PSBT construction\n */\nexport async function getPrePeginHtlcConnectorInfo(\n params: HtlcConnectorParams,\n): Promise<HtlcConnectorInfo> {\n return (await loadTbvWasm()).getPrePeginHtlcConnectorInfo(params);\n}\n\n/**\n * Compute the minimum depositor claim value (PegIn output 1) in satoshis.\n *\n * This covers the full downstream tx graph cost (Claim → Assert → Payout)\n * based on the protocol parameters.\n */\nexport async function computeMinClaimValue(\n txGraphVersion: number,\n numLocalChallengers: number,\n numUniversalChallengers: number,\n councilQuorum: number,\n councilSize: number,\n feeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computeMinClaimValue(\n txGraphVersion,\n numLocalChallengers,\n numUniversalChallengers,\n councilQuorum,\n councilSize,\n feeRate,\n );\n}\n\n/**\n * Compute the minimum PegIn (activation) transaction fee in satoshis.\n *\n * `minPeginFee = peginTxVsize(numVks, numUcs) × minPeginFeeRate`. Each HTLC\n * the depositor funds in the Pre-PegIn tx must reserve at least this fee\n * inside its value (`htlcValue = peginAmount + depositorClaimValue +\n * p2aAnchorValue + minPeginFee`, anchor 0 on vault core 1), otherwise the VP\n * cannot afford to broadcast the PegIn at\n * activation. The vsize comes from a Taproot script-path-spend weight\n * prediction whose witness shape depends on the VK + UC signer count.\n */\nexport async function computeMinPeginFee(\n txGraphVersion: number,\n numVks: number,\n numUcs: number,\n minPeginFeeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computeMinPeginFee(\n txGraphVersion,\n numVks,\n numUcs,\n minPeginFeeRate,\n );\n}\n\n/**\n * Floor of the Payout transaction fee under `txGraphVersion`: the minimum of\n * `estimatedVsize * feeRate` across every output-sizing model a deployed\n * vault provider is known to have used (fixed-34, intermediate,\n * script-aware). A VP-built payout paying less than this is provably not\n * produced by any known VP build. `out0Len` must be the TRUSTED length of the\n * pinned outs[0] script (1..=128); `out1Len` is the measured, UNTRUSTED\n * commission-script length — safe here because padding cannot raise the floor\n * (the fixed-34 model saturates the minimum) and shortening only lowers it.\n * Pass `undefined` for `out1Len` on 2-output (non-VP-claimer) payouts.\n * `feeRate` is the vault's version-locked `offchainParams.feeRate`.\n */\nexport async function computePayoutFeeFloor(\n txGraphVersion: number,\n numVaultKeepers: number,\n numUniversalChallengers: number,\n numLocalChallengers: number,\n councilSize: number,\n out0Len: number,\n out1Len: number | null | undefined,\n feeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computePayoutFeeFloor(\n txGraphVersion,\n numVaultKeepers,\n numUniversalChallengers,\n numLocalChallengers,\n councilSize,\n out0Len,\n out1Len,\n feeRate,\n );\n}\n\n/**\n * Tx graph versions the shipped vault-wasm binary can build. Callers must\n * preflight the required version (fresh: active; resume: stamped) against\n * this list and fail closed instead of hitting per-call errors mid-flow.\n *\n * Note: the facade constructors themselves fail closed on unsupported\n * versions, and derived objects carry the version they were built with —\n * value-level cross-checks live in `assertWasmPeginSizing` and the golden\n * byte-parity tests, not in a per-call version echo.\n */\nexport async function supportedTxGraphVersions(): Promise<number[]> {\n return (await loadTbvWasm()).supportedTxGraphVersions();\n}\n\n/**\n * The PegIn transaction's P2A (pay-to-anchor) output for a graph version, or\n * `null` when that version's PegIn carries no anchor (v1). The facade returns\n * one record per version — never a zero-valued placeholder — so an absent\n * anchor can't be mistaken for a real output. For v2/v3: 240 sats at vout 2,\n * script `51024e73`.\n */\nexport async function peginP2aAnchorOutput(\n txGraphVersion: number,\n): Promise<PeginP2aAnchorInfo | null> {\n return (await loadTbvWasm()).peginP2aAnchorOutput(txGraphVersion);\n}\n\n/**\n * Validate a PegIn transaction's P2A anchor against a graph version's rules:\n * v2 and v3 require the exact anchor (240 sats, vout 2, P2A script) and v1\n * requires that NO output carries the P2A script. Throws on any mismatch — a\n * v2 PegIn checked as v1 fails closed, and vice versa.\n */\nexport async function validatePeginP2aAnchor(\n txGraphVersion: number,\n txHex: string,\n): Promise<void> {\n return (await loadTbvWasm()).validatePeginP2aAnchor(txGraphVersion, txHex);\n}\n\n/**\n * Creates a payout connector for vault transactions.\n *\n * The payout connector generates the necessary taproot scripts and information\n * required for signing payout transactions (both optimistic and regular payout paths).\n *\n * @param params - Parameters for creating the payout connector\n * @param network - Bitcoin network\n * @returns Payout connector information including scripts, hashes, and address\n */\nexport async function createPayoutConnector(\n params: PayoutConnectorParams,\n network: Network,\n): Promise<PayoutConnectorInfo> {\n return (await loadTbvWasm()).createPayoutConnector(params, network);\n}\n\n/**\n * Get the Payout script and control block for the depositor's Assert output.\n *\n * Used to build the depositor's Payout PSBT (depositor-as-claimer path).\n *\n * @param params - Assert Payout/NoPayout connector parameters\n * @returns Payout script and control block (hex encoded)\n */\nexport async function getAssertPayoutScriptInfo(\n params: AssertPayoutNoPayoutConnectorParams,\n): Promise<AssertPayoutScriptInfo> {\n return (await loadTbvWasm()).getAssertPayoutScriptInfo(params);\n}\n\n/**\n * Get the NoPayout script and control block for a specific challenger.\n *\n * Used to build the depositor's NoPayout PSBT (depositor-as-claimer path).\n * Each challenger has a distinct NoPayout script.\n *\n * @param params - Assert Payout/NoPayout connector parameters\n * @param challengerPubkey - The challenger's x-only public key (hex encoded)\n * @returns NoPayout script and control block (hex encoded)\n */\nexport async function getAssertNoPayoutScriptInfo(\n params: AssertPayoutNoPayoutConnectorParams,\n challengerPubkey: string,\n): Promise<AssertNoPayoutScriptInfo> {\n return (await loadTbvWasm()).getAssertNoPayoutScriptInfo(\n params,\n challengerPubkey,\n );\n}\n\n/**\n * Get the ChallengeAssert script and control block.\n *\n * Used to build ChallengeAssert PSBTs for the depositor-as-claimer path.\n * Each challenger has 2 ChallengeAssert transactions (X and Y), and this\n * connector generates the spending scripts using WOTS public keys from the VP.\n *\n * @param params - ChallengeAssert connector parameters\n * @returns Script and control block (hex encoded)\n */\nexport async function getChallengeAssertScriptInfo(\n params: ChallengeAssertConnectorParams,\n): Promise<ChallengeAssertScriptInfo> {\n return (await loadTbvWasm()).getChallengeAssertScriptInfo(params);\n}\n\n/**\n * Get the scriptPubKey that output 0 of every ChallengeAssertX/Y transaction\n * pays to for one challenger: the WronglyChallenged leaves plus the NoPayout\n * leaf carrying the ChallengeAssert timelock.\n *\n * Used to bind the VP-supplied ChallengeAssert parents of a NoPayout before\n * the depositor signs it. The engine rejects a non-P2TR return.\n *\n * @param params - ChallengeAssert output connector parameters\n * @returns P2TR scriptPubKey (hex encoded)\n */\nexport async function getChallengeAssertOutputScriptPubKey(\n params: ChallengeAssertOutputConnectorParams,\n): Promise<string> {\n return (await loadTbvWasm()).getChallengeAssertOutputScriptPubKey(params);\n}\n\n/**\n * Derive 32-byte `authAnchor` (OP_RETURN preimage → VP bearer token).\n * @stability frozen - btc-vault Rust owns this API through the vault-wasm pin (`VAULT_WASM_COMMIT`).\n * Changing the derived bytes breaks VP auth for existing deposits. See CLAUDE.md §4.\n */\nexport async function expandAuthAnchor(root: Uint8Array): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandAuthAnchor(root);\n}\n\n/**\n * Derive 32-byte `hashlockSecret` for HTLC `htlcVout` (preimage → `activateVaultWithSecret`).\n * @stability frozen - btc-vault Rust owns this API.\n * Changing the derived bytes means affected vaults can never activate. See CLAUDE.md §4.\n */\nexport async function expandHashlockSecret(\n root: Uint8Array,\n htlcVout: number,\n): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandHashlockSecret(root, htlcVout);\n}\n\n/**\n * Derive 64-byte `wotsSeed` for HTLC `htlcVout` (→ WOTS keys, hashed as `depositorWotsPkHash`).\n * @stability frozen - btc-vault Rust owns this API.\n * Changing the derived bytes breaks existing `depositorWotsPkHash` values. No claim path remains. See CLAUDE.md §4.\n */\nexport async function expandWotsSeed(\n root: Uint8Array,\n htlcVout: number,\n): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandWotsSeed(root, htlcVout);\n}\n\n/**\n * Derives the vault ID from a PegIn transaction hash and depositor ETH address.\n *\n * Vault ID = keccak256(abi.encode(peginTxHash, depositor))\n * This matches the Solidity-side derivation in BTCVaultRegistry.\n *\n * @param peginTxHash - 32-byte PegIn tx hash in display order (big-endian), hex encoded\n * @param depositor - 20-byte Ethereum address of the depositor, hex encoded\n * @returns Hex-encoded vault ID (32 bytes)\n */\nexport async function deriveVaultId(\n peginTxHash: string,\n depositor: string,\n): Promise<string> {\n return (await loadTbvWasm()).deriveVaultId(peginTxHash, depositor);\n}\n\n// ============================================================================\n// Delegated claim (depositor-as-claimer) — assembly and claim-time surface\n// ============================================================================\n//\n// The forwarding hop for the WASM exports that assemble the two files the\n// `vaultd vp wt` watchtower CLI consumes, and for the claim-time exports\n// that run a claim from those files without the CLI.\n//\n// EXPERIMENTAL — under test, signet only. These names and signatures can\n// change in a minor release. See services/delegated-claim.\n\n/**\n * Depositor's Claim signing PSBT (base64) — spends PegIn:1, script path.\n *\n * @experimental\n */\nexport async function buildClaimPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildClaimPsbt(txGraphVersion, graphJson);\n}\n\n/**\n * Claimer's Assert signing PSBT (base64) — the single WOTS input.\n *\n * @experimental\n */\nexport async function buildAssertClaimerPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildAssertClaimerPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Claimer's Payout signing PSBT (base64) — input 1, Assert connector path.\n *\n * @experimental\n */\nexport async function buildPayoutClaimerPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildPayoutClaimerPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Depositor's Payout signing PSBT (base64) — input 0, the PegIn UTXO spend.\n *\n * @experimental\n */\nexport async function buildPayoutDepositorPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildPayoutDepositorPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Claimer's WronglyChallenged signing PSBTs, per challenger and GC index.\n *\n * @experimental\n */\nexport async function buildWronglyChallengedPsbts(\n txGraphVersion: number,\n graphJson: string,\n): Promise<WronglyChallengedPsbts> {\n return (await loadTbvWasm()).buildWronglyChallengedPsbts(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Verifies the Groth16 pegout proof and pins it into the artifacts, returning\n * the updated artifacts JSON. Persist that copy: the one-time WOTS keypair\n * signs exactly one proof, so a second, different one is refused.\n *\n * @experimental\n */\nexport async function pinPegoutProof(\n txGraphVersion: number,\n artifactsJson: string,\n proofHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).pinPegoutProof(\n txGraphVersion,\n artifactsJson,\n proofHex,\n );\n}\n\n/**\n * Finalizes the Assert from the pinned proof and the WOTS keypair, writes it\n * into the artifacts and returns the updated artifacts JSON. The keypair\n * never leaves the caller.\n *\n * @experimental\n */\nexport async function attachFinalizedAssert(\n txGraphVersion: number,\n artifactsJson: string,\n keypairJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).attachFinalizedAssert(\n txGraphVersion,\n artifactsJson,\n keypairJson,\n );\n}\n\n/**\n * Finalizes the Payout tx from the artifacts' signatures, consensus hex.\n *\n * @experimental\n */\nexport async function finalizePayout(\n txGraphVersion: number,\n artifactsJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizePayout(txGraphVersion, artifactsJson);\n}\n\n/**\n * Finalizes one WronglyChallenged tx — the answer to a ChallengeAssert.\n *\n * @experimental\n */\nexport async function finalizeWronglyChallenged(\n txGraphVersion: number,\n artifactsJson: string,\n challengerPkHex: string,\n gcIndex: number,\n preimageHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizeWronglyChallenged(\n txGraphVersion,\n artifactsJson,\n challengerPkHex,\n gcIndex,\n preimageHex,\n );\n}\n\n/**\n * Applies the depositor signature to the Claim tx, returning consensus hex.\n *\n * @experimental\n */\nexport async function finalizeClaimTx(\n txGraphVersion: number,\n graphJson: string,\n depositorSigHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizeClaimTx(\n txGraphVersion,\n graphJson,\n depositorSigHex,\n );\n}\n\n/**\n * Extracts a signed PSBT input's taproot script-path signature (hex).\n *\n * @experimental\n */\nexport async function extractTapScriptSig(\n psbtBase64: string,\n inputIndex: number,\n): Promise<string> {\n return (await loadTbvWasm()).extractTapScriptSig(psbtBase64, inputIndex);\n}\n\n/**\n * Derive the depositor's WOTS keypair from the 64-byte `wotsSeed`.\n * @stability frozen — `HASH160(seed || block index)` binds on-chain through\n * `depositorWotsPkHash`; see CLAUDE.md §4.\n *\n * @experimental\n */\nexport async function wotsKeypairFromSeed(\n wotsSeed: Uint8Array,\n): Promise<WotsKeypairDerivation> {\n return (await loadTbvWasm()).wotsKeypairFromSeed(wotsSeed);\n}\n\n/**\n * Throws unless the keypair matches the WOTS keys the graph's Claim commits to.\n *\n * @experimental\n */\nexport async function validateWotsKeypairAgainstGraph(\n txGraphVersion: number,\n keypair: unknown,\n graphJson: string,\n): Promise<void> {\n return (await loadTbvWasm()).validateWotsKeypairAgainstGraph(\n txGraphVersion,\n keypair,\n graphJson,\n );\n}\n\n/**\n * Assembles the watchtower `artifacts.json` content, verifying every signature.\n *\n * @experimental\n */\nexport async function buildWatchtowerArtifacts(\n inputs: WatchtowerArtifactsInputs,\n): Promise<string> {\n return (await loadTbvWasm()).buildWatchtowerArtifacts(inputs);\n}\n\n/**\n * Re-verifies every claimer-side signature in an `artifacts.json`.\n *\n * @experimental\n */\nexport async function verifyWatchtowerArtifacts(\n txGraphVersion: number,\n artifactsJson: string,\n): Promise<void> {\n return (await loadTbvWasm()).verifyWatchtowerArtifacts(\n txGraphVersion,\n artifactsJson,\n );\n}\n\nexport type {\n AssertNoPayoutScriptInfo,\n AssertPayoutNoPayoutConnectorParams,\n AssertPayoutScriptInfo,\n ChallengeAssertConnectorParams,\n ChallengeAssertOutputConnectorParams,\n ChallengeAssertScriptInfo,\n HtlcConnectorInfo,\n HtlcConnectorParams,\n Network,\n PayoutConnectorInfo,\n PayoutConnectorParams,\n PeginP2aAnchorInfo,\n PeginTxResult,\n PrePeginParams,\n PrePeginResult,\n WatchtowerArtifactsInputs,\n WotsKeypairDerivation,\n WronglyChallengedPsbts,\n WronglyChallengedSigs,\n};\n"],"names":["TAP_INTERNAL_KEY","tapInternalPubkey","_","index","wasmModulePromise","loadTbvWasm","error","wasm","createPrePeginTransaction","params","buildPeginTxFromPrePegin","timelockPegin","fundedPrePeginTxHex","htlcVout","getPrePeginHtlcConnectorInfo","computeMinClaimValue","txGraphVersion","numLocalChallengers","numUniversalChallengers","councilQuorum","councilSize","feeRate","computeMinPeginFee","numVks","numUcs","minPeginFeeRate","computePayoutFeeFloor","numVaultKeepers","out0Len","out1Len","supportedTxGraphVersions","peginP2aAnchorOutput","validatePeginP2aAnchor","txHex","createPayoutConnector","network","getAssertPayoutScriptInfo","getAssertNoPayoutScriptInfo","challengerPubkey","getChallengeAssertScriptInfo","getChallengeAssertOutputScriptPubKey","expandAuthAnchor","root","expandHashlockSecret","expandWotsSeed","deriveVaultId","peginTxHash","depositor","buildClaimPsbt","graphJson","buildAssertClaimerPsbt","buildPayoutClaimerPsbt","buildPayoutDepositorPsbt","buildWronglyChallengedPsbts","pinPegoutProof","artifactsJson","proofHex","attachFinalizedAssert","keypairJson","finalizePayout","finalizeWronglyChallenged","challengerPkHex","gcIndex","preimageHex","finalizeClaimTx","depositorSigHex","extractTapScriptSig","psbtBase64","inputIndex","wotsKeypairFromSeed","wotsSeed","validateWotsKeypairAgainstGraph","keypair","buildWatchtowerArtifacts","inputs","verifyWatchtowerArtifacts"],"mappings":"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"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/tbv/core/wasm/constants.ts","../../../../src/tbv/core/wasm/index.ts"],"sourcesContent":["/**\n * Protocol constants that do not require loading the vault WASM module.\n *\n * Keeping these values local lets Bitcoin builders construct PSBT metadata\n * without resolving or evaluating the WASM engine at module-import\n * time. The hex value is the BIP-341 nothing-up-my-sleeve internal key and is\n * pinned by the vault protocol.\n */\nexport const TAP_INTERNAL_KEY =\n \"50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0\";\n\nconst HEX_CHARS_PER_BYTE = 2;\n\nexport const tapInternalPubkey = Uint8Array.from(\n { length: TAP_INTERNAL_KEY.length / HEX_CHARS_PER_BYTE },\n (_, index) =>\n Number.parseInt(\n TAP_INTERNAL_KEY.slice(\n index * HEX_CHARS_PER_BYTE,\n index * HEX_CHARS_PER_BYTE + HEX_CHARS_PER_BYTE,\n ),\n 16,\n ),\n);\n","/**\n * Explicit lazy boundary around the vault-WASM engine package.\n *\n * Importing the SDK (including its legacy root barrels) does not resolve the\n * WASM package or generated binary. The engine is loaded only when a caller\n * invokes an operation that actually needs the Bitcoin transaction graph.\n * ETH-only entry points never import this module.\n *\n * @module tbv/core/wasm\n */\n\nimport type {\n AssertNoPayoutScriptInfo,\n AssertPayoutNoPayoutConnectorParams,\n AssertPayoutScriptInfo,\n ChallengeAssertConnectorParams,\n ChallengeAssertOutputConnectorParams,\n ChallengeAssertScriptInfo,\n HtlcConnectorInfo,\n HtlcConnectorParams,\n Network,\n PayoutConnectorInfo,\n PayoutConnectorParams,\n PeginP2aAnchorInfo,\n PeginTxResult,\n PrePeginParams,\n PrePeginResult,\n WatchtowerArtifactsInputs,\n WotsKeypairDerivation,\n WronglyChallengedPsbts,\n WronglyChallengedSigs,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\n\nexport { TAP_INTERNAL_KEY, tapInternalPubkey } from \"./constants\";\n\ntype TbvWasmModule = typeof import(\"@babylonlabs-io/babylon-tbv-rust-wasm\");\n\nlet wasmModulePromise: Promise<TbvWasmModule> | undefined;\n\n/**\n * Load and initialize the WASM engine on first use. Concurrent callers share\n * one load. The returned module is already initialized, so a caller does not\n * call `initWasm()`. A load or initialization failure rejects with an error\n * that names the engine package. The original error is its cause. A failure\n * clears this cache, so the next call loads again. The engine keeps a failed\n * binary initialization rejected, so only a failed import or binary read can\n * succeed on a later call.\n *\n * The module also contains the wasm-bindgen classes. The classes have no value\n * guards. A caller that uses a class must cross-check its output at the call\n * site.\n */\nexport function loadTbvWasm(): Promise<TbvWasmModule> {\n wasmModulePromise ??= import(\"@babylonlabs-io/babylon-tbv-rust-wasm\")\n .catch((error: unknown) => {\n wasmModulePromise = undefined;\n throw new Error(\n \"The vault-WASM engine @babylonlabs-io/babylon-tbv-rust-wasm failed \" +\n \"to load. The module could not be resolved, or it threw while \" +\n \"evaluating, commonly a missing or stale generated WASM build. \" +\n \"See the cause for the underlying error.\",\n { cause: error },\n );\n })\n .then(async (wasm) => {\n try {\n await wasm.initWasm();\n } catch (error: unknown) {\n wasmModulePromise = undefined;\n throw new Error(\n \"The vault-WASM engine @babylonlabs-io/babylon-tbv-rust-wasm \" +\n \"resolved, but its WebAssembly binary failed to initialize, \" +\n \"commonly a missing or stale generated WASM build. See the \" +\n \"cause for the underlying error.\",\n { cause: error },\n );\n }\n return wasm;\n });\n return wasmModulePromise;\n}\n\n/**\n * Creates an unfunded Pre-PegIn transaction with no inputs and HTLC output(s).\n *\n * The HTLC output value (htlcValue) covers the peg-in amount, depositor claim value,\n * and minimum pegin fee — all computed internally from the provided contract parameters.\n *\n * After building the Pre-PegIn transaction, the caller must:\n * 1. Select UTXOs covering htlcValue + network fees\n * 2. Fund the transaction (add inputs and change output)\n * 3. Call reconstructFromFundedTx() with the funded tx hex\n * 4. Call buildPeginTx() to derive the PegIn transaction\n * 5. Sign the PegIn input using the HTLC hashlock leaf (leaf 0)\n *\n * @param params - Pre-PegIn parameters from contract and depositor wallet\n * @returns Unfunded transaction details with HTLC output information\n */\nexport async function createPrePeginTransaction(\n params: PrePeginParams,\n): Promise<PrePeginResult> {\n return (await loadTbvWasm()).createPrePeginTransaction(params);\n}\n\n/**\n * Derives the PegIn transaction from a funded Pre-PegIn transaction.\n *\n * The PegIn transaction has a single input spending the Pre-PegIn HTLC output\n * at `htlcVout` via the hashlock + all-party script (leaf 0).\n *\n * @param params - Same PrePeginParams used to create the Pre-PegIn transaction\n * @param timelockPegin - CSV timelock in blocks for the PegIn vault output\n * @param fundedPrePeginTxHex - Hex-encoded funded Pre-PegIn transaction\n * @param htlcVout - Index of the HTLC output to spend\n * @returns PegIn transaction details including vault output information\n */\nexport async function buildPeginTxFromPrePegin(\n params: PrePeginParams,\n timelockPegin: number,\n fundedPrePeginTxHex: string,\n htlcVout: number,\n): Promise<PeginTxResult> {\n return (await loadTbvWasm()).buildPeginTxFromPrePegin(\n params,\n timelockPegin,\n fundedPrePeginTxHex,\n htlcVout,\n );\n}\n\n/**\n * Returns HTLC connector script info for signing the PegIn transaction input.\n *\n * The depositor signs PegIn input 0 using the hashlock leaf (leaf 0) of the\n * Pre-PegIn HTLC output. Use getHashlockScript() and getHashlockControlBlock()\n * to construct the tapLeafScript entry in the PSBT.\n *\n * @param params - HTLC connector parameters (subset of PrePeginParams)\n * @returns Hashlock and refund script info for PSBT construction\n */\nexport async function getPrePeginHtlcConnectorInfo(\n params: HtlcConnectorParams,\n): Promise<HtlcConnectorInfo> {\n return (await loadTbvWasm()).getPrePeginHtlcConnectorInfo(params);\n}\n\n/**\n * Compute the minimum depositor claim value (PegIn output 1) in satoshis.\n *\n * This covers the full downstream tx graph cost (Claim → Assert → Payout)\n * based on the protocol parameters.\n */\nexport async function computeMinClaimValue(\n txGraphVersion: number,\n numLocalChallengers: number,\n numUniversalChallengers: number,\n councilQuorum: number,\n councilSize: number,\n feeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computeMinClaimValue(\n txGraphVersion,\n numLocalChallengers,\n numUniversalChallengers,\n councilQuorum,\n councilSize,\n feeRate,\n );\n}\n\n/**\n * Compute the minimum PegIn (activation) transaction fee in satoshis.\n *\n * `minPeginFee = peginTxVsize(numVks, numUcs) × minPeginFeeRate`. Each HTLC\n * the depositor funds in the Pre-PegIn tx must reserve at least this fee\n * inside its value (`htlcValue = peginAmount + depositorClaimValue +\n * p2aAnchorValue + minPeginFee`), otherwise the VP\n * cannot afford to broadcast the PegIn at\n * activation. The vsize comes from a Taproot script-path-spend weight\n * prediction whose witness shape depends on the VK + UC signer count.\n */\nexport async function computeMinPeginFee(\n txGraphVersion: number,\n numVks: number,\n numUcs: number,\n minPeginFeeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computeMinPeginFee(\n txGraphVersion,\n numVks,\n numUcs,\n minPeginFeeRate,\n );\n}\n\n/**\n * Floor of the Payout transaction fee under `txGraphVersion`: the minimum of\n * `estimatedVsize * feeRate` across every output-sizing model a deployed\n * vault provider is known to have used (fixed-34, intermediate,\n * script-aware). A VP-built payout paying less than this is provably not\n * produced by any known VP build. `out0Len` must be the TRUSTED length of the\n * pinned outs[0] script (1..=128); `out1Len` is the measured, UNTRUSTED\n * commission-script length — safe here because padding cannot raise the floor\n * (the fixed-34 model saturates the minimum) and shortening only lowers it.\n * Pass `undefined` for `out1Len` on 2-output (non-VP-claimer) payouts.\n * `feeRate` is the vault's version-locked `offchainParams.feeRate`.\n */\nexport async function computePayoutFeeFloor(\n txGraphVersion: number,\n numVaultKeepers: number,\n numUniversalChallengers: number,\n numLocalChallengers: number,\n councilSize: number,\n out0Len: number,\n out1Len: number | null | undefined,\n feeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computePayoutFeeFloor(\n txGraphVersion,\n numVaultKeepers,\n numUniversalChallengers,\n numLocalChallengers,\n councilSize,\n out0Len,\n out1Len,\n feeRate,\n );\n}\n\n/**\n * Tx graph versions the shipped vault-wasm binary can build. Callers must\n * preflight the required version (fresh: active; resume: stamped) against\n * this list and fail closed instead of hitting per-call errors mid-flow.\n *\n * Note: the facade constructors themselves fail closed on unsupported\n * versions, and derived objects carry the version they were built with —\n * value-level cross-checks live in `assertWasmPeginSizing` and the golden\n * byte-parity tests, not in a per-call version echo.\n */\nexport async function supportedTxGraphVersions(): Promise<number[]> {\n return (await loadTbvWasm()).supportedTxGraphVersions();\n}\n\n/**\n * The PegIn transaction's P2A (pay-to-anchor) output for a graph version: 240\n * sats at vout 2, script `51024e73`. Every supported version's PegIn carries\n * the anchor; the engine throws rather than return none.\n */\nexport async function peginP2aAnchorOutput(\n txGraphVersion: number,\n): Promise<PeginP2aAnchorInfo> {\n return (await loadTbvWasm()).peginP2aAnchorOutput(txGraphVersion);\n}\n\n/**\n * Validate a PegIn transaction's P2A anchor against a graph version's rule:\n * the exact anchor (240 sats, vout 2, P2A script). Throws on any mismatch, so\n * a PegIn without the anchor fails closed.\n */\nexport async function validatePeginP2aAnchor(\n txGraphVersion: number,\n txHex: string,\n): Promise<void> {\n return (await loadTbvWasm()).validatePeginP2aAnchor(txGraphVersion, txHex);\n}\n\n/**\n * Creates a payout connector for vault transactions.\n *\n * The payout connector generates the necessary taproot scripts and information\n * required for signing payout transactions (both optimistic and regular payout paths).\n *\n * @param params - Parameters for creating the payout connector\n * @param network - Bitcoin network\n * @returns Payout connector information including scripts, hashes, and address\n */\nexport async function createPayoutConnector(\n params: PayoutConnectorParams,\n network: Network,\n): Promise<PayoutConnectorInfo> {\n return (await loadTbvWasm()).createPayoutConnector(params, network);\n}\n\n/**\n * Get the Payout script and control block for the depositor's Assert output.\n *\n * Used to build the depositor's Payout PSBT (depositor-as-claimer path).\n *\n * @param params - Assert Payout/NoPayout connector parameters\n * @returns Payout script and control block (hex encoded)\n */\nexport async function getAssertPayoutScriptInfo(\n params: AssertPayoutNoPayoutConnectorParams,\n): Promise<AssertPayoutScriptInfo> {\n return (await loadTbvWasm()).getAssertPayoutScriptInfo(params);\n}\n\n/**\n * Get the NoPayout script and control block for a specific challenger.\n *\n * Used to build the depositor's NoPayout PSBT (depositor-as-claimer path).\n * Each challenger has a distinct NoPayout script.\n *\n * @param params - Assert Payout/NoPayout connector parameters\n * @param challengerPubkey - The challenger's x-only public key (hex encoded)\n * @returns NoPayout script and control block (hex encoded)\n */\nexport async function getAssertNoPayoutScriptInfo(\n params: AssertPayoutNoPayoutConnectorParams,\n challengerPubkey: string,\n): Promise<AssertNoPayoutScriptInfo> {\n return (await loadTbvWasm()).getAssertNoPayoutScriptInfo(\n params,\n challengerPubkey,\n );\n}\n\n/**\n * Get the ChallengeAssert script and control block.\n *\n * Used to build ChallengeAssert PSBTs for the depositor-as-claimer path.\n * Each challenger has 2 ChallengeAssert transactions (X and Y), and this\n * connector generates the spending scripts using WOTS public keys from the VP.\n *\n * @param params - ChallengeAssert connector parameters\n * @returns Script and control block (hex encoded)\n */\nexport async function getChallengeAssertScriptInfo(\n params: ChallengeAssertConnectorParams,\n): Promise<ChallengeAssertScriptInfo> {\n return (await loadTbvWasm()).getChallengeAssertScriptInfo(params);\n}\n\n/**\n * Get the scriptPubKey that output 0 of every ChallengeAssertX/Y transaction\n * pays to for one challenger: the WronglyChallenged leaves plus the NoPayout\n * leaf carrying the ChallengeAssert timelock.\n *\n * Used to bind the VP-supplied ChallengeAssert parents of a NoPayout before\n * the depositor signs it. The engine rejects a non-P2TR return.\n *\n * @param params - ChallengeAssert output connector parameters\n * @returns P2TR scriptPubKey (hex encoded)\n */\nexport async function getChallengeAssertOutputScriptPubKey(\n params: ChallengeAssertOutputConnectorParams,\n): Promise<string> {\n return (await loadTbvWasm()).getChallengeAssertOutputScriptPubKey(params);\n}\n\n/**\n * Derive 32-byte `authAnchor` (OP_RETURN preimage → VP bearer token).\n * @stability frozen - btc-vault Rust owns this API through the vault-wasm pin (`VAULT_WASM_COMMIT`).\n * Changing the derived bytes breaks VP auth for existing deposits. See CLAUDE.md §4.\n */\nexport async function expandAuthAnchor(root: Uint8Array): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandAuthAnchor(root);\n}\n\n/**\n * Derive 32-byte `hashlockSecret` for HTLC `htlcVout` (preimage → `activateVaultWithSecret`).\n * @stability frozen - btc-vault Rust owns this API.\n * Changing the derived bytes means affected vaults can never activate. See CLAUDE.md §4.\n */\nexport async function expandHashlockSecret(\n root: Uint8Array,\n htlcVout: number,\n): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandHashlockSecret(root, htlcVout);\n}\n\n/**\n * Derive 64-byte `wotsSeed` for HTLC `htlcVout` (→ WOTS keys, hashed as `depositorWotsPkHash`).\n * @stability frozen - btc-vault Rust owns this API.\n * Changing the derived bytes breaks existing `depositorWotsPkHash` values. No claim path remains. See CLAUDE.md §4.\n */\nexport async function expandWotsSeed(\n root: Uint8Array,\n htlcVout: number,\n): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandWotsSeed(root, htlcVout);\n}\n\n/**\n * Derives the vault ID from a PegIn transaction hash and depositor ETH address.\n *\n * Vault ID = keccak256(abi.encode(peginTxHash, depositor))\n * This matches the Solidity-side derivation in BTCVaultRegistry.\n *\n * @param peginTxHash - 32-byte PegIn tx hash in display order (big-endian), hex encoded\n * @param depositor - 20-byte Ethereum address of the depositor, hex encoded\n * @returns Hex-encoded vault ID (32 bytes)\n */\nexport async function deriveVaultId(\n peginTxHash: string,\n depositor: string,\n): Promise<string> {\n return (await loadTbvWasm()).deriveVaultId(peginTxHash, depositor);\n}\n\n// ============================================================================\n// Delegated claim (depositor-as-claimer) — assembly and claim-time surface\n// ============================================================================\n//\n// The forwarding hop for the WASM exports that assemble the two files the\n// `vaultd vp wt` watchtower CLI consumes, and for the claim-time exports\n// that run a claim from those files without the CLI.\n//\n// EXPERIMENTAL — under test, signet only. These names and signatures can\n// change in a minor release. See services/delegated-claim.\n\n/**\n * Depositor's Claim signing PSBT (base64) — spends PegIn:1, script path.\n *\n * @experimental\n */\nexport async function buildClaimPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildClaimPsbt(txGraphVersion, graphJson);\n}\n\n/**\n * Claimer's Assert signing PSBT (base64) — the single WOTS input.\n *\n * @experimental\n */\nexport async function buildAssertClaimerPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildAssertClaimerPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Claimer's Payout signing PSBT (base64) — input 1, Assert connector path.\n *\n * @experimental\n */\nexport async function buildPayoutClaimerPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildPayoutClaimerPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Depositor's Payout signing PSBT (base64) — input 0, the PegIn UTXO spend.\n *\n * @experimental\n */\nexport async function buildPayoutDepositorPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildPayoutDepositorPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Claimer's WronglyChallenged signing PSBTs, per challenger and GC index.\n *\n * @experimental\n */\nexport async function buildWronglyChallengedPsbts(\n txGraphVersion: number,\n graphJson: string,\n): Promise<WronglyChallengedPsbts> {\n return (await loadTbvWasm()).buildWronglyChallengedPsbts(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Verifies the Groth16 pegout proof and pins it into the artifacts, returning\n * the updated artifacts JSON. Persist that copy: the one-time WOTS keypair\n * signs exactly one proof, so a second, different one is refused.\n *\n * @experimental\n */\nexport async function pinPegoutProof(\n txGraphVersion: number,\n artifactsJson: string,\n proofHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).pinPegoutProof(\n txGraphVersion,\n artifactsJson,\n proofHex,\n );\n}\n\n/**\n * Finalizes the Assert from the pinned proof and the WOTS keypair, writes it\n * into the artifacts and returns the updated artifacts JSON. The keypair\n * never leaves the caller.\n *\n * @experimental\n */\nexport async function attachFinalizedAssert(\n txGraphVersion: number,\n artifactsJson: string,\n keypairJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).attachFinalizedAssert(\n txGraphVersion,\n artifactsJson,\n keypairJson,\n );\n}\n\n/**\n * Finalizes the Payout tx from the artifacts' signatures, consensus hex.\n *\n * @experimental\n */\nexport async function finalizePayout(\n txGraphVersion: number,\n artifactsJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizePayout(txGraphVersion, artifactsJson);\n}\n\n/**\n * Finalizes one WronglyChallenged tx — the answer to a ChallengeAssert.\n *\n * @experimental\n */\nexport async function finalizeWronglyChallenged(\n txGraphVersion: number,\n artifactsJson: string,\n challengerPkHex: string,\n gcIndex: number,\n preimageHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizeWronglyChallenged(\n txGraphVersion,\n artifactsJson,\n challengerPkHex,\n gcIndex,\n preimageHex,\n );\n}\n\n/**\n * Applies the depositor signature to the Claim tx, returning consensus hex.\n *\n * @experimental\n */\nexport async function finalizeClaimTx(\n txGraphVersion: number,\n graphJson: string,\n depositorSigHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizeClaimTx(\n txGraphVersion,\n graphJson,\n depositorSigHex,\n );\n}\n\n/**\n * Extracts a signed PSBT input's taproot script-path signature (hex).\n *\n * @experimental\n */\nexport async function extractTapScriptSig(\n psbtBase64: string,\n inputIndex: number,\n): Promise<string> {\n return (await loadTbvWasm()).extractTapScriptSig(psbtBase64, inputIndex);\n}\n\n/**\n * Derive the depositor's WOTS keypair from the 64-byte `wotsSeed`.\n * @stability frozen — `HASH160(seed || block index)` binds on-chain through\n * `depositorWotsPkHash`; see CLAUDE.md §4.\n *\n * @experimental\n */\nexport async function wotsKeypairFromSeed(\n wotsSeed: Uint8Array,\n): Promise<WotsKeypairDerivation> {\n return (await loadTbvWasm()).wotsKeypairFromSeed(wotsSeed);\n}\n\n/**\n * Throws unless the keypair matches the WOTS keys the graph's Claim commits to.\n *\n * @experimental\n */\nexport async function validateWotsKeypairAgainstGraph(\n txGraphVersion: number,\n keypair: unknown,\n graphJson: string,\n): Promise<void> {\n return (await loadTbvWasm()).validateWotsKeypairAgainstGraph(\n txGraphVersion,\n keypair,\n graphJson,\n );\n}\n\n/**\n * Assembles the watchtower `artifacts.json` content, verifying every signature.\n *\n * @experimental\n */\nexport async function buildWatchtowerArtifacts(\n inputs: WatchtowerArtifactsInputs,\n): Promise<string> {\n return (await loadTbvWasm()).buildWatchtowerArtifacts(inputs);\n}\n\n/**\n * Re-verifies every claimer-side signature in an `artifacts.json`.\n *\n * @experimental\n */\nexport async function verifyWatchtowerArtifacts(\n txGraphVersion: number,\n artifactsJson: string,\n): Promise<void> {\n return (await loadTbvWasm()).verifyWatchtowerArtifacts(\n txGraphVersion,\n artifactsJson,\n );\n}\n\nexport type {\n AssertNoPayoutScriptInfo,\n AssertPayoutNoPayoutConnectorParams,\n AssertPayoutScriptInfo,\n ChallengeAssertConnectorParams,\n ChallengeAssertOutputConnectorParams,\n ChallengeAssertScriptInfo,\n HtlcConnectorInfo,\n HtlcConnectorParams,\n Network,\n PayoutConnectorInfo,\n PayoutConnectorParams,\n PeginP2aAnchorInfo,\n PeginTxResult,\n PrePeginParams,\n PrePeginResult,\n WatchtowerArtifactsInputs,\n WotsKeypairDerivation,\n WronglyChallengedPsbts,\n WronglyChallengedSigs,\n};\n"],"names":["TAP_INTERNAL_KEY","tapInternalPubkey","_","index","wasmModulePromise","loadTbvWasm","error","wasm","createPrePeginTransaction","params","buildPeginTxFromPrePegin","timelockPegin","fundedPrePeginTxHex","htlcVout","getPrePeginHtlcConnectorInfo","computeMinClaimValue","txGraphVersion","numLocalChallengers","numUniversalChallengers","councilQuorum","councilSize","feeRate","computeMinPeginFee","numVks","numUcs","minPeginFeeRate","computePayoutFeeFloor","numVaultKeepers","out0Len","out1Len","supportedTxGraphVersions","peginP2aAnchorOutput","validatePeginP2aAnchor","txHex","createPayoutConnector","network","getAssertPayoutScriptInfo","getAssertNoPayoutScriptInfo","challengerPubkey","getChallengeAssertScriptInfo","getChallengeAssertOutputScriptPubKey","expandAuthAnchor","root","expandHashlockSecret","expandWotsSeed","deriveVaultId","peginTxHash","depositor","buildClaimPsbt","graphJson","buildAssertClaimerPsbt","buildPayoutClaimerPsbt","buildPayoutDepositorPsbt","buildWronglyChallengedPsbts","pinPegoutProof","artifactsJson","proofHex","attachFinalizedAssert","keypairJson","finalizePayout","finalizeWronglyChallenged","challengerPkHex","gcIndex","preimageHex","finalizeClaimTx","depositorSigHex","extractTapScriptSig","psbtBase64","inputIndex","wotsKeypairFromSeed","wotsSeed","validateWotsKeypairAgainstGraph","keypair","buildWatchtowerArtifacts","inputs","verifyWatchtowerArtifacts"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../verifyScriptPathSchnorrSignature-CahYx5Td.cjs"),O=require("../secp256k1-DDHQ1_za.cjs"),o=require("./core/wasm/index.cjs"),R=require("../verifyKeyPathSchnorrSignature-BRTpEH9X.cjs"),E=require("../challengeAssert-C3eMcM5Y.cjs"),r=require("../bitcoin-D-O2GjbC.cjs"),F=require("../abortSignals-msbmbqFe.cjs"),I=require("../signing-DvISftFk.cjs"),P=require("../validation-C6XTfZak.cjs"),V=require("./core/utils/eth/index.cjs"),_=require("../PeginManager-D2R4Q1bN.cjs"),d=require("../PayoutManager-B1Ev0r7o.cjs"),s=require("./core/clients/mempool/index.cjs"),l=require("../registration-records-XQMIKjGV.cjs"),C=require("../signer-set-reader-GrFe_rsW.cjs"),A=require("../pegin-registration-client-CdRyXP3j.cjs"),h=require("../types-BC2TGzcp.cjs"),y=require("../ApplicationRegistry.abi-sMiTWmnL.cjs"),N=require("../BTCVaultRegistry.abi-BH2-LHxN.cjs"),u=require("../BTCVaultRegistryKeyEpochs.abi-CReWFJdu.cjs"),M=require("../ProtocolParams.abi-BgEZaQ2I.cjs"),b=require("../VaultErrors.abi-DQ18kM0L.cjs"),v=require("../buildVaultContextInputForClaim-9XZaqIiw.cjs"),S=require("../deriveVaultRoot-C3uqnJto.cjs"),D=require("../parseFundingOutpoints-C_-PT9BT.cjs"),B=require("../btcTxHash-CGb5BqFL.cjs"),c=require("../psbtInputFields-BrV_ZfL_.cjs"),i=require("../fundPeginTransaction-54-Rwb2k.cjs"),T=require("../reservation-CA5knoQ0.cjs"),m=require("../index-C6avwx1s.cjs"),a=require("../state-C4WoNCy1.cjs"),g=require("../primeVpAuth-CXNXYKrh.cjs"),t=require("../toRefundInputs-DRmK83fv.cjs"),e=require("../buildAndBroadcastReclaim-DPk36Uhp.cjs"),p=require("../peginState-IyE22wWh.cjs");exports.PEGIN_DEPOSITOR_CLAIM_VOUT=n.PEGIN_DEPOSITOR_CLAIM_VOUT;exports.PsbtSubstitutionError=n.PsbtSubstitutionError;exports.assertPsbtUnsignedTxMatches=n.assertPsbtUnsignedTxMatches;exports.assertScriptPathSchnorrSignature=n.assertScriptPathSchnorrSignature;exports.buildPayoutPsbt=n.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=n.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=n.buildPrePeginPsbt;exports.computeNumLocalChallengers=n.computeNumLocalChallengers;exports.createPayoutScript=n.createPayoutScript;exports.deriveDepositorClaimDescriptor=n.deriveDepositorClaimDescriptor;exports.deriveDepositorClaimScriptPubKey=n.deriveDepositorClaimScriptPubKey;exports.extractPayoutSignature=n.extractPayoutSignature;exports.assertValidVaultCoreVersion=O.assertValidVaultCoreVersion;exports.attachFinalizedAssert=o.attachFinalizedAssert;exports.computeMinClaimValue=o.computeMinClaimValue;exports.computeMinPeginFee=o.computeMinPeginFee;exports.deriveVaultId=o.deriveVaultId;exports.expandAuthAnchor=o.expandAuthAnchor;exports.expandHashlockSecret=o.expandHashlockSecret;exports.expandWotsSeed=o.expandWotsSeed;exports.finalizePayout=o.finalizePayout;exports.finalizeWronglyChallenged=o.finalizeWronglyChallenged;exports.peginP2aAnchorOutput=o.peginP2aAnchorOutput;exports.pinPegoutProof=o.pinPegoutProof;exports.supportedTxGraphVersions=o.supportedTxGraphVersions;exports.validatePeginP2aAnchor=o.validatePeginP2aAnchor;exports.assertKeyPathSchnorrSignature=R.assertKeyPathSchnorrSignature;exports.assertReturnedKeyPathSignatures=R.assertReturnedKeyPathSignatures;exports.buildPeginInputPsbt=R.buildPeginInputPsbt;exports.extractPeginInputSignature=R.extractPeginInputSignature;exports.finalizePeginInputPsbt=R.finalizePeginInputPsbt;exports.buildChallengeAssertPsbt=E.buildChallengeAssertPsbt;exports.buildNoPayoutPsbt=E.buildNoPayoutPsbt;exports.buildReclaimPsbt=E.buildReclaimPsbt;exports.buildRefundPsbt=E.buildRefundPsbt;exports.estimateReclaimFeeSats=E.estimateReclaimFeeSats;exports.finalizeScriptPathWithSignatures=E.finalizeScriptPathWithSignatures;exports.reclaimVsize=E.reclaimVsize;exports.canonicalizeBtcPubkey=r.canonicalizeBtcPubkey;exports.deriveBip86ScriptPubKeyHex=r.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=r.deriveNativeSegwitAddress;exports.deriveTaprootAddress=r.deriveTaprootAddress;exports.ensureHexPrefix=r.ensureHexPrefix;exports.formatSatoshisToBtc=r.formatSatoshisToBtc;exports.getNetwork=r.getNetwork;exports.getSortedXOnlyPubkeys=r.getSortedXOnlyPubkeys;exports.hexToUint8Array=r.hexToUint8Array;exports.isAddressFromPublicKey=r.isAddressFromPublicKey;exports.isValidHex=r.isValidHex;exports.processPublicKeyToXOnly=r.processPublicKeyToXOnly;exports.stripHexPrefix=r.stripHexPrefix;exports.toXOnly=r.toXOnly;exports.uint8ArrayToHex=r.uint8ArrayToHex;exports.validateWalletPubkey=r.validateWalletPubkey;exports.combineAbortSignals=F.combineAbortSignals;exports.createTaprootScriptPathSignOptions=I.createTaprootScriptPathSignOptions;exports.createTaprootScriptPathSignOptionsForInput=I.createTaprootScriptPathSignOptionsForInput;exports.BITCOIN_ADDRESS_RE=P.BITCOIN_ADDRESS_RE;exports.COMPRESSED_PUBKEY_HEX_LEN=P.COMPRESSED_PUBKEY_HEX_LEN;exports.HEX_RE=P.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=P.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=P.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=P.TXID_RE;exports.X_ONLY_PUBKEY_HEX_LEN=P.X_ONLY_PUBKEY_HEX_LEN;exports.waitForTransactionReceiptSmartAware=V.waitForTransactionReceiptSmartAware;exports.PeginManager=_.PeginManager;exports.buildDepositTerms=_.buildDepositTerms;exports.computeWotsBlockPublicKeysHash=_.computeWotsBlockPublicKeysHash;exports.deriveWotsBlocksFromSeed=_.deriveWotsBlocksFromSeed;exports.ensurePrePeginTermsApproval=_.ensurePrePeginTermsApproval;exports.PayoutManager=d.PayoutManager;exports.computeHashlock=d.computeHashlock;exports.forwardDepositApproval=d.forwardDepositApproval;exports.requireChangeAddress=d.requireChangeAddress;exports.supportsDepositApproval=d.supportsDepositApproval;exports.validateSecretAgainstHashlock=d.validateSecretAgainstHashlock;exports.MEMPOOL_API_URLS=s.MEMPOOL_API_URLS;exports.MempoolNotFoundError=s.MempoolNotFoundError;exports.getAddressTxs=s.getAddressTxs;exports.getAddressUtxos=s.getAddressUtxos;exports.getMempoolApiUrl=s.getMempoolApiUrl;exports.getNetworkFees=s.getNetworkFees;exports.getOutspend=s.getOutspend;exports.getTipHeight=s.getTipHeight;exports.getTxHex=s.getTxHex;exports.getTxInfo=s.getTxInfo;exports.getUtxoInfo=s.getUtxoInfo;exports.pushTx=s.pushTx;exports.RegistrationLogsUnavailableError=l.RegistrationLogsUnavailableError;exports.VaultClaimableByNotFoundError=l.VaultClaimableByNotFoundError;exports.assertOnChainBtcPubkey=l.assertOnChainBtcPubkey;exports.assertRegisteredPayoutScriptBounds=l.assertRegisteredPayoutScriptBounds;exports.derivePeginVaultId=l.derivePeginVaultId;exports.findRegistrationRecord=l.findRegistrationRecord;exports.isRegistrationLogsUnavailableError=l.isRegistrationLogsUnavailableError;exports.isVaultClaimableByNotFoundError=l.isVaultClaimableByNotFoundError;exports.registrationPrePeginTxHash=l.registrationPrePeginTxHash;exports.validateOffchainParams=l.validateOffchainParams;exports.validatePegInConfiguration=l.validatePegInConfiguration;exports.validateTBVProtocolParams=l.validateTBVProtocolParams;exports.ViemOperationKeyReader=C.ViemOperationKeyReader;exports.ViemUniversalChallengerReader=C.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=C.ViemVaultKeeperReader;exports.resolveProtocolAddresses=C.resolveProtocolAddresses;exports.COMMISSION_BPS_HEADROOM=A.COMMISSION_BPS_HEADROOM;exports.MAX_ACCEPTABLE_COMMISSION_BPS_CAP=A.MAX_ACCEPTABLE_COMMISSION_BPS_CAP;exports.ViemPeginRegistrationClient=A.ViemPeginRegistrationClient;exports.ViemVaultRegistryReader=A.ViemVaultRegistryReader;exports.capMaxAcceptableCommissionBps=A.capMaxAcceptableCommissionBps;exports.OnChainBtcVaultStatus=h.OnChainBtcVaultStatus;exports.ViemProtocolParamsReader=h.ViemProtocolParamsReader;exports.ApplicationRegistryABI=y.ApplicationRegistryABI;exports.BTCVaultRegistryABI=N.BTCVaultRegistryABI;exports.BTCVaultRegistryKeyEpochsABI=u.BTCVaultRegistryKeyEpochsABI;exports.CONTRACT_ERRORS=u.CONTRACT_ERRORS;exports.EMPTY_REVERT_MESSAGE=u.EMPTY_REVERT_MESSAGE;exports.PEGIN_FINGERPRINT_CHANGED_SELECTOR=u.PEGIN_FINGERPRINT_CHANGED_SELECTOR;exports.PeginFingerprintChangedError=u.PeginFingerprintChangedError;exports.extractErrorData=u.extractErrorData;exports.getContractErrorMessage=u.getContractErrorMessage;exports.handleContractError=u.handleContractError;exports.isKnownContractError=u.isKnownContractError;exports.isPeginFingerprintChangedError=u.isPeginFingerprintChangedError;exports.ProtocolParamsABI=M.ProtocolParamsABI;exports.VAULT_ERROR_ABI=b.VAULT_ERROR_ABI;exports.buildVaultContextInputForClaim=v.buildVaultContextInputForClaim;exports.VAULT_APP_NAME=S.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=S.buildFundingOutpointsCommitment;exports.buildVaultContext=S.buildVaultContext;exports.deriveVaultRoot=S.deriveVaultRoot;exports.forwardDeriveContextHash=S.forwardDeriveContextHash;exports.parseFundingOutpointsFromTx=D.parseFundingOutpointsFromTx;exports.calculateBtcTxHash=B.calculateBtcTxHash;exports.BitcoinScriptType=c.BitcoinScriptType;exports.applyChangeOutputPolicy=c.applyChangeOutputPolicy;exports.computeChangeOutputFeeSats=c.computeChangeOutputFeeSats;exports.computeMaxDeposit=c.computeMaxDeposit;exports.computePeginBaseFeeSats=c.computePeginBaseFeeSats;exports.getDustThreshold=c.getDustThreshold;exports.getPsbtInputFields=c.getPsbtInputFields;exports.getScriptType=c.getScriptType;exports.selectUtxosForPegin=c.selectUtxosForPegin;exports.shouldAddChangeOutput=c.shouldAddChangeOutput;exports.BTC_DUST_SAT=i.BTC_DUST_SAT;exports.DUST_THRESHOLD=i.DUST_THRESHOLD;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=i.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=i.MAX_NON_LEGACY_OUTPUT_SIZE;exports.MAX_REASONABLE_PEGIN_VBYTES=i.MAX_REASONABLE_PEGIN_VBYTES;exports.P2TR_INPUT_SIZE=i.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=i.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=i.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=i.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=i.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=i.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=i.fundPeginTransaction;exports.parseUnfundedWasmTransaction=i.parseUnfundedWasmTransaction;exports.peginOutputCount=i.peginOutputCount;exports.rateBasedTxBufferFee=i.rateBasedTxBufferFee;exports.UtxoNotAvailableError=T.UtxoNotAvailableError;exports.assertUtxosAvailable=T.assertUtxosAvailable;exports.extractInputsFromTransaction=T.extractInputsFromTransaction;exports.findOverlappingPendingVaults=T.findOverlappingPendingVaults;exports.validateUtxosAvailable=T.validateUtxosAvailable;exports.VaultProviderRpcClient=m.VaultProviderRpcClient;exports.VpResponseValidationError=m.VpResponseValidationError;exports.batchPollByProvider=m.batchPollByProvider;exports.isUnrecognizedDaemonStatusError=m.isUnrecognizedDaemonStatusError;exports.validateRequestDepositorClaimerArtifactsResponse=m.validateRequestDepositorClaimerArtifactsResponse;exports.AUTH_REJECTED_RPC_CODE=a.AUTH_REJECTED_RPC_CODE;exports.ClaimerPegoutStatusValue=a.ClaimerPegoutStatusValue;exports.DaemonStatus=a.DaemonStatus;exports.JSON_RPC_ERROR_CODES=a.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=a.JsonRpcClient;exports.JsonRpcError=a.JsonRpcError;exports.POST_WOTS_STATUSES=a.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=a.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=a.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=a.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=a.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=a.VP_TRANSIENT_STATUSES;exports.isAuthRejectedError=a.isAuthRejectedError;exports.isPegoutTerminalStatus=a.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=a.isRecognizedPegoutStatus;exports.ServerIdentityError=g.ServerIdentityError;exports.VpTokenRegistry=g.VpTokenRegistry;exports.createAuthenticatedVpClient=g.createAuthenticatedVpClient;exports.primeVpTokenRegistry=g.primeVpTokenRegistry;exports.verifyServerIdentity=g.verifyServerIdentity;exports.vpTokenRegistry=g.vpTokenRegistry;exports.DEPOSIT_TERMS_REJECTED_ERROR_NAME=t.DEPOSIT_TERMS_REJECTED_ERROR_NAME;exports.DepositTermsRejectedError=t.DepositTermsRejectedError;exports.PEGIN_FINGERPRINT_DOMAIN=t.PEGIN_FINGERPRINT_DOMAIN;exports.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE=t.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE;exports.PeginFingerprintInputError=t.PeginFingerprintInputError;exports.PeginParamsAmbiguousError=t.PeginParamsAmbiguousError;exports.PeginParamsIncompleteSpaceError=t.PeginParamsIncompleteSpaceError;exports.PeginParamsNotFoundError=t.PeginParamsNotFoundError;exports.PeginSizingIntegrityError=t.PeginSizingIntegrityError;exports.UnanchoredPrePeginError=t.UnanchoredPrePeginError;exports.VaultRootMismatchError=t.VaultRootMismatchError;exports.assertClaimBatchHomogeneous=t.assertClaimBatchHomogeneous;exports.buildPeginParamsCandidates=t.buildPeginParamsCandidates;exports.computeFundedPrePeginFee=t.computeFundedPrePeginFee;exports.computePeginFingerprint=t.computePeginFingerprint;exports.deriveHashlocksFromPrePegin=t.deriveHashlocksFromPrePegin;exports.describePeginParamsCandidate=t.describePeginParamsCandidate;exports.describeUnresolvedVersion=t.describeUnresolvedVersion;exports.encodePeginFingerprintPreimage=t.encodePeginFingerprintPreimage;exports.isDepositTermsRejectedError=t.isDepositTermsRejectedError;exports.isPeginFingerprintInputError=t.isPeginFingerprintInputError;exports.isWotsMismatchError=t.isWotsMismatchError;exports.orderClaimBatchByHtlcVout=t.orderClaimBatchByHtlcVout;exports.rebuildDepositTermsCore=t.rebuildDepositTermsCore;exports.rebuildDepositTermsForClaim=t.rebuildDepositTermsForClaim;exports.reconstructPeginParams=t.reconstructPeginParams;exports.selectSiblingRegistrations=t.selectSiblingRegistrations;exports.toRefundInputs=t.toRefundInputs;exports.ApplicationEntryPointMismatchError=e.ApplicationEntryPointMismatchError;exports.ArtifactsVaultMismatchError=e.ArtifactsVaultMismatchError;exports.AssertBindingError=e.AssertBindingError;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ChallengerSetMismatchError=e.ChallengerSetMismatchError;exports.DELEGATED_CLAIM_TX_GRAPH_VERSION=e.DELEGATED_CLAIM_TX_GRAPH_VERSION;exports.DelegatedClaimSigningIncompleteError=e.DelegatedClaimSigningIncompleteError;exports.GraphFingerprintError=e.GraphFingerprintError;exports.PEGIN_ETH_CONFIRMATIONS=e.PEGIN_ETH_CONFIRMATIONS;exports.ParticipantKeyDriftError=e.ParticipantKeyDriftError;exports.PayoutDestinationError=e.PayoutDestinationError;exports.PayoutInputLeafError=e.PayoutInputLeafError;exports.PeginRegistrationMissingError=e.PeginRegistrationMissingError;exports.PeginRegistrationNotFinalError=e.PeginRegistrationNotFinalError;exports.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR=e.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR;exports.RECLAIM_MAX_FEE_FRACTION_NUMERATOR=e.RECLAIM_MAX_FEE_FRACTION_NUMERATOR;exports.RECLAIM_MAX_FEE_RATE_SATS_VB=e.RECLAIM_MAX_FEE_RATE_SATS_VB;exports.RECLAIM_WARN_FEE_FRACTION_NUMERATOR=e.RECLAIM_WARN_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=e.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=e.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=e.REFUND_MAX_FEE_RATE_SATS_VB;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.ReclaimUneconomicalError=e.ReclaimUneconomicalError;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.SigningPlanMismatchError=e.SigningPlanMismatchError;exports.VaultIdBindingError=e.VaultIdBindingError;exports.activateVault=e.activateVault;exports.activateVaultAndRedeem=e.activateVaultAndRedeem;exports.assembleWatchtowerArtifacts=e.assembleWatchtowerArtifacts;exports.assembleWatchtowerArtifactsFromSignatures=e.assembleWatchtowerArtifactsFromSignatures;exports.assertArtifactsUsableForVault=e.assertArtifactsUsableForVault;exports.assertAssertBindsClaimAndPayout=e.assertAssertBindsClaimAndPayout;exports.assertChallengerSetMatchesVault=e.assertChallengerSetMatchesVault;exports.assertClaimSpendsVault=e.assertClaimSpendsVault;exports.assertPayoutPaysRegisteredScript=e.assertPayoutPaysRegisteredScript;exports.assertReturnedGraphMatchesFingerprint=e.assertReturnedGraphMatchesFingerprint;exports.assertTermsMatchVault=e.assertTermsMatchVault;exports.assertVaultProviderHintAccepted=e.assertVaultProviderHintAccepted;exports.buildAndBroadcastReclaim=e.buildAndBroadcastReclaim;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.claimExpiredVault=e.claimExpiredVault;exports.copyAssertConnectorLeaf=e.copyAssertConnectorLeaf;exports.deriveClaimerWotsKeypair=e.deriveClaimerWotsKeypair;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.fingerprintReturnedGraph=e.fingerprintReturnedGraph;exports.isApplicationEntryPointMismatchError=e.isApplicationEntryPointMismatchError;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isHintAccepted=e.isHintAccepted;exports.isParticipantKeyDriftError=e.isParticipantKeyDriftError;exports.isPeginRegistrationMissingError=e.isPeginRegistrationMissingError;exports.isPeginRegistrationNotFinalError=e.isPeginRegistrationNotFinalError;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.matchKeyHint=e.matchKeyHint;exports.matchKeySetHint=e.matchKeySetHint;exports.planDelegatedClaimSigning=e.planDelegatedClaimSigning;exports.readDelegatedClaimVaultContext=e.readDelegatedClaimVaultContext;exports.readStampedParticipantKeys=e.readStampedParticipantKeys;exports.resolveCurrentParticipantKeys=e.resolveCurrentParticipantKeys;exports.resolveParticipantKeysAtEpochs=e.resolveParticipantKeysAtEpochs;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDelegatedClaimPlan=e.signDelegatedClaimPlan;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.summarizeWatchtowerArtifacts=e.summarizeWatchtowerArtifacts;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredParticipantKeys=e.verifyRegisteredParticipantKeys;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginRegistrationDepth=e.waitForPeginRegistrationDepth;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=p.ContractStatus;exports.PeginAction=p.PeginAction;exports.activationDeadlineBlocksRemaining=p.activationDeadlineBlocksRemaining;exports.canPerformAction=p.canPerformAction;exports.getPeginProtocolState=p.getPeginProtocolState;exports.isActivationDeadlinePassedOnChain=p.isActivationDeadlinePassedOnChain;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../verifyScriptPathSchnorrSignature-CgDa9Rcg.cjs"),O=require("../secp256k1-DDHQ1_za.cjs"),n=require("./core/wasm/index.cjs"),R=require("../verifyKeyPathSchnorrSignature-DcxCojp0.cjs"),E=require("../challengeAssert-eUMgmpMk.cjs"),r=require("../bitcoin-D-O2GjbC.cjs"),F=require("../abortSignals-msbmbqFe.cjs"),I=require("../signing-DvISftFk.cjs"),P=require("../validation-C6XTfZak.cjs"),V=require("./core/utils/eth/index.cjs"),_=require("../PeginManager-CMbRRTnr.cjs"),d=require("../PayoutManager-Dopxq_Jv.cjs"),s=require("./core/clients/mempool/index.cjs"),l=require("../registration-records-CKc0OVuK.cjs"),C=require("../signer-set-reader-CJfV-GDz.cjs"),A=require("../pegin-registration-client-DLlaZbsZ.cjs"),h=require("../types-BnZIbDHb.cjs"),y=require("../ApplicationRegistry.abi-sMiTWmnL.cjs"),N=require("../BTCVaultRegistry.abi-DzbfZ9_s.cjs"),u=require("../BTCVaultRegistryKeyEpochs.abi-CReWFJdu.cjs"),M=require("../ProtocolParams.abi-DWfIh6VH.cjs"),b=require("../VaultErrors.abi-Hjn1CdLs.cjs"),v=require("../buildVaultContextInputForClaim-9XZaqIiw.cjs"),S=require("../deriveVaultRoot-C3uqnJto.cjs"),D=require("../parseFundingOutpoints-C_-PT9BT.cjs"),B=require("../btcTxHash-CGb5BqFL.cjs"),c=require("../psbtInputFields-BrV_ZfL_.cjs"),i=require("../fundPeginTransaction-54-Rwb2k.cjs"),T=require("../reservation-CA5knoQ0.cjs"),m=require("../index-Dn7RlsKK.cjs"),a=require("../state-C4WoNCy1.cjs"),g=require("../primeVpAuth-Ch-ig2My.cjs"),t=require("../toRefundInputs-BSQjDOK9.cjs"),e=require("../buildAndBroadcastReclaim-OBWjvzuC.cjs"),p=require("../peginState-IyE22wWh.cjs");exports.PEGIN_DEPOSITOR_CLAIM_VOUT=o.PEGIN_DEPOSITOR_CLAIM_VOUT;exports.PsbtSubstitutionError=o.PsbtSubstitutionError;exports.assertPsbtUnsignedTxMatches=o.assertPsbtUnsignedTxMatches;exports.assertScriptPathSchnorrSignature=o.assertScriptPathSchnorrSignature;exports.buildPayoutPsbt=o.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=o.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=o.buildPrePeginPsbt;exports.computeNumLocalChallengers=o.computeNumLocalChallengers;exports.createPayoutScript=o.createPayoutScript;exports.deriveDepositorClaimDescriptor=o.deriveDepositorClaimDescriptor;exports.deriveDepositorClaimScriptPubKey=o.deriveDepositorClaimScriptPubKey;exports.extractPayoutSignature=o.extractPayoutSignature;exports.assertValidVaultCoreVersion=O.assertValidVaultCoreVersion;exports.attachFinalizedAssert=n.attachFinalizedAssert;exports.computeMinClaimValue=n.computeMinClaimValue;exports.computeMinPeginFee=n.computeMinPeginFee;exports.deriveVaultId=n.deriveVaultId;exports.expandAuthAnchor=n.expandAuthAnchor;exports.expandHashlockSecret=n.expandHashlockSecret;exports.expandWotsSeed=n.expandWotsSeed;exports.finalizePayout=n.finalizePayout;exports.finalizeWronglyChallenged=n.finalizeWronglyChallenged;exports.peginP2aAnchorOutput=n.peginP2aAnchorOutput;exports.pinPegoutProof=n.pinPegoutProof;exports.supportedTxGraphVersions=n.supportedTxGraphVersions;exports.validatePeginP2aAnchor=n.validatePeginP2aAnchor;exports.assertKeyPathSchnorrSignature=R.assertKeyPathSchnorrSignature;exports.assertReturnedKeyPathSignatures=R.assertReturnedKeyPathSignatures;exports.buildPeginInputPsbt=R.buildPeginInputPsbt;exports.extractPeginInputSignature=R.extractPeginInputSignature;exports.finalizePeginInputPsbt=R.finalizePeginInputPsbt;exports.buildChallengeAssertPsbt=E.buildChallengeAssertPsbt;exports.buildNoPayoutPsbt=E.buildNoPayoutPsbt;exports.buildReclaimPsbt=E.buildReclaimPsbt;exports.buildRefundPsbt=E.buildRefundPsbt;exports.estimateReclaimFeeSats=E.estimateReclaimFeeSats;exports.finalizeScriptPathWithSignatures=E.finalizeScriptPathWithSignatures;exports.reclaimVsize=E.reclaimVsize;exports.canonicalizeBtcPubkey=r.canonicalizeBtcPubkey;exports.deriveBip86ScriptPubKeyHex=r.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=r.deriveNativeSegwitAddress;exports.deriveTaprootAddress=r.deriveTaprootAddress;exports.ensureHexPrefix=r.ensureHexPrefix;exports.formatSatoshisToBtc=r.formatSatoshisToBtc;exports.getNetwork=r.getNetwork;exports.getSortedXOnlyPubkeys=r.getSortedXOnlyPubkeys;exports.hexToUint8Array=r.hexToUint8Array;exports.isAddressFromPublicKey=r.isAddressFromPublicKey;exports.isValidHex=r.isValidHex;exports.processPublicKeyToXOnly=r.processPublicKeyToXOnly;exports.stripHexPrefix=r.stripHexPrefix;exports.toXOnly=r.toXOnly;exports.uint8ArrayToHex=r.uint8ArrayToHex;exports.validateWalletPubkey=r.validateWalletPubkey;exports.combineAbortSignals=F.combineAbortSignals;exports.createTaprootScriptPathSignOptions=I.createTaprootScriptPathSignOptions;exports.createTaprootScriptPathSignOptionsForInput=I.createTaprootScriptPathSignOptionsForInput;exports.BITCOIN_ADDRESS_RE=P.BITCOIN_ADDRESS_RE;exports.COMPRESSED_PUBKEY_HEX_LEN=P.COMPRESSED_PUBKEY_HEX_LEN;exports.HEX_RE=P.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=P.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=P.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=P.TXID_RE;exports.X_ONLY_PUBKEY_HEX_LEN=P.X_ONLY_PUBKEY_HEX_LEN;exports.waitForTransactionReceiptSmartAware=V.waitForTransactionReceiptSmartAware;exports.PeginManager=_.PeginManager;exports.buildDepositTerms=_.buildDepositTerms;exports.computeWotsBlockPublicKeysHash=_.computeWotsBlockPublicKeysHash;exports.deriveWotsBlocksFromSeed=_.deriveWotsBlocksFromSeed;exports.ensurePrePeginTermsApproval=_.ensurePrePeginTermsApproval;exports.PayoutManager=d.PayoutManager;exports.computeHashlock=d.computeHashlock;exports.forwardDepositApproval=d.forwardDepositApproval;exports.requireChangeAddress=d.requireChangeAddress;exports.supportsDepositApproval=d.supportsDepositApproval;exports.validateSecretAgainstHashlock=d.validateSecretAgainstHashlock;exports.MEMPOOL_API_URLS=s.MEMPOOL_API_URLS;exports.MempoolNotFoundError=s.MempoolNotFoundError;exports.getAddressTxs=s.getAddressTxs;exports.getAddressUtxos=s.getAddressUtxos;exports.getMempoolApiUrl=s.getMempoolApiUrl;exports.getNetworkFees=s.getNetworkFees;exports.getOutspend=s.getOutspend;exports.getTipHeight=s.getTipHeight;exports.getTxHex=s.getTxHex;exports.getTxInfo=s.getTxInfo;exports.getUtxoInfo=s.getUtxoInfo;exports.pushTx=s.pushTx;exports.RegistrationLogsUnavailableError=l.RegistrationLogsUnavailableError;exports.VaultClaimableByNotFoundError=l.VaultClaimableByNotFoundError;exports.assertOnChainBtcPubkey=l.assertOnChainBtcPubkey;exports.assertRegisteredPayoutScriptBounds=l.assertRegisteredPayoutScriptBounds;exports.derivePeginVaultId=l.derivePeginVaultId;exports.findRegistrationRecord=l.findRegistrationRecord;exports.isRegistrationLogsUnavailableError=l.isRegistrationLogsUnavailableError;exports.isVaultClaimableByNotFoundError=l.isVaultClaimableByNotFoundError;exports.registrationPrePeginTxHash=l.registrationPrePeginTxHash;exports.validateOffchainParams=l.validateOffchainParams;exports.validatePegInConfiguration=l.validatePegInConfiguration;exports.validateTBVProtocolParams=l.validateTBVProtocolParams;exports.ViemOperationKeyReader=C.ViemOperationKeyReader;exports.ViemUniversalChallengerReader=C.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=C.ViemVaultKeeperReader;exports.resolveProtocolAddresses=C.resolveProtocolAddresses;exports.COMMISSION_BPS_HEADROOM=A.COMMISSION_BPS_HEADROOM;exports.MAX_ACCEPTABLE_COMMISSION_BPS_CAP=A.MAX_ACCEPTABLE_COMMISSION_BPS_CAP;exports.ViemPeginRegistrationClient=A.ViemPeginRegistrationClient;exports.ViemVaultRegistryReader=A.ViemVaultRegistryReader;exports.capMaxAcceptableCommissionBps=A.capMaxAcceptableCommissionBps;exports.OnChainBtcVaultStatus=h.OnChainBtcVaultStatus;exports.ViemProtocolParamsReader=h.ViemProtocolParamsReader;exports.ApplicationRegistryABI=y.ApplicationRegistryABI;exports.BTCVaultRegistryABI=N.BTCVaultRegistryABI;exports.BTCVaultRegistryKeyEpochsABI=u.BTCVaultRegistryKeyEpochsABI;exports.CONTRACT_ERRORS=u.CONTRACT_ERRORS;exports.EMPTY_REVERT_MESSAGE=u.EMPTY_REVERT_MESSAGE;exports.PEGIN_FINGERPRINT_CHANGED_SELECTOR=u.PEGIN_FINGERPRINT_CHANGED_SELECTOR;exports.PeginFingerprintChangedError=u.PeginFingerprintChangedError;exports.extractErrorData=u.extractErrorData;exports.getContractErrorMessage=u.getContractErrorMessage;exports.handleContractError=u.handleContractError;exports.isKnownContractError=u.isKnownContractError;exports.isPeginFingerprintChangedError=u.isPeginFingerprintChangedError;exports.ProtocolParamsABI=M.ProtocolParamsABI;exports.VAULT_ERROR_ABI=b.VAULT_ERROR_ABI;exports.buildVaultContextInputForClaim=v.buildVaultContextInputForClaim;exports.VAULT_APP_NAME=S.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=S.buildFundingOutpointsCommitment;exports.buildVaultContext=S.buildVaultContext;exports.deriveVaultRoot=S.deriveVaultRoot;exports.forwardDeriveContextHash=S.forwardDeriveContextHash;exports.parseFundingOutpointsFromTx=D.parseFundingOutpointsFromTx;exports.calculateBtcTxHash=B.calculateBtcTxHash;exports.BitcoinScriptType=c.BitcoinScriptType;exports.applyChangeOutputPolicy=c.applyChangeOutputPolicy;exports.computeChangeOutputFeeSats=c.computeChangeOutputFeeSats;exports.computeMaxDeposit=c.computeMaxDeposit;exports.computePeginBaseFeeSats=c.computePeginBaseFeeSats;exports.getDustThreshold=c.getDustThreshold;exports.getPsbtInputFields=c.getPsbtInputFields;exports.getScriptType=c.getScriptType;exports.selectUtxosForPegin=c.selectUtxosForPegin;exports.shouldAddChangeOutput=c.shouldAddChangeOutput;exports.BTC_DUST_SAT=i.BTC_DUST_SAT;exports.DUST_THRESHOLD=i.DUST_THRESHOLD;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=i.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=i.MAX_NON_LEGACY_OUTPUT_SIZE;exports.MAX_REASONABLE_PEGIN_VBYTES=i.MAX_REASONABLE_PEGIN_VBYTES;exports.P2TR_INPUT_SIZE=i.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=i.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=i.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=i.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=i.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=i.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=i.fundPeginTransaction;exports.parseUnfundedWasmTransaction=i.parseUnfundedWasmTransaction;exports.peginOutputCount=i.peginOutputCount;exports.rateBasedTxBufferFee=i.rateBasedTxBufferFee;exports.UtxoNotAvailableError=T.UtxoNotAvailableError;exports.assertUtxosAvailable=T.assertUtxosAvailable;exports.extractInputsFromTransaction=T.extractInputsFromTransaction;exports.findOverlappingPendingVaults=T.findOverlappingPendingVaults;exports.validateUtxosAvailable=T.validateUtxosAvailable;exports.VaultProviderRpcClient=m.VaultProviderRpcClient;exports.VpResponseValidationError=m.VpResponseValidationError;exports.batchPollByProvider=m.batchPollByProvider;exports.isUnrecognizedDaemonStatusError=m.isUnrecognizedDaemonStatusError;exports.validateRequestDepositorClaimerArtifactsResponse=m.validateRequestDepositorClaimerArtifactsResponse;exports.AUTH_REJECTED_RPC_CODE=a.AUTH_REJECTED_RPC_CODE;exports.ClaimerPegoutStatusValue=a.ClaimerPegoutStatusValue;exports.DaemonStatus=a.DaemonStatus;exports.JSON_RPC_ERROR_CODES=a.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=a.JsonRpcClient;exports.JsonRpcError=a.JsonRpcError;exports.POST_WOTS_STATUSES=a.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=a.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=a.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=a.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=a.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=a.VP_TRANSIENT_STATUSES;exports.isAuthRejectedError=a.isAuthRejectedError;exports.isPegoutTerminalStatus=a.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=a.isRecognizedPegoutStatus;exports.ServerIdentityError=g.ServerIdentityError;exports.VpTokenRegistry=g.VpTokenRegistry;exports.createAuthenticatedVpClient=g.createAuthenticatedVpClient;exports.primeVpTokenRegistry=g.primeVpTokenRegistry;exports.verifyServerIdentity=g.verifyServerIdentity;exports.vpTokenRegistry=g.vpTokenRegistry;exports.DEPOSIT_TERMS_REJECTED_ERROR_NAME=t.DEPOSIT_TERMS_REJECTED_ERROR_NAME;exports.DepositTermsRejectedError=t.DepositTermsRejectedError;exports.PEGIN_FINGERPRINT_DOMAIN=t.PEGIN_FINGERPRINT_DOMAIN;exports.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE=t.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE;exports.PeginFingerprintInputError=t.PeginFingerprintInputError;exports.PeginParamsAmbiguousError=t.PeginParamsAmbiguousError;exports.PeginParamsIncompleteSpaceError=t.PeginParamsIncompleteSpaceError;exports.PeginParamsNotFoundError=t.PeginParamsNotFoundError;exports.PeginSizingIntegrityError=t.PeginSizingIntegrityError;exports.UnanchoredPrePeginError=t.UnanchoredPrePeginError;exports.VaultRootMismatchError=t.VaultRootMismatchError;exports.assertClaimBatchHomogeneous=t.assertClaimBatchHomogeneous;exports.buildPeginParamsCandidates=t.buildPeginParamsCandidates;exports.computeFundedPrePeginFee=t.computeFundedPrePeginFee;exports.computePeginFingerprint=t.computePeginFingerprint;exports.deriveHashlocksFromPrePegin=t.deriveHashlocksFromPrePegin;exports.describePeginParamsCandidate=t.describePeginParamsCandidate;exports.describeUnresolvedVersion=t.describeUnresolvedVersion;exports.encodePeginFingerprintPreimage=t.encodePeginFingerprintPreimage;exports.isDepositTermsRejectedError=t.isDepositTermsRejectedError;exports.isPeginFingerprintInputError=t.isPeginFingerprintInputError;exports.isWotsMismatchError=t.isWotsMismatchError;exports.orderClaimBatchByHtlcVout=t.orderClaimBatchByHtlcVout;exports.rebuildDepositTermsCore=t.rebuildDepositTermsCore;exports.rebuildDepositTermsForClaim=t.rebuildDepositTermsForClaim;exports.reconstructPeginParams=t.reconstructPeginParams;exports.selectSiblingRegistrations=t.selectSiblingRegistrations;exports.toRefundInputs=t.toRefundInputs;exports.ApplicationEntryPointMismatchError=e.ApplicationEntryPointMismatchError;exports.ArtifactsVaultMismatchError=e.ArtifactsVaultMismatchError;exports.AssertBindingError=e.AssertBindingError;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ChallengerSetMismatchError=e.ChallengerSetMismatchError;exports.DELEGATED_CLAIM_TX_GRAPH_VERSION=e.DELEGATED_CLAIM_TX_GRAPH_VERSION;exports.DelegatedClaimSigningIncompleteError=e.DelegatedClaimSigningIncompleteError;exports.GraphFingerprintError=e.GraphFingerprintError;exports.PEGIN_ETH_CONFIRMATIONS=e.PEGIN_ETH_CONFIRMATIONS;exports.ParticipantKeyDriftError=e.ParticipantKeyDriftError;exports.PayoutDestinationError=e.PayoutDestinationError;exports.PayoutInputLeafError=e.PayoutInputLeafError;exports.PeginRegistrationMissingError=e.PeginRegistrationMissingError;exports.PeginRegistrationNotFinalError=e.PeginRegistrationNotFinalError;exports.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR=e.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR;exports.RECLAIM_MAX_FEE_FRACTION_NUMERATOR=e.RECLAIM_MAX_FEE_FRACTION_NUMERATOR;exports.RECLAIM_MAX_FEE_RATE_SATS_VB=e.RECLAIM_MAX_FEE_RATE_SATS_VB;exports.RECLAIM_WARN_FEE_FRACTION_NUMERATOR=e.RECLAIM_WARN_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=e.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=e.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=e.REFUND_MAX_FEE_RATE_SATS_VB;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.ReclaimUneconomicalError=e.ReclaimUneconomicalError;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.SigningPlanMismatchError=e.SigningPlanMismatchError;exports.VaultIdBindingError=e.VaultIdBindingError;exports.activateVault=e.activateVault;exports.activateVaultAndRedeem=e.activateVaultAndRedeem;exports.assembleWatchtowerArtifacts=e.assembleWatchtowerArtifacts;exports.assembleWatchtowerArtifactsFromSignatures=e.assembleWatchtowerArtifactsFromSignatures;exports.assertArtifactsUsableForVault=e.assertArtifactsUsableForVault;exports.assertAssertBindsClaimAndPayout=e.assertAssertBindsClaimAndPayout;exports.assertChallengerSetMatchesVault=e.assertChallengerSetMatchesVault;exports.assertClaimSpendsVault=e.assertClaimSpendsVault;exports.assertPayoutPaysRegisteredScript=e.assertPayoutPaysRegisteredScript;exports.assertReturnedGraphMatchesFingerprint=e.assertReturnedGraphMatchesFingerprint;exports.assertTermsMatchVault=e.assertTermsMatchVault;exports.assertVaultProviderHintAccepted=e.assertVaultProviderHintAccepted;exports.buildAndBroadcastReclaim=e.buildAndBroadcastReclaim;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.claimExpiredVault=e.claimExpiredVault;exports.copyAssertConnectorLeaf=e.copyAssertConnectorLeaf;exports.deriveClaimerWotsKeypair=e.deriveClaimerWotsKeypair;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.fingerprintReturnedGraph=e.fingerprintReturnedGraph;exports.isApplicationEntryPointMismatchError=e.isApplicationEntryPointMismatchError;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isHintAccepted=e.isHintAccepted;exports.isParticipantKeyDriftError=e.isParticipantKeyDriftError;exports.isPeginRegistrationMissingError=e.isPeginRegistrationMissingError;exports.isPeginRegistrationNotFinalError=e.isPeginRegistrationNotFinalError;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.matchKeyHint=e.matchKeyHint;exports.matchKeySetHint=e.matchKeySetHint;exports.planDelegatedClaimSigning=e.planDelegatedClaimSigning;exports.readDelegatedClaimVaultContext=e.readDelegatedClaimVaultContext;exports.readRefundPrePeginContext=e.readRefundPrePeginContext;exports.readStampedParticipantKeys=e.readStampedParticipantKeys;exports.resolveCurrentParticipantKeys=e.resolveCurrentParticipantKeys;exports.resolveParticipantKeysAtEpochs=e.resolveParticipantKeysAtEpochs;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDelegatedClaimPlan=e.signDelegatedClaimPlan;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.summarizeWatchtowerArtifacts=e.summarizeWatchtowerArtifacts;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredParticipantKeys=e.verifyRegisteredParticipantKeys;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginRegistrationDepth=e.waitForPeginRegistrationDepth;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=p.ContractStatus;exports.PeginAction=p.PeginAction;exports.activationDeadlineBlocksRemaining=p.activationDeadlineBlocksRemaining;exports.canPerformAction=p.canPerformAction;exports.getPeginProtocolState=p.getPeginProtocolState;exports.isActivationDeadlinePassedOnChain=p.isActivationDeadlinePassedOnChain;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/tbv/index.js CHANGED
@@ -1,38 +1,38 @@
1
- import { P as s, h as r, i as t, j as i, f as o, b as n, a as l, c as p, k as E, d as P, e as c, g as u } from "../verifyScriptPathSchnorrSignature-owu3BfyT.js";
1
+ import { P as s, h as r, i as t, j as i, f as o, b as n, a as l, c as p, k as P, d as E, e as c, g as d } from "../verifyScriptPathSchnorrSignature-D-fdi-sG.js";
2
2
  import { a as g } from "../secp256k1-BuxBFUHm.js";
3
3
  import { attachFinalizedAssert as R, computeMinClaimValue as A, computeMinPeginFee as _, deriveVaultId as S, expandAuthAnchor as T, expandHashlockSecret as C, expandWotsSeed as I, finalizePayout as f, finalizeWronglyChallenged as h, peginP2aAnchorOutput as V, pinPegoutProof as O, supportedTxGraphVersions as x, validatePeginP2aAnchor as b } from "./core/wasm/index.js";
4
- import { a as N, c as M, b as y, e as v, f as D } from "../verifyKeyPathSchnorrSignature-IIj3Z2se.js";
5
- import { d as U, c as H, a as L, b as K, e as X, f as G, r as k } from "../challengeAssert-B2otuf7y.js";
4
+ import { a as N, c as M, b as y, e as v, f as D } from "../verifyKeyPathSchnorrSignature-DPXOFOol.js";
5
+ import { d as U, c as H, a as L, b as K, e as X, f as G, r as k } from "../challengeAssert-pJP7MKhG.js";
6
6
  import { c as w, d as z, a as Y, b as j, e as J, f as Z, k as q, g as Q, h as $, i as aa, j as ea, p as sa, s as ra, t as ta, u as ia, v as oa } from "../bitcoin-C-TuHb-v.js";
7
7
  import { c as la } from "../abortSignals-BPpAUL1Z.js";
8
- import { c as Ea, a as Pa } from "../signing-C1rR4tqs.js";
9
- import { B as ua, C as da, H as ga, K as ma, M as Ra, T as Aa, X as _a } from "../validation-OSC0xTHB.js";
8
+ import { c as Pa, a as Ea } from "../signing-C1rR4tqs.js";
9
+ import { B as da, C as ua, H as ga, K as ma, M as Ra, T as Aa, X as _a } from "../validation-OSC0xTHB.js";
10
10
  import { waitForTransactionReceiptSmartAware as Ta } from "./core/utils/eth/index.js";
11
- import { P as Ia, b as fa, c as ha, d as Va, e as Oa } from "../PeginManager-CQ9bVPR3.js";
12
- import { P as ba, c as Fa, f as Na, r as Ma, s as ya, v as va } from "../PayoutManager-xEGvTbhL.js";
11
+ import { P as Ia, b as fa, c as ha, d as Va, e as Oa } from "../PeginManager-Cas6_j7t.js";
12
+ import { P as ba, c as Fa, f as Na, r as Ma, s as ya, v as va } from "../PayoutManager-BUWP-H-q.js";
13
13
  import { MEMPOOL_API_URLS as Ba, MempoolNotFoundError as Ua, getAddressTxs as Ha, getAddressUtxos as La, getMempoolApiUrl as Ka, getNetworkFees as Xa, getOutspend as Ga, getTipHeight as ka, getTxHex as Wa, getTxInfo as wa, getUtxoInfo as za, pushTx as Ya } from "./core/clients/mempool/index.js";
14
- import { R as Ja, V as Za, a as qa, f as Qa, d as $a, g as ae, e as ee, i as se, r as re, v as te, b as ie, c as oe } from "../registration-records-DJJC2NiO.js";
15
- import { V as le, a as pe, b as Ee, r as Pe } from "../signer-set-reader-CSUe92zE.js";
16
- import { C as ue, M as de, V as ge, a as me, c as Re } from "../pegin-registration-client-Cvjk4ILq.js";
17
- import { O as _e, V as Se } from "../types-24A9Qoxb.js";
14
+ import { R as Ja, V as Za, a as qa, f as Qa, d as $a, g as ae, e as ee, i as se, r as re, v as te, b as ie, c as oe } from "../registration-records-D39ApuHS.js";
15
+ import { V as le, a as pe, b as Pe, r as Ee } from "../signer-set-reader-DiwLeqik.js";
16
+ import { C as de, M as ue, V as ge, a as me, c as Re } from "../pegin-registration-client-ZI0k10_3.js";
17
+ import { O as _e, V as Se } from "../types-K_aM5GZO.js";
18
18
  import { A as Ce } from "../ApplicationRegistry.abi-s8cQ1ooR.js";
19
- import { B as fe } from "../BTCVaultRegistry.abi-BzNTa_EU.js";
19
+ import { B as fe } from "../BTCVaultRegistry.abi-DnP4UkB5.js";
20
20
  import { B as Ve, C as Oe, E as xe, P as be, a as Fe, e as Ne, g as Me, h as ye, i as ve, b as De } from "../BTCVaultRegistryKeyEpochs.abi-Btg0nBz1.js";
21
- import { P as Ue } from "../ProtocolParams.abi-Cv77fsUe.js";
22
- import { V as Le } from "../VaultErrors.abi-Boz4w97c.js";
21
+ import { P as Ue } from "../ProtocolParams.abi-CuDl7AuC.js";
22
+ import { V as Le } from "../VaultErrors.abi-Dc3UnB_h.js";
23
23
  import { b as Xe } from "../buildVaultContextInputForClaim-DhBoQKyN.js";
24
24
  import { V as ke, b as We, a as we, d as ze, f as Ye } from "../deriveVaultRoot-BcvmER1E.js";
25
25
  import { p as Je } from "../parseFundingOutpoints-GSM-IaaK.js";
26
26
  import { c as qe } from "../btcTxHash-BRZ8_EZq.js";
27
27
  import { B as $e, a as as, c as es, b as ss, d as rs, g as ts, h as is, f as os, s as ns, e as ls } from "../psbtInputFields-CCVyaQMi.js";
28
- import { B as Es, D as Ps, L as cs, M as us, c as ds, P as gs, b as ms, a as Rs, S as As, T as _s, W as Ss, f as Ts, d as Cs, p as Is, r as fs } from "../fundPeginTransaction-CwhRbCQC.js";
28
+ import { B as Ps, D as Es, L as cs, M as ds, c as us, P as gs, b as ms, a as Rs, S as As, T as _s, W as Ss, f as Ts, d as Cs, p as Is, r as fs } from "../fundPeginTransaction-CwhRbCQC.js";
29
29
  import { U as Vs, a as Os, e as xs, f as bs, v as Fs } from "../reservation-BZQABu4g.js";
30
- import { V as Ms, a as ys, b as vs, i as Ds, v as Bs } from "../index-BRsWXDlv.js";
30
+ import { V as Ms, a as ys, b as vs, i as Ds, v as Bs } from "../index-B-9aXMxk.js";
31
31
  import { A as Hs, C as Ls, D as Ks, J as Xs, a as Gs, b as ks, d as Ws, P as ws, R as zs, e as Ys, c as js, V as Js, i as Zs, g as qs, f as Qs } from "../state-CFn1rT74.js";
32
- import { S as ar, V as er, c as sr, p as rr, v as tr, a as ir } from "../primeVpAuth-D4UWXQ76.js";
33
- import { D as nr, g as lr, P as pr, a as Er, b as Pr, u as cr, v as ur, t as dr, w as gr, U as mr, V as Rr, f as Ar, m as _r, j as Sr, c as Tr, l as Cr, p as Ir, n as fr, e as hr, h as Vr, d as Or, i as xr, o as br, r as Fr, k as Nr, q as Mr, s as yr, x as vr } from "../toRefundInputs-DH-1bRNY.js";
34
- import { J as Br, l as Ur, A as Hr, a8 as Lr, C as Kr, D as Xr, n as Gr, G as kr, u as Wr, W as wr, P as zr, j as Yr, v as jr, w as Jr, ah as Zr, ai as qr, aj as Qr, ak as $r, ab as at, ac as et, ad as st, ae as rt, af as tt, Z as it, S as ot, V as nt, a as lt, b as pt, d as Et, e as Pt, m as ct, f as ut, g as dt, t as gt, i as mt, B as Rt, o as At, a1 as _t, ag as St, a9 as Tt, c as Ct, k as It, h as ft, aa as ht, E as Vt, K as Ot, M as xt, a2 as bt, X as Ft, x as Nt, y as Mt, _ as yt, a3 as vt, a4 as Dt, p as Bt, r as Ut, a5 as Ht, a6 as Lt, a7 as Kt, F as Xt, q as Gt, H as kt, I as Wt, s as wt, N as zt, O as Yt, L as jt, Q as Jt, R as Zt, T as qt, U as Qt, Y as $t, $ as ai, z as ei, a0 as si } from "../buildAndBroadcastReclaim-CQANDXVJ.js";
35
- import { C as ti, P as ii, a as oi, c as ni, g as li, i as pi } from "../peginState-CIibG9S_.js";
32
+ import { S as ar, V as er, c as sr, p as rr, v as tr, a as ir } from "../primeVpAuth-C-ET0XF4.js";
33
+ import { D as nr, g as lr, P as pr, a as Pr, b as Er, u as cr, v as dr, t as ur, w as gr, U as mr, V as Rr, f as Ar, m as _r, j as Sr, c as Tr, l as Cr, p as Ir, n as fr, e as hr, h as Vr, d as Or, i as xr, o as br, r as Fr, k as Nr, q as Mr, s as yr, x as vr } from "../toRefundInputs-BbbvPb2A.js";
34
+ import { J as Br, l as Ur, A as Hr, a8 as Lr, C as Kr, D as Xr, n as Gr, G as kr, u as Wr, W as wr, P as zr, j as Yr, v as jr, w as Jr, ai as Zr, aj as qr, ak as Qr, al as $r, ab as at, ac as et, ad as st, ae as rt, ag as tt, Z as it, S as ot, V as nt, a as lt, b as pt, d as Pt, e as Et, m as ct, f as dt, g as ut, t as gt, i as mt, B as Rt, o as At, a1 as _t, ah as St, a9 as Tt, c as Ct, k as It, h as ft, aa as ht, E as Vt, K as Ot, M as xt, a2 as bt, X as Ft, x as Nt, y as Mt, _ as yt, a3 as vt, a4 as Dt, p as Bt, r as Ut, af as Ht, a5 as Lt, a6 as Kt, a7 as Xt, F as Gt, q as kt, H as Wt, I as wt, s as zt, N as Yt, O as jt, L as Jt, Q as Zt, R as qt, T as Qt, U as $t, Y as ai, $ as ei, z as si, a0 as ri } from "../buildAndBroadcastReclaim-ByXYSUwj.js";
35
+ import { C as ii, P as oi, a as ni, c as li, g as pi, i as Pi } from "../peginState-CIibG9S_.js";
36
36
  export {
37
37
  Hs as AUTH_REJECTED_RPC_CODE,
38
38
  Br as ApplicationEntryPointMismatchError,
@@ -40,20 +40,20 @@ export {
40
40
  Ur as ArtifactsVaultMismatchError,
41
41
  Hr as AssertBindingError,
42
42
  Lr as BIP68NotMatureError,
43
- ua as BITCOIN_ADDRESS_RE,
43
+ da as BITCOIN_ADDRESS_RE,
44
44
  fe as BTCVaultRegistryABI,
45
45
  Ve as BTCVaultRegistryKeyEpochsABI,
46
- Es as BTC_DUST_SAT,
46
+ Ps as BTC_DUST_SAT,
47
47
  $e as BitcoinScriptType,
48
- ue as COMMISSION_BPS_HEADROOM,
49
- da as COMPRESSED_PUBKEY_HEX_LEN,
48
+ de as COMMISSION_BPS_HEADROOM,
49
+ ua as COMPRESSED_PUBKEY_HEX_LEN,
50
50
  Oe as CONTRACT_ERRORS,
51
51
  Kr as ChallengerSetMismatchError,
52
52
  Ls as ClaimerPegoutStatusValue,
53
- ti as ContractStatus,
53
+ ii as ContractStatus,
54
54
  Xr as DELEGATED_CLAIM_TX_GRAPH_VERSION,
55
55
  nr as DEPOSIT_TERMS_REJECTED_ERROR_NAME,
56
- Ps as DUST_THRESHOLD,
56
+ Es as DUST_THRESHOLD,
57
57
  Ks as DaemonStatus,
58
58
  Gr as DelegatedClaimSigningIncompleteError,
59
59
  lr as DepositTermsRejectedError,
@@ -65,10 +65,10 @@ export {
65
65
  ks as JsonRpcError,
66
66
  ma as KNOWN_SCRIPT_PREFIXES,
67
67
  cs as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
68
- de as MAX_ACCEPTABLE_COMMISSION_BPS_CAP,
69
- us as MAX_NON_LEGACY_OUTPUT_SIZE,
68
+ ue as MAX_ACCEPTABLE_COMMISSION_BPS_CAP,
69
+ ds as MAX_NON_LEGACY_OUTPUT_SIZE,
70
70
  Ra as MAX_REASONABLE_FEE_SATS,
71
- ds as MAX_REASONABLE_PEGIN_VBYTES,
71
+ us as MAX_REASONABLE_PEGIN_VBYTES,
72
72
  Ba as MEMPOOL_API_URLS,
73
73
  Ua as MempoolNotFoundError,
74
74
  _e as OnChainBtcVaultStatus,
@@ -78,7 +78,7 @@ export {
78
78
  Wr as PEGIN_ETH_CONFIRMATIONS,
79
79
  be as PEGIN_FINGERPRINT_CHANGED_SELECTOR,
80
80
  pr as PEGIN_FINGERPRINT_DOMAIN,
81
- Er as PEGIN_FINGERPRINT_DOMAIN_PREIMAGE,
81
+ Pr as PEGIN_FINGERPRINT_DOMAIN_PREIMAGE,
82
82
  Rs as PEGIN_FIXED_OUTPUTS,
83
83
  Ws as POST_WOTS_STATUSES,
84
84
  ws as PRE_DEPOSITOR_SIGNATURES_STATES,
@@ -86,13 +86,13 @@ export {
86
86
  zr as PayoutDestinationError,
87
87
  Yr as PayoutInputLeafError,
88
88
  ba as PayoutManager,
89
- ii as PeginAction,
89
+ oi as PeginAction,
90
90
  Fe as PeginFingerprintChangedError,
91
- Pr as PeginFingerprintInputError,
91
+ Er as PeginFingerprintInputError,
92
92
  Ia as PeginManager,
93
93
  cr as PeginParamsAmbiguousError,
94
- ur as PeginParamsIncompleteSpaceError,
95
- dr as PeginParamsNotFoundError,
94
+ dr as PeginParamsIncompleteSpaceError,
95
+ ur as PeginParamsNotFoundError,
96
96
  jr as PeginRegistrationMissingError,
97
97
  Jr as PeginRegistrationNotFinalError,
98
98
  gr as PeginSizingIntegrityError,
@@ -130,7 +130,7 @@ export {
130
130
  ge as ViemPeginRegistrationClient,
131
131
  Se as ViemProtocolParamsReader,
132
132
  pe as ViemUniversalChallengerReader,
133
- Ee as ViemVaultKeeperReader,
133
+ Pe as ViemVaultKeeperReader,
134
134
  me as ViemVaultRegistryReader,
135
135
  ys as VpResponseValidationError,
136
136
  er as VpTokenRegistry,
@@ -138,13 +138,13 @@ export {
138
138
  _a as X_ONLY_PUBKEY_HEX_LEN,
139
139
  lt as activateVault,
140
140
  pt as activateVaultAndRedeem,
141
- oi as activationDeadlineBlocksRemaining,
141
+ ni as activationDeadlineBlocksRemaining,
142
142
  as as applyChangeOutputPolicy,
143
- Et as assembleWatchtowerArtifacts,
144
- Pt as assembleWatchtowerArtifactsFromSignatures,
143
+ Pt as assembleWatchtowerArtifacts,
144
+ Et as assembleWatchtowerArtifactsFromSignatures,
145
145
  ct as assertArtifactsUsableForVault,
146
- ut as assertAssertBindsClaimAndPayout,
147
- dt as assertChallengerSetMatchesVault,
146
+ dt as assertAssertBindsClaimAndPayout,
147
+ ut as assertChallengerSetMatchesVault,
148
148
  Ar as assertClaimBatchHomogeneous,
149
149
  gt as assertClaimSpendsVault,
150
150
  N as assertKeyPathSchnorrSignature,
@@ -177,7 +177,7 @@ export {
177
177
  we as buildVaultContext,
178
178
  Xe as buildVaultContextInputForClaim,
179
179
  qe as calculateBtcTxHash,
180
- ni as canPerformAction,
180
+ li as canPerformAction,
181
181
  w as canonicalizeBtcPubkey,
182
182
  Re as capMaxAcceptableCommissionBps,
183
183
  Ct as claimExpiredVault,
@@ -194,12 +194,12 @@ export {
194
194
  ha as computeWotsBlockPublicKeysHash,
195
195
  It as copyAssertConnectorLeaf,
196
196
  sr as createAuthenticatedVpClient,
197
- E as createPayoutScript,
198
- Ea as createTaprootScriptPathSignOptions,
199
- Pa as createTaprootScriptPathSignOptionsForInput,
197
+ P as createPayoutScript,
198
+ Pa as createTaprootScriptPathSignOptions,
199
+ Ea as createTaprootScriptPathSignOptionsForInput,
200
200
  z as deriveBip86ScriptPubKeyHex,
201
201
  ft as deriveClaimerWotsKeypair,
202
- P as deriveDepositorClaimDescriptor,
202
+ E as deriveDepositorClaimDescriptor,
203
203
  c as deriveDepositorClaimScriptPubKey,
204
204
  Cr as deriveHashlocksFromPrePegin,
205
205
  Y as deriveNativeSegwitAddress,
@@ -220,7 +220,7 @@ export {
220
220
  I as expandWotsSeed,
221
221
  Ne as extractErrorData,
222
222
  xs as extractInputsFromTransaction,
223
- u as extractPayoutSignature,
223
+ d as extractPayoutSignature,
224
224
  v as extractPeginInputSignature,
225
225
  f as finalizePayout,
226
226
  D as finalizePeginInputPsbt,
@@ -241,7 +241,7 @@ export {
241
241
  q as getNetwork,
242
242
  Xa as getNetworkFees,
243
243
  Ga as getOutspend,
244
- li as getPeginProtocolState,
244
+ pi as getPeginProtocolState,
245
245
  is as getPsbtInputFields,
246
246
  os as getScriptType,
247
247
  Q as getSortedXOnlyPubkeys,
@@ -251,7 +251,7 @@ export {
251
251
  za as getUtxoInfo,
252
252
  ye as handleContractError,
253
253
  $ as hexToUint8Array,
254
- pi as isActivationDeadlinePassedOnChain,
254
+ Pi as isActivationDeadlinePassedOnChain,
255
255
  aa as isAddressFromPublicKey,
256
256
  Ot as isApplicationEntryPointMismatchError,
257
257
  Zs as isAuthRejectedError,
@@ -286,51 +286,52 @@ export {
286
286
  Ya as pushTx,
287
287
  fs as rateBasedTxBufferFee,
288
288
  Ut as readDelegatedClaimVaultContext,
289
- Ht as readStampedParticipantKeys,
289
+ Ht as readRefundPrePeginContext,
290
+ Lt as readStampedParticipantKeys,
290
291
  Fr as rebuildDepositTermsCore,
291
292
  Nr as rebuildDepositTermsForClaim,
292
293
  k as reclaimVsize,
293
294
  Mr as reconstructPeginParams,
294
295
  re as registrationPrePeginTxHash,
295
296
  Ma as requireChangeAddress,
296
- Lt as resolveCurrentParticipantKeys,
297
- Kt as resolveParticipantKeysAtEpochs,
298
- Pe as resolveProtocolAddresses,
299
- Xt as runDepositorPresignFlow,
297
+ Kt as resolveCurrentParticipantKeys,
298
+ Xt as resolveParticipantKeysAtEpochs,
299
+ Ee as resolveProtocolAddresses,
300
+ Gt as runDepositorPresignFlow,
300
301
  yr as selectSiblingRegistrations,
301
302
  ns as selectUtxosForPegin,
302
303
  ls as shouldAddChangeOutput,
303
- Gt as signDelegatedClaimPlan,
304
- kt as signDepositorGraph,
304
+ kt as signDelegatedClaimPlan,
305
+ Wt as signDepositorGraph,
305
306
  ra as stripHexPrefix,
306
- Wt as submitWotsPublicKey,
307
- wt as summarizeWatchtowerArtifacts,
307
+ wt as submitWotsPublicKey,
308
+ zt as summarizeWatchtowerArtifacts,
308
309
  x as supportedTxGraphVersions,
309
310
  ya as supportsDepositApproval,
310
311
  vr as toRefundInputs,
311
312
  ta as toXOnly,
312
313
  ia as uint8ArrayToHex,
313
- zt as validateDepositAmount,
314
- Yt as validateMultiVaultDepositInputs,
314
+ Yt as validateDepositAmount,
315
+ jt as validateMultiVaultDepositInputs,
315
316
  te as validateOffchainParams,
316
- jt as validateOnChainParticipantKeys,
317
+ Jt as validateOnChainParticipantKeys,
317
318
  ie as validatePegInConfiguration,
318
319
  b as validatePeginP2aAnchor,
319
- Jt as validateProviderSelection,
320
- Zt as validateRemainingCapacity,
320
+ Zt as validateProviderSelection,
321
+ qt as validateRemainingCapacity,
321
322
  Bs as validateRequestDepositorClaimerArtifactsResponse,
322
323
  va as validateSecretAgainstHashlock,
323
324
  oe as validateTBVProtocolParams,
324
325
  Fs as validateUtxosAvailable,
325
- qt as validateVaultAmounts,
326
- Qt as validateVaultProviderPubkey,
326
+ Qt as validateVaultAmounts,
327
+ $t as validateVaultProviderPubkey,
327
328
  oa as validateWalletPubkey,
328
- $t as verifyRegisteredParticipantKeys,
329
- ai as verifyRegisteredVaultVersions,
329
+ ai as verifyRegisteredParticipantKeys,
330
+ ei as verifyRegisteredVaultVersions,
330
331
  tr as verifyServerIdentity,
331
332
  ir as vpTokenRegistry,
332
- ei as waitForPeginRegistrationDepth,
333
- si as waitForPeginStatus,
333
+ si as waitForPeginRegistrationDepth,
334
+ ri as waitForPeginStatus,
334
335
  Ta as waitForTransactionReceiptSmartAware
335
336
  };
336
337
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ "use strict";var Pe=Object.defineProperty;var fe=(e,t,r)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var j=(e,t,r)=>fe(e,typeof t!="symbol"?t+"":t,r);const M=require("./registration-records-CKc0OVuK.cjs"),d=require("./bitcoin-D-O2GjbC.cjs"),N=require("./btcTxHash-CGb5BqFL.cjs"),O=require("bitcoinjs-lib"),ve=require("buffer"),be=require("./tbv/core/clients/mempool/index.cjs"),X=require("./validation-C6XTfZak.cjs"),y=require("viem"),Ee=require("./sha2-Ce6KewYx.cjs"),D=require("./PayoutManager-Dopxq_Jv.cjs"),ee=require("./PeginManager-CMbRRTnr.cjs"),b=require("./tbv/core/wasm/index.cjs"),xe=require("./deriveVaultRoot-C3uqnJto.cjs"),we=require("./parseFundingOutpoints-C_-PT9BT.cjs"),K=require("./verifyScriptPathSchnorrSignature-CgDa9Rcg.cjs"),Q=require("./fundPeginTransaction-54-Rwb2k.cjs"),ye=["vaultCoreVersion","offchainParamsVersion","appVaultKeepersVersion","universalChallengersVersion"],Ce=["applicationEntryPoint","vaultProvider"];function te(e,t){const r=t.depositor.toLowerCase(),n=M.registrationPrePeginTxHash(t).toLowerCase();return e.filter(o=>o.vaultId!==t.vaultId&&o.depositor.toLowerCase()===r&&M.registrationPrePeginTxHash(o).toLowerCase()===n)}function re(e,t){for(const r of t){for(const n of ye)if(r.vault.protocol[n]!==e.vault.protocol[n])throw new Error(`Sibling vaults of this Pre-PegIn disagree on ${n} (${r.vault.protocol[n]} vs ${e.vault.protocol[n]}); the batch cannot be described by one set of deposit terms.`);if(r.maxAcceptableCommissionBps!==e.maxAcceptableCommissionBps)throw new Error(`Sibling vaults of this Pre-PegIn disagree on maxAcceptableCommissionBps (${r.maxAcceptableCommissionBps} vs ${e.maxAcceptableCommissionBps}); the batch cannot be described by one set of deposit terms.`);for(const n of Ce)if(r.vault.basic[n].toLowerCase()!==e.vault.basic[n].toLowerCase())throw new Error(`Sibling vaults of this Pre-PegIn disagree on ${n} (${r.vault.basic[n]} vs ${e.vault.basic[n]}); the batch cannot be described by one set of deposit terms.`)}}function ne(e){const t=[...e].sort((r,n)=>r.vault.protocol.htlcVout-n.vault.protocol.htlcVout);return t.forEach((r,n)=>{if(r.vault.protocol.htlcVout!==n)throw new Error(`Sibling discovery produced a non-contiguous HTLC vector (${t.map(o=>o.vault.protocol.htlcVout).join(", ")}).`)}),t.map(r=>({hashlock:r.vault.protocol.hashlock,amount:r.vault.basic.amount}))}const L="DepositTermsRejectedError";class oe extends Error{constructor(r,n="device-envelope"){super(r);j(this,"reason");this.name=L,this.reason=n}}function Re(e){if(e instanceof oe)return!0;if(typeof e!="object"||e===null)return!1;const t=e;return t.name===L&&t.reason==="device-envelope"}async function se(e,t){const r=O.Transaction.fromHex(d.stripHexPrefix(e)),o=(await Promise.all(r.ins.map(a=>be.getUtxoInfo(ve.Buffer.from(a.hash).reverse().toString("hex"),a.index,t)))).reduce((a,i)=>a+BigInt(i.value),0n),c=r.outs.reduce((a,i)=>a+BigInt(i.value),0n),s=o-c;if(s<=0n)throw new Error(`The funded Pre-PegIn transaction's inputs do not cover its outputs plus a fee (computed fee: ${s} sats).`);if(s>X.MAX_REASONABLE_FEE_SATS)throw new Error(`The funded Pre-PegIn transaction's computed fee (${s} sats) exceeds the maximum reasonable fee (${X.MAX_REASONABLE_FEE_SATS} sats); the mempool API may have returned manipulated prevout data.`);return s}async function z(e){const t=e.siblings.length;if(t===0)throw new Error("rebuildDepositTermsCore: at least one sibling is required");for(const[m,p]of e.siblings.entries())if(p.amount<=0n)throw new Error(`rebuildDepositTermsCore: sibling[${m}] has non-positive on-chain pegin amount ${p.amount}; the chain-read vault record is invalid. Resume refused.`);if(e.prepeginMaxFee<=0n)throw new Error(`rebuildDepositTermsCore: prepeginMaxFee must be > 0, got ${e.prepeginMaxFee}`);const r=d.stripHexPrefix(e.prepeginTxid).toLowerCase(),n=d.stripHexPrefix(N.calculateBtcTxHash(e.fundedPrePeginTxHex)).toLowerCase();if(n!==r)throw new Error(`Funded Pre-PegIn tx hashes to ${n}, expected ${r} (on-chain prepeginTxid). Resume refused.`);const o=D.findAuthAnchorOpReturn(d.stripHexPrefix(e.fundedPrePeginTxHex));if(o===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(o.vout!==t)throw new Error(`Auth-anchor OP_RETURN at vout ${o.vout} does not match the discovered sibling count ${t}; the discovered sibling set does not cover this transaction's HTLC outputs (a lagging index can cause this — retry later). Resume refused.`);const c=e.vaultKeeperBtcPubkeys.length,s=e.universalChallengerBtcPubkeys.length,a=await b.computeMinClaimValue(e.vaultCoreVersion,c,s,e.councilQuorum,e.councilSize,e.protocolFeeRate),i=await b.computeMinPeginFee(e.vaultCoreVersion,c,s,e.minPeginFeeRate),{value:l}=await b.peginP2aAnchorOutput(e.vaultCoreVersion);if(a<=0n)throw new Error(`WASM returned non-positive depositorClaimValue ${a}; expected > 0. Resume refused.`);if(i<=0n)throw new Error(`WASM returned non-positive peginMaxFee ${i}; expected > 0. Resume refused.`);if(l<0n)throw new Error(`WASM returned negative P2A anchor value ${l}. Resume refused.`);const u=i+l,h=e.minPeginFeeRate*Q.MAX_REASONABLE_PEGIN_VBYTES;if(u<=0n||u>h)throw new Error(`WASM implied PegIn reserve ${u} sat is outside (0, ${h}] (minPeginFeeRate=${e.minPeginFeeRate} × ${Q.MAX_REASONABLE_PEGIN_VBYTES} vbytes). Resume refused.`);const x=e.siblings.map(m=>m.amount+a+i+l),w=await Promise.all(e.siblings.map(async m=>(await b.getPrePeginHtlcConnectorInfo({txGraphVersion:e.vaultCoreVersion,depositorPubkey:e.depositorBtcPubkey,vaultProviderPubkey:e.vaultProviderBtcPubkey,vaultKeeperPubkeys:[...e.vaultKeeperBtcPubkeys],universalChallengerPubkeys:[...e.universalChallengerBtcPubkeys],hashlock:d.stripHexPrefix(m.hashlock),timelockRefund:e.timelockRefund,network:e.network})).scriptPubKey)),C=O.Transaction.fromHex(d.stripHexPrefix(e.fundedPrePeginTxHex)).outs.map(m=>({value:m.value,script:m.script}));return K.assertEncodedHtlcOutputsMatch(C,x,w),ee.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(m=>m.amount),depositorClaimValue:a,peginMaxFee:i})}async function ke(e){const{read:t}=e,r=d.canonicalizeBtcPubkey(e.depositorBtcPubkey);if(r!==t.context.depositorBtcPubkey)throw new Error("Connected wallet key is not the vault's depositor key; select the account that made the deposit.");const n=d.stripHexPrefix(t.prePeginTxHash).toLowerCase(),o=d.stripHexPrefix(N.calculateBtcTxHash(e.fundedPrePeginTxHex)).toLowerCase();if(o!==n)throw new Error(`Funded Pre-PegIn tx hashes to ${o}, expected ${n} (on-chain prePeginTxHash).`);const c=await Promise.all(te(t.registrationRecords,t.registrationRecord).map(async l=>{const u=await e.siblingReader.getVaultData(l.vaultId);if(u.protocol.prePeginTxHash.toLowerCase()!==M.registrationPrePeginTxHash(l).toLowerCase())throw new Error(`Sibling ${l.vaultId} is registered against a different Pre-PegIn on chain than its registration log records; refusing an inconsistent node.`);return{vault:u,maxAcceptableCommissionBps:l.maxAcceptableCommissionBps}})),s={vault:t.vault,maxAcceptableCommissionBps:t.registrationRecord.maxAcceptableCommissionBps};re(s,c);const a=ne([s,...c]),i=await se(e.fundedPrePeginTxHex,e.mempoolApiUrl);return z({vaultCoreVersion:t.vault.protocol.vaultCoreVersion,siblings:a,fundedPrePeginTxHex:e.fundedPrePeginTxHex,depositorBtcPubkey:r,vaultProviderBtcPubkey:t.participantKeys.vaultProvider.operationBtcPubkey,vaultKeeperBtcPubkeys:t.participantKeys.vaultKeeperOperationKeysSorted,universalChallengerBtcPubkeys:t.participantKeys.universalChallengerOperationKeysSorted,protocolFeeRate:t.offchainParams.feeRate,minPeginFeeRate:t.offchainParams.minPeginFeeRate,councilQuorum:t.offchainParams.councilQuorum,councilSize:t.offchainParams.securityCouncilKeys.length,timelockPegin:t.context.timelockPegin,timelockAssert:t.context.timelockAssert,timelockRefund:t.offchainParams.tRefund,prepeginTxid:n,prepeginMaxFee:i,maxAcceptableCommissionBps:t.registrationRecord.maxAcceptableCommissionBps,network:e.network})}function Te(e){const t=(e instanceof Error?e.message:typeof e=="string"?e:"").toLowerCase();return t.includes("wots")&&t.includes("hash")&&t.includes("does not match")}const ie="TBV.PeginFingerprint.v1",ae=y.keccak256(y.toHex(ie)),W=65535,J=2n**64n-1n,Ae=2n**256n-1n,Ve=/^0x[0-9a-fA-F]{64}$/,Y=1;class f extends Error{constructor(t){super(t),this.name="PeginFingerprintInputError"}}function Ie(e){return e instanceof f||e instanceof Error&&e.name==="PeginFingerprintInputError"}function _(e,t,r,n){if(typeof t!="bigint")throw new f(`${e} must be a bigint (Solidity ${n}), got ${typeof t}`);if(t<0n||t>r)throw new f(`${e} must fit Solidity ${n} (0..${r}), got ${t}`)}function I(e,t){if(!Number.isInteger(t)||t<0||t>W)throw new f(`${e} must be an integer fitting Solidity uint16 (0..${W}), got ${t}`)}function $e(e,t){if(!Ve.test(t))throw new f(`${e} must be 32 bytes as 0x-prefixed hex (66 characters), got "${t}"`);return t.toLowerCase()}function Be(e){if(!y.isAddress(e,{strict:!1}))throw new f(`registryAddress must be a 20-byte 0x-prefixed address, got "${e}"`);const t=e.toLowerCase();if(t===y.zeroAddress)throw new f("registryAddress must not be the zero address; a zero here means the registry address was never resolved");return t}const Fe=[{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 ce(e){if(_("chainId",e.chainId,Ae,"uint256"),e.chainId===0n)throw new f("chainId must not be 0; a zero here means the chain id was never resolved");const t=Be(e.registryAddress),r=$e("vaultProviderBtcKey",e.vaultProviderBtcKey);if(_("appKeeperKeyEpoch",e.appKeeperKeyEpoch,J,"uint64"),_("ucKeyEpoch",e.ucKeyEpoch,J,"uint64"),I("appVaultKeepersVersion",e.appVaultKeepersVersion),I("universalChallengersVersion",e.universalChallengersVersion),I("offchainParamsVersion",e.offchainParamsVersion),I("vaultCoreVersion",e.vaultCoreVersion),e.vaultCoreVersion<Y)throw new f(`vaultCoreVersion must be at least ${Y}; ${e.vaultCoreVersion} means the version was never resolved`);return y.encodeAbiParameters(Fe,[ae,e.chainId,t,r,e.appKeeperKeyEpoch,e.ucKeyEpoch,e.appVaultKeepersVersion,e.universalChallengersVersion,e.offchainParamsVersion,e.vaultCoreVersion])}function Se(e){return y.keccak256(ce(e))}class ue extends Error{constructor(t,r){super(`Re-derived vault root does not match this Pre-PegIn: derived auth-anchor hash ${t}, transaction commits to ${r}. Connect the same wallet, on the same account and the same network, that created the deposit.`),this.derivedAuthAnchorHash=t,this.onChainAuthAnchorHash=r,this.name="VaultRootMismatchError"}}class B extends Error{constructor(t){super(t),this.name="UnanchoredPrePeginError"}}class le extends Error{constructor(t,r,n=[]){super(`No candidate parameter set reproduces this Pre-PegIn's HTLC outputs (${t} candidate(s) tried). `+(n.length>0?`${n.length} version(s) could not be resolved and may hold the answer: ${n.join(" | ")}. `:"")+`Sample rejections: ${r.join(" | ")}`),this.candidatesTried=t,this.sampleRejections=r,this.unresolvedLabels=n,this.name="PeginParamsNotFoundError"}}class he extends Error{constructor(t){super(`${t.length} candidate parameter sets reproduce this Pre-PegIn's HTLC outputs, so the vault's stamped versions cannot be determined: ${t.join(" | ")}. Reconstruction refused.`),this.survivorLabels=t,this.name="PeginParamsAmbiguousError"}}class de extends Error{constructor(t,r){super(`A candidate matched this Pre-PegIn (${t}), but ${r.length} version(s) could not be resolved, so the search space did not provably contain the true parameters: ${r.join(" | ")}. A version sharing the matched timelockRefund and participants is indistinguishable from the true one, so the match cannot be trusted. Reconstruction refused.`),this.matchedLabel=t,this.unresolvedLabels=r,this.name="PeginParamsIncompleteSpaceError"}}class A extends Error{constructor(t){super(`${t}. Reconstruction refused.`),this.name="PeginSizingIntegrityError"}}async function He(e){const{wallet:t,depositorBtcPubkey:r,fundedPrePeginTxHex:n}=e,o=d.stripHexPrefix(n),c=D.findAuthAnchorOpReturn(o);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 s=c.vout;if(s===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 a=we.parseFundingOutpointsFromTx(o),i=await xe.deriveVaultRoot(t,{depositorBtcPubkey:d.hexToUint8Array(d.processPublicKeyToXOnly(r)),fundingOutpoints:a});try{const u=await b.expandAuthAnchor(i);let h;try{h=d.uint8ArrayToHex(Ee.sha256(u))}finally{u.fill(0)}if(h!==c.hash)throw new ue(h,c.hash)}catch(u){throw i.fill(0),u}const{hashlocks:l}=await ee.expandPerVaultSecrets(i,s);return{vaultCount:s,hashlocks:l,authAnchorHash:c.hash}}function _e(e){const{vaultCoreVersion:t,offchainParams:r,participantKeySets:n}=e;if(!Number.isInteger(t)||t<1)throw new Error(`buildPeginParamsCandidates: vaultCoreVersion must be a positive integer, got ${t}`);if(r.length===0)throw new Error("buildPeginParamsCandidates: at least one offchain-params version is required");if(n.length===0)throw new Error("buildPeginParamsCandidates: at least one participant key set is required");const o=[];for(const c of r)for(const s of n)o.push({vaultCoreVersion:t,offchainParams:c,participants:s});return o}function pe(e){return`${e.axis} v${e.version} (${e.reason})`}function $(e){const{participants:t}=e;return`core=${e.vaultCoreVersion} offchain=${e.offchainParams.version} keepers=${t.appVaultKeepersVersion} challengers=${t.universalChallengersVersion} vp=${t.vaultProvider}`}const Z=5;function Me(e,t){return JSON.stringify({terms:e,peginAmounts:t},(r,n)=>typeof n=="bigint"?`${n}`:n)}function Ke(e){const{offchainParams:t,participants:r}=e;return[e.vaultCoreVersion,r.vaultKeeperBtcPubkeys.length,r.universalChallengerBtcPubkeys.length,t.councilQuorum,t.councilSize,t.protocolFeeRate,t.minPeginFeeRate].join("|")}async function Ne(e){const{offchainParams:t,participants:r}=e,n=r.vaultKeeperBtcPubkeys.length,o=r.universalChallengerBtcPubkeys.length,[c,s,a]=await Promise.all([b.computeMinClaimValue(e.vaultCoreVersion,n,o,t.councilQuorum,t.councilSize,t.protocolFeeRate),b.computeMinPeginFee(e.vaultCoreVersion,n,o,t.minPeginFeeRate),b.peginP2aAnchorOutput(e.vaultCoreVersion)]),i=a.value;if(c<=0n)throw new A(`WASM returned non-positive depositorClaimValue ${c} for graph version ${e.vaultCoreVersion}`);if(s<=0n)throw new A(`WASM returned non-positive peginMaxFee ${s} for graph version ${e.vaultCoreVersion}`);if(i<0n)throw new A(`WASM returned negative P2A anchor value ${i} for graph version ${e.vaultCoreVersion}`);return{depositorClaimValue:c,peginMaxFee:s,p2aAnchorValue:i}}async function Oe(e){const{hashlocks:t,fundedPrePeginTxHex:r,depositorBtcPubkey:n,prepeginMaxFee:o,maxAcceptableCommissionBps:c,network:s,candidates:a,unresolvedVersions:i}=e;if(t.length===0)throw new Error("reconstructPeginParams: at least one hashlock is required");if(a.length===0)throw new Error("reconstructPeginParams: candidate space is empty");const l=d.processPublicKeyToXOnly(n),u=d.stripHexPrefix(r),h=D.findAuthAnchorOpReturn(u);if(h===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(h.vout!==t.length)throw new Error(`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.`);const x=O.Transaction.fromHex(u).outs,w=t.map((g,P)=>BigInt(x[P].value)),C=d.stripHexPrefix(N.calculateBtcTxHash(u)).toLowerCase(),m=new Map,p=[],F=[],S=[];let U=0;for(const g of a)try{const P=Ke(g);let v=m.get(P);v===void 0&&(v=await Ne(g),m.set(P,v));const R=v.depositorClaimValue+v.peginMaxFee+v.p2aAnchorValue,k=w.map(T=>T-R),V=k.findIndex(T=>T<=0n);if(V!==-1)throw new K.HtlcOutputMismatchError(`HTLC output[${V}] value ${w[V]} is not above this candidate's reserve ${R}, so it implies a non-positive pegin amount ${k[V]}.`);const{offchainParams:E,participants:H}=g,G=await z({vaultCoreVersion:g.vaultCoreVersion,siblings:t.map((T,ge)=>({hashlock:T,amount:k[ge]})),fundedPrePeginTxHex:u,depositorBtcPubkey:l,vaultProviderBtcPubkey:H.vaultProviderBtcPubkey,vaultKeeperBtcPubkeys:H.vaultKeeperBtcPubkeys,universalChallengerBtcPubkeys:H.universalChallengerBtcPubkeys,protocolFeeRate:E.protocolFeeRate,minPeginFeeRate:E.minPeginFeeRate,councilQuorum:E.councilQuorum,councilSize:E.councilSize,timelockPegin:E.timelockPegin,timelockAssert:E.timelockAssert,timelockRefund:E.timelockRefund,prepeginTxid:C,prepeginMaxFee:o,maxAcceptableCommissionBps:c,network:s});p.push({candidate:g,terms:G,peginAmounts:k,fingerprint:Me(G,k)})}catch(P){if(P instanceof A)throw P;const v=$(g),R=P instanceof Error?P.message:String(P);P instanceof K.HtlcOutputMismatchError?F.length<Z&&F.push(`[${v}] ${R}`):(U++,S.length<Z&&S.push(`${v} (${R})`))}const me=i.length+U,q=[...i.map(pe),...S];if(p.length===0)throw new le(a.length,F,q);if(new Set(p.map(g=>g.fingerprint)).size>1)throw new he(p.map(g=>$(g.candidate)));if(me>0)throw new de($(p[0].candidate),q);return{candidate:p[0].candidate,terms:p[0].terms,peginAmounts:p[0].peginAmounts,authAnchorHash:h.hash,candidatesTried:a.length,matchedCandidates:p.map(g=>g.candidate)}}function De(e,t){const{htlcVout:r,depositorBtcPubkey:n,applicationEntryPoint:o,fundedPrePeginTxHex:c,hashlocks:s,network:a}=t,{candidate:i,peginAmounts:l}=e,{offchainParams:u,participants:h}=i;if(s.length!==l.length)throw new Error(`toRefundInputs: ${s.length} hashlock(s) but ${l.length} reconstructed amount(s); the reconstruction and the hashlock vector describe different transactions.`);if(!Number.isInteger(r)||r<0||r>=l.length)throw new Error(`toRefundInputs: htlcVout ${r} is outside the reconstructed batch of ${l.length} vault(s).`);const x=l.map((m,p)=>({hashlock:d.ensureHexPrefix(s[p]),amount:m,htlcVout:p})),w={vaultCoreVersion:i.vaultCoreVersion,hashlock:x[r].hashlock,htlcVout:r,offchainParamsVersion:u.version,appVaultKeepersVersion:h.appVaultKeepersVersion,universalChallengersVersion:h.universalChallengersVersion,vaultProvider:h.vaultProvider,applicationEntryPoint:o,amount:l[r],unsignedPrePeginTxHex:c,depositorBtcPubkey:n,batch:x},C={vaultProviderPubkey:h.vaultProviderBtcPubkey,vaultKeeperPubkeys:h.vaultKeeperBtcPubkeys,universalChallengerPubkeys:h.universalChallengerBtcPubkeys,timelockRefund:u.timelockRefund,feeRate:u.protocolFeeRate,minPeginFeeRate:u.minPeginFeeRate,numLocalChallengers:h.vaultKeeperBtcPubkeys.length,councilQuorum:u.councilQuorum,councilSize:u.councilSize,network:a};return{vault:w,context:C}}exports.DEPOSIT_TERMS_REJECTED_ERROR_NAME=L;exports.DepositTermsRejectedError=oe;exports.PEGIN_FINGERPRINT_DOMAIN=ae;exports.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE=ie;exports.PeginFingerprintInputError=f;exports.PeginParamsAmbiguousError=he;exports.PeginParamsIncompleteSpaceError=de;exports.PeginParamsNotFoundError=le;exports.PeginSizingIntegrityError=A;exports.UnanchoredPrePeginError=B;exports.VaultRootMismatchError=ue;exports.assertClaimBatchHomogeneous=re;exports.buildPeginParamsCandidates=_e;exports.computeFundedPrePeginFee=se;exports.computePeginFingerprint=Se;exports.deriveHashlocksFromPrePegin=He;exports.describePeginParamsCandidate=$;exports.describeUnresolvedVersion=pe;exports.encodePeginFingerprintPreimage=ce;exports.isDepositTermsRejectedError=Re;exports.isPeginFingerprintInputError=Ie;exports.isWotsMismatchError=Te;exports.orderClaimBatchByHtlcVout=ne;exports.rebuildDepositTermsCore=z;exports.rebuildDepositTermsForClaim=ke;exports.reconstructPeginParams=Oe;exports.selectSiblingRegistrations=te;exports.toRefundInputs=De;
2
+ //# sourceMappingURL=toRefundInputs-BSQjDOK9.cjs.map