@babylonlabs-io/ts-sdk 0.67.0 → 0.68.1

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 (151) hide show
  1. package/dist/PeginManager-Bsv6caG3.js +1466 -0
  2. package/dist/PeginManager-Bsv6caG3.js.map +1 -0
  3. package/dist/PeginManager-C5NWzGT7.cjs +2 -0
  4. package/dist/PeginManager-C5NWzGT7.cjs.map +1 -0
  5. package/dist/{batchPoll-cIxrSLLJ.js → batchPoll-Bc_UKaTz.js} +372 -421
  6. package/dist/batchPoll-Bc_UKaTz.js.map +1 -0
  7. package/dist/batchPoll-C9cZ5usJ.cjs +2 -0
  8. package/dist/batchPoll-C9cZ5usJ.cjs.map +1 -0
  9. package/dist/{bitcoin-d9eaaZB_.js → bitcoin-Ch_jxnDa.js} +3 -3
  10. package/dist/{bitcoin-d9eaaZB_.js.map → bitcoin-Ch_jxnDa.js.map} +1 -1
  11. package/dist/{buildAndBroadcastRefund-C4LiPATK.js → buildAndBroadcastRefund-CpMDJ8up.js} +142 -150
  12. package/dist/buildAndBroadcastRefund-CpMDJ8up.js.map +1 -0
  13. package/dist/buildAndBroadcastRefund-DrXwxrW1.cjs +2 -0
  14. package/dist/buildAndBroadcastRefund-DrXwxrW1.cjs.map +1 -0
  15. package/dist/challengeAssert-BNQ8sToz.js +64 -0
  16. package/dist/challengeAssert-BNQ8sToz.js.map +1 -0
  17. package/dist/challengeAssert-BrpC3-cQ.cjs +2 -0
  18. package/dist/challengeAssert-BrpC3-cQ.cjs.map +1 -0
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.js +246 -243
  21. package/dist/{mempoolApi-BxSINXIB.js → mempoolApi-71R_CNZa.js} +193 -117
  22. package/dist/mempoolApi-71R_CNZa.js.map +1 -0
  23. package/dist/mempoolApi-BJN9fGEd.cjs +2 -0
  24. package/dist/mempoolApi-BJN9fGEd.cjs.map +1 -0
  25. package/dist/{noPayout-BaZGRLD2.js → noPayout-CXn-geIS.js} +3 -3
  26. package/dist/{noPayout-BaZGRLD2.js.map → noPayout-CXn-geIS.js.map} +1 -1
  27. package/dist/{noPayout-CnQ1WLtr.cjs → noPayout-Ox27Td9x.cjs} +2 -2
  28. package/dist/{noPayout-CnQ1WLtr.cjs.map → noPayout-Ox27Td9x.cjs.map} +1 -1
  29. package/dist/{onChainBtcPubkey-DeF4cKoO.js → onChainBtcPubkey-BAHZyKQL.js} +2 -2
  30. package/dist/{onChainBtcPubkey-DeF4cKoO.js.map → onChainBtcPubkey-BAHZyKQL.js.map} +1 -1
  31. package/dist/{parseFundingOutpoints-pBRE11Hr.js → parseFundingOutpoints-CO-f6IHK.js} +2 -2
  32. package/dist/{parseFundingOutpoints-pBRE11Hr.js.map → parseFundingOutpoints-CO-f6IHK.js.map} +1 -1
  33. package/dist/{reservation-B4i_PQhY.js → reservation-CBAvoF3U.js} +2 -2
  34. package/dist/{reservation-B4i_PQhY.js.map → reservation-CBAvoF3U.js.map} +1 -1
  35. package/dist/{signPsbtsWithFallback-Bb66DfY5.js → signPsbtsWithFallback-Bv79gLFe.js} +122 -100
  36. package/dist/signPsbtsWithFallback-Bv79gLFe.js.map +1 -0
  37. package/dist/signPsbtsWithFallback-DJ4kE9UI.cjs +2 -0
  38. package/dist/signPsbtsWithFallback-DJ4kE9UI.cjs.map +1 -0
  39. package/dist/tbv/core/clients/index.cjs +1 -1
  40. package/dist/tbv/core/clients/index.js +3 -3
  41. package/dist/tbv/core/clients/vault-provider/auth/__tests__/bip322P2wpkhVectors.d.ts +32 -0
  42. package/dist/tbv/core/clients/vault-provider/auth/__tests__/bip322P2wpkhVectors.d.ts.map +1 -0
  43. package/dist/tbv/core/clients/vault-provider/auth/__tests__/bip322Verify.test.d.ts +9 -6
  44. package/dist/tbv/core/clients/vault-provider/auth/__tests__/bip322Verify.test.d.ts.map +1 -1
  45. package/dist/tbv/core/clients/vault-provider/auth/bip322Verify.d.ts +54 -20
  46. package/dist/tbv/core/clients/vault-provider/auth/bip322Verify.d.ts.map +1 -1
  47. package/dist/tbv/core/deposit-terms/__tests__/depositTerms.test.d.ts +2 -0
  48. package/dist/tbv/core/deposit-terms/__tests__/depositTerms.test.d.ts.map +1 -0
  49. package/dist/tbv/core/deposit-terms/depositTerms.d.ts +41 -4
  50. package/dist/tbv/core/deposit-terms/depositTerms.d.ts.map +1 -1
  51. package/dist/tbv/core/deposit-terms/prePeginApproval.d.ts +10 -5
  52. package/dist/tbv/core/deposit-terms/prePeginApproval.d.ts.map +1 -1
  53. package/dist/tbv/core/index.cjs +1 -1
  54. package/dist/tbv/core/index.js +244 -241
  55. package/dist/tbv/core/managers/PayoutManager.d.ts +8 -2
  56. package/dist/tbv/core/managers/PayoutManager.d.ts.map +1 -1
  57. package/dist/tbv/core/managers/PeginManager.d.ts +7 -0
  58. package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
  59. package/dist/tbv/core/managers/index.cjs +1 -1
  60. package/dist/tbv/core/managers/index.js +2 -2
  61. package/dist/tbv/core/managers/pegin/__tests__/verifyPopWitness.test.d.ts +11 -0
  62. package/dist/tbv/core/managers/pegin/__tests__/verifyPopWitness.test.d.ts.map +1 -0
  63. package/dist/tbv/core/managers/pegin/expandPerVaultSecrets.d.ts.map +1 -1
  64. package/dist/tbv/core/managers/pegin/index.d.ts +1 -0
  65. package/dist/tbv/core/managers/pegin/index.d.ts.map +1 -1
  66. package/dist/tbv/core/managers/pegin/verifyPopWitness.d.ts +21 -0
  67. package/dist/tbv/core/managers/pegin/verifyPopWitness.d.ts.map +1 -0
  68. package/dist/tbv/core/primitives/challengers.d.ts +31 -5
  69. package/dist/tbv/core/primitives/challengers.d.ts.map +1 -1
  70. package/dist/tbv/core/primitives/index.cjs +1 -1
  71. package/dist/tbv/core/primitives/index.d.ts +2 -0
  72. package/dist/tbv/core/primitives/index.d.ts.map +1 -1
  73. package/dist/tbv/core/primitives/index.js +43 -41
  74. package/dist/tbv/core/primitives/psbt/__tests__/helpers.d.ts +5 -0
  75. package/dist/tbv/core/primitives/psbt/__tests__/helpers.d.ts.map +1 -1
  76. package/dist/tbv/core/primitives/psbt/__tests__/verifyKeyPathSchnorrSignature.test.d.ts +12 -0
  77. package/dist/tbv/core/primitives/psbt/__tests__/verifyKeyPathSchnorrSignature.test.d.ts.map +1 -0
  78. package/dist/tbv/core/primitives/psbt/payout.d.ts +19 -7
  79. package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
  80. package/dist/tbv/core/primitives/psbt/verifyKeyPathSchnorrSignature.d.ts +65 -0
  81. package/dist/tbv/core/primitives/psbt/verifyKeyPathSchnorrSignature.d.ts.map +1 -0
  82. package/dist/tbv/core/primitives/psbt/verifyP2wpkhEcdsaSignature.d.ts +40 -0
  83. package/dist/tbv/core/primitives/psbt/verifyP2wpkhEcdsaSignature.d.ts.map +1 -0
  84. package/dist/tbv/core/primitives/psbt/verifyScriptPathSchnorrSignature.d.ts +2 -1
  85. package/dist/tbv/core/primitives/psbt/verifyScriptPathSchnorrSignature.d.ts.map +1 -1
  86. package/dist/tbv/core/primitives/utils/__tests__/taproot.test.d.ts +13 -0
  87. package/dist/tbv/core/primitives/utils/__tests__/taproot.test.d.ts.map +1 -0
  88. package/dist/tbv/core/primitives/utils/taproot.d.ts +29 -0
  89. package/dist/tbv/core/primitives/utils/taproot.d.ts.map +1 -0
  90. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts +2 -2
  91. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -1
  92. package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts.map +1 -1
  93. package/dist/tbv/core/services/index.cjs +1 -1
  94. package/dist/tbv/core/services/index.js +2 -2
  95. package/dist/tbv/core/utils/index.js +2 -2
  96. package/dist/tbv/core/utils/witness/witnessStack.d.ts +24 -0
  97. package/dist/tbv/core/utils/witness/witnessStack.d.ts.map +1 -0
  98. package/dist/tbv/core/vault-secrets/index.js +1 -1
  99. package/dist/tbv/index.cjs +1 -1
  100. package/dist/tbv/index.js +244 -241
  101. package/dist/testing/MockBitcoinWallet.d.ts +9 -0
  102. package/dist/testing/MockBitcoinWallet.d.ts.map +1 -1
  103. package/dist/testing/__tests__/MockBitcoinWallet.test.d.ts +2 -0
  104. package/dist/testing/__tests__/MockBitcoinWallet.test.d.ts.map +1 -0
  105. package/dist/testing/index.cjs +1 -1
  106. package/dist/testing/index.cjs.map +1 -1
  107. package/dist/testing/index.js +136 -45
  108. package/dist/testing/index.js.map +1 -1
  109. package/dist/testing/signBip322P2wpkhWitness.d.ts +25 -0
  110. package/dist/testing/signBip322P2wpkhWitness.d.ts.map +1 -0
  111. package/dist/{toRefundInputs-BY_fcvrv.js → toRefundInputs-4UJfSVEz.js} +6 -6
  112. package/dist/{toRefundInputs-BY_fcvrv.js.map → toRefundInputs-4UJfSVEz.js.map} +1 -1
  113. package/dist/{toRefundInputs-DYL9C-aG.cjs → toRefundInputs-DgDhx_Ut.cjs} +2 -2
  114. package/dist/{toRefundInputs-DYL9C-aG.cjs.map → toRefundInputs-DgDhx_Ut.cjs.map} +1 -1
  115. package/dist/verifyKeyPathSchnorrSignature-C6Cmk0R1.js +372 -0
  116. package/dist/verifyKeyPathSchnorrSignature-C6Cmk0R1.js.map +1 -0
  117. package/dist/verifyKeyPathSchnorrSignature-Cr5T4Aym.cjs +2 -0
  118. package/dist/verifyKeyPathSchnorrSignature-Cr5T4Aym.cjs.map +1 -0
  119. package/dist/verifyScriptPathSchnorrSignature-Dy9gF5RF.js +931 -0
  120. package/dist/verifyScriptPathSchnorrSignature-Dy9gF5RF.js.map +1 -0
  121. package/dist/verifyScriptPathSchnorrSignature-la8XOAFm.cjs +2 -0
  122. package/dist/verifyScriptPathSchnorrSignature-la8XOAFm.cjs.map +1 -0
  123. package/package.json +1 -1
  124. package/dist/PeginManager-BBl4xkWz.js +0 -1359
  125. package/dist/PeginManager-BBl4xkWz.js.map +0 -1
  126. package/dist/PeginManager-p-ajwSxG.cjs +0 -2
  127. package/dist/PeginManager-p-ajwSxG.cjs.map +0 -1
  128. package/dist/batchPoll-6L5oToGr.cjs +0 -2
  129. package/dist/batchPoll-6L5oToGr.cjs.map +0 -1
  130. package/dist/batchPoll-cIxrSLLJ.js.map +0 -1
  131. package/dist/buildAndBroadcastRefund-C4LiPATK.js.map +0 -1
  132. package/dist/buildAndBroadcastRefund-Daw5ZUKR.cjs +0 -2
  133. package/dist/buildAndBroadcastRefund-Daw5ZUKR.cjs.map +0 -1
  134. package/dist/challengeAssert-BFRE2DM-.cjs +0 -2
  135. package/dist/challengeAssert-BFRE2DM-.cjs.map +0 -1
  136. package/dist/challengeAssert-C7PzyJ7g.js +0 -75
  137. package/dist/challengeAssert-C7PzyJ7g.js.map +0 -1
  138. package/dist/mempoolApi-BxSINXIB.js.map +0 -1
  139. package/dist/mempoolApi-CXfr-L6x.cjs +0 -2
  140. package/dist/mempoolApi-CXfr-L6x.cjs.map +0 -1
  141. package/dist/peginInput-Ci921gTl.cjs +0 -2
  142. package/dist/peginInput-Ci921gTl.cjs.map +0 -1
  143. package/dist/peginInput-HQPWZfly.js +0 -123
  144. package/dist/peginInput-HQPWZfly.js.map +0 -1
  145. package/dist/signPsbtsWithFallback-Bb66DfY5.js.map +0 -1
  146. package/dist/signPsbtsWithFallback-PTgWxsG3.cjs +0 -2
  147. package/dist/signPsbtsWithFallback-PTgWxsG3.cjs.map +0 -1
  148. package/dist/verifyScriptPathSchnorrSignature-DPAd_qke.cjs +0 -2
  149. package/dist/verifyScriptPathSchnorrSignature-DPAd_qke.cjs.map +0 -1
  150. package/dist/verifyScriptPathSchnorrSignature-i-koT139.js +0 -817
  151. package/dist/verifyScriptPathSchnorrSignature-i-koT139.js.map +0 -1
