@babylonlabs-io/ts-sdk 1.0.0 → 1.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 (141) hide show
  1. package/dist/{signPsbtsWithFallback-DoRbHHua.js → PayoutManager-CHTOwj0E.js} +25 -25
  2. package/dist/PayoutManager-CHTOwj0E.js.map +1 -0
  3. package/dist/PayoutManager-CpfQjtL0.cjs +2 -0
  4. package/dist/PayoutManager-CpfQjtL0.cjs.map +1 -0
  5. package/dist/PeginManager-6tjlGd0t.cjs +2 -0
  6. package/dist/PeginManager-6tjlGd0t.cjs.map +1 -0
  7. package/dist/{PeginManager-BH_AKu4l.js → PeginManager-DEldv_Ro.js} +21 -20
  8. package/dist/PeginManager-DEldv_Ro.js.map +1 -0
  9. package/dist/buildAndBroadcastReclaim-BwT6Jxp5.cjs +2 -0
  10. package/dist/buildAndBroadcastReclaim-BwT6Jxp5.cjs.map +1 -0
  11. package/dist/buildAndBroadcastReclaim-CqO2DoP8.js +1919 -0
  12. package/dist/buildAndBroadcastReclaim-CqO2DoP8.js.map +1 -0
  13. package/dist/challengeAssert-Cp_GeRg8.js.map +1 -1
  14. package/dist/challengeAssert-Z7_YULBb.cjs.map +1 -1
  15. package/dist/deriveVaultRoot-BwbXmN0x.js +79 -0
  16. package/dist/{parseFundingOutpoints-BwC3foxS.cjs.map → deriveVaultRoot-BwbXmN0x.js.map} +1 -1
  17. package/dist/deriveVaultRoot-DvhkHzNb.cjs +2 -0
  18. package/dist/deriveVaultRoot-DvhkHzNb.cjs.map +1 -0
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.js +286 -268
  21. package/dist/index.js.map +1 -1
  22. package/dist/noPayout-DAWBQ0eG.cjs.map +1 -1
  23. package/dist/noPayout-qBXWKwav.js.map +1 -1
  24. package/dist/onChainBtcPubkey-BXry_CM4.cjs +2 -0
  25. package/dist/onChainBtcPubkey-BXry_CM4.cjs.map +1 -0
  26. package/dist/onChainBtcPubkey-C1WqyxPM.js +159 -0
  27. package/dist/onChainBtcPubkey-C1WqyxPM.js.map +1 -0
  28. package/dist/parseFundingOutpoints-C_-PT9BT.cjs +2 -0
  29. package/dist/parseFundingOutpoints-C_-PT9BT.cjs.map +1 -0
  30. package/dist/parseFundingOutpoints-GSM-IaaK.js +17 -0
  31. package/dist/parseFundingOutpoints-GSM-IaaK.js.map +1 -0
  32. package/dist/{pegin-registration-client-pcczkzMg.js → pegin-registration-client-1sZ-74UC.js} +260 -383
  33. package/dist/pegin-registration-client-1sZ-74UC.js.map +1 -0
  34. package/dist/pegin-registration-client-BNV44jzw.cjs +2 -0
  35. package/dist/pegin-registration-client-BNV44jzw.cjs.map +1 -0
  36. package/dist/signing-3l5Aqd-H.cjs +2 -0
  37. package/dist/signing-3l5Aqd-H.cjs.map +1 -0
  38. package/dist/signing-Dhr2t0Z6.js +39 -0
  39. package/dist/signing-Dhr2t0Z6.js.map +1 -0
  40. package/dist/tbv/core/clients/eth/index.cjs +1 -1
  41. package/dist/tbv/core/clients/eth/index.js +8 -8
  42. package/dist/tbv/core/clients/index.cjs +1 -1
  43. package/dist/tbv/core/clients/index.js +8 -8
  44. package/dist/tbv/core/index.cjs +1 -1
  45. package/dist/tbv/core/index.js +284 -266
  46. package/dist/tbv/core/index.js.map +1 -1
  47. package/dist/tbv/core/managers/PayoutManager.d.ts +1 -1
  48. package/dist/tbv/core/managers/PeginManager.d.ts +1 -1
  49. package/dist/tbv/core/managers/index.cjs +1 -1
  50. package/dist/tbv/core/managers/index.js +2 -2
  51. package/dist/tbv/core/primitives/index.d.ts +1 -1
  52. package/dist/tbv/core/primitives/psbt/challengeAssert.d.ts +2 -2
  53. package/dist/tbv/core/primitives/psbt/challengeAssert.d.ts.map +1 -1
  54. package/dist/tbv/core/primitives/psbt/noPayout.d.ts +1 -1
  55. package/dist/tbv/core/primitives/psbt/noPayout.d.ts.map +1 -1
  56. package/dist/tbv/core/primitives/psbt/payout.d.ts +13 -7
  57. package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
  58. package/dist/tbv/core/services/delegated-claim/__tests__/assembleWatchtowerArtifacts.test.d.ts +15 -0
  59. package/dist/tbv/core/services/delegated-claim/__tests__/assembleWatchtowerArtifacts.test.d.ts.map +1 -0
  60. package/dist/tbv/core/services/delegated-claim/__tests__/deriveClaimerWotsKeypair.test.d.ts +11 -0
  61. package/dist/tbv/core/services/delegated-claim/__tests__/deriveClaimerWotsKeypair.test.d.ts.map +1 -0
  62. package/dist/tbv/core/services/delegated-claim/__tests__/readWatchtowerArtifacts.test.d.ts +10 -0
  63. package/dist/tbv/core/services/delegated-claim/__tests__/readWatchtowerArtifacts.test.d.ts.map +1 -0
  64. package/dist/tbv/core/services/delegated-claim/__tests__/vaultIdBinding.test.d.ts +10 -0
  65. package/dist/tbv/core/services/delegated-claim/__tests__/vaultIdBinding.test.d.ts.map +1 -0
  66. package/dist/tbv/core/services/delegated-claim/__tests__/wotsKeypair.golden.test.d.ts +11 -0
  67. package/dist/tbv/core/services/delegated-claim/__tests__/wotsKeypair.golden.test.d.ts.map +1 -0
  68. package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifacts.d.ts +46 -0
  69. package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifacts.d.ts.map +1 -0
  70. package/dist/tbv/core/services/delegated-claim/challengerBinding.d.ts +72 -0
  71. package/dist/tbv/core/services/delegated-claim/challengerBinding.d.ts.map +1 -0
  72. package/dist/tbv/core/services/delegated-claim/deriveClaimerWotsKeypair.d.ts +63 -0
  73. package/dist/tbv/core/services/delegated-claim/deriveClaimerWotsKeypair.d.ts.map +1 -0
  74. package/dist/tbv/core/services/delegated-claim/index.d.ts +55 -0
  75. package/dist/tbv/core/services/delegated-claim/index.d.ts.map +1 -0
  76. package/dist/tbv/core/services/delegated-claim/payoutBinding.d.ts +65 -0
  77. package/dist/tbv/core/services/delegated-claim/payoutBinding.d.ts.map +1 -0
  78. package/dist/tbv/core/services/delegated-claim/readWatchtowerArtifacts.d.ts +70 -0
  79. package/dist/tbv/core/services/delegated-claim/readWatchtowerArtifacts.d.ts.map +1 -0
  80. package/dist/tbv/core/services/delegated-claim/types.d.ts +105 -0
  81. package/dist/tbv/core/services/delegated-claim/types.d.ts.map +1 -0
  82. package/dist/tbv/core/services/delegated-claim/vaultIdBinding.d.ts +44 -0
  83. package/dist/tbv/core/services/delegated-claim/vaultIdBinding.d.ts.map +1 -0
  84. package/dist/tbv/core/services/index.cjs +1 -1
  85. package/dist/tbv/core/services/index.d.ts +1 -0
  86. package/dist/tbv/core/services/index.d.ts.map +1 -1
  87. package/dist/tbv/core/services/index.js +73 -56
  88. package/dist/tbv/core/services/index.js.map +1 -1
  89. package/dist/tbv/core/utils/index.cjs +1 -1
  90. package/dist/tbv/core/utils/index.js +44 -43
  91. package/dist/tbv/core/utils/signing.d.ts +24 -0
  92. package/dist/tbv/core/utils/signing.d.ts.map +1 -1
  93. package/dist/tbv/core/vault-secrets/index.cjs +1 -1
  94. package/dist/tbv/core/vault-secrets/index.js +9 -8
  95. package/dist/tbv/core/vault-secrets/index.js.map +1 -1
  96. package/dist/tbv/core/wasm/index.cjs +1 -1
  97. package/dist/tbv/core/wasm/index.cjs.map +1 -1
  98. package/dist/tbv/core/wasm/index.d.ts +102 -5
  99. package/dist/tbv/core/wasm/index.d.ts.map +1 -1
  100. package/dist/tbv/core/wasm/index.js +170 -73
  101. package/dist/tbv/core/wasm/index.js.map +1 -1
  102. package/dist/tbv/index.cjs +1 -1
  103. package/dist/tbv/index.js +284 -266
  104. package/dist/tbv/index.js.map +1 -1
  105. package/dist/tbv/integrations/aave/types.d.ts +1 -1
  106. package/dist/toRefundInputs-BaN9XluU.cjs +2 -0
  107. package/dist/{toRefundInputs-DEPXcrgO.cjs.map → toRefundInputs-BaN9XluU.cjs.map} +1 -1
  108. package/dist/{toRefundInputs-BEulLgN_.js → toRefundInputs-mtuuYezp.js} +23 -22
  109. package/dist/{toRefundInputs-BEulLgN_.js.map → toRefundInputs-mtuuYezp.js.map} +1 -1
  110. package/dist/{types-B9YhlXe8.js → types-BdCEoANP.js} +2 -2
  111. package/dist/{types-B9YhlXe8.js.map → types-BdCEoANP.js.map} +1 -1
  112. package/dist/{types-C1tpDycc.cjs → types-BuxreSq4.cjs} +2 -2
  113. package/dist/{types-C1tpDycc.cjs.map → types-BuxreSq4.cjs.map} +1 -1
  114. package/dist/verifyScriptPathSchnorrSignature-BKZihCjk.cjs.map +1 -1
  115. package/dist/verifyScriptPathSchnorrSignature-CpjSTfMj.js.map +1 -1
  116. package/package.json +3 -3
  117. package/dist/PeginManager-BCJWwV05.cjs +0 -2
  118. package/dist/PeginManager-BCJWwV05.cjs.map +0 -1
  119. package/dist/PeginManager-BH_AKu4l.js.map +0 -1
  120. package/dist/buildAndBroadcastReclaim-DLsf5hjO.cjs +0 -2
  121. package/dist/buildAndBroadcastReclaim-DLsf5hjO.cjs.map +0 -1
  122. package/dist/buildAndBroadcastReclaim-OMvihzJg.js +0 -1545
  123. package/dist/buildAndBroadcastReclaim-OMvihzJg.js.map +0 -1
  124. package/dist/onChainBtcPubkey-BbxRrbvg.cjs +0 -2
  125. package/dist/onChainBtcPubkey-BbxRrbvg.cjs.map +0 -1
  126. package/dist/onChainBtcPubkey-C-6UWpD8.js +0 -34
  127. package/dist/onChainBtcPubkey-C-6UWpD8.js.map +0 -1
  128. package/dist/parseFundingOutpoints-BwC3foxS.cjs +0 -2
  129. package/dist/parseFundingOutpoints-CC4NKYz2.js +0 -93
  130. package/dist/parseFundingOutpoints-CC4NKYz2.js.map +0 -1
  131. package/dist/pegin-registration-client-CZgcU2_0.cjs +0 -2
  132. package/dist/pegin-registration-client-CZgcU2_0.cjs.map +0 -1
  133. package/dist/pegin-registration-client-pcczkzMg.js.map +0 -1
  134. package/dist/signPsbtsWithFallback-DoRbHHua.js.map +0 -1
  135. package/dist/signPsbtsWithFallback-FwrTYZS4.cjs +0 -2
  136. package/dist/signPsbtsWithFallback-FwrTYZS4.cjs.map +0 -1
  137. package/dist/signing-BJ3X66b-.cjs +0 -2
  138. package/dist/signing-BJ3X66b-.cjs.map +0 -1
  139. package/dist/signing-Cm-McVR2.js +0 -22
  140. package/dist/signing-Cm-McVR2.js.map +0 -1
  141. package/dist/toRefundInputs-DEPXcrgO.cjs +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","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 ChallengeAssertScriptInfo,\n HtlcConnectorInfo,\n HtlcConnectorParams,\n Network,\n PayoutConnectorInfo,\n PayoutConnectorParams,\n PeginP2aAnchorInfo,\n PeginTxResult,\n PrePeginParams,\n PrePeginResult,\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 * minPeginFee`), otherwise the VP 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 3 ChallengeAssert transactions, and this connector\n * 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 * 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\nexport type {\n AssertNoPayoutScriptInfo,\n AssertPayoutNoPayoutConnectorParams,\n AssertPayoutScriptInfo,\n ChallengeAssertConnectorParams,\n ChallengeAssertScriptInfo,\n HtlcConnectorInfo,\n HtlcConnectorParams,\n Network,\n PayoutConnectorInfo,\n PayoutConnectorParams,\n PeginP2aAnchorInfo,\n PeginTxResult,\n PrePeginParams,\n PrePeginResult,\n};\n"],"names":["TAP_INTERNAL_KEY","HEX_CHARS_PER_BYTE","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","expandAuthAnchor","root","expandHashlockSecret","expandWotsSeed","deriveVaultId","peginTxHash","depositor"],"mappings":"2hBAQO,MAAMA,EACX,mEAEIC,EAAqB,EAEdC,EAAoB,WAAW,KAC1C,CAAE,OAAQF,EAAiB,OAASC,CAAA,EACpC,CAACE,EAAGC,IACF,OAAO,SACLJ,EAAiB,MACfI,EAAQH,EACRG,EAAQH,EAAqBA,CAAA,EAE/B,EAAA,CAEN,ECSA,IAAII,EAeG,SAASC,GAAsC,CACpD,OAAAD,MAAsB,OAAO,uCAAuC,EACjE,MAAOE,GAAmB,CACzB,MAAAF,EAAoB,OACd,IAAI,MACR,wOAIA,CAAE,MAAOE,CAAA,CAAM,CAEnB,CAAC,EACA,KAAK,MAAOC,GAAS,CACpB,GAAI,CACF,MAAMA,EAAK,SAAA,CACb,OAASD,EAAgB,CACvB,MAAAF,EAAoB,OACd,IAAI,MACR,mNAIA,CAAE,MAAOE,CAAA,CAAM,CAEnB,CACA,OAAOC,CACT,CAAC,GACIH,CACT,CAkBA,eAAsBI,EACpBC,EACyB,CACzB,OAAQ,MAAMJ,KAAe,0BAA0BI,CAAM,CAC/D,CAcA,eAAsBC,EACpBD,EACAE,EACAC,EACAC,EACwB,CACxB,OAAQ,MAAMR,KAAe,yBAC3BI,EACAE,EACAC,EACAC,CAAA,CAEJ,CAYA,eAAsBC,EACpBL,EAC4B,CAC5B,OAAQ,MAAMJ,KAAe,6BAA6BI,CAAM,CAClE,CAQA,eAAsBM,EACpBC,EACAC,EACAC,EACAC,EACAC,EACAC,EACiB,CACjB,OAAQ,MAAMhB,KAAe,qBAC3BW,EACAC,EACAC,EACAC,EACAC,EACAC,CAAA,CAEJ,CAYA,eAAsBC,EACpBN,EACAO,EACAC,EACAC,EACiB,CACjB,OAAQ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ources":["../../../../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 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 * 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 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","HEX_CHARS_PER_BYTE","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","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","build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f,OAAQ,MAAMjD,KAAe,0BAC3BW,EACAsC,CAAA,CAEJ"}
@@ -1,4 +1,4 @@
1
- import { AssertNoPayoutScriptInfo, AssertPayoutNoPayoutConnectorParams, AssertPayoutScriptInfo, ChallengeAssertConnectorParams, ChallengeAssertScriptInfo, HtlcConnectorInfo, HtlcConnectorParams, Network, PayoutConnectorInfo, PayoutConnectorParams, PeginP2aAnchorInfo, PeginTxResult, PrePeginParams, PrePeginResult } from '@babylonlabs-io/babylon-tbv-rust-wasm';
1
+ import { AssertNoPayoutScriptInfo, AssertPayoutNoPayoutConnectorParams, AssertPayoutScriptInfo, ChallengeAssertConnectorParams, ChallengeAssertScriptInfo, HtlcConnectorInfo, HtlcConnectorParams, Network, PayoutConnectorInfo, PayoutConnectorParams, PeginP2aAnchorInfo, PeginTxResult, PrePeginParams, PrePeginResult, WatchtowerArtifactsInputs, WotsKeypairDerivation, WronglyChallengedPsbts, WronglyChallengedSigs } from '@babylonlabs-io/babylon-tbv-rust-wasm';
2
2
  export { TAP_INTERNAL_KEY, tapInternalPubkey } from './constants';
3
3
  type TbvWasmModule = typeof import("@babylonlabs-io/babylon-tbv-rust-wasm");
4
4
  /**
@@ -69,7 +69,8 @@ export declare function computeMinClaimValue(txGraphVersion: number, numLocalCha
69
69
  * `minPeginFee = peginTxVsize(numVks, numUcs) × minPeginFeeRate`. Each HTLC
70
70
  * the depositor funds in the Pre-PegIn tx must reserve at least this fee
71
71
  * inside its value (`htlcValue = peginAmount + depositorClaimValue +