@@ -0,0 +1,21 @@
1
+ import { Hex } from 'viem';
2
+ export type PopWitnessVerdict = {
3
+ readonly kind: "p2tr-verified";
4
+ } | {
5
+ readonly kind: "p2wpkh-verified";
6
+ };
7
+ /**
8
+ * Decode a consensus-encoded PoP witness and verify it against the
9
+ * depositor's key: Schnorr for the P2TR shape, ECDSA over the BIP-322
10
+ * P2WPKH virtual transaction for the two-item shape.
11
+ *
12
+ * @param messageBytes - Bytes of the PoP message that was signed.
13
+ * @param depositorXOnlyHex - Depositor x-only pubkey, bare 64-char hex
14
+ * (enforced, not assumed).
15
+ * @param witnessHex - 0x-prefixed consensus-encoded witness.
16
+ * @throws If the witness is malformed, has an unsupported item count, the
17
+ * depositor key is not bare x-only hex, the witness pubkey is not
18
+ * the depositor's, or the signature does not verify.
19
+ */
20
+ export declare function verifyPopWitness(messageBytes: Uint8Array, depositorXOnlyHex: string, witnessHex: Hex): PopWitnessVerdict;
21
+ //# sourceMappingURL=verifyPopWitness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyPopWitness.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/managers/pegin/verifyPopWitness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AA2BhC,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;CAAE,GAClC;IAAE,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAgBzC;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,UAAU,EACxB,iBAAiB,EAAE,MAAM,EACzB,UAAU,EAAE,GAAG,GACd,iBAAiB,CAgHnB"}
@@ -1,9 +1,7 @@
1
1
  /**
2
- * Challenger counting utilities.
3
- *
4
- * Used for UI-level validation (e.g. computing minimum deposit amounts)
5
- * where the depositor's identity is known. The transaction builders use
6
- * `vaultKeeperBtcPubkeys.length` to match the VP's current validation.
2
+ * Challenger derivation utilities — counting local challengers for UI-level
3
+ * validation (e.g. minimum deposit amounts) and deriving the exact
4
+ * local-challenger set a claimer's tx graph is built from.
7
5
  */
8
6
  /**
9
7
  * Compute the number of local challengers for a vault.
@@ -20,4 +18,32 @@
20
18
  * @returns Number of local challengers
21
19
  */
22
20
  export declare function computeNumLocalChallengers(vaultProviderPubkey: string, vaultKeeperPubkeys: string[], depositorPubkey: string): number;
21
+ /** Roles a claimer can hold; determines which local-challenger rule applies. */
22
+ export interface DeriveLocalChallengersParams {
23
+ /** The graph's claimer (VP, a vault keeper, or the depositor). */
24
+ claimerBtcPubkey: string;
25
+ /** Depositor registered on-chain for the vault. */
26
+ depositorBtcPubkey: string;
27
+ /** Vault provider registered on-chain for the vault. */
28
+ vaultProviderBtcPubkey: string;
29
+ /** Vault keepers registered on-chain for the vault. */
30
+ vaultKeeperBtcPubkeys: string[];
31
+ }
32
+ /**
33
+ * Derive the local-challenger set for a claimer's graph.
34
+ *
35
+ * Byte-for-byte mirror of btc-vault `derive_challengers_for`
36
+ * (`crates/vault/src/tx_graph/graph.rs:257-284`):
37
+ * - depositor-as-claimer → vault keepers only (VP excluded)
38
+ * - VP- or VK-claimer → `({VP} ∪ VKs) − {claimer}`, sorted and deduplicated
39
+ *
40
+ * The protocol guarantees the depositor is not a vault keeper
41
+ * (`TxGraphParams::validate`), so the depositor filter in the first branch is
42
+ * defense-in-depth; it surfaces a clear error if a misconfigured context ever
43
+ * violates the invariant.
44
+ *
45
+ * @throws If no local challenger remains, or (depositor path) the keeper set
46
+ * contains duplicates — both mean the signing context is misconfigured.
47
+ */
48
+ export declare function deriveLocalChallengers(params: DeriveLocalChallengersParams): string[];
23
49
  //# sourceMappingURL=challengers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"challengers.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/primitives/challengers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CACxC,mBAAmB,EAAE,MAAM,EAC3B,kBAAkB,EAAE,MAAM,EAAE,EAC5B,eAAe,EAAE,MAAM,GACtB,MAAM,CAQR"}
1
+ {"version":3,"file":"challengers.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/primitives/challengers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CACxC,mBAAmB,EAAE,MAAM,EAC3B,kBAAkB,EAAE,MAAM,EAAE,EAC5B,eAAe,EAAE,MAAM,GACtB,MAAM,CAQR;AAED,gFAAgF;AAChF,MAAM,WAAW,4BAA4B;IAC3C,kEAAkE;IAClE,gBAAgB,EAAE,MAAM,CAAC;IACzB,mDAAmD;IACnD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wDAAwD;IACxD,sBAAsB,EAAE,MAAM,CAAC;IAC/B,uDAAuD;IACvD,qBAAqB,EAAE,MAAM,EAAE,CAAC;CACjC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,4BAA4B,GACnC,MAAM,EAAE,CAgCV"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../../challengeAssert-BFRE2DM-.cjs"),a=require("../../../constants-DU5CGcqO.cjs"),r=require("@babylonlabs-io/babylon-tbv-rust-wasm"),t=require("../../../verifyScriptPathSchnorrSignature-DPAd_qke.cjs"),i=require("../../../peginInput-Ci921gTl.cjs"),u=require("../../../noPayout-CnQ1WLtr.cjs"),e=require("../../../bitcoin-m84N5a8o.cjs");exports.buildChallengeAssertPsbt=n.buildChallengeAssertPsbt;exports.computeNumLocalChallengers=n.computeNumLocalChallengers;exports.assertValidVaultCoreVersion=a.assertValidVaultCoreVersion;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>r.computeMinClaimValue});Object.defineProperty(exports,"computeMinPeginFee",{enumerable:!0,get:()=>r.computeMinPeginFee});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>r.deriveVaultId});Object.defineProperty(exports,"peginP2aAnchorOutput",{enumerable:!0,get:()=>r.peginP2aAnchorOutput});Object.defineProperty(exports,"supportedTxGraphVersions",{enumerable:!0,get:()=>r.supportedTxGraphVersions});Object.defineProperty(exports,"validatePeginP2aAnchor",{enumerable:!0,get:()=>r.validatePeginP2aAnchor});exports.PsbtSubstitutionError=t.PsbtSubstitutionError;exports.assertPsbtUnsignedTxMatches=t.assertPsbtUnsignedTxMatches;exports.assertScriptPathSchnorrSignature=t.assertScriptPathSchnorrSignature;exports.buildPayoutPsbt=t.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=t.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=t.buildPrePeginPsbt;exports.createPayoutScript=t.createPayoutScript;exports.extractPayoutSignature=t.extractPayoutSignature;exports.buildPeginInputPsbt=i.buildPeginInputPsbt;exports.extractPeginInputSignature=i.extractPeginInputSignature;exports.finalizePeginInputPsbt=i.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=u.buildNoPayoutPsbt;exports.buildRefundPsbt=u.buildRefundPsbt;exports.canonicalizeBtcPubkey=e.canonicalizeBtcPubkey;exports.deriveBip86ScriptPubKeyHex=e.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=e.deriveNativeSegwitAddress;exports.deriveTaprootAddress=e.deriveTaprootAddress;exports.ensureHexPrefix=e.ensureHexPrefix;exports.formatSatoshisToBtc=e.formatSatoshisToBtc;exports.getSortedXOnlyPubkeys=e.getSortedXOnlyPubkeys;exports.hexToUint8Array=e.hexToUint8Array;exports.isAddressFromPublicKey=e.isAddressFromPublicKey;exports.isValidHex=e.isValidHex;exports.processPublicKeyToXOnly=e.processPublicKeyToXOnly;exports.stripHexPrefix=e.stripHexPrefix;exports.toXOnly=e.toXOnly;exports.uint8ArrayToHex=e.uint8ArrayToHex;exports.validateWalletPubkey=e.validateWalletPubkey;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../verifyScriptPathSchnorrSignature-la8XOAFm.cjs"),a=require("../../../constants-DU5CGcqO.cjs"),r=require("@babylonlabs-io/babylon-tbv-rust-wasm"),i=require("../../../verifyKeyPathSchnorrSignature-Cr5T4Aym.cjs"),n=require("../../../noPayout-Ox27Td9x.cjs"),u=require("../../../challengeAssert-BrpC3-cQ.cjs"),e=require("../../../bitcoin-m84N5a8o.cjs");exports.PsbtSubstitutionError=t.PsbtSubstitutionError;exports.assertPsbtUnsignedTxMatches=t.assertPsbtUnsignedTxMatches;exports.assertScriptPathSchnorrSignature=t.assertScriptPathSchnorrSignature;exports.buildPayoutPsbt=t.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=t.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=t.buildPrePeginPsbt;exports.computeNumLocalChallengers=t.computeNumLocalChallengers;exports.createPayoutScript=t.createPayoutScript;exports.extractPayoutSignature=t.extractPayoutSignature;exports.assertValidVaultCoreVersion=a.assertValidVaultCoreVersion;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>r.computeMinClaimValue});Object.defineProperty(exports,"computeMinPeginFee",{enumerable:!0,get:()=>r.computeMinPeginFee});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>r.deriveVaultId});Object.defineProperty(exports,"peginP2aAnchorOutput",{enumerable:!0,get:()=>r.peginP2aAnchorOutput});Object.defineProperty(exports,"supportedTxGraphVersions",{enumerable:!0,get:()=>r.supportedTxGraphVersions});Object.defineProperty(exports,"validatePeginP2aAnchor",{enumerable:!0,get:()=>r.validatePeginP2aAnchor});exports.assertKeyPathSchnorrSignature=i.assertKeyPathSchnorrSignature;exports.assertReturnedKeyPathSignatures=i.assertReturnedKeyPathSignatures;exports.buildPeginInputPsbt=i.buildPeginInputPsbt;exports.extractPeginInputSignature=i.extractPeginInputSignature;exports.finalizePeginInputPsbt=i.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=n.buildNoPayoutPsbt;exports.buildRefundPsbt=n.buildRefundPsbt;exports.buildChallengeAssertPsbt=u.buildChallengeAssertPsbt;exports.canonicalizeBtcPubkey=e.canonicalizeBtcPubkey;exports.deriveBip86ScriptPubKeyHex=e.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=e.deriveNativeSegwitAddress;exports.deriveTaprootAddress=e.deriveTaprootAddress;exports.ensureHexPrefix=e.ensureHexPrefix;exports.formatSatoshisToBtc=e.formatSatoshisToBtc;exports.getSortedXOnlyPubkeys=e.getSortedXOnlyPubkeys;exports.hexToUint8Array=e.hexToUint8Array;exports.isAddressFromPublicKey=e.isAddressFromPublicKey;exports.isValidHex=e.isValidHex;exports.processPublicKeyToXOnly=e.processPublicKeyToXOnly;exports.stripHexPrefix=e.stripHexPrefix;exports.toXOnly=e.toXOnly;exports.uint8ArrayToHex=e.uint8ArrayToHex;exports.validateWalletPubkey=e.validateWalletPubkey;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -96,6 +96,8 @@ export { PsbtSubstitutionError, assertPsbtUnsignedTxMatches, } from './psbt/asse
96
96
  export type { AssertPsbtUnsignedTxMatchesParams } from './psbt/assertPsbtUnsignedTxMatches';