72
- * minPeginFee`), otherwise the VP cannot afford to broadcast the PegIn at
72
+ * p2aAnchorValue + minPeginFee`, anchor 0 on vault core 1), otherwise the VP
73
+ * cannot afford to broadcast the PegIn at
73
74
  * activation. The vsize comes from a Taproot script-path-spend weight
74
75
  * prediction whose witness shape depends on the VK + UC signer count.
75
76
  */
@@ -148,8 +149,8 @@ export declare function getAssertNoPayoutScriptInfo(params: AssertPayoutNoPayout
148
149
  * Get the ChallengeAssert script and control block.
149
150
  *
150
151
  * Used to build ChallengeAssert PSBTs for the depositor-as-claimer path.
151
- * Each challenger has 3 ChallengeAssert transactions, and this connector
152
- * generates the spending scripts using WOTS public keys from the VP.
152
+ * Each challenger has 2 ChallengeAssert transactions (X and Y), and this
153
+ * connector generates the spending scripts using WOTS public keys from the VP.
153
154
  *
154
155
  * @param params - ChallengeAssert connector parameters
155
156
  * @returns Script and control block (hex encoded)
@@ -184,5 +185,101 @@ export declare function expandWotsSeed(root: Uint8Array, htlcVout: number): Prom
184
185
  * @returns Hex-encoded vault ID (32 bytes)
185
186
  */
186
187
  export declare function deriveVaultId(peginTxHash: string, depositor: string): Promise<string>;
187
- export type { AssertNoPayoutScriptInfo, AssertPayoutNoPayoutConnectorParams, AssertPayoutScriptInfo, ChallengeAssertConnectorParams, ChallengeAssertScriptInfo, HtlcConnectorInfo, HtlcConnectorParams, Network, PayoutConnectorInfo, PayoutConnectorParams, PeginP2aAnchorInfo, PeginTxResult, PrePeginParams, PrePeginResult, };
188
+ /**
189
+ * Depositor's Claim signing PSBT (base64) — spends PegIn:1, script path.
190
+ *
191
+ * @experimental
192
+ */
193
+ export declare function buildClaimPsbt(txGraphVersion: number, graphJson: string): Promise<string>;
194
+ /**
195
+ * Claimer's Assert signing PSBT (base64) — the single WOTS input.
196
+ *
197
+ * @experimental
198
+ */
199
+ export declare function buildAssertClaimerPsbt(txGraphVersion: number, graphJson: string): Promise<string>;
200
+ /**
201
+ * Claimer's Payout signing PSBT (base64) — input 1, Assert connector path.
202
+ *
203
+ * @experimental
204
+ */
205
+ export declare function buildPayoutClaimerPsbt(txGraphVersion: number, graphJson: string): Promise<string>;
206
+ /**
207
+ * Depositor's Payout signing PSBT (base64) — input 0, the PegIn UTXO spend.
208
+ *
209
+ * @experimental
210
+ */
211
+ export declare function buildPayoutDepositorPsbt(txGraphVersion: number, graphJson: string): Promise<string>;
212
+ /**
213
+ * Claimer's WronglyChallenged signing PSBTs, per challenger and GC index.
214
+ *
215
+ * @experimental
216
+ */
217
+ export declare function buildWronglyChallengedPsbts(txGraphVersion: number, graphJson: string): Promise<WronglyChallengedPsbts>;
218
+ /**
219
+ * Verifies the Groth16 pegout proof and pins it into the artifacts, returning
220
+ * the updated artifacts JSON. Persist that copy: the one-time WOTS keypair
221
+ * signs exactly one proof, so a second, different one is refused.
222
+ *
223
+ * @experimental
224
+ */
225
+ export declare function pinPegoutProof(txGraphVersion: number, artifactsJson: string, proofHex: string): Promise<string>;
226
+ /**
227
+ * Finalizes the Assert from the pinned proof and the WOTS keypair, writes it
228
+ * into the artifacts and returns the updated artifacts JSON. The keypair
229
+ * never leaves the caller.
230
+ *
231
+ * @experimental
232
+ */
233
+ export declare function attachFinalizedAssert(txGraphVersion: number, artifactsJson: string, keypairJson: string): Promise<string>;
234
+ /**
235
+ * Finalizes the Payout tx from the artifacts' signatures, consensus hex.
236
+ *
237
+ * @experimental
238
+ */
239
+ export declare function finalizePayout(txGraphVersion: number, artifactsJson: string): Promise<string>;
240
+ /**
241
+ * Finalizes one WronglyChallenged tx — the answer to a ChallengeAssert.
242
+ *
243
+ * @experimental
244
+ */
245
+ export declare function finalizeWronglyChallenged(txGraphVersion: number, artifactsJson: string, challengerPkHex: string, gcIndex: number, preimageHex: string): Promise<string>;
246
+ /**
247
+ * Applies the depositor signature to the Claim tx, returning consensus hex.
248
+ *
249
+ * @experimental
250
+ */
251
+ export declare function finalizeClaimTx(txGraphVersion: number, graphJson: string, depositorSigHex: string): Promise<string>;
252
+ /**
253
+ * Extracts a signed PSBT input's taproot script-path signature (hex).
254
+ *
255
+ * @experimental
256
+ */
257
+ export declare function extractTapScriptSig(psbtBase64: string, inputIndex: number): Promise<string>;
258
+ /**
259
+ * Derive the depositor's WOTS keypair from the 64-byte `wotsSeed`.
260
+ * @stability frozen — `HASH160(seed || block index)` binds on-chain through
261
+ * `depositorWotsPkHash`; see CLAUDE.md §4.
262
+ *
263
+ * @experimental
264
+ */
265
+ export declare function wotsKeypairFromSeed(wotsSeed: Uint8Array): Promise<WotsKeypairDerivation>;
266
+ /**
267
+ * Throws unless the keypair matches the WOTS keys the graph's Claim commits to.
268
+ *
269
+ * @experimental
270
+ */
271
+ export declare function validateWotsKeypairAgainstGraph(txGraphVersion: number, keypair: unknown, graphJson: string): Promise<void>;
272
+ /**
273
+ * Assembles the watchtower `artifacts.json` content, verifying every signature.
274
+ *
275
+ * @experimental
276
+ */
277
+ export declare function buildWatchtowerArtifacts(inputs: WatchtowerArtifactsInputs): Promise<string>;
278
+ /**
279
+ * Re-verifies every claimer-side signature in an `artifacts.json`.
280
+ *
281
+ * @experimental
282
+ */
283
+ export declare function verifyWatchtowerArtifacts(txGraphVersion: number, artifactsJson: string): Promise<void>;
284
+ export type { AssertNoPayoutScriptInfo, AssertPayoutNoPayoutConnectorParams, AssertPayoutScriptInfo, ChallengeAssertConnectorParams, ChallengeAssertScriptInfo, HtlcConnectorInfo, HtlcConnectorParams, Network, PayoutConnectorInfo, PayoutConnectorParams, PeginP2aAnchorInfo, PeginTxResult, PrePeginParams, PrePeginResult, WatchtowerArtifactsInputs, WotsKeypairDerivation, WronglyChallengedPsbts, WronglyChallengedSigs, };
188
285
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/wasm/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,wBAAwB,EACxB,mCAAmC,EACnC,sBAAsB,EACtB,8BAA8B,EAC9B,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,OAAO,EACP,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,cAAc,EACf,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAElE,KAAK,aAAa,GAAG,cAAc,uCAAuC,CAAC,CAAC;AAI5E;;;;;;;;;;;;GAYG;AACH,wBAAg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EACtB,8BAA8B,EAC9B,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,OAAO,EACP,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,cAAc,GACf,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/wasm/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,wBAAwB,EACxB,mCAAmC,EACnC,sBAAsB,EACtB,8BAA8B,EAC9B,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,OAAO,EACP,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAElE,KAAK,aAAa,GAAG,cAAc,uCAAuC,CAAC,CAAC;AAI5E;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAAC,aAAa,CAAC,CA4BpD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,cAAc,CAAC,CAEzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,cAAc,EACtB,aAAa,EAAE,MAAM,EACrB,mBAAmB,EAAE,MAAM,EAC3B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,aAAa,CAAC,CAOxB;AAED;;;;;;;;;GASG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CAE5B;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,cAAc,EAAE,MAAM,EACtB,mBAAmB,E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AAC,MAAM,CAAC,CAEjB;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,YAAY,EACV,wBAAwB,EACxB,mCAAmC,EACnC,sBAAsB,EACtB,8BAA8B,EAC9B,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,OAAO,EACP,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,GACtB,CAAC"}
@@ -1,8 +1,8 @@
1
- const u = "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0";
1
+ const c = "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0";
2
2
  const y = Uint8Array.from(
3
- { length: u.length / 2 },
4
- (e, n) => Number.parseInt(
5
- u.slice(
3
+ { length: c.length / 2 },
4
+ (t, n) => Number.parseInt(
5
+ c.slice(
6
6
  n * 2,
7
7
  n * 2 + 2
8
8
  ),
@@ -10,124 +10,221 @@ const y = Uint8Array.from(
10
10
  )
11
11
  );
12
12
  let o;
13
- function t() {
14
- return o ?? (o = import("@babylonlabs-io/babylon-tbv-rust-wasm").catch((e) => {
13
+ function a() {
14
+ return o ?? (o = import("@babylonlabs-io/babylon-tbv-rust-wasm").catch((t) => {
15
15
  throw o = void 0, new Error(
16
16
  "The vault-WASM engine @babylonlabs-io/babylon-tbv-rust-wasm failed to load. The module could not be resolved, or it threw while evaluating, commonly a missing or stale generated WASM build. See the cause for the underlying error.",
17
- { cause: e }
17
+ { cause: t }
18
18
  );
19
- }).then(async (e) => {
19
+ }).then(async (t) => {
20
20
  try {
21
- await e.initWasm();
21
+ await t.initWasm();
22
22
  } catch (n) {
23
23
  throw o = void 0, new Error(
24
24
  "The vault-WASM engine @babylonlabs-io/babylon-tbv-rust-wasm resolved, but its WebAssembly binary failed to initialize, commonly a missing or stale generated WASM build. See the cause for the underlying error.",
25
25
  { cause: n }
26
26
  );
27
27
  }
28
- return e;
28
+ return t;
29
29
  })), o;
30
30
  }
31
- async function P(e) {
32
- return (await t()).createPrePeginTransaction(e);
31
+ async function f(t) {
32
+ return (await a()).createPrePeginTransaction(t);
33
33
  }
34
- async function d(e, n, a, r) {
35
- return (await t()).buildPeginTxFromPrePegin(
36
- e,
34
+ async function P(t, n, e, r) {
35
+ return (await a()).buildPeginTxFromPrePegin(
36
+ t,
37
37
  n,
38
- a,
38
+ e,
39
39
  r
40
40
  );
41
41
  }
42
- async function g(e) {
43
- return (await t()).getPrePeginHtlcConnectorInfo(e);
42
+ async function d(t) {
43
+ return (await a()).getPrePeginHtlcConnectorInfo(t);
44
44
  }
45
- async function f(e, n, a, r, i, c) {
46
- return (await t()).computeMinClaimValue(
47
- e,
45
+ async function b(t, n, e, r, i, u) {
46
+ return (await a()).computeMinClaimValue(
47
+ t,
48
48
  n,
49
- a,
49
+ e,
50
50
  r,
51
51
  i,
52
- c
52
+ u
53
53
  );
54
54
  }
55
- async function p(e, n, a, r) {
56
- return (await t()).computeMinPeginFee(
57
- e,
55
+ async function g(t, n, e, r) {
56
+ return (await a()).computeMinPeginFee(
57
+ t,
58
58
  n,
59
- a,
59
+ e,
60
60
  r
61
61
  );
62
62
  }
63
- async function h(e, n, a, r, i, c, s, l) {
64
- return (await t()).computePayoutFeeFloor(
65
- e,
63
+ async function w(t, n, e, r, i, u, s, l) {
64
+ return (await a()).computePayoutFeeFloor(
65
+ t,
66
66
  n,
67
- a,
67
+ e,
68
68
  r,
69
69
  i,
70
- c,
70
+ u,
71
71
  s,
72
72
  l
73
73
  );
74
74
  }
75
- async function b() {
76
- return (await t()).supportedTxGraphVersions();
75
+ async function p() {
76
+ return (await a()).supportedTxGraphVersions();
77
77
  }
78
- async function A(e) {
79
- return (await t()).peginP2aAnchorOutput(e);
78
+ async function h(t) {
79
+ return (await a()).peginP2aAnchorOutput(t);
80
80
  }
81
- async function m(e, n) {
82
- return (await t()).validatePeginP2aAnchor(e, n);
81
+ async function A(t, n) {
82
+ return (await a()).validatePeginP2aAnchor(t, n);
83
83
  }
84
- async function w(e, n) {
85
- return (await t()).createPayoutConnector(e, n);
84
+ async function m(t, n) {
85
+ return (await a()).createPayoutConnector(t, n);
86
86
  }
87
- async function S(e) {
88
- return (await t()).getAssertPayoutScriptInfo(e);
87
+ async function S(t) {
88
+ return (await a()).getAssertPayoutScriptInfo(t);
89
89
  }
90
- async function E(e, n) {
91
- return (await t()).getAssertNoPayoutScriptInfo(
92
- e,
90
+ async function C(t, n) {
91
+ return (await a()).getAssertNoPayoutScriptInfo(
92
+ t,
93
+ n
94
+ );
95
+ }
96
+ async function T(t) {
97
+ return (await a()).getChallengeAssertScriptInfo(t);
98
+ }
99
+ async function E(t) {
100
+ return (await a()).expandAuthAnchor(t);
101
+ }
102
+ async function W(t, n) {
103
+ return (await a()).expandHashlockSecret(t, n);
104
+ }
105
+ async function v(t, n) {
106
+ return (await a()).expandWotsSeed(t, n);
107
+ }
108
+ async function _(t, n) {
109
+ return (await a()).deriveVaultId(t, n);
110
+ }
111
+ async function x(t, n) {
112
+ return (await a()).buildClaimPsbt(t, n);
113
+ }
114
+ async function H(t, n) {
115
+ return (await a()).buildAssertClaimerPsbt(
116
+ t,
117
+ n
118
+ );
119
+ }
120
+ async function I(t, n) {
121
+ return (await a()).buildPayoutClaimerPsbt(
122
+ t,
123
+ n
124
+ );
125
+ }
126
+ async function F(t, n) {
127
+ return (await a()).buildPayoutDepositorPsbt(
128
+ t,
129
+ n
130
+ );
131
+ }
132
+ async function R(t, n) {
133
+ return (await a()).buildWronglyChallengedPsbts(
134
+ t,
93
135
  n
94
136
  );
95
137
  }
96
- async function _(e) {
97
- return (await t()).getChallengeAssertScriptInfo(e);
138
+ async function z(t, n, e) {
139
+ return (await a()).pinPegoutProof(
140
+ t,
141
+ n,
142
+ e
143
+ );
98
144
  }
99
- async function T(e) {
100
- return (await t()).expandAuthAnchor(e);
145
+ async function M(t, n, e) {
146
+ return (await a()).attachFinalizedAssert(
147
+ t,
148
+ n,
149
+ e
150
+ );
101
151
  }
102
- async function v(e, n) {
103
- return (await t()).expandHashlockSecret(e, n);
152
+ async function V(t, n) {
153
+ return (await a()).finalizePayout(t, n);
104
154
  }
105
- async function H(e, n) {
106
- return (await t()).expandWotsSeed(e, n);
155
+ async function Y(t, n, e, r, i) {
156
+ return (await a()).finalizeWronglyChallenged(
157
+ t,
158
+ n,
159
+ e,
160
+ r,
161
+ i
162
+ );
107
163
  }
108
- async function C(e, n) {
109
- return (await t()).deriveVaultId(e, n);
164
+ async function B(t, n, e) {
165
+ return (await a()).finalizeClaimTx(
166
+ t,
167
+ n,
168
+ e
169
+ );
170
+ }
171
+ async function K(t, n) {
172
+ return (await a()).extractTapScriptSig(t, n);
173
+ }
174
+ async function N(t) {
175
+ return (await a()).wotsKeypairFromSeed(t);
176
+ }
177
+ async function X(t, n, e) {
178
+ return (await a()).validateWotsKeypairAgainstGraph(
179
+ t,
180
+ n,
181
+ e
182
+ );
183
+ }
184
+ async function G(t) {
185
+ return (await a()).buildWatchtowerArtifacts(t);
186
+ }
187
+ async function k(t, n) {
188
+ return (await a()).verifyWatchtowerArtifacts(
189
+ t,
190
+ n
191
+ );
110
192
  }
111
193
  export {
112
- u as TAP_INTERNAL_KEY,
113
- d as buildPeginTxFromPrePegin,
114
- f as computeMinClaimValue,
115
- p as computeMinPeginFee,
116
- h as computePayoutFeeFloor,
117
- w as createPayoutConnector,
118
- P as createPrePeginTransaction,
119
- C as deriveVaultId,
120
- T as expandAuthAnchor,
121
- v as expandHashlockSecret,
122
- H as expandWotsSeed,
123
- E as getAssertNoPayoutScriptInfo,
194
+ c as TAP_INTERNAL_KEY,
195
+ M as attachFinalizedAssert,
196
+ H as buildAssertClaimerPsbt,
197
+ x as buildClaimPsbt,
198
+ I as buildPayoutClaimerPsbt,
199
+ F as buildPayoutDepositorPsbt,
200
+ P as buildPeginTxFromPrePegin,
201
+ G as buildWatchtowerArtifacts,
202
+ R as buildWronglyChallengedPsbts,
203
+ b as computeMinClaimValue,
204
+ g as computeMinPeginFee,
205
+ w as computePayoutFeeFloor,
206
+ m as createPayoutConnector,
207
+ f as createPrePeginTransaction,
208
+ _ as deriveVaultId,
209
+ E as expandAuthAnchor,
210
+ W as expandHashlockSecret,
211
+ v as expandWotsSeed,
212
+ K as extractTapScriptSig,
213
+ B as finalizeClaimTx,
214
+ V as finalizePayout,
215
+ Y as finalizeWronglyChallenged,
216
+ C as getAssertNoPayoutScriptInfo,
124
217
  S as getAssertPayoutScriptInfo,
125
- _ as getChallengeAssertScriptInfo,
126
- g as getPrePeginHtlcConnectorInfo,
127
- t as loadTbvWasm,
128
- A as peginP2aAnchorOutput,
129
- b as supportedTxGraphVersions,
218
+ T as getChallengeAssertScriptInfo,
219
+ d as getPrePeginHtlcConnectorInfo,
220
+ a as loadTbvWasm,
221
+ h as peginP2aAnchorOutput,
222
+ z as pinPegoutProof,
223
+ p as supportedTxGraphVersions,
130
224
  y as tapInternalPubkey,
131
- m as validatePeginP2aAnchor
225
+ A as validatePeginP2aAnchor,
226
+ X as validateWotsKeypairAgainstGraph,
227
+ k as verifyWatchtowerArtifacts,
228
+ N as wotsKeypairFromSeed
132
229
  };
133
230
  //# sourceMappingURL=index.js.map