97
97
  export { assertScriptPathSchnorrSignature } from './psbt/verifyScriptPathSchnorrSignature';
98
98
  export type { VerifyScriptPathSchnorrSignatureParams } from './psbt/verifyScriptPathSchnorrSignature';
99
+ export { assertKeyPathSchnorrSignature, assertReturnedKeyPathSignatures, } from './psbt/verifyKeyPathSchnorrSignature';
100
+ export type { AssertKeyPathSchnorrSignatureParams, AssertReturnedKeyPathSignaturesParams, } from './psbt/verifyKeyPathSchnorrSignature';
99
101
  export { buildNoPayoutPsbt } from './psbt/noPayout';
100
102
  export type { NoPayoutParams } from './psbt/noPayout';
101
103
  export { buildChallengeAssertPsbt } from './psbt/challengeAssert';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/primitives/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;G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B,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAGpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG/E,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,uBAAuB,EACvB,cAAc,EACd,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,KAAK,4BAA4B,GAClC,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/primitives/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAGjE,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,uCAAuC,CAAC;AAC/C,YAAY,EACV,mCAAmC,EACnC,8BAA8B,EAC9B,OAAO,EACP,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,uCAAuC,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,MAAM,EAAE,CAAC;AAGpC,OAAO,EACL,8BAA8B,EAC9B,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,kBAAkB,EAClB,aA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BAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,uBAAuB,EACvB,cAAc,EACd,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,KAAK,4BAA4B,GAClC,MAAM,iBAAiB,CAAC"}
@@ -1,47 +1,49 @@
1
- import { b as s, c as t } from "../../../challengeAssert-C7PzyJ7g.js";
2
- import { a as i } from "../../../constants-GjWXdaqV.js";
3
- import { computeMinClaimValue as u, computeMinPeginFee as n, deriveVaultId as P, peginP2aAnchorOutput as d, supportedTxGraphVersions as l, validatePeginP2aAnchor as b } from "@babylonlabs-io/babylon-tbv-rust-wasm";
4
- import { P as c, d as x, f as g, c as f, b as m, a as y, g as h, e as S } from "../../../verifyScriptPathSchnorrSignature-i-koT139.js";
5
- import { b as A, e as T, f as V } from "../../../peginInput-HQPWZfly.js";
6
- import { a as C, b as F } from "../../../noPayout-BaZGRLD2.js";
7
- import { c as O, d as k, a as B, b as K, e as M, f as N, g as X, h as z, i as U, j, p as w, s as E, t as G, u as L, v as R } from "../../../bitcoin-d9eaaZB_.js";
1
+ import { P as s, f as t, g as r, d as i, b as o, a as u, c as n, h as P, e as d } from "../../../verifyScriptPathSchnorrSignature-Dy9gF5RF.js";
2
+ import { a as b } from "../../../constants-GjWXdaqV.js";
3
+ import { computeMinClaimValue as c, computeMinPeginFee as g, deriveVaultId as x, peginP2aAnchorOutput as y, supportedTxGraphVersions as f, validatePeginP2aAnchor as h } from "@babylonlabs-io/babylon-tbv-rust-wasm";
4
+ import { a as S, c as v, b as A, e as T, f as V } from "../../../verifyKeyPathSchnorrSignature-C6Cmk0R1.js";
5
+ import { a as K, b as C } from "../../../noPayout-CXn-geIS.js";
6
+ import { b as I } from "../../../challengeAssert-BNQ8sToz.js";
7
+ import { c as k, d as B, a as M, b as N, e as X, f as z, g as R, h as U, i as j, j as w, p as E, s as G, t as L, u as W, v as q } from "../../../bitcoin-Ch_jxnDa.js";
8
8
  export {
9
- c as PsbtSubstitutionError,
10
- x as assertPsbtUnsignedTxMatches,
11
- g as assertScriptPathSchnorrSignature,
12
- i as assertValidVaultCoreVersion,
13
- s as buildChallengeAssertPsbt,
14
- C as buildNoPayoutPsbt,
15
- f as buildPayoutPsbt,
9
+ s as PsbtSubstitutionError,
10
+ S as assertKeyPathSchnorrSignature,
11
+ t as assertPsbtUnsignedTxMatches,
12
+ v as assertReturnedKeyPathSignatures,
13
+ r as assertScriptPathSchnorrSignature,
14
+ b as assertValidVaultCoreVersion,
15
+ I as buildChallengeAssertPsbt,
16
+ K as buildNoPayoutPsbt,
17
+ i as buildPayoutPsbt,
16
18
  A as buildPeginInputPsbt,
17
- m as buildPeginTxFromFundedPrePegin,
18
- y as buildPrePeginPsbt,
19
- F as buildRefundPsbt,
20
- O as canonicalizeBtcPubkey,
21
- u as computeMinClaimValue,
22
- n as computeMinPeginFee,
23
- t as computeNumLocalChallengers,
24
- h as createPayoutScript,
25
- k as deriveBip86ScriptPubKeyHex,
26
- B as deriveNativeSegwitAddress,
27
- K as deriveTaprootAddress,
28
- P as deriveVaultId,
29
- M as ensureHexPrefix,
30
- S as extractPayoutSignature,
19
+ o as buildPeginTxFromFundedPrePegin,
20
+ u as buildPrePeginPsbt,
21
+ C as buildRefundPsbt,
22
+ k as canonicalizeBtcPubkey,
23
+ c as computeMinClaimValue,
24
+ g as computeMinPeginFee,
25
+ n as computeNumLocalChallengers,
26
+ P as createPayoutScript,
27
+ B as deriveBip86ScriptPubKeyHex,
28
+ M as deriveNativeSegwitAddress,
29
+ N as deriveTaprootAddress,
30
+ x as deriveVaultId,
31
+ X as ensureHexPrefix,
32
+ d as extractPayoutSignature,
31
33
  T as extractPeginInputSignature,
32
34
  V as finalizePeginInputPsbt,
33
- N as formatSatoshisToBtc,
34
- X as getSortedXOnlyPubkeys,
35
- z as hexToUint8Array,
36
- U as isAddressFromPublicKey,
37
- j as isValidHex,
38
- d as peginP2aAnchorOutput,
39
- w as processPublicKeyToXOnly,
40
- E as stripHexPrefix,
41
- l as supportedTxGraphVersions,
42
- G as toXOnly,
43
- L as uint8ArrayToHex,
44
- b as validatePeginP2aAnchor,
45
- R as validateWalletPubkey
35
+ z as formatSatoshisToBtc,
36
+ R as getSortedXOnlyPubkeys,
37
+ U as hexToUint8Array,
38
+ j as isAddressFromPublicKey,
39
+ w as isValidHex,
40
+ y as peginP2aAnchorOutput,
41
+ E as processPublicKeyToXOnly,
42
+ G as stripHexPrefix,
43
+ f as supportedTxGraphVersions,
44
+ L as toXOnly,
45
+ W as uint8ArrayToHex,
46
+ h as validatePeginP2aAnchor,
47
+ q as validateWalletPubkey
46
48
  };
47
49
  //# sourceMappingURL=index.js.map
@@ -64,4 +64,9 @@ export declare const TEST_AMOUNTS: {
64
64
  * ```
65
65
  */
66
66
  export declare function initializeWasmForTests(): Promise<void>;
67
+ /**
68
+ * Deterministic distinct valid x-only pubkeys (scalar * G for scalars
69
+ * offset..offset+count-1), sorted ascending as the protocol requires.
70
+ */
71
+ export declare function generateXOnlyKeys(count: number, offset: number): string[];
67
72
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/primitives/psbt/__tests__/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;GAIG;AACH,eAAO,MAAM,SAAS;;IAGpB,wCAAwC;;IAIxC,qBAAqB;;IAIrB,qBAAqB;;IAIrB,6BAA6B;;IAI7B,6BAA6B;;CAGrB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY;IACvB,qCAAqC;;IAGrC,qCAAqC;;IAGrC,wCAAwC;;IAGxC,2CAA2C;;IAG3C,sDAAsD;;IAGtD,sDAAsD;;IAGtD,sCAAsC;;IAGtC,+CAA+C;;CAEvC,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5D"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/primitives/psbt/__tests__/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;;;GAIG;AACH,eAAO,MAAM,SAAS;;IAGpB,wCAAwC;;IAIxC,qBAAqB;;IAIrB,qBAAqB;;IAIrB,6BAA6B;;IAI7B,6BAA6B;;CAGrB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY;IACvB,qCAAqC;;IAGrC,qCAAqC;;IAGrC,wCAAwC;;IAGxC,2CAA2C;;IAG3C,sDAAsD;;IAGtD,sDAAsD;;IAGtD,sCAAsC;;IAGtC,+CAA+C;;CAEvC,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAUzE"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Tests for the key-path twin of the script-path verifier: BIP-340 verification
3
+ * of wallet-returned Taproot KEY-PATH signatures against an independently
4
+ * recomputed sighash over the PSBT we requested.
5
+ *
6
+ * The positive cases sign the real BIP-341 key-path sighash with a BIP-86
7
+ * tweaked test key. The negative cases model what the guard exists for: a
8
+ * tampered signature, a missing signature, a substituted input set, and a
9
+ * malformed finalized witness.
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=verifyKeyPathSchnorrSignature.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyKeyPathSchnorrSignature.test.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/primitives/psbt/__tests__/verifyKeyPathSchnorrSignature.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
@@ -81,13 +81,20 @@ export interface PayoutParams {
81
81
  */
82
82
  protocolFeeRate: bigint;
83
83
  /**
84
- * Security council member count from the locked offchain params version.
85
- * Mirrors the upstream estimator's signature; at the current model pins the
86
- * council occupies a single taptree leaf regardless of size, so the floor
87
- * is council-size-invariant — passed for forward compatibility with future
88
- * pinned models.
84
+ * Security council member x-only public keys (hex) from the locked offchain
85
+ * params version — `getOffchainParamsByVersion(...).securityCouncilKeys`.
86
+ * The council occupies the last leaf of the Assert:0 taptree
87
+ * (btc-vault `crates/vault/src/connectors/assert_payout_nopayout_council.rs`),
88
+ * so the keys are needed to rebuild input 1's payout leaf, and the count
89
+ * feeds the fee-band domain.
89
90
  */
90
- councilSize: number;
91
+ councilMembers: string[];
92
+ /**
93
+ * M-of-N council quorum from the locked offchain params version —
94
+ * `getOffchainParamsByVersion(...).councilQuorum`. Shapes the council leaf's
95
+ * multisig script, and with it the Assert:0 taptree root.
96
+ */
97
+ councilQuorum: number;
91
98
  /**
92
99
  * RFC-006. Expected `outs[0].script` per vault-keeper claimer, keyed by
93
100
  * lowercased x-only **operation** pubkey (no `0x`), resolved from
@@ -134,6 +141,9 @@ export interface PayoutPsbtResult {
134
141
  * - Input 0: from PeginTx output0 (signed by depositor)
135
142
  * - Input 1: from Assert output0 (NOT signed by depositor)
136
143
  *
144
+ * Both inputs carry their taproot script-path leaf. Input 1's is not signed
145
+ * here — it is what a hardware signer reads to display the payout terms.
146
+ *
137
147
  * @param params - Payout parameters
138
148
  * @returns Unsigned PSBT ready for depositor to sign
139
149
  *
@@ -145,7 +155,7 @@ export interface PayoutPsbtResult {
145
155
  * @throws If the implicit fee (inputs − outputs) is outside the fee band —
146
156
  * below the floor or above the fee-band ceiling (see
147
157
  * {@link assertPayoutFeeInBand})
148
- * @throws If `protocolFeeRate`, a participant count, or `councilSize` is
158
+ * @throws If `protocolFeeRate`, a participant count, or the council size is
149
159
  * outside the accepted input domain (see {@link assertPayoutFeeBandDomain})
150
160
  * @throws If a non-anchor scriptPubKey length is outside `[1,
151
161
  * {@link MAX_PAYOUT_SCRIPT_LEN}]`
@@ -153,6 +163,8 @@ export interface PayoutPsbtResult {
153
163
  * @throws If payout output count, outs[0] script, outs[last] anchor value, or
154
164
  * (VP-claimer) outs[1] commission cap do not match the protocol layout
155
165
  * @throws If `commissionBps` is not a non-negative integer below 10_000
166
+ * @throws If the locally rebuilt Assert:0 payout leaf does not bind to the
167
+ * Assert output input 1 spends
156
168
  */
157
169
  export declare function buildPayoutPsbt(params: PayoutParams): Promise<PayoutPsbtResult>;
158
170
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"payout.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/payout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,KAAK,OAAO,EAEb,MAAM,uCAAuC,CAAC;AA0C/C;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAEhC;;OAEG;IACH,6BAA6B,EAAE,MAAM,EAAE,CAAC;IAExC;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,4BAA4B,EAAE,MAAM,CAAC;IAErC;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;;;;;;;;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;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,4BAA4B,EAAE,MAAM,CAAC;IAErC;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;;;;;OAOG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IAEzB;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;;;;;;;;;OAcG;IACH,4BAA4B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAE/D;;;;;OAKG;IACH,wBAAwB,EAAE,MAAM,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,gBAAgB,CAAC,CAoH3B;AA4bD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,MAAM,EACvB,UAAU,SAAI,GACb,MAAM,CA+CR"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Far-side verification of Taproot KEY-PATH Schnorr signatures a wallet
3
+ * returned, over the PSBT we requested (trusted prevouts) — the key-path twin
4
+ * of `assertScriptPathSchnorrSignature`. Reference: btc-vault
5
+ * `crates/btc-wallet-remote/src/client.rs check_signatures_valid` (output key taken
6
+ * from the prevout scriptPubKey, all prevouts committed). The wallet's
7
+ * success/finalization is never trusted on its own (CLAUDE.md §8).
8
+ * `assertReturnedKeyPathSignatures` additionally dispatches P2WPKH-funded
9
+ * inputs to `verifyP2wpkhEcdsaSignature` (client.rs's
10
+ * `verify_finalized_p2wpkh_spend` sibling), so a Native SegWit software
11
+ * wallet's signatures no longer pass through unchecked.
12
+ *
13
+ * Why verify against the *requested* PSBT: `assertPsbtUnsignedTxMatches` pins
14
+ * the unsigned transaction but deliberately skips per-input metadata, so a
15
+ * wallet could rewrite `witnessUtxo` in its response and make a wrong-message
16
+ * signature self-validate. Prevout scripts and values therefore come from the
17
+ * PSBT we built; only the signature bytes come from the wallet.
18
+ *
19
+ * @module tbv/core/primitives/psbt/verifyKeyPathSchnorrSignature
20
+ */
21
+ export interface AssertKeyPathSchnorrSignatureParams {
22
+ /** Hex of the PSBT we built and sent (trusted prevout scripts/values). NOT the wallet's. */
23
+ requestedPsbtHex: string;
24
+ /** 64- or 65-byte signature, hex. */
25
+ signatureHex: string;
26
+ /** Index of the input the signature is for. */
27
+ inputIndex: number;
28
+ }
29
+ /**
30
+ * Assert that `signatureHex` is a valid BIP-340 Schnorr signature over the
31
+ * Taproot key-path sighash of `requestedPsbtHex` input `inputIndex`, under the
32
+ * tweaked output key taken from that input's prevout scriptPubKey.
33
+ *
34
+ * @throws If the input is not a key-path P2TR spend, the requested PSBT lacks
35
+ * the prevout data needed to recompute the sighash, or the signature
36
+ * does not verify.
37
+ */
38
+ export declare function assertKeyPathSchnorrSignature(params: AssertKeyPathSchnorrSignatureParams): void;
39
+ export interface AssertReturnedKeyPathSignaturesParams {
40
+ /** PSBT we built locally and asked the wallet to sign. */
41
+ requestedPsbtHex: string;
42
+ /** PSBT the wallet returned after signing. */
43
+ returnedPsbtHex: string;
44
+ }
45
+ /**
46
+ * Verify every key-path-eligible and P2WPKH input of the REQUESTED PSBT
47
+ * against what the wallet RETURNED. Key-path: `tapKeySig`, or the single
48
+ * finalized witness item for wallets that auto-finalize — and when both are
49
+ * present they must be the same bytes. P2WPKH: `partialSig`, or the finalized
50
+ * 2-item witness, verified as ECDSA over the BIP-143 sighash
51
+ * ({@link assertReturnedP2wpkhSignature}); a failure throws but the input is
52
+ * NOT counted. Any other input type (script-path, P2WSH, ...) throws — no
53
+ * verifier here covers it, so it cannot be treated as verified.
54
+ *
55
+ * @returns How many inputs were verified KEY-PATH. A caller that knows every
56
+ * input is taproot key-path (e.g. an approval wallet) must assert
57
+ * this equals its input count — P2WPKH inputs never count toward it,
58
+ * so that gate stays exact.
59
+ * @throws If the input counts differ, an input is neither key-path P2TR nor
60
+ * P2WPKH, an eligible input carries no signature, a finalized witness
61
+ * disagrees with its `tapKeySig`/`partialSig`, or any signature does
62
+ * not verify.
63
+ */
64
+ export declare function assertReturnedKeyPathSignatures(params: AssertReturnedKeyPathSignaturesParams): number;
65
+ //# sourceMappingURL=verifyKeyPathSchnorrSignature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyKeyPathSchnorrSignature.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/verifyKeyPathSchnorrSignature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAwDH,MAAM,WAAW,mCAAmC;IAClD,4FAA4F;IAC5F,gBAAgB,EAAE,MAAM,CAAC;IACzB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,mCAAmC,GAC1C,IAAI,CA0DN;AA2CD,MAAM,WAAW,qCAAqC;IACpD,0DAA0D;IAC1D,gBAAgB,EAAE,MAAM,CAAC;IACzB,8CAA8C;IAC9C,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,qCAAqC,GAC5C,MAAM,CAmER"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Far-side verification of P2WPKH ECDSA signatures a wallet returned, over
3
+ * the PSBT we requested (trusted prevouts) — the Native SegWit sibling of
4
+ * `verifyKeyPathSchnorrSignature`. Reference: btc-vault
5
+ * `crates/btc-wallet-remote/src/client.rs:945-1000
6
+ * verify_finalized_p2wpkh_spend`. The wallet's success/finalization is
7
+ * never trusted on its own (CLAUDE.md §8): prevout script and value come
8
+ * from the PSBT we built; only the signature bytes come from the wallet.
9
+ *
10
+ * @module tbv/core/primitives/psbt/verifyP2wpkhEcdsaSignature
11
+ */
12
+ /** Only claim P2WPKH: 22-byte scriptPubKey starting `OP_0 PUSH20`. */
13
+ export declare function isP2wpkhScript(script: Uint8Array | undefined): script is Uint8Array;
14
+ export interface AssertReturnedP2wpkhSignatureParams {
15
+ /** Hex of the PSBT we built and sent (trusted prevout script/value). NOT the wallet's. */
16
+ requestedPsbtHex: string;
17
+ /** The wallet-returned PSBT input carrying the signature material. */
18
+ returnedInput: {
19
+ partialSig?: Array<{
20
+ pubkey: Uint8Array;
21
+ signature: Uint8Array;
22
+ }>;
23
+ finalScriptWitness?: Uint8Array;
24
+ };
25
+ /** Index of the input the signature is for. */
26
+ inputIndex: number;
27
+ }
28
+ /**
29
+ * Assert that the returned input carries a valid P2WPKH ECDSA signature
30
+ * over the BIP-143 sighash of `requestedPsbtHex` input `inputIndex`:
31
+ * `partialSig` (BIP-174: the value is the exact witness-stack signature
32
+ * bytes, the key its pubkey), or the finalized 2-item witness — and when
33
+ * both are present they must be the same bytes.
34
+ *
35
+ * @throws If the requested input is not a P2WPKH spend, no signature was
36
+ * returned, a finalized witness disagrees with its `partialSig`,
37
+ * or any check of `verify_finalized_p2wpkh_spend` fails.
38
+ */
39
+ export declare function assertReturnedP2wpkhSignature(params: AssertReturnedP2wpkhSignatureParams): void;
40
+ //# sourceMappingURL=verifyP2wpkhEcdsaSignature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyP2wpkhEcdsaSignature.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/verifyP2wpkhEcdsaSignature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA2BH,sEAAsE;AACtE,wBAAgB,cAAc,CAC5B,MAAM,EAAE,UAAU,GAAG,SAAS,GAC7B,MAAM,IAAI,UAAU,CAOtB;AAqBD,MAAM,WAAW,mCAAmC;IAClD,0FAA0F;IAC1F,gBAAgB,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,aAAa,EAAE;QACb,UAAU,CAAC,EAAE,KAAK,CAAC;YAAE,MAAM,EAAE,UAAU,CAAC;YAAC,SAAS,EAAE,UAAU,CAAA;SAAE,CAAC,CAAC;QAClE,kBAAkB,CAAC,EAAE,UAAU,CAAC;KACjC,CAAC;IACF,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,mCAAmC,GAC1C,IAAI,CA6CN"}
@@ -23,7 +23,8 @@
23
23
  * Reuses the exact primitives `bip322Verify.ts` already depends on — no new
24
24
  * dependency:
25
25
  * - `@bitcoin-js/tiny-secp256k1-asmjs` → `verifySchnorr`
26
- * - `bitcoinjs-lib` → `Transaction.hashForWitnessV1`, `crypto.taggedHash` (TapLeaf hash)
26
+ * - `bitcoinjs-lib` → `Transaction.hashForWitnessV1`
27
+ * - `../utils/taproot` → `computeTapLeafHash`
27
28
  *
28
29
  * @module tbv/core/primitives/psbt/verifyScriptPathSchnorrSignature
29
30
  */
@@ -1 +1 @@
1
- {"version":3,"file":"verifyScriptPathSchnorrSignature.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/verifyScriptPathSchnorrSignature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA4DH,MAAM,WAAW,sCAAsC;IACrD;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,0FAA0F;IAC1F,YAAY,EAAE,MAAM,CAAC;IACrB,oFAAoF;IACpF,oBAAoB,EAAE,MAAM,CAAC;IAC7B,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,sCAAsC,GAC7C,IAAI,CAmGN"}
1
+ {"version":3,"file":"verifyScriptPathSchnorrSignature.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/verifyScriptPathSchnorrSignature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAgBH,MAAM,WAAW,sCAAsC;IACrD;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,0FAA0F;IAC1F,YAAY,EAAE,MAAM,CAAC;IACrB,oFAAoF;IACpF,oBAAoB,EAAE,MAAM,CAAC;IAC7B,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,sCAAsC,GAC7C,IAAI,CAmGN"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Tests for the BIP-341 taproot primitives.
3
+ *
4
+ * Two independent oracles:
5
+ * - the official BIP-341 wallet test vectors
6
+ * (https://github.com/bitcoin/bips/blob/master/bip-0341/wallet-test-vectors.json),
7
+ * which publish an internal key, a script tree and the control block for
8
+ * every leaf alongside the resulting scriptPubKey;
9
+ * - bitcoinjs-lib's own `payments.p2tr`, which builds a taptree and emits both
10
+ * the output script and a leaf's control block.
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=taproot.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taproot.test.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/primitives/utils/__tests__/taproot.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
@@ -0,0 +1,29 @@
1
+ import { Buffer } from 'buffer';
2
+ /**
3
+ * Compute the BIP-341 TapLeaf hash for a tapscript leaf:
4
+ * `tagged_hash("TapLeaf", leaf_version || compact_size(script) || script)`.
5
+ */
6
+ export declare function computeTapLeafHash(leafVersion: number, script: Uint8Array): Buffer;
7
+ export interface TaprootScriptPathBinding {
8
+ /** Tapscript leaf version, e.g. `0xc0`. */
9
+ leafVersion: number;
10
+ /** The tapscript leaf being spent. */
11
+ script: Uint8Array;
12
+ /** BIP-341 control block: version/parity byte, internal key, merkle path. */
13
+ controlBlock: Uint8Array;
14
+ }
15
+ /**
16
+ * Recompute the P2TR scriptPubKey that a `(leafVersion, script, controlBlock)`
17
+ * triple can spend, by walking the control block's merkle path to the taptree
18
+ * root and tweaking the control block's internal key with it (BIP-341
19
+ * "Script validation rules").
20
+ *
21
+ * Comparing the result against a real previous output is what proves the triple
22
+ * belongs to that output rather than to some other taptree.
23
+ *
24
+ * @throws If the control block is malformed, the leaf version disagrees with
25
+ * the control block, the tweak is off-curve, or the recovered output key's
26
+ * parity contradicts the control block.
27
+ */
28
+ export declare function computeTaprootScriptPubKey(binding: TaprootScriptPathBinding): Buffer;
29
+ //# sourceMappingURL=taproot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taproot.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/utils/taproot.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAoDhC;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,UAAU,GACjB,MAAM,CAOR;AAED,MAAM,WAAW,wBAAwB;IACvC,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,MAAM,EAAE,UAAU,CAAC;IACnB,6EAA6E;IAC7E,YAAY,EAAE,UAAU,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,wBAAwB,GAChC,MAAM,CAoER"}
@@ -37,14 +37,14 @@ export interface PayoutSigningContext {
37
37
  * Security council member x-only public keys (hex, no prefix).
38
38
  * Source: ProtocolParams contract via
39
39
  * `getOffchainParamsByVersion(...).securityCouncilKeys`.
40
- * Required for the depositor-graph NoPayout local rebuild.
40
+ * Required to rebuild every Assert:0 leaf (payout and NoPayout) locally.
41
41
  */
42
42
  councilMembers: string[];
43
43
  /**
44
44
  * M-of-N council quorum threshold.
45
45
  * Source: ProtocolParams contract via
46
46
  * `getOffchainParamsByVersion(...).councilQuorum`.
47
- * Required for the depositor-graph NoPayout local rebuild.
47
+ * Required to rebuild every Assert:0 leaf (payout and NoPayout) locally.
48
48
  */
49
49
  councilQuorum: number;
50
50
  /** BTC network (Mainnet, Testnet, etc.) */
@@ -1 +1 @@
1
- {"version":3,"file":"runDepositorPresignFlow.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/deposit/runDepositorPresignFlow.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAErE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAM3E,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAQrE;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,sBAAsB,EAAE,MAAM,CAAC;IAC/B,kEAAkE;IAClE,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,0EAA0E;IAC1E,6BAA6B,EAAE,MAAM,EAAE,CAAC;IACxC,yDAAyD;IACzD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,6DAA6D;IAC7D,aAAa,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB;;;;;OAKG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,8DAA8D;IAC9D,4BAA4B,EAAE,MAAM,CAAC;IACrC,iGAAiG;IACjG,aAAa,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,4BAA4B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/D;;;OAGG;IACH,wBAAwB,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,6BAA6B;IAC5C,yDAAyD;IACzD,YAAY,EAAE,iBAAiB,CAAC;IAChC,oEAAoE;IACpE,aAAa,EAAE,aAAa,CAAC;IAC7B,iCAAiC;IACjC,SAAS,EAAE,aAAa,CAAC;IACzB,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,cAAc,EAAE,oBAAoB,CAAC;IACrC;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,sEAAsE;IACtE,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzD;AAmRD;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,IAAI,CAAC,CAuIf"}
1
+ {"version":3,"file":"runDepositorPresignFlow.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/deposit/runDepositorPresignFlow.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAErE,OAAO,KAAK,EAAE,aAAa,EAAE,M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nE,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,cAAc,EAAE,oBAAoB,CAAC;IACrC;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,sEAAsE;IACtE,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzD;AAoRD;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,IAAI,CAAC,CAuIf"}
@@ -1 +1 @@
1
- {"version":3,"file":"signDepositorGraph.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/deposit/signDepositorGraph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAGrE,OAAO,KAAK,EACV,aAAa,EAEd,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAG3B,MAAM,oCAAoC,CAAC;AA6c5C;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,8DAA8D;IAC9D,sBAAsB,EAAE,MAAM,CAAC;IAC/B,kEAAkE;IAClE,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,0EAA0E;IAC1E,6BAA6B,EAAE,MAAM,EAAE,CAAC;IACxC,0EAA0E;IAC1E,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC;;;;;OAKG;IACH,4BAA4B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/D,uEAAuE;IACvE,wBAAwB,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,wBAAwB;IACvC,2CAA2C;IAC3C,cAAc,EAAE,0BAA0B,CAAC;IAC3C,iCAAiC;IACjC,SAAS,EAAE,aAAa,CAAC;IACzB,8DAA8D;IAC9D,cAAc,EAAE,4BAA4B,CAAC;CAC9C;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,+BAA+B,CAAC,CAuC1C"}
1
+ {"version":3,"file":"signDepositorGraph.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/deposit/signDepositorGraph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAGrE,OAAO,KAAK,EACV,aAAa,EAEd,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAG3B,MAAM,oCAAoC,CAAC;AA4a5C;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,8DAA8D;IAC9D,sBAAsB,EAAE,MAAM,CAAC;IAC/B,kEAAkE;IAClE,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,0EAA0E;IAC1E,6BAA6B,EAAE,MAAM,EAAE,CAAC;IACxC,0EAA0E;IAC1E,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC;;;;;OAKG;IACH,4BAA4B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/D,uEAAuE;IACvE,wBAAwB,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,wBAAwB;IACvC,2CAA2C;IAC3C,cAAc,EAAE,0BAA0B,CAAC;IAC3C,iCAAiC;IACjC,SAAS,EAAE,aAAa,CAAC;IACzB,8DAA8D;IAC9D,cAAc,EAAE,4BAA4B,CAAC;CAC9C;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,+BAA+B,CAAC,CAuC1C"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../signPsbtsWithFallback-PTgWxsG3.cjs"),t=require("../../../buildAndBroadcastRefund-Daw5ZUKR.cjs"),i=require("../../../peginState-eaQ4IO_R.cjs");exports.computeHashlock=e.computeHashlock;exports.validateSecretAgainstHashlock=e.validateSecretAgainstHashlock;exports.BIP68NotMatureError=t.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=t.ClaimerPegoutStatusValue;exports.PEGIN_ETH_CONFIRMATIONS=t.PEGIN_ETH_CONFIRMATIONS;exports.ParticipantKeyDriftError=t.ParticipantKeyDriftError;exports.PeginRegistrationMissingError=t.PeginRegistrationMissingError;exports.PeginRegistrationNotFinalError=t.PeginRegistrationNotFinalError;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=t.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=t.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=t.REFUND_MAX_FEE_RATE_SATS_VB;exports.REFUND_VSIZE=t.REFUND_VSIZE;exports.RegisteredVaultVersionMismatchError=t.RegisteredVaultVersionMismatchError;exports.activateVault=t.activateVault;exports.activateVaultAndRedeem=t.activateVaultAndRedeem;exports.assertVaultProviderHintAccepted=t.assertVaultProviderHintAccepted;exports.buildAndBroadcastRefund=t.buildAndBroadcastRefund;exports.estimateRefundFeeSats=t.estimateRefundFeeSats;exports.isDepositAmountValid=t.isDepositAmountValid;exports.isHintAccepted=t.isHintAccepted;exports.isParticipantKeyDriftError=t.isParticipantKeyDriftError;exports.isPeginRegistrationMissingError=t.isPeginRegistrationMissingError;exports.isPeginRegistrationNotFinalError=t.isPeginRegistrationNotFinalError;exports.isPegoutTerminalStatus=t.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=t.isRecognizedPegoutStatus;exports.isRegisteredVaultVersionMismatchError=t.isRegisteredVaultVersionMismatchError;exports.matchKeyHint=t.matchKeyHint;exports.matchKeySetHint=t.matchKeySetHint;exports.resolveCurrentParticipantKeys=t.resolveCurrentParticipantKeys;exports.resolveParticipantKeysAtEpochs=t.resolveParticipantKeysAtEpochs;exports.runDepositorPresignFlow=t.runDepositorPresignFlow;exports.signDepositorGraph=t.signDepositorGraph;exports.submitWotsPublicKey=t.submitWotsPublicKey;exports.validateDepositAmount=t.validateDepositAmount;exports.validateMultiVaultDepositInputs=t.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=t.validateOnChainParticipantKeys;exports.validateProviderSelection=t.validateProviderSelection;exports.validateRemainingCapacity=t.validateRemainingCapacity;exports.validateVaultAmounts=t.validateVaultAmounts;exports.validateVaultProviderPubkey=t.validateVaultProviderPubkey;exports.verifyRegisteredParticipantKeys=t.verifyRegisteredParticipantKeys;exports.verifyRegisteredVaultVersions=t.verifyRegisteredVaultVersions;exports.waitForPeginRegistrationDepth=t.waitForPeginRegistrationDepth;exports.waitForPeginStatus=t.waitForPeginStatus;exports.ContractStatus=i.ContractStatus;exports.PeginAction=i.PeginAction;exports.canPerformAction=i.canPerformAction;exports.getPeginProtocolState=i.getPeginProtocolState;exports.isActivationDeadlinePassedOnChain=i.isActivationDeadlinePassedOnChain;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../signPsbtsWithFallback-DJ4kE9UI.cjs"),t=require("../../../buildAndBroadcastRefund-DrXwxrW1.cjs"),i=require("../../../peginState-eaQ4IO_R.cjs");exports.computeHashlock=e.computeHashlock;exports.validateSecretAgainstHashlock=e.validateSecretAgainstHashlock;exports.BIP68NotMatureError=t.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=t.ClaimerPegoutStatusValue;exports.PEGIN_ETH_CONFIRMATIONS=t.PEGIN_ETH_CONFIRMATIONS;exports.ParticipantKeyDriftError=t.ParticipantKeyDriftError;exports.PeginRegistrationMissingError=t.PeginRegistrationMissingError;exports.PeginRegistrationNotFinalError=t.PeginRegistrationNotFinalError;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=t.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=t.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=t.REFUND_MAX_FEE_RATE_SATS_VB;exports.REFUND_VSIZE=t.REFUND_VSIZE;exports.RegisteredVaultVersionMismatchError=t.RegisteredVaultVersionMismatchError;exports.activateVault=t.activateVault;exports.activateVaultAndRedeem=t.activateVaultAndRedeem;exports.assertVaultProviderHintAccepted=t.assertVaultProviderHintAccepted;exports.buildAndBroadcastRefund=t.buildAndBroadcastRefund;exports.estimateRefundFeeSats=t.estimateRefundFeeSats;exports.isDepositAmountValid=t.isDepositAmountValid;exports.isHintAccepted=t.isHintAccepted;exports.isParticipantKeyDriftError=t.isParticipantKeyDriftError;exports.isPeginRegistrationMissingError=t.isPeginRegistrationMissingError;exports.isPeginRegistrationNotFinalError=t.isPeginRegistrationNotFinalError;exports.isPegoutTerminalStatus=t.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=t.isRecognizedPegoutStatus;exports.isRegisteredVaultVersionMismatchError=t.isRegisteredVaultVersionMismatchError;exports.matchKeyHint=t.matchKeyHint;exports.matchKeySetHint=t.matchKeySetHint;exports.resolveCurrentParticipantKeys=t.resolveCurrentParticipantKeys;exports.resolveParticipantKeysAtEpochs=t.resolveParticipantKeysAtEpochs;exports.runDepositorPresignFlow=t.runDepositorPresignFlow;exports.signDepositorGraph=t.signDepositorGraph;exports.submitWotsPublicKey=t.submitWotsPublicKey;exports.validateDepositAmount=t.validateDepositAmount;exports.validateMultiVaultDepositInputs=t.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=t.validateOnChainParticipantKeys;exports.validateProviderSelection=t.validateProviderSelection;exports.validateRemainingCapacity=t.validateRemainingCapacity;exports.validateVaultAmounts=t.validateVaultAmounts;exports.validateVaultProviderPubkey=t.validateVaultProviderPubkey;exports.verifyRegisteredParticipantKeys=t.verifyRegisteredParticipantKeys;exports.verifyRegisteredVaultVersions=t.verifyRegisteredVaultVersions;exports.waitForPeginRegistrationDepth=t.waitForPeginRegistrationDepth;exports.waitForPeginStatus=t.waitForPeginStatus;exports.ContractStatus=i.ContractStatus;exports.PeginAction=i.PeginAction;exports.canPerformAction=i.canPerformAction;exports.getPeginProtocolState=i.getPeginProtocolState;exports.isActivationDeadlinePassedOnChain=i.isActivationDeadlinePassedOnChain;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
- import { c as s, v as i } from "../../../signPsbtsWithFallback-Bb66DfY5.js";
2
- import { H as r, E as o, P as n, o as c, c as l, d as u, K as g, L as P, M as d, N as E, R, a as p, b as A, y as v, I as m, J as F, g as N, z as V, p as _, i as D, e as y, G as S, F as M, t as h, A as f, B as C, C as I, D as K, r as O, s as T, f as H, h as b, j as U, v as k, k as w, l as x, m as B, n as G, q as X, u as z, w as j, x as q } from "../../../buildAndBroadcastRefund-C4LiPATK.js";
1
+ import { c as s, v as i } from "../../../signPsbtsWithFallback-Bv79gLFe.js";
2
+ import { H as r, E as o, P as n, o as c, c as l, d as u, K as g, L as P, M as d, N as E, R, a as p, b as A, y as v, I as m, J as F, g as N, z as V, p as _, i as D, e as y, G as S, F as M, t as h, A as f, B as C, C as I, D as K, r as O, s as T, f as H, h as b, j as U, v as k, k as w, l as x, m as B, n as G, q as X, u as z, w as j, x as q } from "../../../buildAndBroadcastRefund-CpMDJ8up.js";
3
3
  import { C as L, P as W, c as Z, g as Q, i as Y } from "../../../peginState-CxDiaKuk.js";
4
4
  export {
5
5
  r as BIP68NotMatureError,
@@ -2,8 +2,8 @@ import { B as t, H as e, K as T, M as _, T as o, c as E } from "../../../validat
2
2
  import { c as p } from "../../../signing-DaLvGwQe.js";
3
3
  import { B as i, a as n, f as A, c, b as u, d as R, g as I, i as O, h as P, s as U, e as l, w as F } from "../../../waitForTransactionReceiptSmartAware-lobLm0q0.js";
4
4
  import { B, D as N, L as d, M as f, c as x, P as m, b as L, a as C, S as D, T as H, W as h, f as X, d as b, p as M, r as v } from "../../../fundPeginTransaction-B2wyjqp0.js";
5
- import { U as Y, a as w, e as y, f as G, v as V } from "../../../reservation-B4i_PQhY.js";
6
- import { k } from "../../../bitcoin-d9eaaZB_.js";
5
+ import { U as Y, a as w, e as y, f as G, v as V } from "../../../reservation-CBAvoF3U.js";
6
+ import { k } from "../../../bitcoin-Ch_jxnDa.js";
7
7
  export {
8
8
  t as BITCOIN_ADDRESS_RE,
9
9
  B as BTC_DUST_SAT,
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Consensus witness-stack decoding, shared by every module that reads a
3
+ * witness we did not build.
4
+ *
5
+ * Two independent decoders drifted apart before this existed: one accepted
6
+ * non-minimal CompactSize encodings, the other rejected them. vaultd decodes
7
+ * with rust-bitcoin, whose `VarInt::consensus_decode`
8
+ * (0.32.8 `consensus/encode.rs:493-522`) returns `NonMinimalVarInt` for a 0xfd
9
+ * carrying < 0xfd and a 0xfe carrying < 0x10000 — so the strict reading is the
10
+ * only one that matches what the network will accept.
11
+ *
12
+ * @module tbv/core/utils/witness/witnessStack
13
+ */
14
+ /**
15
+ * Decode a consensus-encoded witness stack: item count, then (len, bytes)*.
16
+ *
17
+ * @param witness - The consensus-encoded witness bytes.
18
+ * @param subject - Names the witness in error messages (e.g. "finalScriptWitness").
19
+ * @returns The stack items, as views over `witness`.
20
+ * @throws If the encoding is truncated, non-minimal, out of range, or leaves
21
+ * trailing bytes.
22
+ */
23
+ export declare function decodeWitnessStack(witness: Uint8Array, subject: string): Uint8Array[];
24
+ //# sourceMappingURL=witnessStack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"witnessStack.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/utils/witness/witnessStack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAUH;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,MAAM,GACd,UAAU,EAAE,CAwDd"}