@babylonlabs-io/ts-sdk 3.3.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BTCVaultRegistry.abi-BzNTa_EU.js → BTCVaultRegistry.abi-DnP4UkB5.js} +9 -140
- package/dist/BTCVaultRegistry.abi-DnP4UkB5.js.map +1 -0
- package/dist/{BTCVaultRegistry.abi-BH2-LHxN.cjs → BTCVaultRegistry.abi-DzbfZ9_s.cjs} +2 -2
- package/dist/BTCVaultRegistry.abi-DzbfZ9_s.cjs.map +1 -0
- package/dist/{PayoutManager-xEGvTbhL.js → PayoutManager-BUWP-H-q.js} +3 -3
- package/dist/PayoutManager-BUWP-H-q.js.map +1 -0
- package/dist/{PayoutManager-B1Ev0r7o.cjs → PayoutManager-Dopxq_Jv.cjs} +2 -2
- package/dist/PayoutManager-Dopxq_Jv.cjs.map +1 -0
- package/dist/PeginManager-CMbRRTnr.cjs +2 -0
- package/dist/{PeginManager-Co43rW_x.cjs.map → PeginManager-CMbRRTnr.cjs.map} +1 -1
- package/dist/{PeginManager-BJnUgW8C.js → PeginManager-Cas6_j7t.js} +118 -107
- package/dist/{PeginManager-BJnUgW8C.js.map → PeginManager-Cas6_j7t.js.map} +1 -1
- package/dist/{ProtocolParams.abi-Cv77fsUe.js → ProtocolParams.abi-CuDl7AuC.js} +3 -3
- package/dist/{ProtocolParams.abi-Cv77fsUe.js.map → ProtocolParams.abi-CuDl7AuC.js.map} +1 -1
- package/dist/{ProtocolParams.abi-BgEZaQ2I.cjs → ProtocolParams.abi-DWfIh6VH.cjs} +2 -2
- package/dist/{ProtocolParams.abi-BgEZaQ2I.cjs.map → ProtocolParams.abi-DWfIh6VH.cjs.map} +1 -1
- package/dist/VaultErrors.abi-Dc3UnB_h.js +5 -0
- package/dist/{VaultErrors.abi-Boz4w97c.js.map → VaultErrors.abi-Dc3UnB_h.js.map} +1 -1
- package/dist/VaultErrors.abi-Hjn1CdLs.cjs +2 -0
- package/dist/{VaultErrors.abi-DQ18kM0L.cjs.map → VaultErrors.abi-Hjn1CdLs.cjs.map} +1 -1
- package/dist/buildAndBroadcastReclaim-CVmG3ldA.cjs +2 -0
- package/dist/buildAndBroadcastReclaim-CVmG3ldA.cjs.map +1 -0
- package/dist/{buildAndBroadcastReclaim-CQANDXVJ.js → buildAndBroadcastReclaim-XRWuJWVL.js} +48 -50
- package/dist/buildAndBroadcastReclaim-XRWuJWVL.js.map +1 -0
- package/dist/{challengeAssert-C3eMcM5Y.cjs → challengeAssert-BE6Wm4x1.cjs} +2 -2
- package/dist/challengeAssert-BE6Wm4x1.cjs.map +1 -0
- package/dist/{challengeAssert-B2otuf7y.js → challengeAssert-DUKSjirl.js} +3 -3
- package/dist/challengeAssert-DUKSjirl.js.map +1 -0
- package/dist/constants-BCg6O0PX.cjs +2 -0
- package/dist/constants-BCg6O0PX.cjs.map +1 -0
- package/dist/constants-CmDDuM3L.js +50 -0
- package/dist/constants-CmDDuM3L.js.map +1 -0
- package/dist/{index-BRsWXDlv.js → index-B-9aXMxk.js} +6 -6
- package/dist/{index-BRsWXDlv.js.map → index-B-9aXMxk.js.map} +1 -1
- package/dist/{index-C6avwx1s.cjs → index-Dn7RlsKK.cjs} +2 -2
- package/dist/{index-C6avwx1s.cjs.map → index-Dn7RlsKK.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +16 -16
- package/dist/pegin-registration-client-DLlaZbsZ.cjs +2 -0
- package/dist/pegin-registration-client-DLlaZbsZ.cjs.map +1 -0
- package/dist/{pegin-registration-client-Cvjk4ILq.js → pegin-registration-client-ZI0k10_3.js} +90 -96
- package/dist/pegin-registration-client-ZI0k10_3.js.map +1 -0
- package/dist/{primeVpAuth-D4UWXQ76.js → primeVpAuth-C-ET0XF4.js} +2 -2
- package/dist/{primeVpAuth-D4UWXQ76.js.map → primeVpAuth-C-ET0XF4.js.map} +1 -1
- package/dist/{primeVpAuth-CXNXYKrh.cjs → primeVpAuth-Ch-ig2My.cjs} +2 -2
- package/dist/{primeVpAuth-CXNXYKrh.cjs.map → primeVpAuth-Ch-ig2My.cjs.map} +1 -1
- package/dist/registration-records-CKc0OVuK.cjs +2 -0
- package/dist/registration-records-CKc0OVuK.cjs.map +1 -0
- package/dist/{registration-records-DJJC2NiO.js → registration-records-D39ApuHS.js} +141 -141
- package/dist/registration-records-D39ApuHS.js.map +1 -0
- package/dist/shared/index.cjs.map +1 -1
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/wallets/interfaces/BitcoinWallet.d.ts +5 -0
- package/dist/shared/wallets/interfaces/BitcoinWallet.d.ts.map +1 -1
- package/dist/{signer-set-reader-GrFe_rsW.cjs → signer-set-reader-CJfV-GDz.cjs} +2 -2
- package/dist/{signer-set-reader-GrFe_rsW.cjs.map → signer-set-reader-CJfV-GDz.cjs.map} +1 -1
- package/dist/{signer-set-reader-CSUe92zE.js → signer-set-reader-DiwLeqik.js} +3 -3
- package/dist/{signer-set-reader-CSUe92zE.js.map → signer-set-reader-DiwLeqik.js.map} +1 -1
- package/dist/tbv/core/clients/eth/index.cjs +1 -1
- package/dist/tbv/core/clients/eth/index.js +4 -4
- package/dist/tbv/core/clients/eth/protocol-params-validation.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/registration-logs-error.d.ts +6 -6
- package/dist/tbv/core/clients/eth/registration-records.d.ts +1 -1
- package/dist/tbv/core/clients/eth/types.d.ts +12 -13
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +6 -6
- package/dist/tbv/core/clients/vault-provider/status/index.cjs +1 -1
- package/dist/tbv/core/clients/vault-provider/status/index.js +1 -1
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +5 -111
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts +2 -2
- package/dist/tbv/core/contracts/abis/vaultErrors.abi.json.d.ts +1 -1
- package/dist/tbv/core/contracts/index.cjs +1 -1
- package/dist/tbv/core/contracts/index.js +3 -3
- package/dist/tbv/core/deposit-terms/__tests__/rebuildDepositTermsCore.test.d.ts +1 -1
- package/dist/tbv/core/deposit-terms/commissionCeiling.d.ts +1 -1
- package/dist/tbv/core/deposit-terms/depositTerms.d.ts +5 -5
- package/dist/tbv/core/deposit-terms/rebuildDepositTermsCore.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +16 -16
- package/dist/tbv/core/managers/PeginManager.d.ts +2 -1
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.js +2 -2
- package/dist/tbv/core/primitives/__tests__/vaultCoreVersion.test.d.ts +1 -1
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.js +3 -3
- package/dist/tbv/core/primitives/psbt/__tests__/deriveExpectedPeginPayoutScriptPubKey.test.d.ts +1 -1
- package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/constants.d.ts +38 -13
- package/dist/tbv/core/primitives/psbt/constants.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/depositorClaim.d.ts +3 -6
- package/dist/tbv/core/primitives/psbt/depositorClaim.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/pegin.d.ts +3 -5
- package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
- package/dist/tbv/core/recovery/peginParamsCandidates.d.ts +1 -1
- package/dist/tbv/core/recovery/reconstructPeginParams.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/__tests__/realWasmWatchtowerArtifacts.test.d.ts +2 -2
- package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifacts.d.ts +2 -1
- package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifacts.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/deriveClaimerWotsKeypair.d.ts +1 -1
- package/dist/tbv/core/services/delegated-claim/deriveClaimerWotsKeypair.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/planDelegatedClaimSigning.d.ts +2 -1
- package/dist/tbv/core/services/delegated-claim/planDelegatedClaimSigning.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/readDelegatedClaimVaultContext.d.ts +1 -1
- package/dist/tbv/core/services/delegated-claim/readDelegatedClaimVaultContext.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/readWatchtowerArtifacts.d.ts +3 -3
- package/dist/tbv/core/services/delegated-claim/readWatchtowerArtifacts.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/types.d.ts +5 -6
- package/dist/tbv/core/services/delegated-claim/types.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/__tests__/signDepositorGraph.realGraph.test.d.ts +3 -3
- package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +2 -2
- package/dist/tbv/core/wasm/index.cjs.map +1 -1
- package/dist/tbv/core/wasm/index.d.ts +8 -11
- package/dist/tbv/core/wasm/index.d.ts.map +1 -1
- package/dist/tbv/core/wasm/index.js.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +16 -16
- package/dist/toRefundInputs-BSQjDOK9.cjs +2 -0
- package/dist/toRefundInputs-BSQjDOK9.cjs.map +1 -0
- package/dist/{toRefundInputs-Dzw1cteD.js → toRefundInputs-BbbvPb2A.js} +175 -173
- package/dist/toRefundInputs-BbbvPb2A.js.map +1 -0
- package/dist/{types-BC2TGzcp.cjs → types-BnZIbDHb.cjs} +2 -2
- package/dist/types-BnZIbDHb.cjs.map +1 -0
- package/dist/{types-24A9Qoxb.js → types-K_aM5GZO.js} +39 -39
- package/dist/types-K_aM5GZO.js.map +1 -0
- package/dist/{verifyKeyPathSchnorrSignature-IIj3Z2se.js → verifyKeyPathSchnorrSignature-DPXOFOol.js} +2 -2
- package/dist/{verifyKeyPathSchnorrSignature-IIj3Z2se.js.map → verifyKeyPathSchnorrSignature-DPXOFOol.js.map} +1 -1
- package/dist/{verifyKeyPathSchnorrSignature-BRTpEH9X.cjs → verifyKeyPathSchnorrSignature-DcxCojp0.cjs} +2 -2
- package/dist/{verifyKeyPathSchnorrSignature-BRTpEH9X.cjs.map → verifyKeyPathSchnorrSignature-DcxCojp0.cjs.map} +1 -1
- package/dist/verifyScriptPathSchnorrSignature-CgDa9Rcg.cjs +2 -0
- package/dist/verifyScriptPathSchnorrSignature-CgDa9Rcg.cjs.map +1 -0
- package/dist/{verifyScriptPathSchnorrSignature-owu3BfyT.js → verifyScriptPathSchnorrSignature-D-fdi-sG.js} +462 -459
- package/dist/verifyScriptPathSchnorrSignature-D-fdi-sG.js.map +1 -0
- package/package.json +3 -3
- package/dist/BTCVaultRegistry.abi-BH2-LHxN.cjs.map +0 -1
- package/dist/BTCVaultRegistry.abi-BzNTa_EU.js.map +0 -1
- package/dist/PayoutManager-B1Ev0r7o.cjs.map +0 -1
- package/dist/PayoutManager-xEGvTbhL.js.map +0 -1
- package/dist/PeginManager-Co43rW_x.cjs +0 -2
- package/dist/VaultErrors.abi-Boz4w97c.js +0 -5
- package/dist/VaultErrors.abi-DQ18kM0L.cjs +0 -2
- package/dist/buildAndBroadcastReclaim-CQANDXVJ.js.map +0 -1
- package/dist/buildAndBroadcastReclaim-DPk36Uhp.cjs +0 -2
- package/dist/buildAndBroadcastReclaim-DPk36Uhp.cjs.map +0 -1
- package/dist/challengeAssert-B2otuf7y.js.map +0 -1
- package/dist/challengeAssert-C3eMcM5Y.cjs.map +0 -1
- package/dist/constants-CAm10Qwp.cjs +0 -2
- package/dist/constants-CAm10Qwp.cjs.map +0 -1
- package/dist/constants-CvQZuxKv.js +0 -48
- package/dist/constants-CvQZuxKv.js.map +0 -1
- package/dist/pegin-registration-client-CdRyXP3j.cjs +0 -2
- package/dist/pegin-registration-client-CdRyXP3j.cjs.map +0 -1
- package/dist/pegin-registration-client-Cvjk4ILq.js.map +0 -1
- package/dist/registration-records-DJJC2NiO.js.map +0 -1
- package/dist/registration-records-XQMIKjGV.cjs +0 -2
- package/dist/registration-records-XQMIKjGV.cjs.map +0 -1
- package/dist/toRefundInputs-DTuWi--u.cjs +0 -2
- package/dist/toRefundInputs-DTuWi--u.cjs.map +0 -1
- package/dist/toRefundInputs-Dzw1cteD.js.map +0 -1
- package/dist/types-24A9Qoxb.js.map +0 -1
- package/dist/types-BC2TGzcp.cjs.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-CahYx5Td.cjs +0 -2
- package/dist/verifyScriptPathSchnorrSignature-CahYx5Td.cjs.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-owu3BfyT.js.map +0 -1
|
@@ -8,11 +8,10 @@ import { OnChainBtcPubkey } from '../../clients/eth/types';
|
|
|
8
8
|
*/
|
|
9
9
|
export interface WatchtowerArtifactsSummary {
|
|
10
10
|
/**
|
|
11
|
-
* Vault Core version the file records
|
|
12
|
-
*
|
|
13
|
-
* value differs from the version it verifies under.
|
|
11
|
+
* Vault Core version the file records. `assertArtifactsUsableForVault`
|
|
12
|
+
* refuses a file whose value differs from the version it verifies under.
|
|
14
13
|
*/
|
|
15
|
-
vaultCoreVersion
|
|
14
|
+
vaultCoreVersion: number;
|
|
16
15
|
/** 32-byte on-chain vault id, as the file records it. */
|
|
17
16
|
vaultId: string;
|
|
18
17
|
/** Txid of the fully signed Claim transaction the file carries. */
|
|
@@ -45,7 +44,7 @@ export interface WatchtowerArtifactsSummary {
|
|
|
45
44
|
/**
|
|
46
45
|
* Whether the file carries BaBe sessions.
|
|
47
46
|
*
|
|
48
|
-
* An unjoined file (`babe_sessions` empty
|
|
47
|
+
* An unjoined file (`babe_sessions` empty) is the normal output of
|
|
49
48
|
* a browser assembly, and it cannot defend a claim. Claim, Assert and Payout
|
|
50
49
|
* finalize without the sessions, but answering a `ChallengeAssert` needs
|
|
51
50
|
* them: the watchtower decrypts the hashlock preimage from the joined
|
|
@@ -126,7 +125,7 @@ export interface DelegatedClaimVaultContext {
|
|
|
126
125
|
vaultKeeperBtcPubkeys: string[];
|
|
127
126
|
/** Universal challengers registered on chain. */
|
|
128
127
|
universalChallengerBtcPubkeys: string[];
|
|
129
|
-
/** Graph (vault core) version of the vault. Delegated claim requires
|
|
128
|
+
/** Graph (vault core) version of the vault. Delegated claim requires `DELEGATED_CLAIM_TX_GRAPH_VERSION`. */
|
|
130
129
|
txGraphVersion: number;
|
|
131
130
|
proverCircuitVersion: number;
|
|
132
131
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/delegated-claim/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/delegated-claim/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,gBAAgB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artifacts
|
|
4
|
-
* `delegated-claim/__tests__/fixtures/
|
|
2
|
+
* Depositor-graph presigning through the real WASM on a Vault Core 1
|
|
3
|
+
* depositor graph built by btc-vault's own code (the watchtower-artifacts
|
|
4
|
+
* fixture, see `delegated-claim/__tests__/fixtures/watchtowerArtifacts/README.md`).
|
|
5
5
|
*
|
|
6
6
|
* The other signDepositorGraph tests mock the primitives; this file proves an
|
|
7
7
|
* honest btc-vault graph clears every check and reaches the wallet, and that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signDepositorGraph.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/deposit/signDepositorGraph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAGrE,OAAO,KAAK,EACV,aAAa,EAEd,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAE1B,wBAAwB,EACzB,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"signDepositorGraph.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/deposit/signDepositorGraph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAGrE,OAAO,KAAK,EACV,aAAa,EAEd,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAE1B,wBAAwB,EACzB,MAAM,oCAAoC,CAAC;AAoJ5C,wEAAwE;AACxE,MAAM,WAAW,eAAe;IAC9B,gDAAgD;IAChD,UAAU,EAAE,wBAAwB,CAAC;IACrC,sDAAsD;IACtD,gBAAgB,EAAE,MAAM,CAAC;IACzB,mFAAmF;IACnF,QAAQ,EAAE,KAAK,CAAC;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,KAAK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wB;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,CAiD1C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../PayoutManager-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../PayoutManager-Dopxq_Jv.cjs"),t=require("../../../buildAndBroadcastReclaim-CVmG3ldA.cjs"),i=require("../wasm/index.cjs"),e=require("../../../peginState-IyE22wWh.cjs"),a=require("../../../state-C4WoNCy1.cjs");exports.computeHashlock=r.computeHashlock;exports.validateSecretAgainstHashlock=r.validateSecretAgainstHashlock;exports.ApplicationEntryPointMismatchError=t.ApplicationEntryPointMismatchError;exports.ArtifactsVaultMismatchError=t.ArtifactsVaultMismatchError;exports.AssertBindingError=t.AssertBindingError;exports.BIP68NotMatureError=t.BIP68NotMatureError;exports.ChallengerSetMismatchError=t.ChallengerSetMismatchError;exports.DELEGATED_CLAIM_TX_GRAPH_VERSION=t.DELEGATED_CLAIM_TX_GRAPH_VERSION;exports.DelegatedClaimSigningIncompleteError=t.DelegatedClaimSigningIncompleteError;exports.GraphFingerprintError=t.GraphFingerprintError;exports.PEGIN_ETH_CONFIRMATIONS=t.PEGIN_ETH_CONFIRMATIONS;exports.ParticipantKeyDriftError=t.ParticipantKeyDriftError;exports.PayoutDestinationError=t.PayoutDestinationError;exports.PayoutInputLeafError=t.PayoutInputLeafError;exports.PeginRegistrationMissingError=t.PeginRegistrationMissingError;exports.PeginRegistrationNotFinalError=t.PeginRegistrationNotFinalError;exports.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR=t.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR;exports.RECLAIM_MAX_FEE_FRACTION_NUMERATOR=t.RECLAIM_MAX_FEE_FRACTION_NUMERATOR;exports.RECLAIM_MAX_FEE_RATE_SATS_VB=t.RECLAIM_MAX_FEE_RATE_SATS_VB;exports.RECLAIM_WARN_FEE_FRACTION_NUMERATOR=t.RECLAIM_WARN_FEE_FRACTION_NUMERATOR;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.ReclaimUneconomicalError=t.ReclaimUneconomicalError;exports.RegisteredVaultVersionMismatchError=t.RegisteredVaultVersionMismatchError;exports.SigningPlanMismatchError=t.SigningPlanMismatchError;exports.VaultIdBindingError=t.VaultIdBindingError;exports.activateVault=t.activateVault;exports.activateVaultAndRedeem=t.activateVaultAndRedeem;exports.assembleWatchtowerArtifacts=t.assembleWatchtowerArtifacts;exports.assembleWatchtowerArtifactsFromSignatures=t.assembleWatchtowerArtifactsFromSignatures;exports.assertArtifactsUsableForVault=t.assertArtifactsUsableForVault;exports.assertAssertBindsClaimAndPayout=t.assertAssertBindsClaimAndPayout;exports.assertChallengerSetMatchesVault=t.assertChallengerSetMatchesVault;exports.assertClaimSpendsVault=t.assertClaimSpendsVault;exports.assertPayoutPaysRegisteredScript=t.assertPayoutPaysRegisteredScript;exports.assertReturnedGraphMatchesFingerprint=t.assertReturnedGraphMatchesFingerprint;exports.assertTermsMatchVault=t.assertTermsMatchVault;exports.assertVaultProviderHintAccepted=t.assertVaultProviderHintAccepted;exports.buildAndBroadcastReclaim=t.buildAndBroadcastReclaim;exports.buildAndBroadcastRefund=t.buildAndBroadcastRefund;exports.claimExpiredVault=t.claimExpiredVault;exports.copyAssertConnectorLeaf=t.copyAssertConnectorLeaf;exports.deriveClaimerWotsKeypair=t.deriveClaimerWotsKeypair;exports.estimateRefundFeeSats=t.estimateRefundFeeSats;exports.fingerprintReturnedGraph=t.fingerprintReturnedGraph;exports.isApplicationEntryPointMismatchError=t.isApplicationEntryPointMismatchError;exports.isDepositAmountValid=t.isDepositAmountValid;exports.isHintAccepted=t.isHintAccepted;exports.isParticipantKeyDriftError=t.isParticipantKeyDriftError;exports.isPeginRegistrationMissingError=t.isPeginRegistrationMissingError;exports.isPeginRegistrationNotFinalError=t.isPeginRegistrationNotFinalError;exports.isRegisteredVaultVersionMismatchError=t.isRegisteredVaultVersionMismatchError;exports.matchKeyHint=t.matchKeyHint;exports.matchKeySetHint=t.matchKeySetHint;exports.planDelegatedClaimSigning=t.planDelegatedClaimSigning;exports.readDelegatedClaimVaultContext=t.readDelegatedClaimVaultContext;exports.readStampedParticipantKeys=t.readStampedParticipantKeys;exports.resolveCurrentParticipantKeys=t.resolveCurrentParticipantKeys;exports.resolveParticipantKeysAtEpochs=t.resolveParticipantKeysAtEpochs;exports.runDepositorPresignFlow=t.runDepositorPresignFlow;exports.signDelegatedClaimPlan=t.signDelegatedClaimPlan;exports.signDepositorGraph=t.signDepositorGraph;exports.submitWotsPublicKey=t.submitWotsPublicKey;exports.summarizeWatchtowerArtifacts=t.summarizeWatchtowerArtifacts;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.attachFinalizedAssert=i.attachFinalizedAssert;exports.finalizePayout=i.finalizePayout;exports.finalizeWronglyChallenged=i.finalizeWronglyChallenged;exports.pinPegoutProof=i.pinPegoutProof;exports.ContractStatus=e.ContractStatus;exports.PeginAction=e.PeginAction;exports.activationDeadlineBlocksRemaining=e.activationDeadlineBlocksRemaining;exports.canPerformAction=e.canPerformAction;exports.getPeginProtocolState=e.getPeginProtocolState;exports.isActivationDeadlinePassedOnChain=e.isActivationDeadlinePassedOnChain;exports.ClaimerPegoutStatusValue=a.ClaimerPegoutStatusValue;exports.isPegoutTerminalStatus=a.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=a.isRecognizedPegoutStatus;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as s, v as e } from "../../../PayoutManager-
|
|
2
|
-
import { J as r, l as n, A as o, a8 as l, C as c, D as E, n as g, G as A, u as d, W as u, P as R, j as m, v as p, w as P, ah as _, ai as C, aj as M, ak as h, ab as F, ac as S, ad as V, ae as f, af as y, Z as N, S as D, V as I, a as v, b as T, d as O, e as K, m as b, f as B, g as U, t as H, i as L, B as x, o as G, a1 as W, ag as X, a9 as w, c as k, k as z, h as j, aa as Z, E as q, K as J, M as Q, a2 as Y, X as $, x as aa, y as ta, _ as sa, a3 as ea, a4 as ia, p as ra, r as na, a5 as oa, a6 as la, a7 as ca, F as Ea, q as ga, H as Aa, I as da, s as ua, N as Ra, O as ma, L as pa, Q as Pa, R as _a, T as Ca, U as Ma, Y as ha, $ as Fa, z as Sa, a0 as Va } from "../../../buildAndBroadcastReclaim-
|
|
1
|
+
import { c as s, v as e } from "../../../PayoutManager-BUWP-H-q.js";
|
|
2
|
+
import { J as r, l as n, A as o, a8 as l, C as c, D as E, n as g, G as A, u as d, W as u, P as R, j as m, v as p, w as P, ah as _, ai as C, aj as M, ak as h, ab as F, ac as S, ad as V, ae as f, af as y, Z as N, S as D, V as I, a as v, b as T, d as O, e as K, m as b, f as B, g as U, t as H, i as L, B as x, o as G, a1 as W, ag as X, a9 as w, c as k, k as z, h as j, aa as Z, E as q, K as J, M as Q, a2 as Y, X as $, x as aa, y as ta, _ as sa, a3 as ea, a4 as ia, p as ra, r as na, a5 as oa, a6 as la, a7 as ca, F as Ea, q as ga, H as Aa, I as da, s as ua, N as Ra, O as ma, L as pa, Q as Pa, R as _a, T as Ca, U as Ma, Y as ha, $ as Fa, z as Sa, a0 as Va } from "../../../buildAndBroadcastReclaim-XRWuJWVL.js";
|
|
3
3
|
import { attachFinalizedAssert as ya, finalizePayout as Na, finalizeWronglyChallenged as Da, pinPegoutProof as Ia } from "../wasm/index.js";
|
|
4
4
|
import { C as Ta, P as Oa, a as Ka, c as ba, g as Ba, i as Ua } from "../../../peginState-CIibG9S_.js";
|
|
5
5
|
import { C as La, g as xa, f as Ga } from "../../../state-CFn1rT74.js";
|
|
@@ -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 ChallengeAssertOutputConnectorParams,\n ChallengeAssertScriptInfo,\n HtlcConnectorInfo,\n HtlcConnectorParams,\n Network,\n PayoutConnectorInfo,\n PayoutConnectorParams,\n PeginP2aAnchorInfo,\n PeginTxResult,\n PrePeginParams,\n PrePeginResult,\n WatchtowerArtifactsInputs,\n WotsKeypairDerivation,\n WronglyChallengedPsbts,\n WronglyChallengedSigs,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\n\nexport { TAP_INTERNAL_KEY, tapInternalPubkey } from \"./constants\";\n\ntype TbvWasmModule = typeof import(\"@babylonlabs-io/babylon-tbv-rust-wasm\");\n\nlet wasmModulePromise: Promise<TbvWasmModule> | undefined;\n\n/**\n * Load and initialize the WASM engine on first use. Concurrent callers share\n * one load. The returned module is already initialized, so a caller does not\n * call `initWasm()`. A load or initialization failure rejects with an error\n * that names the engine package. The original error is its cause. A failure\n * clears this cache, so the next call loads again. The engine keeps a failed\n * binary initialization rejected, so only a failed import or binary read can\n * succeed on a later call.\n *\n * The module also contains the wasm-bindgen classes. The classes have no value\n * guards. A caller that uses a class must cross-check its output at the call\n * site.\n */\nexport function loadTbvWasm(): Promise<TbvWasmModule> {\n wasmModulePromise ??= import(\"@babylonlabs-io/babylon-tbv-rust-wasm\")\n .catch((error: unknown) => {\n wasmModulePromise = undefined;\n throw new Error(\n \"The vault-WASM engine @babylonlabs-io/babylon-tbv-rust-wasm failed \" +\n \"to load. The module could not be resolved, or it threw while \" +\n \"evaluating, commonly a missing or stale generated WASM build. \" +\n \"See the cause for the underlying error.\",\n { cause: error },\n );\n })\n .then(async (wasm) => {\n try {\n await wasm.initWasm();\n } catch (error: unknown) {\n wasmModulePromise = undefined;\n throw new Error(\n \"The vault-WASM engine @babylonlabs-io/babylon-tbv-rust-wasm \" +\n \"resolved, but its WebAssembly binary failed to initialize, \" +\n \"commonly a missing or stale generated WASM build. See the \" +\n \"cause for the underlying error.\",\n { cause: error },\n );\n }\n return wasm;\n });\n return wasmModulePromise;\n}\n\n/**\n * Creates an unfunded Pre-PegIn transaction with no inputs and HTLC output(s).\n *\n * The HTLC output value (htlcValue) covers the peg-in amount, depositor claim value,\n * and minimum pegin fee — all computed internally from the provided contract parameters.\n *\n * After building the Pre-PegIn transaction, the caller must:\n * 1. Select UTXOs covering htlcValue + network fees\n * 2. Fund the transaction (add inputs and change output)\n * 3. Call reconstructFromFundedTx() with the funded tx hex\n * 4. Call buildPeginTx() to derive the PegIn transaction\n * 5. Sign the PegIn input using the HTLC hashlock leaf (leaf 0)\n *\n * @param params - Pre-PegIn parameters from contract and depositor wallet\n * @returns Unfunded transaction details with HTLC output information\n */\nexport async function createPrePeginTransaction(\n params: PrePeginParams,\n): Promise<PrePeginResult> {\n return (await loadTbvWasm()).createPrePeginTransaction(params);\n}\n\n/**\n * Derives the PegIn transaction from a funded Pre-PegIn transaction.\n *\n * The PegIn transaction has a single input spending the Pre-PegIn HTLC output\n * at `htlcVout` via the hashlock + all-party script (leaf 0).\n *\n * @param params - Same PrePeginParams used to create the Pre-PegIn transaction\n * @param timelockPegin - CSV timelock in blocks for the PegIn vault output\n * @param fundedPrePeginTxHex - Hex-encoded funded Pre-PegIn transaction\n * @param htlcVout - Index of the HTLC output to spend\n * @returns PegIn transaction details including vault output information\n */\nexport async function buildPeginTxFromPrePegin(\n params: PrePeginParams,\n timelockPegin: number,\n fundedPrePeginTxHex: string,\n htlcVout: number,\n): Promise<PeginTxResult> {\n return (await loadTbvWasm()).buildPeginTxFromPrePegin(\n params,\n timelockPegin,\n fundedPrePeginTxHex,\n htlcVout,\n );\n}\n\n/**\n * Returns HTLC connector script info for signing the PegIn transaction input.\n *\n * The depositor signs PegIn input 0 using the hashlock leaf (leaf 0) of the\n * Pre-PegIn HTLC output. Use getHashlockScript() and getHashlockControlBlock()\n * to construct the tapLeafScript entry in the PSBT.\n *\n * @param params - HTLC connector parameters (subset of PrePeginParams)\n * @returns Hashlock and refund script info for PSBT construction\n */\nexport async function getPrePeginHtlcConnectorInfo(\n params: HtlcConnectorParams,\n): Promise<HtlcConnectorInfo> {\n return (await loadTbvWasm()).getPrePeginHtlcConnectorInfo(params);\n}\n\n/**\n * Compute the minimum depositor claim value (PegIn output 1) in satoshis.\n *\n * This covers the full downstream tx graph cost (Claim → Assert → Payout)\n * based on the protocol parameters.\n */\nexport async function computeMinClaimValue(\n txGraphVersion: number,\n numLocalChallengers: number,\n numUniversalChallengers: number,\n councilQuorum: number,\n councilSize: number,\n feeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computeMinClaimValue(\n txGraphVersion,\n numLocalChallengers,\n numUniversalChallengers,\n councilQuorum,\n councilSize,\n feeRate,\n );\n}\n\n/**\n * Compute the minimum PegIn (activation) transaction fee in satoshis.\n *\n * `minPeginFee = peginTxVsize(numVks, numUcs) × minPeginFeeRate`. Each HTLC\n * the depositor funds in the Pre-PegIn tx must reserve at least this fee\n * inside its value (`htlcValue = peginAmount + depositorClaimValue +\n * p2aAnchorValue + minPeginFee`, anchor 0 on vault core 1), otherwise the VP\n * cannot afford to broadcast the PegIn at\n * activation. The vsize comes from a Taproot script-path-spend weight\n * prediction whose witness shape depends on the VK + UC signer count.\n */\nexport async function computeMinPeginFee(\n txGraphVersion: number,\n numVks: number,\n numUcs: number,\n minPeginFeeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computeMinPeginFee(\n txGraphVersion,\n numVks,\n numUcs,\n minPeginFeeRate,\n );\n}\n\n/**\n * Floor of the Payout transaction fee under `txGraphVersion`: the minimum of\n * `estimatedVsize * feeRate` across every output-sizing model a deployed\n * vault provider is known to have used (fixed-34, intermediate,\n * script-aware). A VP-built payout paying less than this is provably not\n * produced by any known VP build. `out0Len` must be the TRUSTED length of the\n * pinned outs[0] script (1..=128); `out1Len` is the measured, UNTRUSTED\n * commission-script length — safe here because padding cannot raise the floor\n * (the fixed-34 model saturates the minimum) and shortening only lowers it.\n * Pass `undefined` for `out1Len` on 2-output (non-VP-claimer) payouts.\n * `feeRate` is the vault's version-locked `offchainParams.feeRate`.\n */\nexport async function computePayoutFeeFloor(\n txGraphVersion: number,\n numVaultKeepers: number,\n numUniversalChallengers: number,\n numLocalChallengers: number,\n councilSize: number,\n out0Len: number,\n out1Len: number | null | undefined,\n feeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computePayoutFeeFloor(\n txGraphVersion,\n numVaultKeepers,\n numUniversalChallengers,\n numLocalChallengers,\n councilSize,\n out0Len,\n out1Len,\n feeRate,\n );\n}\n\n/**\n * Tx graph versions the shipped vault-wasm binary can build. Callers must\n * preflight the required version (fresh: active; resume: stamped) against\n * this list and fail closed instead of hitting per-call errors mid-flow.\n *\n * Note: the facade constructors themselves fail closed on unsupported\n * versions, and derived objects carry the version they were built with —\n * value-level cross-checks live in `assertWasmPeginSizing` and the golden\n * byte-parity tests, not in a per-call version echo.\n */\nexport async function supportedTxGraphVersions(): Promise<number[]> {\n return (await loadTbvWasm()).supportedTxGraphVersions();\n}\n\n/**\n * The PegIn transaction's P2A (pay-to-anchor) output for a graph version, or\n * `null` when that version's PegIn carries no anchor (v1). The facade returns\n * one record per version — never a zero-valued placeholder — so an absent\n * anchor can't be mistaken for a real output. For v2/v3: 240 sats at vout 2,\n * script `51024e73`.\n */\nexport async function peginP2aAnchorOutput(\n txGraphVersion: number,\n): Promise<PeginP2aAnchorInfo | null> {\n return (await loadTbvWasm()).peginP2aAnchorOutput(txGraphVersion);\n}\n\n/**\n * Validate a PegIn transaction's P2A anchor against a graph version's rules:\n * v2 and v3 require the exact anchor (240 sats, vout 2, P2A script) and v1\n * requires that NO output carries the P2A script. Throws on any mismatch — a\n * v2 PegIn checked as v1 fails closed, and vice versa.\n */\nexport async function validatePeginP2aAnchor(\n txGraphVersion: number,\n txHex: string,\n): Promise<void> {\n return (await loadTbvWasm()).validatePeginP2aAnchor(txGraphVersion, txHex);\n}\n\n/**\n * Creates a payout connector for vault transactions.\n *\n * The payout connector generates the necessary taproot scripts and information\n * required for signing payout transactions (both optimistic and regular payout paths).\n *\n * @param params - Parameters for creating the payout connector\n * @param network - Bitcoin network\n * @returns Payout connector information including scripts, hashes, and address\n */\nexport async function createPayoutConnector(\n params: PayoutConnectorParams,\n network: Network,\n): Promise<PayoutConnectorInfo> {\n return (await loadTbvWasm()).createPayoutConnector(params, network);\n}\n\n/**\n * Get the Payout script and control block for the depositor's Assert output.\n *\n * Used to build the depositor's Payout PSBT (depositor-as-claimer path).\n *\n * @param params - Assert Payout/NoPayout connector parameters\n * @returns Payout script and control block (hex encoded)\n */\nexport async function getAssertPayoutScriptInfo(\n params: AssertPayoutNoPayoutConnectorParams,\n): Promise<AssertPayoutScriptInfo> {\n return (await loadTbvWasm()).getAssertPayoutScriptInfo(params);\n}\n\n/**\n * Get the NoPayout script and control block for a specific challenger.\n *\n * Used to build the depositor's NoPayout PSBT (depositor-as-claimer path).\n * Each challenger has a distinct NoPayout script.\n *\n * @param params - Assert Payout/NoPayout connector parameters\n * @param challengerPubkey - The challenger's x-only public key (hex encoded)\n * @returns NoPayout script and control block (hex encoded)\n */\nexport async function getAssertNoPayoutScriptInfo(\n params: AssertPayoutNoPayoutConnectorParams,\n challengerPubkey: string,\n): Promise<AssertNoPayoutScriptInfo> {\n return (await loadTbvWasm()).getAssertNoPayoutScriptInfo(\n params,\n challengerPubkey,\n );\n}\n\n/**\n * Get the ChallengeAssert script and control block.\n *\n * Used to build ChallengeAssert PSBTs for the depositor-as-claimer path.\n * Each challenger has 2 ChallengeAssert transactions (X and Y), and this\n * connector generates the spending scripts using WOTS public keys from the VP.\n *\n * @param params - ChallengeAssert connector parameters\n * @returns Script and control block (hex encoded)\n */\nexport async function getChallengeAssertScriptInfo(\n params: ChallengeAssertConnectorParams,\n): Promise<ChallengeAssertScriptInfo> {\n return (await loadTbvWasm()).getChallengeAssertScriptInfo(params);\n}\n\n/**\n * Get the scriptPubKey that output 0 of every ChallengeAssertX/Y transaction\n * pays to for one challenger: the WronglyChallenged leaves plus the NoPayout\n * leaf carrying the ChallengeAssert timelock.\n *\n * Used to bind the VP-supplied ChallengeAssert parents of a NoPayout before\n * the depositor signs it. The engine rejects a non-P2TR return.\n *\n * @param params - ChallengeAssert output connector parameters\n * @returns P2TR scriptPubKey (hex encoded)\n */\nexport async function getChallengeAssertOutputScriptPubKey(\n params: ChallengeAssertOutputConnectorParams,\n): Promise<string> {\n return (await loadTbvWasm()).getChallengeAssertOutputScriptPubKey(params);\n}\n\n/**\n * Derive 32-byte `authAnchor` (OP_RETURN preimage → VP bearer token).\n * @stability frozen - btc-vault Rust owns this API through the vault-wasm pin (`VAULT_WASM_COMMIT`).\n * Changing the derived bytes breaks VP auth for existing deposits. See CLAUDE.md §4.\n */\nexport async function expandAuthAnchor(root: Uint8Array): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandAuthAnchor(root);\n}\n\n/**\n * Derive 32-byte `hashlockSecret` for HTLC `htlcVout` (preimage → `activateVaultWithSecret`).\n * @stability frozen - btc-vault Rust owns this API.\n * Changing the derived bytes means affected vaults can never activate. See CLAUDE.md §4.\n */\nexport async function expandHashlockSecret(\n root: Uint8Array,\n htlcVout: number,\n): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandHashlockSecret(root, htlcVout);\n}\n\n/**\n * Derive 64-byte `wotsSeed` for HTLC `htlcVout` (→ WOTS keys, hashed as `depositorWotsPkHash`).\n * @stability frozen - btc-vault Rust owns this API.\n * Changing the derived bytes breaks existing `depositorWotsPkHash` values. No claim path remains. See CLAUDE.md §4.\n */\nexport async function expandWotsSeed(\n root: Uint8Array,\n htlcVout: number,\n): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandWotsSeed(root, htlcVout);\n}\n\n/**\n * Derives the vault ID from a PegIn transaction hash and depositor ETH address.\n *\n * Vault ID = keccak256(abi.encode(peginTxHash, depositor))\n * This matches the Solidity-side derivation in BTCVaultRegistry.\n *\n * @param peginTxHash - 32-byte PegIn tx hash in display order (big-endian), hex encoded\n * @param depositor - 20-byte Ethereum address of the depositor, hex encoded\n * @returns Hex-encoded vault ID (32 bytes)\n */\nexport async function deriveVaultId(\n peginTxHash: string,\n depositor: string,\n): Promise<string> {\n return (await loadTbvWasm()).deriveVaultId(peginTxHash, depositor);\n}\n\n// ============================================================================\n// Delegated claim (depositor-as-claimer) — assembly and claim-time surface\n// ============================================================================\n//\n// The forwarding hop for the WASM exports that assemble the two files the\n// `vaultd vp wt` watchtower CLI consumes, and for the claim-time exports\n// that run a claim from those files without the CLI.\n//\n// EXPERIMENTAL — under test, signet only. These names and signatures can\n// change in a minor release. See services/delegated-claim.\n\n/**\n * Depositor's Claim signing PSBT (base64) — spends PegIn:1, script path.\n *\n * @experimental\n */\nexport async function buildClaimPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildClaimPsbt(txGraphVersion, graphJson);\n}\n\n/**\n * Claimer's Assert signing PSBT (base64) — the single WOTS input.\n *\n * @experimental\n */\nexport async function buildAssertClaimerPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildAssertClaimerPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Claimer's Payout signing PSBT (base64) — input 1, Assert connector path.\n *\n * @experimental\n */\nexport async function buildPayoutClaimerPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildPayoutClaimerPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Depositor's Payout signing PSBT (base64) — input 0, the PegIn UTXO spend.\n *\n * @experimental\n */\nexport async function buildPayoutDepositorPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildPayoutDepositorPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Claimer's WronglyChallenged signing PSBTs, per challenger and GC index.\n *\n * @experimental\n */\nexport async function buildWronglyChallengedPsbts(\n txGraphVersion: number,\n graphJson: string,\n): Promise<WronglyChallengedPsbts> {\n return (await loadTbvWasm()).buildWronglyChallengedPsbts(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Verifies the Groth16 pegout proof and pins it into the artifacts, returning\n * the updated artifacts JSON. Persist that copy: the one-time WOTS keypair\n * signs exactly one proof, so a second, different one is refused.\n *\n * @experimental\n */\nexport async function pinPegoutProof(\n txGraphVersion: number,\n artifactsJson: string,\n proofHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).pinPegoutProof(\n txGraphVersion,\n artifactsJson,\n proofHex,\n );\n}\n\n/**\n * Finalizes the Assert from the pinned proof and the WOTS keypair, writes it\n * into the artifacts and returns the updated artifacts JSON. The keypair\n * never leaves the caller.\n *\n * @experimental\n */\nexport async function attachFinalizedAssert(\n txGraphVersion: number,\n artifactsJson: string,\n keypairJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).attachFinalizedAssert(\n txGraphVersion,\n artifactsJson,\n keypairJson,\n );\n}\n\n/**\n * Finalizes the Payout tx from the artifacts' signatures, consensus hex.\n *\n * @experimental\n */\nexport async function finalizePayout(\n txGraphVersion: number,\n artifactsJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizePayout(txGraphVersion, artifactsJson);\n}\n\n/**\n * Finalizes one WronglyChallenged tx — the answer to a ChallengeAssert.\n *\n * @experimental\n */\nexport async function finalizeWronglyChallenged(\n txGraphVersion: number,\n artifactsJson: string,\n challengerPkHex: string,\n gcIndex: number,\n preimageHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizeWronglyChallenged(\n txGraphVersion,\n artifactsJson,\n challengerPkHex,\n gcIndex,\n preimageHex,\n );\n}\n\n/**\n * Applies the depositor signature to the Claim tx, returning consensus hex.\n *\n * @experimental\n */\nexport async function finalizeClaimTx(\n txGraphVersion: number,\n graphJson: string,\n depositorSigHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizeClaimTx(\n txGraphVersion,\n graphJson,\n depositorSigHex,\n );\n}\n\n/**\n * Extracts a signed PSBT input's taproot script-path signature (hex).\n *\n * @experimental\n */\nexport async function extractTapScriptSig(\n psbtBase64: string,\n inputIndex: number,\n): Promise<string> {\n return (await loadTbvWasm()).extractTapScriptSig(psbtBase64, inputIndex);\n}\n\n/**\n * Derive the depositor's WOTS keypair from the 64-byte `wotsSeed`.\n * @stability frozen — `HASH160(seed || block index)` binds on-chain through\n * `depositorWotsPkHash`; see CLAUDE.md §4.\n *\n * @experimental\n */\nexport async function wotsKeypairFromSeed(\n wotsSeed: Uint8Array,\n): Promise<WotsKeypairDerivation> {\n return (await loadTbvWasm()).wotsKeypairFromSeed(wotsSeed);\n}\n\n/**\n * Throws unless the keypair matches the WOTS keys the graph's Claim commits to.\n *\n * @experimental\n */\nexport async function validateWotsKeypairAgainstGraph(\n txGraphVersion: number,\n keypair: unknown,\n graphJson: string,\n): Promise<void> {\n return (await loadTbvWasm()).validateWotsKeypairAgainstGraph(\n txGraphVersion,\n keypair,\n graphJson,\n );\n}\n\n/**\n * Assembles the watchtower `artifacts.json` content, verifying every signature.\n *\n * @experimental\n */\nexport async function buildWatchtowerArtifacts(\n inputs: WatchtowerArtifactsInputs,\n): Promise<string> {\n return (await loadTbvWasm()).buildWatchtowerArtifacts(inputs);\n}\n\n/**\n * Re-verifies every claimer-side signature in an `artifacts.json`.\n *\n * @experimental\n */\nexport async function verifyWatchtowerArtifacts(\n txGraphVersion: number,\n artifactsJson: string,\n): Promise<void> {\n return (await loadTbvWasm()).verifyWatchtowerArtifacts(\n txGraphVersion,\n artifactsJson,\n );\n}\n\nexport type {\n AssertNoPayoutScriptInfo,\n AssertPayoutNoPayoutConnectorParams,\n AssertPayoutScriptInfo,\n ChallengeAssertConnectorParams,\n ChallengeAssertOutputConnectorParams,\n ChallengeAssertScriptInfo,\n HtlcConnectorInfo,\n HtlcConnectorParams,\n Network,\n PayoutConnectorInfo,\n PayoutConnectorParams,\n PeginP2aAnchorInfo,\n PeginTxResult,\n PrePeginParams,\n PrePeginResult,\n WatchtowerArtifactsInputs,\n WotsKeypairDerivation,\n WronglyChallengedPsbts,\n WronglyChallengedSigs,\n};\n"],"names":["TAP_INTERNAL_KEY","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","getChallengeAssertOutputScriptPubKey","expandAuthAnchor","root","expandHashlockSecret","expandWotsSeed","deriveVaultId","peginTxHash","depositor","buildClaimPsbt","graphJson","buildAssertClaimerPsbt","buildPayoutClaimerPsbt","buildPayoutDepositorPsbt","buildWronglyChallengedPsbts","pinPegoutProof","artifactsJson","proofHex","attachFinalizedAssert","keypairJson","finalizePayout","finalizeWronglyChallenged","challengerPkHex","gcIndex","preimageHex","finalizeClaimTx","depositorSigHex","extractTapScriptSig","psbtBase64","inputIndex","wotsKeypairFromSeed","wotsSeed","validateWotsKeypairAgainstGraph","keypair","buildWatchtowerArtifacts","inputs","verifyWatchtowerArtifacts"],"mappings":"2hBAQO,MAAMA,EACX,mEAEIC,EAAqB,EAEdC,EAAoB,WAAW,KAC1C,CAAE,OAAQF,EAAiB,OAASC,CAAA,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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 ChallengeAssertOutputConnectorParams,\n ChallengeAssertScriptInfo,\n HtlcConnectorInfo,\n HtlcConnectorParams,\n Network,\n PayoutConnectorInfo,\n PayoutConnectorParams,\n PeginP2aAnchorInfo,\n PeginTxResult,\n PrePeginParams,\n PrePeginResult,\n WatchtowerArtifactsInputs,\n WotsKeypairDerivation,\n WronglyChallengedPsbts,\n WronglyChallengedSigs,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\n\nexport { TAP_INTERNAL_KEY, tapInternalPubkey } from \"./constants\";\n\ntype TbvWasmModule = typeof import(\"@babylonlabs-io/babylon-tbv-rust-wasm\");\n\nlet wasmModulePromise: Promise<TbvWasmModule> | undefined;\n\n/**\n * Load and initialize the WASM engine on first use. Concurrent callers share\n * one load. The returned module is already initialized, so a caller does not\n * call `initWasm()`. A load or initialization failure rejects with an error\n * that names the engine package. The original error is its cause. A failure\n * clears this cache, so the next call loads again. The engine keeps a failed\n * binary initialization rejected, so only a failed import or binary read can\n * succeed on a later call.\n *\n * The module also contains the wasm-bindgen classes. The classes have no value\n * guards. A caller that uses a class must cross-check its output at the call\n * site.\n */\nexport function loadTbvWasm(): Promise<TbvWasmModule> {\n wasmModulePromise ??= import(\"@babylonlabs-io/babylon-tbv-rust-wasm\")\n .catch((error: unknown) => {\n wasmModulePromise = undefined;\n throw new Error(\n \"The vault-WASM engine @babylonlabs-io/babylon-tbv-rust-wasm failed \" +\n \"to load. The module could not be resolved, or it threw while \" +\n \"evaluating, commonly a missing or stale generated WASM build. \" +\n \"See the cause for the underlying error.\",\n { cause: error },\n );\n })\n .then(async (wasm) => {\n try {\n await wasm.initWasm();\n } catch (error: unknown) {\n wasmModulePromise = undefined;\n throw new Error(\n \"The vault-WASM engine @babylonlabs-io/babylon-tbv-rust-wasm \" +\n \"resolved, but its WebAssembly binary failed to initialize, \" +\n \"commonly a missing or stale generated WASM build. See the \" +\n \"cause for the underlying error.\",\n { cause: error },\n );\n }\n return wasm;\n });\n return wasmModulePromise;\n}\n\n/**\n * Creates an unfunded Pre-PegIn transaction with no inputs and HTLC output(s).\n *\n * The HTLC output value (htlcValue) covers the peg-in amount, depositor claim value,\n * and minimum pegin fee — all computed internally from the provided contract parameters.\n *\n * After building the Pre-PegIn transaction, the caller must:\n * 1. Select UTXOs covering htlcValue + network fees\n * 2. Fund the transaction (add inputs and change output)\n * 3. Call reconstructFromFundedTx() with the funded tx hex\n * 4. Call buildPeginTx() to derive the PegIn transaction\n * 5. Sign the PegIn input using the HTLC hashlock leaf (leaf 0)\n *\n * @param params - Pre-PegIn parameters from contract and depositor wallet\n * @returns Unfunded transaction details with HTLC output information\n */\nexport async function createPrePeginTransaction(\n params: PrePeginParams,\n): Promise<PrePeginResult> {\n return (await loadTbvWasm()).createPrePeginTransaction(params);\n}\n\n/**\n * Derives the PegIn transaction from a funded Pre-PegIn transaction.\n *\n * The PegIn transaction has a single input spending the Pre-PegIn HTLC output\n * at `htlcVout` via the hashlock + all-party script (leaf 0).\n *\n * @param params - Same PrePeginParams used to create the Pre-PegIn transaction\n * @param timelockPegin - CSV timelock in blocks for the PegIn vault output\n * @param fundedPrePeginTxHex - Hex-encoded funded Pre-PegIn transaction\n * @param htlcVout - Index of the HTLC output to spend\n * @returns PegIn transaction details including vault output information\n */\nexport async function buildPeginTxFromPrePegin(\n params: PrePeginParams,\n timelockPegin: number,\n fundedPrePeginTxHex: string,\n htlcVout: number,\n): Promise<PeginTxResult> {\n return (await loadTbvWasm()).buildPeginTxFromPrePegin(\n params,\n timelockPegin,\n fundedPrePeginTxHex,\n htlcVout,\n );\n}\n\n/**\n * Returns HTLC connector script info for signing the PegIn transaction input.\n *\n * The depositor signs PegIn input 0 using the hashlock leaf (leaf 0) of the\n * Pre-PegIn HTLC output. Use getHashlockScript() and getHashlockControlBlock()\n * to construct the tapLeafScript entry in the PSBT.\n *\n * @param params - HTLC connector parameters (subset of PrePeginParams)\n * @returns Hashlock and refund script info for PSBT construction\n */\nexport async function getPrePeginHtlcConnectorInfo(\n params: HtlcConnectorParams,\n): Promise<HtlcConnectorInfo> {\n return (await loadTbvWasm()).getPrePeginHtlcConnectorInfo(params);\n}\n\n/**\n * Compute the minimum depositor claim value (PegIn output 1) in satoshis.\n *\n * This covers the full downstream tx graph cost (Claim → Assert → Payout)\n * based on the protocol parameters.\n */\nexport async function computeMinClaimValue(\n txGraphVersion: number,\n numLocalChallengers: number,\n numUniversalChallengers: number,\n councilQuorum: number,\n councilSize: number,\n feeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computeMinClaimValue(\n txGraphVersion,\n numLocalChallengers,\n numUniversalChallengers,\n councilQuorum,\n councilSize,\n feeRate,\n );\n}\n\n/**\n * Compute the minimum PegIn (activation) transaction fee in satoshis.\n *\n * `minPeginFee = peginTxVsize(numVks, numUcs) × minPeginFeeRate`. Each HTLC\n * the depositor funds in the Pre-PegIn tx must reserve at least this fee\n * inside its value (`htlcValue = peginAmount + depositorClaimValue +\n * p2aAnchorValue + minPeginFee`), otherwise the VP\n * cannot afford to broadcast the PegIn at\n * activation. The vsize comes from a Taproot script-path-spend weight\n * prediction whose witness shape depends on the VK + UC signer count.\n */\nexport async function computeMinPeginFee(\n txGraphVersion: number,\n numVks: number,\n numUcs: number,\n minPeginFeeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computeMinPeginFee(\n txGraphVersion,\n numVks,\n numUcs,\n minPeginFeeRate,\n );\n}\n\n/**\n * Floor of the Payout transaction fee under `txGraphVersion`: the minimum of\n * `estimatedVsize * feeRate` across every output-sizing model a deployed\n * vault provider is known to have used (fixed-34, intermediate,\n * script-aware). A VP-built payout paying less than this is provably not\n * produced by any known VP build. `out0Len` must be the TRUSTED length of the\n * pinned outs[0] script (1..=128); `out1Len` is the measured, UNTRUSTED\n * commission-script length — safe here because padding cannot raise the floor\n * (the fixed-34 model saturates the minimum) and shortening only lowers it.\n * Pass `undefined` for `out1Len` on 2-output (non-VP-claimer) payouts.\n * `feeRate` is the vault's version-locked `offchainParams.feeRate`.\n */\nexport async function computePayoutFeeFloor(\n txGraphVersion: number,\n numVaultKeepers: number,\n numUniversalChallengers: number,\n numLocalChallengers: number,\n councilSize: number,\n out0Len: number,\n out1Len: number | null | undefined,\n feeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computePayoutFeeFloor(\n txGraphVersion,\n numVaultKeepers,\n numUniversalChallengers,\n numLocalChallengers,\n councilSize,\n out0Len,\n out1Len,\n feeRate,\n );\n}\n\n/**\n * Tx graph versions the shipped vault-wasm binary can build. Callers must\n * preflight the required version (fresh: active; resume: stamped) against\n * this list and fail closed instead of hitting per-call errors mid-flow.\n *\n * Note: the facade constructors themselves fail closed on unsupported\n * versions, and derived objects carry the version they were built with —\n * value-level cross-checks live in `assertWasmPeginSizing` and the golden\n * byte-parity tests, not in a per-call version echo.\n */\nexport async function supportedTxGraphVersions(): Promise<number[]> {\n return (await loadTbvWasm()).supportedTxGraphVersions();\n}\n\n/**\n * The PegIn transaction's P2A (pay-to-anchor) output for a graph version: 240\n * sats at vout 2, script `51024e73`. Every supported version's PegIn carries\n * the anchor; the engine throws rather than return none.\n */\nexport async function peginP2aAnchorOutput(\n txGraphVersion: number,\n): Promise<PeginP2aAnchorInfo> {\n return (await loadTbvWasm()).peginP2aAnchorOutput(txGraphVersion);\n}\n\n/**\n * Validate a PegIn transaction's P2A anchor against a graph version's rule:\n * the exact anchor (240 sats, vout 2, P2A script). Throws on any mismatch, so\n * a PegIn without the anchor fails closed.\n */\nexport async function validatePeginP2aAnchor(\n txGraphVersion: number,\n txHex: string,\n): Promise<void> {\n return (await loadTbvWasm()).validatePeginP2aAnchor(txGraphVersion, txHex);\n}\n\n/**\n * Creates a payout connector for vault transactions.\n *\n * The payout connector generates the necessary taproot scripts and information\n * required for signing payout transactions (both optimistic and regular payout paths).\n *\n * @param params - Parameters for creating the payout connector\n * @param network - Bitcoin network\n * @returns Payout connector information including scripts, hashes, and address\n */\nexport async function createPayoutConnector(\n params: PayoutConnectorParams,\n network: Network,\n): Promise<PayoutConnectorInfo> {\n return (await loadTbvWasm()).createPayoutConnector(params, network);\n}\n\n/**\n * Get the Payout script and control block for the depositor's Assert output.\n *\n * Used to build the depositor's Payout PSBT (depositor-as-claimer path).\n *\n * @param params - Assert Payout/NoPayout connector parameters\n * @returns Payout script and control block (hex encoded)\n */\nexport async function getAssertPayoutScriptInfo(\n params: AssertPayoutNoPayoutConnectorParams,\n): Promise<AssertPayoutScriptInfo> {\n return (await loadTbvWasm()).getAssertPayoutScriptInfo(params);\n}\n\n/**\n * Get the NoPayout script and control block for a specific challenger.\n *\n * Used to build the depositor's NoPayout PSBT (depositor-as-claimer path).\n * Each challenger has a distinct NoPayout script.\n *\n * @param params - Assert Payout/NoPayout connector parameters\n * @param challengerPubkey - The challenger's x-only public key (hex encoded)\n * @returns NoPayout script and control block (hex encoded)\n */\nexport async function getAssertNoPayoutScriptInfo(\n params: AssertPayoutNoPayoutConnectorParams,\n challengerPubkey: string,\n): Promise<AssertNoPayoutScriptInfo> {\n return (await loadTbvWasm()).getAssertNoPayoutScriptInfo(\n params,\n challengerPubkey,\n );\n}\n\n/**\n * Get the ChallengeAssert script and control block.\n *\n * Used to build ChallengeAssert PSBTs for the depositor-as-claimer path.\n * Each challenger has 2 ChallengeAssert transactions (X and Y), and this\n * connector generates the spending scripts using WOTS public keys from the VP.\n *\n * @param params - ChallengeAssert connector parameters\n * @returns Script and control block (hex encoded)\n */\nexport async function getChallengeAssertScriptInfo(\n params: ChallengeAssertConnectorParams,\n): Promise<ChallengeAssertScriptInfo> {\n return (await loadTbvWasm()).getChallengeAssertScriptInfo(params);\n}\n\n/**\n * Get the scriptPubKey that output 0 of every ChallengeAssertX/Y transaction\n * pays to for one challenger: the WronglyChallenged leaves plus the NoPayout\n * leaf carrying the ChallengeAssert timelock.\n *\n * Used to bind the VP-supplied ChallengeAssert parents of a NoPayout before\n * the depositor signs it. The engine rejects a non-P2TR return.\n *\n * @param params - ChallengeAssert output connector parameters\n * @returns P2TR scriptPubKey (hex encoded)\n */\nexport async function getChallengeAssertOutputScriptPubKey(\n params: ChallengeAssertOutputConnectorParams,\n): Promise<string> {\n return (await loadTbvWasm()).getChallengeAssertOutputScriptPubKey(params);\n}\n\n/**\n * Derive 32-byte `authAnchor` (OP_RETURN preimage → VP bearer token).\n * @stability frozen - btc-vault Rust owns this API through the vault-wasm pin (`VAULT_WASM_COMMIT`).\n * Changing the derived bytes breaks VP auth for existing deposits. See CLAUDE.md §4.\n */\nexport async function expandAuthAnchor(root: Uint8Array): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandAuthAnchor(root);\n}\n\n/**\n * Derive 32-byte `hashlockSecret` for HTLC `htlcVout` (preimage → `activateVaultWithSecret`).\n * @stability frozen - btc-vault Rust owns this API.\n * Changing the derived bytes means affected vaults can never activate. See CLAUDE.md §4.\n */\nexport async function expandHashlockSecret(\n root: Uint8Array,\n htlcVout: number,\n): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandHashlockSecret(root, htlcVout);\n}\n\n/**\n * Derive 64-byte `wotsSeed` for HTLC `htlcVout` (→ WOTS keys, hashed as `depositorWotsPkHash`).\n * @stability frozen - btc-vault Rust owns this API.\n * Changing the derived bytes breaks existing `depositorWotsPkHash` values. No claim path remains. See CLAUDE.md §4.\n */\nexport async function expandWotsSeed(\n root: Uint8Array,\n htlcVout: number,\n): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandWotsSeed(root, htlcVout);\n}\n\n/**\n * Derives the vault ID from a PegIn transaction hash and depositor ETH address.\n *\n * Vault ID = keccak256(abi.encode(peginTxHash, depositor))\n * This matches the Solidity-side derivation in BTCVaultRegistry.\n *\n * @param peginTxHash - 32-byte PegIn tx hash in display order (big-endian), hex encoded\n * @param depositor - 20-byte Ethereum address of the depositor, hex encoded\n * @returns Hex-encoded vault ID (32 bytes)\n */\nexport async function deriveVaultId(\n peginTxHash: string,\n depositor: string,\n): Promise<string> {\n return (await loadTbvWasm()).deriveVaultId(peginTxHash, depositor);\n}\n\n// ============================================================================\n// Delegated claim (depositor-as-claimer) — assembly and claim-time surface\n// ============================================================================\n//\n// The forwarding hop for the WASM exports that assemble the two files the\n// `vaultd vp wt` watchtower CLI consumes, and for the claim-time exports\n// that run a claim from those files without the CLI.\n//\n// EXPERIMENTAL — under test, signet only. These names and signatures can\n// change in a minor release. See services/delegated-claim.\n\n/**\n * Depositor's Claim signing PSBT (base64) — spends PegIn:1, script path.\n *\n * @experimental\n */\nexport async function buildClaimPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildClaimPsbt(txGraphVersion, graphJson);\n}\n\n/**\n * Claimer's Assert signing PSBT (base64) — the single WOTS input.\n *\n * @experimental\n */\nexport async function buildAssertClaimerPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildAssertClaimerPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Claimer's Payout signing PSBT (base64) — input 1, Assert connector path.\n *\n * @experimental\n */\nexport async function buildPayoutClaimerPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildPayoutClaimerPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Depositor's Payout signing PSBT (base64) — input 0, the PegIn UTXO spend.\n *\n * @experimental\n */\nexport async function buildPayoutDepositorPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildPayoutDepositorPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Claimer's WronglyChallenged signing PSBTs, per challenger and GC index.\n *\n * @experimental\n */\nexport async function buildWronglyChallengedPsbts(\n txGraphVersion: number,\n graphJson: string,\n): Promise<WronglyChallengedPsbts> {\n return (await loadTbvWasm()).buildWronglyChallengedPsbts(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Verifies the Groth16 pegout proof and pins it into the artifacts, returning\n * the updated artifacts JSON. Persist that copy: the one-time WOTS keypair\n * signs exactly one proof, so a second, different one is refused.\n *\n * @experimental\n */\nexport async function pinPegoutProof(\n txGraphVersion: number,\n artifactsJson: string,\n proofHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).pinPegoutProof(\n txGraphVersion,\n artifactsJson,\n proofHex,\n );\n}\n\n/**\n * Finalizes the Assert from the pinned proof and the WOTS keypair, writes it\n * into the artifacts and returns the updated artifacts JSON. The keypair\n * never leaves the caller.\n *\n * @experimental\n */\nexport async function attachFinalizedAssert(\n txGraphVersion: number,\n artifactsJson: string,\n keypairJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).attachFinalizedAssert(\n txGraphVersion,\n artifactsJson,\n keypairJson,\n );\n}\n\n/**\n * Finalizes the Payout tx from the artifacts' signatures, consensus hex.\n *\n * @experimental\n */\nexport async function finalizePayout(\n txGraphVersion: number,\n artifactsJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizePayout(txGraphVersion, artifactsJson);\n}\n\n/**\n * Finalizes one WronglyChallenged tx — the answer to a ChallengeAssert.\n *\n * @experimental\n */\nexport async function finalizeWronglyChallenged(\n txGraphVersion: number,\n artifactsJson: string,\n challengerPkHex: string,\n gcIndex: number,\n preimageHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizeWronglyChallenged(\n txGraphVersion,\n artifactsJson,\n challengerPkHex,\n gcIndex,\n preimageHex,\n );\n}\n\n/**\n * Applies the depositor signature to the Claim tx, returning consensus hex.\n *\n * @experimental\n */\nexport async function finalizeClaimTx(\n txGraphVersion: number,\n graphJson: string,\n depositorSigHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizeClaimTx(\n txGraphVersion,\n graphJson,\n depositorSigHex,\n );\n}\n\n/**\n * Extracts a signed PSBT input's taproot script-path signature (hex).\n *\n * @experimental\n */\nexport async function extractTapScriptSig(\n psbtBase64: string,\n inputIndex: number,\n): Promise<string> {\n return (await loadTbvWasm()).extractTapScriptSig(psbtBase64, inputIndex);\n}\n\n/**\n * Derive the depositor's WOTS keypair from the 64-byte `wotsSeed`.\n * @stability frozen — `HASH160(seed || block index)` binds on-chain through\n * `depositorWotsPkHash`; see CLAUDE.md §4.\n *\n * @experimental\n */\nexport async function wotsKeypairFromSeed(\n wotsSeed: Uint8Array,\n): Promise<WotsKeypairDerivation> {\n return (await loadTbvWasm()).wotsKeypairFromSeed(wotsSeed);\n}\n\n/**\n * Throws unless the keypair matches the WOTS keys the graph's Claim commits to.\n *\n * @experimental\n */\nexport async function validateWotsKeypairAgainstGraph(\n txGraphVersion: number,\n keypair: unknown,\n graphJson: string,\n): Promise<void> {\n return (await loadTbvWasm()).validateWotsKeypairAgainstGraph(\n txGraphVersion,\n keypair,\n graphJson,\n );\n}\n\n/**\n * Assembles the watchtower `artifacts.json` content, verifying every signature.\n *\n * @experimental\n */\nexport async function buildWatchtowerArtifacts(\n inputs: WatchtowerArtifactsInputs,\n): Promise<string> {\n return (await loadTbvWasm()).buildWatchtowerArtifacts(inputs);\n}\n\n/**\n * Re-verifies every claimer-side signature in an `artifacts.json`.\n *\n * @experimental\n */\nexport async function verifyWatchtowerArtifacts(\n txGraphVersion: number,\n artifactsJson: string,\n): Promise<void> {\n return (await loadTbvWasm()).verifyWatchtowerArtifacts(\n txGraphVersion,\n artifactsJson,\n );\n}\n\nexport type {\n AssertNoPayoutScriptInfo,\n AssertPayoutNoPayoutConnectorParams,\n AssertPayoutScriptInfo,\n ChallengeAssertConnectorParams,\n ChallengeAssertOutputConnectorParams,\n ChallengeAssertScriptInfo,\n HtlcConnectorInfo,\n HtlcConnectorParams,\n Network,\n PayoutConnectorInfo,\n PayoutConnectorParams,\n PeginP2aAnchorInfo,\n PeginTxResult,\n PrePeginParams,\n PrePeginResult,\n WatchtowerArtifactsInputs,\n WotsKeypairDerivation,\n WronglyChallengedPsbts,\n WronglyChallengedSigs,\n};\n"],"names":["TAP_INTERNAL_KEY","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","getChallengeAssertOutputScriptPubKey","expandAuthAnchor","root","expandHashlockSecret","expandWotsSeed","deriveVaultId","peginTxHash","depositor","buildClaimPsbt","graphJson","buildAssertClaimerPsbt","buildPayoutClaimerPsbt","buildPayoutDepositorPsbt","buildWronglyChallengedPsbts","pinPegoutProof","artifactsJson","proofHex","attachFinalizedAssert","keypairJson","finalizePayout","finalizeWronglyChallenged","challengerPkHex","gcIndex","preimageHex","finalizeClaimTx","depositorSigHex","extractTapScriptSig","psbtBase64","inputIndex","wotsKeypairFromSeed","wotsSeed","validateWotsKeypairAgainstGraph","keypair","buildWatchtowerArtifacts","inputs","verifyWatchtowerArtifacts"],"mappings":"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,ECcA,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,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ACAiC,EACAgB,CAAA,CAEJ,CAOA,eAAsBC,EACpBC,EACAC,EACiB,CACjB,OAAQ,MAAM/D,EAAA,GAAe,oBAAoB8D,EAAYC,CAAU,CACzE,CASA,eAAsBC,EACpBC,EACgC,CAChC,OAAQ,MAAMjE,KAAe,oBAAoBiE,CAAQ,CAC3D,CAOA,eAAsBC,EACpBvD,EACAwD,EACAvB,EACe,CACf,OAAQ,MAAM5C,KAAe,gCAC3BW,EACAwD,EACAvB,CAAA,CAEJ,CAOA,eAAsBwB,EACpBC,EACiB,CACjB,OAAQ,MAAMrE,KAAe,yBAAyBqE,CAAM,CAC9D,CAOA,eAAsBC,EACpB3D,EACAuC,EACe,CACf,OAAQ,MAAMlD,KAAe,0BAC3BW,EACAuC,CAAA,CAEJ"}
|
|
@@ -69,7 +69,7 @@ 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
|
-
* p2aAnchorValue + minPeginFee
|
|
72
|
+
* p2aAnchorValue + minPeginFee`), otherwise the VP
|
|
73
73
|
* cannot afford to broadcast the PegIn at
|
|
74
74
|
* activation. The vsize comes from a Taproot script-path-spend weight
|
|
75
75
|
* prediction whose witness shape depends on the VK + UC signer count.
|
|
@@ -100,18 +100,15 @@ export declare function computePayoutFeeFloor(txGraphVersion: number, numVaultKe
|
|
|
100
100
|
*/
|
|
101
101
|
export declare function supportedTxGraphVersions(): Promise<number[]>;
|
|
102
102
|
/**
|
|
103
|
-
* The PegIn transaction's P2A (pay-to-anchor) output for a graph version
|
|
104
|
-
* `
|
|
105
|
-
*
|
|
106
|
-
* anchor can't be mistaken for a real output. For v2/v3: 240 sats at vout 2,
|
|
107
|
-
* script `51024e73`.
|
|
103
|
+
* The PegIn transaction's P2A (pay-to-anchor) output for a graph version: 240
|
|
104
|
+
* sats at vout 2, script `51024e73`. Every supported version's PegIn carries
|
|
105
|
+
* the anchor; the engine throws rather than return none.
|
|
108
106
|
*/
|
|
109
|
-
export declare function peginP2aAnchorOutput(txGraphVersion: number): Promise<PeginP2aAnchorInfo
|
|
107
|
+
export declare function peginP2aAnchorOutput(txGraphVersion: number): Promise<PeginP2aAnchorInfo>;
|
|
110
108
|
/**
|
|
111
|
-
* Validate a PegIn transaction's P2A anchor against a graph version's
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* v2 PegIn checked as v1 fails closed, and vice versa.
|
|
109
|
+
* Validate a PegIn transaction's P2A anchor against a graph version's rule:
|
|
110
|
+
* the exact anchor (240 sats, vout 2, P2A script). Throws on any mismatch, so
|
|
111
|
+
* a PegIn without the anchor fails closed.
|
|
115
112
|
*/
|
|
116
113
|
export declare function validatePeginP2aAnchor(txGraphVersion: number, txHex: string): Promise<void>;
|
|
117
114
|
/**
|
|
@@ -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,oCAAoC,EACpC,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,C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,EAAE,MAAM,EACtB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,YAAY,EACV,wBAAwB,EACxB,mCAAmC,EACnC,sBAAsB,EACtB,8BAA8B,EAC9B,oCAAoC,EACpC,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/tbv/core/wasm/constants.ts","../../../../src/tbv/core/wasm/index.ts"],"sourcesContent":["/**\n * Protocol constants that do not require loading the vault WASM module.\n *\n * Keeping these values local lets Bitcoin builders construct PSBT metadata\n * without resolving or evaluating the WASM engine at module-import\n * time. The hex value is the BIP-341 nothing-up-my-sleeve internal key and is\n * pinned by the vault protocol.\n */\nexport const TAP_INTERNAL_KEY =\n \"50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0\";\n\nconst HEX_CHARS_PER_BYTE = 2;\n\nexport const tapInternalPubkey = Uint8Array.from(\n { length: TAP_INTERNAL_KEY.length / HEX_CHARS_PER_BYTE },\n (_, index) =>\n Number.parseInt(\n TAP_INTERNAL_KEY.slice(\n index * HEX_CHARS_PER_BYTE,\n index * HEX_CHARS_PER_BYTE + HEX_CHARS_PER_BYTE,\n ),\n 16,\n ),\n);\n","/**\n * Explicit lazy boundary around the vault-WASM engine package.\n *\n * Importing the SDK (including its legacy root barrels) does not resolve the\n * WASM package or generated binary. The engine is loaded only when a caller\n * invokes an operation that actually needs the Bitcoin transaction graph.\n * ETH-only entry points never import this module.\n *\n * @module tbv/core/wasm\n */\n\nimport type {\n AssertNoPayoutScriptInfo,\n AssertPayoutNoPayoutConnectorParams,\n AssertPayoutScriptInfo,\n ChallengeAssertConnectorParams,\n ChallengeAssertOutputConnectorParams,\n ChallengeAssertScriptInfo,\n HtlcConnectorInfo,\n HtlcConnectorParams,\n Network,\n PayoutConnectorInfo,\n PayoutConnectorParams,\n PeginP2aAnchorInfo,\n PeginTxResult,\n PrePeginParams,\n PrePeginResult,\n WatchtowerArtifactsInputs,\n WotsKeypairDerivation,\n WronglyChallengedPsbts,\n WronglyChallengedSigs,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\n\nexport { TAP_INTERNAL_KEY, tapInternalPubkey } from \"./constants\";\n\ntype TbvWasmModule = typeof import(\"@babylonlabs-io/babylon-tbv-rust-wasm\");\n\nlet wasmModulePromise: Promise<TbvWasmModule> | undefined;\n\n/**\n * Load and initialize the WASM engine on first use. Concurrent callers share\n * one load. The returned module is already initialized, so a caller does not\n * call `initWasm()`. A load or initialization failure rejects with an error\n * that names the engine package. The original error is its cause. A failure\n * clears this cache, so the next call loads again. The engine keeps a failed\n * binary initialization rejected, so only a failed import or binary read can\n * succeed on a later call.\n *\n * The module also contains the wasm-bindgen classes. The classes have no value\n * guards. A caller that uses a class must cross-check its output at the call\n * site.\n */\nexport function loadTbvWasm(): Promise<TbvWasmModule> {\n wasmModulePromise ??= import(\"@babylonlabs-io/babylon-tbv-rust-wasm\")\n .catch((error: unknown) => {\n wasmModulePromise = undefined;\n throw new Error(\n \"The vault-WASM engine @babylonlabs-io/babylon-tbv-rust-wasm failed \" +\n \"to load. The module could not be resolved, or it threw while \" +\n \"evaluating, commonly a missing or stale generated WASM build. \" +\n \"See the cause for the underlying error.\",\n { cause: error },\n );\n })\n .then(async (wasm) => {\n try {\n await wasm.initWasm();\n } catch (error: unknown) {\n wasmModulePromise = undefined;\n throw new Error(\n \"The vault-WASM engine @babylonlabs-io/babylon-tbv-rust-wasm \" +\n \"resolved, but its WebAssembly binary failed to initialize, \" +\n \"commonly a missing or stale generated WASM build. See the \" +\n \"cause for the underlying error.\",\n { cause: error },\n );\n }\n return wasm;\n });\n return wasmModulePromise;\n}\n\n/**\n * Creates an unfunded Pre-PegIn transaction with no inputs and HTLC output(s).\n *\n * The HTLC output value (htlcValue) covers the peg-in amount, depositor claim value,\n * and minimum pegin fee — all computed internally from the provided contract parameters.\n *\n * After building the Pre-PegIn transaction, the caller must:\n * 1. Select UTXOs covering htlcValue + network fees\n * 2. Fund the transaction (add inputs and change output)\n * 3. Call reconstructFromFundedTx() with the funded tx hex\n * 4. Call buildPeginTx() to derive the PegIn transaction\n * 5. Sign the PegIn input using the HTLC hashlock leaf (leaf 0)\n *\n * @param params - Pre-PegIn parameters from contract and depositor wallet\n * @returns Unfunded transaction details with HTLC output information\n */\nexport async function createPrePeginTransaction(\n params: PrePeginParams,\n): Promise<PrePeginResult> {\n return (await loadTbvWasm()).createPrePeginTransaction(params);\n}\n\n/**\n * Derives the PegIn transaction from a funded Pre-PegIn transaction.\n *\n * The PegIn transaction has a single input spending the Pre-PegIn HTLC output\n * at `htlcVout` via the hashlock + all-party script (leaf 0).\n *\n * @param params - Same PrePeginParams used to create the Pre-PegIn transaction\n * @param timelockPegin - CSV timelock in blocks for the PegIn vault output\n * @param fundedPrePeginTxHex - Hex-encoded funded Pre-PegIn transaction\n * @param htlcVout - Index of the HTLC output to spend\n * @returns PegIn transaction details including vault output information\n */\nexport async function buildPeginTxFromPrePegin(\n params: PrePeginParams,\n timelockPegin: number,\n fundedPrePeginTxHex: string,\n htlcVout: number,\n): Promise<PeginTxResult> {\n return (await loadTbvWasm()).buildPeginTxFromPrePegin(\n params,\n timelockPegin,\n fundedPrePeginTxHex,\n htlcVout,\n );\n}\n\n/**\n * Returns HTLC connector script info for signing the PegIn transaction input.\n *\n * The depositor signs PegIn input 0 using the hashlock leaf (leaf 0) of the\n * Pre-PegIn HTLC output. Use getHashlockScript() and getHashlockControlBlock()\n * to construct the tapLeafScript entry in the PSBT.\n *\n * @param params - HTLC connector parameters (subset of PrePeginParams)\n * @returns Hashlock and refund script info for PSBT construction\n */\nexport async function getPrePeginHtlcConnectorInfo(\n params: HtlcConnectorParams,\n): Promise<HtlcConnectorInfo> {\n return (await loadTbvWasm()).getPrePeginHtlcConnectorInfo(params);\n}\n\n/**\n * Compute the minimum depositor claim value (PegIn output 1) in satoshis.\n *\n * This covers the full downstream tx graph cost (Claim → Assert → Payout)\n * based on the protocol parameters.\n */\nexport async function computeMinClaimValue(\n txGraphVersion: number,\n numLocalChallengers: number,\n numUniversalChallengers: number,\n councilQuorum: number,\n councilSize: number,\n feeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computeMinClaimValue(\n txGraphVersion,\n numLocalChallengers,\n numUniversalChallengers,\n councilQuorum,\n councilSize,\n feeRate,\n );\n}\n\n/**\n * Compute the minimum PegIn (activation) transaction fee in satoshis.\n *\n * `minPeginFee = peginTxVsize(numVks, numUcs) × minPeginFeeRate`. Each HTLC\n * the depositor funds in the Pre-PegIn tx must reserve at least this fee\n * inside its value (`htlcValue = peginAmount + depositorClaimValue +\n * p2aAnchorValue + minPeginFee`, anchor 0 on vault core 1), otherwise the VP\n * cannot afford to broadcast the PegIn at\n * activation. The vsize comes from a Taproot script-path-spend weight\n * prediction whose witness shape depends on the VK + UC signer count.\n */\nexport async function computeMinPeginFee(\n txGraphVersion: number,\n numVks: number,\n numUcs: number,\n minPeginFeeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computeMinPeginFee(\n txGraphVersion,\n numVks,\n numUcs,\n minPeginFeeRate,\n );\n}\n\n/**\n * Floor of the Payout transaction fee under `txGraphVersion`: the minimum of\n * `estimatedVsize * feeRate` across every output-sizing model a deployed\n * vault provider is known to have used (fixed-34, intermediate,\n * script-aware). A VP-built payout paying less than this is provably not\n * produced by any known VP build. `out0Len` must be the TRUSTED length of the\n * pinned outs[0] script (1..=128); `out1Len` is the measured, UNTRUSTED\n * commission-script length — safe here because padding cannot raise the floor\n * (the fixed-34 model saturates the minimum) and shortening only lowers it.\n * Pass `undefined` for `out1Len` on 2-output (non-VP-claimer) payouts.\n * `feeRate` is the vault's version-locked `offchainParams.feeRate`.\n */\nexport async function computePayoutFeeFloor(\n txGraphVersion: number,\n numVaultKeepers: number,\n numUniversalChallengers: number,\n numLocalChallengers: number,\n councilSize: number,\n out0Len: number,\n out1Len: number | null | undefined,\n feeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computePayoutFeeFloor(\n txGraphVersion,\n numVaultKeepers,\n numUniversalChallengers,\n numLocalChallengers,\n councilSize,\n out0Len,\n out1Len,\n feeRate,\n );\n}\n\n/**\n * Tx graph versions the shipped vault-wasm binary can build. Callers must\n * preflight the required version (fresh: active; resume: stamped) against\n * this list and fail closed instead of hitting per-call errors mid-flow.\n *\n * Note: the facade constructors themselves fail closed on unsupported\n * versions, and derived objects carry the version they were built with —\n * value-level cross-checks live in `assertWasmPeginSizing` and the golden\n * byte-parity tests, not in a per-call version echo.\n */\nexport async function supportedTxGraphVersions(): Promise<number[]> {\n return (await loadTbvWasm()).supportedTxGraphVersions();\n}\n\n/**\n * The PegIn transaction's P2A (pay-to-anchor) output for a graph version, or\n * `null` when that version's PegIn carries no anchor (v1). The facade returns\n * one record per version — never a zero-valued placeholder — so an absent\n * anchor can't be mistaken for a real output. For v2/v3: 240 sats at vout 2,\n * script `51024e73`.\n */\nexport async function peginP2aAnchorOutput(\n txGraphVersion: number,\n): Promise<PeginP2aAnchorInfo | null> {\n return (await loadTbvWasm()).peginP2aAnchorOutput(txGraphVersion);\n}\n\n/**\n * Validate a PegIn transaction's P2A anchor against a graph version's rules:\n * v2 and v3 require the exact anchor (240 sats, vout 2, P2A script) and v1\n * requires that NO output carries the P2A script. Throws on any mismatch — a\n * v2 PegIn checked as v1 fails closed, and vice versa.\n */\nexport async function validatePeginP2aAnchor(\n txGraphVersion: number,\n txHex: string,\n): Promise<void> {\n return (await loadTbvWasm()).validatePeginP2aAnchor(txGraphVersion, txHex);\n}\n\n/**\n * Creates a payout connector for vault transactions.\n *\n * The payout connector generates the necessary taproot scripts and information\n * required for signing payout transactions (both optimistic and regular payout paths).\n *\n * @param params - Parameters for creating the payout connector\n * @param network - Bitcoin network\n * @returns Payout connector information including scripts, hashes, and address\n */\nexport async function createPayoutConnector(\n params: PayoutConnectorParams,\n network: Network,\n): Promise<PayoutConnectorInfo> {\n return (await loadTbvWasm()).createPayoutConnector(params, network);\n}\n\n/**\n * Get the Payout script and control block for the depositor's Assert output.\n *\n * Used to build the depositor's Payout PSBT (depositor-as-claimer path).\n *\n * @param params - Assert Payout/NoPayout connector parameters\n * @returns Payout script and control block (hex encoded)\n */\nexport async function getAssertPayoutScriptInfo(\n params: AssertPayoutNoPayoutConnectorParams,\n): Promise<AssertPayoutScriptInfo> {\n return (await loadTbvWasm()).getAssertPayoutScriptInfo(params);\n}\n\n/**\n * Get the NoPayout script and control block for a specific challenger.\n *\n * Used to build the depositor's NoPayout PSBT (depositor-as-claimer path).\n * Each challenger has a distinct NoPayout script.\n *\n * @param params - Assert Payout/NoPayout connector parameters\n * @param challengerPubkey - The challenger's x-only public key (hex encoded)\n * @returns NoPayout script and control block (hex encoded)\n */\nexport async function getAssertNoPayoutScriptInfo(\n params: AssertPayoutNoPayoutConnectorParams,\n challengerPubkey: string,\n): Promise<AssertNoPayoutScriptInfo> {\n return (await loadTbvWasm()).getAssertNoPayoutScriptInfo(\n params,\n challengerPubkey,\n );\n}\n\n/**\n * Get the ChallengeAssert script and control block.\n *\n * Used to build ChallengeAssert PSBTs for the depositor-as-claimer path.\n * Each challenger has 2 ChallengeAssert transactions (X and Y), and this\n * connector generates the spending scripts using WOTS public keys from the VP.\n *\n * @param params - ChallengeAssert connector parameters\n * @returns Script and control block (hex encoded)\n */\nexport async function getChallengeAssertScriptInfo(\n params: ChallengeAssertConnectorParams,\n): Promise<ChallengeAssertScriptInfo> {\n return (await loadTbvWasm()).getChallengeAssertScriptInfo(params);\n}\n\n/**\n * Get the scriptPubKey that output 0 of every ChallengeAssertX/Y transaction\n * pays to for one challenger: the WronglyChallenged leaves plus the NoPayout\n * leaf carrying the ChallengeAssert timelock.\n *\n * Used to bind the VP-supplied ChallengeAssert parents of a NoPayout before\n * the depositor signs it. The engine rejects a non-P2TR return.\n *\n * @param params - ChallengeAssert output connector parameters\n * @returns P2TR scriptPubKey (hex encoded)\n */\nexport async function getChallengeAssertOutputScriptPubKey(\n params: ChallengeAssertOutputConnectorParams,\n): Promise<string> {\n return (await loadTbvWasm()).getChallengeAssertOutputScriptPubKey(params);\n}\n\n/**\n * Derive 32-byte `authAnchor` (OP_RETURN preimage → VP bearer token).\n * @stability frozen - btc-vault Rust owns this API through the vault-wasm pin (`VAULT_WASM_COMMIT`).\n * Changing the derived bytes breaks VP auth for existing deposits. See CLAUDE.md §4.\n */\nexport async function expandAuthAnchor(root: Uint8Array): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandAuthAnchor(root);\n}\n\n/**\n * Derive 32-byte `hashlockSecret` for HTLC `htlcVout` (preimage → `activateVaultWithSecret`).\n * @stability frozen - btc-vault Rust owns this API.\n * Changing the derived bytes means affected vaults can never activate. See CLAUDE.md §4.\n */\nexport async function expandHashlockSecret(\n root: Uint8Array,\n htlcVout: number,\n): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandHashlockSecret(root, htlcVout);\n}\n\n/**\n * Derive 64-byte `wotsSeed` for HTLC `htlcVout` (→ WOTS keys, hashed as `depositorWotsPkHash`).\n * @stability frozen - btc-vault Rust owns this API.\n * Changing the derived bytes breaks existing `depositorWotsPkHash` values. No claim path remains. See CLAUDE.md §4.\n */\nexport async function expandWotsSeed(\n root: Uint8Array,\n htlcVout: number,\n): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandWotsSeed(root, htlcVout);\n}\n\n/**\n * Derives the vault ID from a PegIn transaction hash and depositor ETH address.\n *\n * Vault ID = keccak256(abi.encode(peginTxHash, depositor))\n * This matches the Solidity-side derivation in BTCVaultRegistry.\n *\n * @param peginTxHash - 32-byte PegIn tx hash in display order (big-endian), hex encoded\n * @param depositor - 20-byte Ethereum address of the depositor, hex encoded\n * @returns Hex-encoded vault ID (32 bytes)\n */\nexport async function deriveVaultId(\n peginTxHash: string,\n depositor: string,\n): Promise<string> {\n return (await loadTbvWasm()).deriveVaultId(peginTxHash, depositor);\n}\n\n// ============================================================================\n// Delegated claim (depositor-as-claimer) — assembly and claim-time surface\n// ============================================================================\n//\n// The forwarding hop for the WASM exports that assemble the two files the\n// `vaultd vp wt` watchtower CLI consumes, and for the claim-time exports\n// that run a claim from those files without the CLI.\n//\n// EXPERIMENTAL — under test, signet only. These names and signatures can\n// change in a minor release. See services/delegated-claim.\n\n/**\n * Depositor's Claim signing PSBT (base64) — spends PegIn:1, script path.\n *\n * @experimental\n */\nexport async function buildClaimPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildClaimPsbt(txGraphVersion, graphJson);\n}\n\n/**\n * Claimer's Assert signing PSBT (base64) — the single WOTS input.\n *\n * @experimental\n */\nexport async function buildAssertClaimerPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildAssertClaimerPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Claimer's Payout signing PSBT (base64) — input 1, Assert connector path.\n *\n * @experimental\n */\nexport async function buildPayoutClaimerPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildPayoutClaimerPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Depositor's Payout signing PSBT (base64) — input 0, the PegIn UTXO spend.\n *\n * @experimental\n */\nexport async function buildPayoutDepositorPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildPayoutDepositorPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Claimer's WronglyChallenged signing PSBTs, per challenger and GC index.\n *\n * @experimental\n */\nexport async function buildWronglyChallengedPsbts(\n txGraphVersion: number,\n graphJson: string,\n): Promise<WronglyChallengedPsbts> {\n return (await loadTbvWasm()).buildWronglyChallengedPsbts(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Verifies the Groth16 pegout proof and pins it into the artifacts, returning\n * the updated artifacts JSON. Persist that copy: the one-time WOTS keypair\n * signs exactly one proof, so a second, different one is refused.\n *\n * @experimental\n */\nexport async function pinPegoutProof(\n txGraphVersion: number,\n artifactsJson: string,\n proofHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).pinPegoutProof(\n txGraphVersion,\n artifactsJson,\n proofHex,\n );\n}\n\n/**\n * Finalizes the Assert from the pinned proof and the WOTS keypair, writes it\n * into the artifacts and returns the updated artifacts JSON. The keypair\n * never leaves the caller.\n *\n * @experimental\n */\nexport async function attachFinalizedAssert(\n txGraphVersion: number,\n artifactsJson: string,\n keypairJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).attachFinalizedAssert(\n txGraphVersion,\n artifactsJson,\n keypairJson,\n );\n}\n\n/**\n * Finalizes the Payout tx from the artifacts' signatures, consensus hex.\n *\n * @experimental\n */\nexport async function finalizePayout(\n txGraphVersion: number,\n artifactsJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizePayout(txGraphVersion, artifactsJson);\n}\n\n/**\n * Finalizes one WronglyChallenged tx — the answer to a ChallengeAssert.\n *\n * @experimental\n */\nexport async function finalizeWronglyChallenged(\n txGraphVersion: number,\n artifactsJson: string,\n challengerPkHex: string,\n gcIndex: number,\n preimageHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizeWronglyChallenged(\n txGraphVersion,\n artifactsJson,\n challengerPkHex,\n gcIndex,\n preimageHex,\n );\n}\n\n/**\n * Applies the depositor signature to the Claim tx, returning consensus hex.\n *\n * @experimental\n */\nexport async function finalizeClaimTx(\n txGraphVersion: number,\n graphJson: string,\n depositorSigHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizeClaimTx(\n txGraphVersion,\n graphJson,\n depositorSigHex,\n );\n}\n\n/**\n * Extracts a signed PSBT input's taproot script-path signature (hex).\n *\n * @experimental\n */\nexport async function extractTapScriptSig(\n psbtBase64: string,\n inputIndex: number,\n): Promise<string> {\n return (await loadTbvWasm()).extractTapScriptSig(psbtBase64, inputIndex);\n}\n\n/**\n * Derive the depositor's WOTS keypair from the 64-byte `wotsSeed`.\n * @stability frozen — `HASH160(seed || block index)` binds on-chain through\n * `depositorWotsPkHash`; see CLAUDE.md §4.\n *\n * @experimental\n */\nexport async function wotsKeypairFromSeed(\n wotsSeed: Uint8Array,\n): Promise<WotsKeypairDerivation> {\n return (await loadTbvWasm()).wotsKeypairFromSeed(wotsSeed);\n}\n\n/**\n * Throws unless the keypair matches the WOTS keys the graph's Claim commits to.\n *\n * @experimental\n */\nexport async function validateWotsKeypairAgainstGraph(\n txGraphVersion: number,\n keypair: unknown,\n graphJson: string,\n): Promise<void> {\n return (await loadTbvWasm()).validateWotsKeypairAgainstGraph(\n txGraphVersion,\n keypair,\n graphJson,\n );\n}\n\n/**\n * Assembles the watchtower `artifacts.json` content, verifying every signature.\n *\n * @experimental\n */\nexport async function buildWatchtowerArtifacts(\n inputs: WatchtowerArtifactsInputs,\n): Promise<string> {\n return (await loadTbvWasm()).buildWatchtowerArtifacts(inputs);\n}\n\n/**\n * Re-verifies every claimer-side signature in an `artifacts.json`.\n *\n * @experimental\n */\nexport async function verifyWatchtowerArtifacts(\n txGraphVersion: number,\n artifactsJson: string,\n): Promise<void> {\n return (await loadTbvWasm()).verifyWatchtowerArtifacts(\n txGraphVersion,\n artifactsJson,\n );\n}\n\nexport type {\n AssertNoPayoutScriptInfo,\n AssertPayoutNoPayoutConnectorParams,\n AssertPayoutScriptInfo,\n ChallengeAssertConnectorParams,\n ChallengeAssertOutputConnectorParams,\n ChallengeAssertScriptInfo,\n HtlcConnectorInfo,\n HtlcConnectorParams,\n Network,\n PayoutConnectorInfo,\n PayoutConnectorParams,\n PeginP2aAnchorInfo,\n PeginTxResult,\n PrePeginParams,\n PrePeginResult,\n WatchtowerArtifactsInputs,\n WotsKeypairDerivation,\n WronglyChallengedPsbts,\n WronglyChallengedSigs,\n};\n"],"names":["TAP_INTERNAL_KEY","tapInternalPubkey","_","index","wasmModulePromise","loadTbvWasm","error","wasm","createPrePeginTransaction","params","buildPeginTxFromPrePegin","timelockPegin","fundedPrePeginTxHex","htlcVout","getPrePeginHtlcConnectorInfo","computeMinClaimValue","txGraphVersion","numLocalChallengers","numUniversalChallengers","councilQuorum","councilSize","feeRate","computeMinPeginFee","numVks","numUcs","minPeginFeeRate","computePayoutFeeFloor","numVaultKeepers","out0Len","out1Len","supportedTxGraphVersions","peginP2aAnchorOutput","validatePeginP2aAnchor","txHex","createPayoutConnector","network","getAssertPayoutScriptInfo","getAssertNoPayoutScriptInfo","challengerPubkey","getChallengeAssertScriptInfo","getChallengeAssertOutputScriptPubKey","expandAuthAnchor","root","expandHashlockSecret","expandWotsSeed","deriveVaultId","peginTxHash","depositor","buildClaimPsbt","graphJson","buildAssertClaimerPsbt","buildPayoutClaimerPsbt","buildPayoutDepositorPsbt","buildWronglyChallengedPsbts","pinPegoutProof","artifactsJson","proofHex","attachFinalizedAssert","keypairJson","finalizePayout","finalizeWronglyChallenged","challengerPkHex","gcIndex","preimageHex","finalizeClaimTx","depositorSigHex","extractTapScriptSig","psbtBase64","inputIndex","wotsKeypairFromSeed","wotsSeed","validateWotsKeypairAgainstGraph","keypair","buildWatchtowerArtifacts","inputs","verifyWatchtowerArtifacts"],"mappings":"AAQO,MAAMA,IACX;AAIK,MAAMC,IAAoB,WAAW;AAAA,EAC1C,EAAE,QAAQD,EAAiB,SAAS,EAAA;AAAA,EACpC,CAACE,GAAGC,MACF,OAAO;AAAA,IACLH,EAAiB;AAAA,MACfG,IAAQ;AAAA,MACRA,IAAQ,IAAqB;AAAA,IAAA;AAAA,IAE/B;AAAA,EAAA;AAEN;ACcA,IAAIC;AAeG,SAASC,IAAsC;AACpD,SAAAD,UAAsB,OAAO,uCAAuC,EACjE,MAAM,CAACE,MAAmB;AACzB,UAAAF,IAAoB,QACd,IAAI;A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AAA,EAAA;AAEJ;AAOA,eAAsBwB,EACpBC,GACiB;AACjB,UAAQ,MAAMrE,KAAe,yBAAyBqE,CAAM;AAC9D;AAOA,eAAsBC,EACpB3D,GACAuC,GACe;AACf,UAAQ,MAAMlD,KAAe;AAAA,IAC3BW;AAAA,IACAuC;AAAA,EAAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/tbv/core/wasm/constants.ts","../../../../src/tbv/core/wasm/index.ts"],"sourcesContent":["/**\n * Protocol constants that do not require loading the vault WASM module.\n *\n * Keeping these values local lets Bitcoin builders construct PSBT metadata\n * without resolving or evaluating the WASM engine at module-import\n * time. The hex value is the BIP-341 nothing-up-my-sleeve internal key and is\n * pinned by the vault protocol.\n */\nexport const TAP_INTERNAL_KEY =\n \"50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0\";\n\nconst HEX_CHARS_PER_BYTE = 2;\n\nexport const tapInternalPubkey = Uint8Array.from(\n { length: TAP_INTERNAL_KEY.length / HEX_CHARS_PER_BYTE },\n (_, index) =>\n Number.parseInt(\n TAP_INTERNAL_KEY.slice(\n index * HEX_CHARS_PER_BYTE,\n index * HEX_CHARS_PER_BYTE + HEX_CHARS_PER_BYTE,\n ),\n 16,\n ),\n);\n","/**\n * Explicit lazy boundary around the vault-WASM engine package.\n *\n * Importing the SDK (including its legacy root barrels) does not resolve the\n * WASM package or generated binary. The engine is loaded only when a caller\n * invokes an operation that actually needs the Bitcoin transaction graph.\n * ETH-only entry points never import this module.\n *\n * @module tbv/core/wasm\n */\n\nimport type {\n AssertNoPayoutScriptInfo,\n AssertPayoutNoPayoutConnectorParams,\n AssertPayoutScriptInfo,\n ChallengeAssertConnectorParams,\n ChallengeAssertOutputConnectorParams,\n ChallengeAssertScriptInfo,\n HtlcConnectorInfo,\n HtlcConnectorParams,\n Network,\n PayoutConnectorInfo,\n PayoutConnectorParams,\n PeginP2aAnchorInfo,\n PeginTxResult,\n PrePeginParams,\n PrePeginResult,\n WatchtowerArtifactsInputs,\n WotsKeypairDerivation,\n WronglyChallengedPsbts,\n WronglyChallengedSigs,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\n\nexport { TAP_INTERNAL_KEY, tapInternalPubkey } from \"./constants\";\n\ntype TbvWasmModule = typeof import(\"@babylonlabs-io/babylon-tbv-rust-wasm\");\n\nlet wasmModulePromise: Promise<TbvWasmModule> | undefined;\n\n/**\n * Load and initialize the WASM engine on first use. Concurrent callers share\n * one load. The returned module is already initialized, so a caller does not\n * call `initWasm()`. A load or initialization failure rejects with an error\n * that names the engine package. The original error is its cause. A failure\n * clears this cache, so the next call loads again. The engine keeps a failed\n * binary initialization rejected, so only a failed import or binary read can\n * succeed on a later call.\n *\n * The module also contains the wasm-bindgen classes. The classes have no value\n * guards. A caller that uses a class must cross-check its output at the call\n * site.\n */\nexport function loadTbvWasm(): Promise<TbvWasmModule> {\n wasmModulePromise ??= import(\"@babylonlabs-io/babylon-tbv-rust-wasm\")\n .catch((error: unknown) => {\n wasmModulePromise = undefined;\n throw new Error(\n \"The vault-WASM engine @babylonlabs-io/babylon-tbv-rust-wasm failed \" +\n \"to load. The module could not be resolved, or it threw while \" +\n \"evaluating, commonly a missing or stale generated WASM build. \" +\n \"See the cause for the underlying error.\",\n { cause: error },\n );\n })\n .then(async (wasm) => {\n try {\n await wasm.initWasm();\n } catch (error: unknown) {\n wasmModulePromise = undefined;\n throw new Error(\n \"The vault-WASM engine @babylonlabs-io/babylon-tbv-rust-wasm \" +\n \"resolved, but its WebAssembly binary failed to initialize, \" +\n \"commonly a missing or stale generated WASM build. See the \" +\n \"cause for the underlying error.\",\n { cause: error },\n );\n }\n return wasm;\n });\n return wasmModulePromise;\n}\n\n/**\n * Creates an unfunded Pre-PegIn transaction with no inputs and HTLC output(s).\n *\n * The HTLC output value (htlcValue) covers the peg-in amount, depositor claim value,\n * and minimum pegin fee — all computed internally from the provided contract parameters.\n *\n * After building the Pre-PegIn transaction, the caller must:\n * 1. Select UTXOs covering htlcValue + network fees\n * 2. Fund the transaction (add inputs and change output)\n * 3. Call reconstructFromFundedTx() with the funded tx hex\n * 4. Call buildPeginTx() to derive the PegIn transaction\n * 5. Sign the PegIn input using the HTLC hashlock leaf (leaf 0)\n *\n * @param params - Pre-PegIn parameters from contract and depositor wallet\n * @returns Unfunded transaction details with HTLC output information\n */\nexport async function createPrePeginTransaction(\n params: PrePeginParams,\n): Promise<PrePeginResult> {\n return (await loadTbvWasm()).createPrePeginTransaction(params);\n}\n\n/**\n * Derives the PegIn transaction from a funded Pre-PegIn transaction.\n *\n * The PegIn transaction has a single input spending the Pre-PegIn HTLC output\n * at `htlcVout` via the hashlock + all-party script (leaf 0).\n *\n * @param params - Same PrePeginParams used to create the Pre-PegIn transaction\n * @param timelockPegin - CSV timelock in blocks for the PegIn vault output\n * @param fundedPrePeginTxHex - Hex-encoded funded Pre-PegIn transaction\n * @param htlcVout - Index of the HTLC output to spend\n * @returns PegIn transaction details including vault output information\n */\nexport async function buildPeginTxFromPrePegin(\n params: PrePeginParams,\n timelockPegin: number,\n fundedPrePeginTxHex: string,\n htlcVout: number,\n): Promise<PeginTxResult> {\n return (await loadTbvWasm()).buildPeginTxFromPrePegin(\n params,\n timelockPegin,\n fundedPrePeginTxHex,\n htlcVout,\n );\n}\n\n/**\n * Returns HTLC connector script info for signing the PegIn transaction input.\n *\n * The depositor signs PegIn input 0 using the hashlock leaf (leaf 0) of the\n * Pre-PegIn HTLC output. Use getHashlockScript() and getHashlockControlBlock()\n * to construct the tapLeafScript entry in the PSBT.\n *\n * @param params - HTLC connector parameters (subset of PrePeginParams)\n * @returns Hashlock and refund script info for PSBT construction\n */\nexport async function getPrePeginHtlcConnectorInfo(\n params: HtlcConnectorParams,\n): Promise<HtlcConnectorInfo> {\n return (await loadTbvWasm()).getPrePeginHtlcConnectorInfo(params);\n}\n\n/**\n * Compute the minimum depositor claim value (PegIn output 1) in satoshis.\n *\n * This covers the full downstream tx graph cost (Claim → Assert → Payout)\n * based on the protocol parameters.\n */\nexport async function computeMinClaimValue(\n txGraphVersion: number,\n numLocalChallengers: number,\n numUniversalChallengers: number,\n councilQuorum: number,\n councilSize: number,\n feeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computeMinClaimValue(\n txGraphVersion,\n numLocalChallengers,\n numUniversalChallengers,\n councilQuorum,\n councilSize,\n feeRate,\n );\n}\n\n/**\n * Compute the minimum PegIn (activation) transaction fee in satoshis.\n *\n * `minPeginFee = peginTxVsize(numVks, numUcs) × minPeginFeeRate`. Each HTLC\n * the depositor funds in the Pre-PegIn tx must reserve at least this fee\n * inside its value (`htlcValue = peginAmount + depositorClaimValue +\n * p2aAnchorValue + minPeginFee`), otherwise the VP\n * cannot afford to broadcast the PegIn at\n * activation. The vsize comes from a Taproot script-path-spend weight\n * prediction whose witness shape depends on the VK + UC signer count.\n */\nexport async function computeMinPeginFee(\n txGraphVersion: number,\n numVks: number,\n numUcs: number,\n minPeginFeeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computeMinPeginFee(\n txGraphVersion,\n numVks,\n numUcs,\n minPeginFeeRate,\n );\n}\n\n/**\n * Floor of the Payout transaction fee under `txGraphVersion`: the minimum of\n * `estimatedVsize * feeRate` across every output-sizing model a deployed\n * vault provider is known to have used (fixed-34, intermediate,\n * script-aware). A VP-built payout paying less than this is provably not\n * produced by any known VP build. `out0Len` must be the TRUSTED length of the\n * pinned outs[0] script (1..=128); `out1Len` is the measured, UNTRUSTED\n * commission-script length — safe here because padding cannot raise the floor\n * (the fixed-34 model saturates the minimum) and shortening only lowers it.\n * Pass `undefined` for `out1Len` on 2-output (non-VP-claimer) payouts.\n * `feeRate` is the vault's version-locked `offchainParams.feeRate`.\n */\nexport async function computePayoutFeeFloor(\n txGraphVersion: number,\n numVaultKeepers: number,\n numUniversalChallengers: number,\n numLocalChallengers: number,\n councilSize: number,\n out0Len: number,\n out1Len: number | null | undefined,\n feeRate: bigint,\n): Promise<bigint> {\n return (await loadTbvWasm()).computePayoutFeeFloor(\n txGraphVersion,\n numVaultKeepers,\n numUniversalChallengers,\n numLocalChallengers,\n councilSize,\n out0Len,\n out1Len,\n feeRate,\n );\n}\n\n/**\n * Tx graph versions the shipped vault-wasm binary can build. Callers must\n * preflight the required version (fresh: active; resume: stamped) against\n * this list and fail closed instead of hitting per-call errors mid-flow.\n *\n * Note: the facade constructors themselves fail closed on unsupported\n * versions, and derived objects carry the version they were built with —\n * value-level cross-checks live in `assertWasmPeginSizing` and the golden\n * byte-parity tests, not in a per-call version echo.\n */\nexport async function supportedTxGraphVersions(): Promise<number[]> {\n return (await loadTbvWasm()).supportedTxGraphVersions();\n}\n\n/**\n * The PegIn transaction's P2A (pay-to-anchor) output for a graph version: 240\n * sats at vout 2, script `51024e73`. Every supported version's PegIn carries\n * the anchor; the engine throws rather than return none.\n */\nexport async function peginP2aAnchorOutput(\n txGraphVersion: number,\n): Promise<PeginP2aAnchorInfo> {\n return (await loadTbvWasm()).peginP2aAnchorOutput(txGraphVersion);\n}\n\n/**\n * Validate a PegIn transaction's P2A anchor against a graph version's rule:\n * the exact anchor (240 sats, vout 2, P2A script). Throws on any mismatch, so\n * a PegIn without the anchor fails closed.\n */\nexport async function validatePeginP2aAnchor(\n txGraphVersion: number,\n txHex: string,\n): Promise<void> {\n return (await loadTbvWasm()).validatePeginP2aAnchor(txGraphVersion, txHex);\n}\n\n/**\n * Creates a payout connector for vault transactions.\n *\n * The payout connector generates the necessary taproot scripts and information\n * required for signing payout transactions (both optimistic and regular payout paths).\n *\n * @param params - Parameters for creating the payout connector\n * @param network - Bitcoin network\n * @returns Payout connector information including scripts, hashes, and address\n */\nexport async function createPayoutConnector(\n params: PayoutConnectorParams,\n network: Network,\n): Promise<PayoutConnectorInfo> {\n return (await loadTbvWasm()).createPayoutConnector(params, network);\n}\n\n/**\n * Get the Payout script and control block for the depositor's Assert output.\n *\n * Used to build the depositor's Payout PSBT (depositor-as-claimer path).\n *\n * @param params - Assert Payout/NoPayout connector parameters\n * @returns Payout script and control block (hex encoded)\n */\nexport async function getAssertPayoutScriptInfo(\n params: AssertPayoutNoPayoutConnectorParams,\n): Promise<AssertPayoutScriptInfo> {\n return (await loadTbvWasm()).getAssertPayoutScriptInfo(params);\n}\n\n/**\n * Get the NoPayout script and control block for a specific challenger.\n *\n * Used to build the depositor's NoPayout PSBT (depositor-as-claimer path).\n * Each challenger has a distinct NoPayout script.\n *\n * @param params - Assert Payout/NoPayout connector parameters\n * @param challengerPubkey - The challenger's x-only public key (hex encoded)\n * @returns NoPayout script and control block (hex encoded)\n */\nexport async function getAssertNoPayoutScriptInfo(\n params: AssertPayoutNoPayoutConnectorParams,\n challengerPubkey: string,\n): Promise<AssertNoPayoutScriptInfo> {\n return (await loadTbvWasm()).getAssertNoPayoutScriptInfo(\n params,\n challengerPubkey,\n );\n}\n\n/**\n * Get the ChallengeAssert script and control block.\n *\n * Used to build ChallengeAssert PSBTs for the depositor-as-claimer path.\n * Each challenger has 2 ChallengeAssert transactions (X and Y), and this\n * connector generates the spending scripts using WOTS public keys from the VP.\n *\n * @param params - ChallengeAssert connector parameters\n * @returns Script and control block (hex encoded)\n */\nexport async function getChallengeAssertScriptInfo(\n params: ChallengeAssertConnectorParams,\n): Promise<ChallengeAssertScriptInfo> {\n return (await loadTbvWasm()).getChallengeAssertScriptInfo(params);\n}\n\n/**\n * Get the scriptPubKey that output 0 of every ChallengeAssertX/Y transaction\n * pays to for one challenger: the WronglyChallenged leaves plus the NoPayout\n * leaf carrying the ChallengeAssert timelock.\n *\n * Used to bind the VP-supplied ChallengeAssert parents of a NoPayout before\n * the depositor signs it. The engine rejects a non-P2TR return.\n *\n * @param params - ChallengeAssert output connector parameters\n * @returns P2TR scriptPubKey (hex encoded)\n */\nexport async function getChallengeAssertOutputScriptPubKey(\n params: ChallengeAssertOutputConnectorParams,\n): Promise<string> {\n return (await loadTbvWasm()).getChallengeAssertOutputScriptPubKey(params);\n}\n\n/**\n * Derive 32-byte `authAnchor` (OP_RETURN preimage → VP bearer token).\n * @stability frozen - btc-vault Rust owns this API through the vault-wasm pin (`VAULT_WASM_COMMIT`).\n * Changing the derived bytes breaks VP auth for existing deposits. See CLAUDE.md §4.\n */\nexport async function expandAuthAnchor(root: Uint8Array): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandAuthAnchor(root);\n}\n\n/**\n * Derive 32-byte `hashlockSecret` for HTLC `htlcVout` (preimage → `activateVaultWithSecret`).\n * @stability frozen - btc-vault Rust owns this API.\n * Changing the derived bytes means affected vaults can never activate. See CLAUDE.md §4.\n */\nexport async function expandHashlockSecret(\n root: Uint8Array,\n htlcVout: number,\n): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandHashlockSecret(root, htlcVout);\n}\n\n/**\n * Derive 64-byte `wotsSeed` for HTLC `htlcVout` (→ WOTS keys, hashed as `depositorWotsPkHash`).\n * @stability frozen - btc-vault Rust owns this API.\n * Changing the derived bytes breaks existing `depositorWotsPkHash` values. No claim path remains. See CLAUDE.md §4.\n */\nexport async function expandWotsSeed(\n root: Uint8Array,\n htlcVout: number,\n): Promise<Uint8Array> {\n return (await loadTbvWasm()).expandWotsSeed(root, htlcVout);\n}\n\n/**\n * Derives the vault ID from a PegIn transaction hash and depositor ETH address.\n *\n * Vault ID = keccak256(abi.encode(peginTxHash, depositor))\n * This matches the Solidity-side derivation in BTCVaultRegistry.\n *\n * @param peginTxHash - 32-byte PegIn tx hash in display order (big-endian), hex encoded\n * @param depositor - 20-byte Ethereum address of the depositor, hex encoded\n * @returns Hex-encoded vault ID (32 bytes)\n */\nexport async function deriveVaultId(\n peginTxHash: string,\n depositor: string,\n): Promise<string> {\n return (await loadTbvWasm()).deriveVaultId(peginTxHash, depositor);\n}\n\n// ============================================================================\n// Delegated claim (depositor-as-claimer) — assembly and claim-time surface\n// ============================================================================\n//\n// The forwarding hop for the WASM exports that assemble the two files the\n// `vaultd vp wt` watchtower CLI consumes, and for the claim-time exports\n// that run a claim from those files without the CLI.\n//\n// EXPERIMENTAL — under test, signet only. These names and signatures can\n// change in a minor release. See services/delegated-claim.\n\n/**\n * Depositor's Claim signing PSBT (base64) — spends PegIn:1, script path.\n *\n * @experimental\n */\nexport async function buildClaimPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildClaimPsbt(txGraphVersion, graphJson);\n}\n\n/**\n * Claimer's Assert signing PSBT (base64) — the single WOTS input.\n *\n * @experimental\n */\nexport async function buildAssertClaimerPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildAssertClaimerPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Claimer's Payout signing PSBT (base64) — input 1, Assert connector path.\n *\n * @experimental\n */\nexport async function buildPayoutClaimerPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildPayoutClaimerPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Depositor's Payout signing PSBT (base64) — input 0, the PegIn UTXO spend.\n *\n * @experimental\n */\nexport async function buildPayoutDepositorPsbt(\n txGraphVersion: number,\n graphJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).buildPayoutDepositorPsbt(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Claimer's WronglyChallenged signing PSBTs, per challenger and GC index.\n *\n * @experimental\n */\nexport async function buildWronglyChallengedPsbts(\n txGraphVersion: number,\n graphJson: string,\n): Promise<WronglyChallengedPsbts> {\n return (await loadTbvWasm()).buildWronglyChallengedPsbts(\n txGraphVersion,\n graphJson,\n );\n}\n\n/**\n * Verifies the Groth16 pegout proof and pins it into the artifacts, returning\n * the updated artifacts JSON. Persist that copy: the one-time WOTS keypair\n * signs exactly one proof, so a second, different one is refused.\n *\n * @experimental\n */\nexport async function pinPegoutProof(\n txGraphVersion: number,\n artifactsJson: string,\n proofHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).pinPegoutProof(\n txGraphVersion,\n artifactsJson,\n proofHex,\n );\n}\n\n/**\n * Finalizes the Assert from the pinned proof and the WOTS keypair, writes it\n * into the artifacts and returns the updated artifacts JSON. The keypair\n * never leaves the caller.\n *\n * @experimental\n */\nexport async function attachFinalizedAssert(\n txGraphVersion: number,\n artifactsJson: string,\n keypairJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).attachFinalizedAssert(\n txGraphVersion,\n artifactsJson,\n keypairJson,\n );\n}\n\n/**\n * Finalizes the Payout tx from the artifacts' signatures, consensus hex.\n *\n * @experimental\n */\nexport async function finalizePayout(\n txGraphVersion: number,\n artifactsJson: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizePayout(txGraphVersion, artifactsJson);\n}\n\n/**\n * Finalizes one WronglyChallenged tx — the answer to a ChallengeAssert.\n *\n * @experimental\n */\nexport async function finalizeWronglyChallenged(\n txGraphVersion: number,\n artifactsJson: string,\n challengerPkHex: string,\n gcIndex: number,\n preimageHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizeWronglyChallenged(\n txGraphVersion,\n artifactsJson,\n challengerPkHex,\n gcIndex,\n preimageHex,\n );\n}\n\n/**\n * Applies the depositor signature to the Claim tx, returning consensus hex.\n *\n * @experimental\n */\nexport async function finalizeClaimTx(\n txGraphVersion: number,\n graphJson: string,\n depositorSigHex: string,\n): Promise<string> {\n return (await loadTbvWasm()).finalizeClaimTx(\n txGraphVersion,\n graphJson,\n depositorSigHex,\n );\n}\n\n/**\n * Extracts a signed PSBT input's taproot script-path signature (hex).\n *\n * @experimental\n */\nexport async function extractTapScriptSig(\n psbtBase64: string,\n inputIndex: number,\n): Promise<string> {\n return (await loadTbvWasm()).extractTapScriptSig(psbtBase64, inputIndex);\n}\n\n/**\n * Derive the depositor's WOTS keypair from the 64-byte `wotsSeed`.\n * @stability frozen — `HASH160(seed || block index)` binds on-chain through\n * `depositorWotsPkHash`; see CLAUDE.md §4.\n *\n * @experimental\n */\nexport async function wotsKeypairFromSeed(\n wotsSeed: Uint8Array,\n): Promise<WotsKeypairDerivation> {\n return (await loadTbvWasm()).wotsKeypairFromSeed(wotsSeed);\n}\n\n/**\n * Throws unless the keypair matches the WOTS keys the graph's Claim commits to.\n *\n * @experimental\n */\nexport async function validateWotsKeypairAgainstGraph(\n txGraphVersion: number,\n keypair: unknown,\n graphJson: string,\n): Promise<void> {\n return (await loadTbvWasm()).validateWotsKeypairAgainstGraph(\n txGraphVersion,\n keypair,\n graphJson,\n );\n}\n\n/**\n * Assembles the watchtower `artifacts.json` content, verifying every signature.\n *\n * @experimental\n */\nexport async function buildWatchtowerArtifacts(\n inputs: WatchtowerArtifactsInputs,\n): Promise<string> {\n return (await loadTbvWasm()).buildWatchtowerArtifacts(inputs);\n}\n\n/**\n * Re-verifies every claimer-side signature in an `artifacts.json`.\n *\n * @experimental\n */\nexport async function verifyWatchtowerArtifacts(\n txGraphVersion: number,\n artifactsJson: string,\n): Promise<void> {\n return (await loadTbvWasm()).verifyWatchtowerArtifacts(\n txGraphVersion,\n artifactsJson,\n );\n}\n\nexport type {\n AssertNoPayoutScriptInfo,\n AssertPayoutNoPayoutConnectorParams,\n AssertPayoutScriptInfo,\n ChallengeAssertConnectorParams,\n ChallengeAssertOutputConnectorParams,\n ChallengeAssertScriptInfo,\n HtlcConnectorInfo,\n HtlcConnectorParams,\n Network,\n PayoutConnectorInfo,\n PayoutConnectorParams,\n PeginP2aAnchorInfo,\n PeginTxResult,\n PrePeginParams,\n PrePeginResult,\n WatchtowerArtifactsInputs,\n WotsKeypairDerivation,\n WronglyChallengedPsbts,\n WronglyChallengedSigs,\n};\n"],"names":["TAP_INTERNAL_KEY","tapInternalPubkey","_","index","wasmModulePromise","loadTbvWasm","error","wasm","createPrePeginTransaction","params","buildPeginTxFromPrePegin","timelockPegin","fundedPrePeginTxHex","htlcVout","getPrePeginHtlcConnectorInfo","computeMinClaimValue","txGraphVersion","numLocalChallengers","numUniversalChallengers","councilQuorum","councilSize","feeRate","computeMinPeginFee","numVks","numUcs","minPeginFeeRate","computePayoutFeeFloor","numVaultKeepers","out0Len","out1Len","supportedTxGraphVersions","peginP2aAnchorOutput","validatePeginP2aAnchor","txHex","createPayoutConnector","network","getAssertPayoutScriptInfo","getAssertNoPayoutScriptInfo","challengerPubkey","getChallengeAssertScriptInfo","getChallengeAssertOutputScriptPubKey","expandAuthAnchor","root","expandHashlockSecret","expandWotsSeed","deriveVaultId","peginTxHash","depositor","buildClaimPsbt","graphJson","buildAssertClaimerPsbt","buildPayoutClaimerPsbt","buildPayoutDepositorPsbt","buildWronglyChallengedPsbts","pinPegoutProof","artifactsJson","proofHex","attachFinalizedAssert","keypairJson","finalizePayout","finalizeWronglyChallenged","challengerPkHex","gcIndex","preimageHex","finalizeClaimTx","depositorSigHex","extractTapScriptSig","psbtBase64","inputIndex","wotsKeypairFromSeed","wotsSeed","validateWotsKeypairAgainstGraph","keypair","buildWatchtowerArtifacts","inputs","verifyWatchtowerArtifacts"],"mappings":"AAQO,MAAMA,IACX;AAIK,MAAMC,IAAoB,WAAW;AAAA,EAC1C,EAAE,QAAQD,EAAiB,SAAS,EAAA;AAAA,EACpC,CAACE,GAAGC,MACF,OAAO;AAAA,IACLH,EAAiB;AAAA,MACfG,IAAQ;AAAA,MACRA,IAAQ,IAAqB;AAAA,IAAA;AAAA,IAE/B;AAAA,EAAA;AAEN;ACcA,IAAIC;AAeG,SAASC,IAAsC;AACpD,SAAAD,UAAsB,OAAO,uCAAuC,EACjE,MAAM,CAACE,MAAmB;AACzB,UAAAF,IAAoB,QACd,IAAI;AAAA,MACR;AAAA,MAIA,EAAE,OAAOE,EAAA;AAAA,IAAM;AAAA,EAEnB,CAAC,EACA,KAAK,OAAOC,MAAS;AACpB,QAAI;AACF,YAAMA,EAAK,SAAA;AAAA,IACb,SAASD,GAAgB;AACvB,YAAAF,IAAoB,QACd,IAAI;AAAA,QACR;AAAA,QAIA,EAAE,OAAOE,EAAA;AAAA,MAAM;AAAA,IAEnB;AACA,WAAOC;AAAA,EACT,CAAC,IACIH;A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perty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../verifyScriptPathSchnorrSignature-CahYx5Td.cjs"),O=require("../secp256k1-DDHQ1_za.cjs"),o=require("./core/wasm/index.cjs"),R=require("../verifyKeyPathSchnorrSignature-BRTpEH9X.cjs"),E=require("../challengeAssert-C3eMcM5Y.cjs"),r=require("../bitcoin-D-O2GjbC.cjs"),F=require("../abortSignals-msbmbqFe.cjs"),I=require("../signing-DvISftFk.cjs"),P=require("../validation-C6XTfZak.cjs"),V=require("./core/utils/eth/index.cjs"),_=require("../PeginManager-Co43rW_x.cjs"),d=require("../PayoutManager-B1Ev0r7o.cjs"),s=require("./core/clients/mempool/index.cjs"),l=require("../registration-records-XQMIKjGV.cjs"),C=require("../signer-set-reader-GrFe_rsW.cjs"),A=require("../pegin-registration-client-CdRyXP3j.cjs"),h=require("../types-BC2TGzcp.cjs"),y=require("../ApplicationRegistry.abi-sMiTWmnL.cjs"),N=require("../BTCVaultRegistry.abi-BH2-LHxN.cjs"),u=require("../BTCVaultRegistryKeyEpochs.abi-CReWFJdu.cjs"),M=require("../ProtocolParams.abi-BgEZaQ2I.cjs"),b=require("../VaultErrors.abi-DQ18kM0L.cjs"),v=require("../buildVaultContextInputForClaim-9XZaqIiw.cjs"),S=require("../deriveVaultRoot-C3uqnJto.cjs"),D=require("../parseFundingOutpoints-C_-PT9BT.cjs"),B=require("../btcTxHash-CGb5BqFL.cjs"),c=require("../psbtInputFields-BrV_ZfL_.cjs"),i=require("../fundPeginTransaction-54-Rwb2k.cjs"),T=require("../reservation-CA5knoQ0.cjs"),m=require("../index-C6avwx1s.cjs"),a=require("../state-C4WoNCy1.cjs"),g=require("../primeVpAuth-CXNXYKrh.cjs"),t=require("../toRefundInputs-DTuWi--u.cjs"),e=require("../buildAndBroadcastReclaim-DPk36Uhp.cjs"),p=require("../peginState-IyE22wWh.cjs");exports.PEGIN_DEPOSITOR_CLAIM_VOUT=n.PEGIN_DEPOSITOR_CLAIM_VOUT;exports.PsbtSubstitutionError=n.PsbtSubstitutionError;exports.assertPsbtUnsignedTxMatches=n.assertPsbtUnsignedTxMatches;exports.assertScriptPathSchnorrSignature=n.assertScriptPathSchnorrSignature;exports.buildPayoutPsbt=n.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=n.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=n.buildPrePeginPsbt;exports.computeNumLocalChallengers=n.computeNumLocalChallengers;exports.createPayoutScript=n.createPayoutScript;exports.deriveDepositorClaimDescriptor=n.deriveDepositorClaimDescriptor;exports.deriveDepositorClaimScriptPubKey=n.deriveDepositorClaimScriptPubKey;exports.extractPayoutSignature=n.extractPayoutSignature;exports.assertValidVaultCoreVersion=O.assertValidVaultCoreVersion;exports.attachFinalizedAssert=o.attachFinalizedAssert;exports.computeMinClaimValue=o.computeMinClaimValue;exports.computeMinPeginFee=o.computeMinPeginFee;exports.deriveVaultId=o.deriveVaultId;exports.expandAuthAnchor=o.expandAuthAnchor;exports.expandHashlockSecret=o.expandHashlockSecret;exports.expandWotsSeed=o.expandWotsSeed;exports.finalizePayout=o.finalizePayout;exports.finalizeWronglyChallenged=o.finalizeWronglyChallenged;exports.peginP2aAnchorOutput=o.peginP2aAnchorOutput;exports.pinPegoutProof=o.pinPegoutProof;exports.supportedTxGraphVersions=o.supportedTxGraphVersions;exports.validatePeginP2aAnchor=o.validatePeginP2aAnchor;exports.assertKeyPathSchnorrSignature=R.assertKeyPathSchnorrSignature;exports.assertReturnedKeyPathSignatures=R.assertReturnedKeyPathSignatures;exports.buildPeginInputPsbt=R.buildPeginInputPsbt;exports.extractPeginInputSignature=R.extractPeginInputSignature;exports.finalizePeginInputPsbt=R.finalizePeginInputPsbt;exports.buildChallengeAssertPsbt=E.buildChallengeAssertPsbt;exports.buildNoPayoutPsbt=E.buildNoPayoutPsbt;exports.buildReclaimPsbt=E.buildReclaimPsbt;exports.buildRefundPsbt=E.buildRefundPsbt;exports.estimateReclaimFeeSats=E.estimateReclaimFeeSats;exports.finalizeScriptPathWithSignatures=E.finalizeScriptPathWithSignatures;exports.reclaimVsize=E.reclaimVsize;exports.canonicalizeBtcPubkey=r.canonicalizeBtcPubkey;exports.deriveBip86ScriptPubKeyHex=r.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=r.deriveNativeSegwitAddress;exports.deriveTaprootAddress=r.deriveTaprootAddress;exports.ensureHexPrefix=r.ensureHexPrefix;exports.formatSatoshisToBtc=r.formatSatoshisToBtc;exports.getNetwork=r.getNetwork;exports.getSortedXOnlyPubkeys=r.getSortedXOnlyPubkeys;exports.hexToUint8Array=r.hexToUint8Array;exports.isAddressFromPublicKey=r.isAddressFromPublicKey;exports.isValidHex=r.isValidHex;exports.processPublicKeyToXOnly=r.processPublicKeyToXOnly;exports.stripHexPrefix=r.stripHexPrefix;exports.toXOnly=r.toXOnly;exports.uint8ArrayToHex=r.uint8ArrayToHex;exports.validateWalletPubkey=r.validateWalletPubkey;exports.combineAbortSignals=F.combineAbortSignals;exports.createTaprootScriptPathSignOptions=I.createTaprootScriptPathSignOptions;exports.createTaprootScriptPathSignOptionsForInput=I.createTaprootScriptPathSignOptionsForInput;exports.BITCOIN_ADDRESS_RE=P.BITCOIN_ADDRESS_RE;exports.COMPRESSED_PUBKEY_HEX_LEN=P.COMPRESSED_PUBKEY_HEX_LEN;exports.HEX_RE=P.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=P.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=P.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=P.TXID_RE;exports.X_ONLY_PUBKEY_HEX_LEN=P.X_ONLY_PUBKEY_HEX_LEN;exports.waitForTransactionReceiptSmartAware=V.waitForTransactionReceiptSmartAware;exports.PeginManager=_.PeginManager;exports.buildDepositTerms=_.buildDepositTerms;exports.computeWotsBlockPublicKeysHash=_.computeWotsBlockPublicKeysHash;exports.deriveWotsBlocksFromSeed=_.deriveWotsBlocksFromSeed;exports.ensurePrePeginTermsApproval=_.ensurePrePeginTermsApproval;exports.PayoutManager=d.PayoutManager;exports.computeHashlock=d.computeHashlock;exports.forwardDepositApproval=d.forwardDepositApproval;exports.requireChangeAddress=d.requireChangeAddress;exports.supportsDepositApproval=d.supportsDepositApproval;exports.validateSecretAgainstHashlock=d.validateSecretAgainstHashlock;exports.MEMPOOL_API_URLS=s.MEMPOOL_API_URLS;exports.MempoolNotFoundError=s.MempoolNotFoundError;exports.getAddressTxs=s.getAddressTxs;exports.getAddressUtxos=s.getAddressUtxos;exports.getMempoolApiUrl=s.getMempoolApiUrl;exports.getNetworkFees=s.getNetworkFees;exports.getOutspend=s.getOutspend;exports.getTipHeight=s.getTipHeight;exports.getTxHex=s.getTxHex;exports.getTxInfo=s.getTxInfo;exports.getUtxoInfo=s.getUtxoInfo;exports.pushTx=s.pushTx;exports.RegistrationLogsUnavailableError=l.RegistrationLogsUnavailableError;exports.VaultClaimableByNotFoundError=l.VaultClaimableByNotFoundError;exports.assertOnChainBtcPubkey=l.assertOnChainBtcPubkey;exports.assertRegisteredPayoutScriptBounds=l.assertRegisteredPayoutScriptBounds;exports.derivePeginVaultId=l.derivePeginVaultId;exports.findRegistrationRecord=l.findRegistrationRecord;exports.isRegistrationLogsUnavailableError=l.isRegistrationLogsUnavailableError;exports.isVaultClaimableByNotFoundError=l.isVaultClaimableByNotFoundError;exports.registrationPrePeginTxHash=l.registrationPrePeginTxHash;exports.validateOffchainParams=l.validateOffchainParams;exports.validatePegInConfiguration=l.validatePegInConfiguration;exports.validateTBVProtocolParams=l.validateTBVProtocolParams;exports.ViemOperationKeyReader=C.ViemOperationKeyReader;exports.ViemUniversalChallengerReader=C.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=C.ViemVaultKeeperReader;exports.resolveProtocolAddresses=C.resolveProtocolAddresses;exports.COMMISSION_BPS_HEADROOM=A.COMMISSION_BPS_HEADROOM;exports.MAX_ACCEPTABLE_COMMISSION_BPS_CAP=A.MAX_ACCEPTABLE_COMMISSION_BPS_CAP;exports.ViemPeginRegistrationClient=A.ViemPeginRegistrationClient;exports.ViemVaultRegistryReader=A.ViemVaultRegistryReader;exports.capMaxAcceptableCommissionBps=A.capMaxAcceptableCommissionBps;exports.OnChainBtcVaultStatus=h.OnChainBtcVaultStatus;exports.ViemProtocolParamsReader=h.ViemProtocolParamsReader;exports.ApplicationRegistryABI=y.ApplicationRegistryABI;exports.BTCVaultRegistryABI=N.BTCVaultRegistryABI;exports.BTCVaultRegistryKeyEpochsABI=u.BTCVaultRegistryKeyEpochsABI;exports.CONTRACT_ERRORS=u.CONTRACT_ERRORS;exports.EMPTY_REVERT_MESSAGE=u.EMPTY_REVERT_MESSAGE;exports.PEGIN_FINGERPRINT_CHANGED_SELECTOR=u.PEGIN_FINGERPRINT_CHANGED_SELECTOR;exports.PeginFingerprintChangedError=u.PeginFingerprintChangedError;exports.extractErrorData=u.extractErrorData;exports.getContractErrorMessage=u.getContractErrorMessage;exports.handleContractError=u.handleContractError;exports.isKnownContractError=u.isKnownContractError;exports.isPeginFingerprintChangedError=u.isPeginFingerprintChangedError;exports.ProtocolParamsABI=M.ProtocolParamsABI;exports.VAULT_ERROR_ABI=b.VAULT_ERROR_ABI;exports.buildVaultContextInputForClaim=v.buildVaultContextInputForClaim;exports.VAULT_APP_NAME=S.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=S.buildFundingOutpointsCommitment;exports.buildVaultContext=S.buildVaultContext;exports.deriveVaultRoot=S.deriveVaultRoot;exports.forwardDeriveContextHash=S.forwardDeriveContextHash;exports.parseFundingOutpointsFromTx=D.parseFundingOutpointsFromTx;exports.calculateBtcTxHash=B.calculateBtcTxHash;exports.BitcoinScriptType=c.BitcoinScriptType;exports.applyChangeOutputPolicy=c.applyChangeOutputPolicy;exports.computeChangeOutputFeeSats=c.computeChangeOutputFeeSats;exports.computeMaxDeposit=c.computeMaxDeposit;exports.computePeginBaseFeeSats=c.computePeginBaseFeeSats;exports.getDustThreshold=c.getDustThreshold;exports.getPsbtInputFields=c.getPsbtInputFields;exports.getScriptType=c.getScriptType;exports.selectUtxosForPegin=c.selectUtxosForPegin;exports.shouldAddChangeOutput=c.shouldAddChangeOutput;exports.BTC_DUST_SAT=i.BTC_DUST_SAT;exports.DUST_THRESHOLD=i.DUST_THRESHOLD;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=i.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=i.MAX_NON_LEGACY_OUTPUT_SIZE;exports.MAX_REASONABLE_PEGIN_VBYTES=i.MAX_REASONABLE_PEGIN_VBYTES;exports.P2TR_INPUT_SIZE=i.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=i.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=i.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=i.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=i.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=i.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=i.fundPeginTransaction;exports.parseUnfundedWasmTransaction=i.parseUnfundedWasmTransaction;exports.peginOutputCount=i.peginOutputCount;exports.rateBasedTxBufferFee=i.rateBasedTxBufferFee;exports.UtxoNotAvailableError=T.UtxoNotAvailableError;exports.assertUtxosAvailable=T.assertUtxosAvailable;exports.extractInputsFromTransaction=T.extractInputsFromTransaction;exports.findOverlappingPendingVaults=T.findOverlappingPendingVaults;exports.validateUtxosAvailable=T.validateUtxosAvailable;exports.VaultProviderRpcClient=m.VaultProviderRpcClient;exports.VpResponseValidationError=m.VpResponseValidationError;exports.batchPollByProvider=m.batchPollByProvider;exports.isUnrecognizedDaemonStatusError=m.isUnrecognizedDaemonStatusError;exports.validateRequestDepositorClaimerArtifactsResponse=m.validateRequestDepositorClaimerArtifactsResponse;exports.AUTH_REJECTED_RPC_CODE=a.AUTH_REJECTED_RPC_CODE;exports.ClaimerPegoutStatusValue=a.ClaimerPegoutStatusValue;exports.DaemonStatus=a.DaemonStatus;exports.JSON_RPC_ERROR_CODES=a.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=a.JsonRpcClient;exports.JsonRpcError=a.JsonRpcError;exports.POST_WOTS_STATUSES=a.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=a.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=a.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=a.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=a.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=a.VP_TRANSIENT_STATUSES;exports.isAuthRejectedError=a.isAuthRejectedError;exports.isPegoutTerminalStatus=a.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=a.isRecognizedPegoutStatus;exports.ServerIdentityError=g.ServerIdentityError;exports.VpTokenRegistry=g.VpTokenRegistry;exports.createAuthenticatedVpClient=g.createAuthenticatedVpClient;exports.primeVpTokenRegistry=g.primeVpTokenRegistry;exports.verifyServerIdentity=g.verifyServerIdentity;exports.vpTokenRegistry=g.vpTokenRegistry;exports.DEPOSIT_TERMS_REJECTED_ERROR_NAME=t.DEPOSIT_TERMS_REJECTED_ERROR_NAME;exports.DepositTermsRejectedError=t.DepositTermsRejectedError;exports.PEGIN_FINGERPRINT_DOMAIN=t.PEGIN_FINGERPRINT_DOMAIN;exports.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE=t.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE;exports.PeginFingerprintInputError=t.PeginFingerprintInputError;exports.PeginParamsAmbiguousError=t.PeginParamsAmbiguousError;exports.PeginParamsIncompleteSpaceError=t.PeginParamsIncompleteSpaceError;exports.PeginParamsNotFoundError=t.PeginParamsNotFoundError;exports.PeginSizingIntegrityError=t.PeginSizingIntegrityError;exports.UnanchoredPrePeginError=t.UnanchoredPrePeginError;exports.VaultRootMismatchError=t.VaultRootMismatchError;exports.assertClaimBatchHomogeneous=t.assertClaimBatchHomogeneous;exports.buildPeginParamsCandidates=t.buildPeginParamsCandidates;exports.computeFundedPrePeginFee=t.computeFundedPrePeginFee;exports.computePeginFingerprint=t.computePeginFingerprint;exports.deriveHashlocksFromPrePegin=t.deriveHashlocksFromPrePegin;exports.describePeginParamsCandidate=t.describePeginParamsCandidate;exports.describeUnresolvedVersion=t.describeUnresolvedVersion;exports.encodePeginFingerprintPreimage=t.encodePeginFingerprintPreimage;exports.isDepositTermsRejectedError=t.isDepositTermsRejectedError;exports.isPeginFingerprintInputError=t.isPeginFingerprintInputError;exports.isWotsMismatchError=t.isWotsMismatchError;exports.orderClaimBatchByHtlcVout=t.orderClaimBatchByHtlcVout;exports.rebuildDepositTermsCore=t.rebuildDepositTermsCore;exports.rebuildDepositTermsForClaim=t.rebuildDepositTermsForClaim;exports.reconstructPeginParams=t.reconstructPeginParams;exports.selectSiblingRegistrations=t.selectSiblingRegistrations;exports.toRefundInputs=t.toRefundInputs;exports.ApplicationEntryPointMismatchError=e.ApplicationEntryPointMismatchError;exports.ArtifactsVaultMismatchError=e.ArtifactsVaultMismatchError;exports.AssertBindingError=e.AssertBindingError;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ChallengerSetMismatchError=e.ChallengerSetMismatchError;exports.DELEGATED_CLAIM_TX_GRAPH_VERSION=e.DELEGATED_CLAIM_TX_GRAPH_VERSION;exports.DelegatedClaimSigningIncompleteError=e.DelegatedClaimSigningIncompleteError;exports.GraphFingerprintError=e.GraphFingerprintError;exports.PEGIN_ETH_CONFIRMATIONS=e.PEGIN_ETH_CONFIRMATIONS;exports.ParticipantKeyDriftError=e.ParticipantKeyDriftError;exports.PayoutDestinationError=e.PayoutDestinationError;exports.PayoutInputLeafError=e.PayoutInputLeafError;exports.PeginRegistrationMissingError=e.PeginRegistrationMissingError;exports.PeginRegistrationNotFinalError=e.PeginRegistrationNotFinalError;exports.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR=e.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR;exports.RECLAIM_MAX_FEE_FRACTION_NUMERATOR=e.RECLAIM_MAX_FEE_FRACTION_NUMERATOR;exports.RECLAIM_MAX_FEE_RATE_SATS_VB=e.RECLAIM_MAX_FEE_RATE_SATS_VB;exports.RECLAIM_WARN_FEE_FRACTION_NUMERATOR=e.RECLAIM_WARN_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=e.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=e.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=e.REFUND_MAX_FEE_RATE_SATS_VB;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.ReclaimUneconomicalError=e.ReclaimUneconomicalError;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.SigningPlanMismatchError=e.SigningPlanMismatchError;exports.VaultIdBindingError=e.VaultIdBindingError;exports.activateVault=e.activateVault;exports.activateVaultAndRedeem=e.activateVaultAndRedeem;exports.assembleWatchtowerArtifacts=e.assembleWatchtowerArtifacts;exports.assembleWatchtowerArtifactsFromSignatures=e.assembleWatchtowerArtifactsFromSignatures;exports.assertArtifactsUsableForVault=e.assertArtifactsUsableForVault;exports.assertAssertBindsClaimAndPayout=e.assertAssertBindsClaimAndPayout;exports.assertChallengerSetMatchesVault=e.assertChallengerSetMatchesVault;exports.assertClaimSpendsVault=e.assertClaimSpendsVault;exports.assertPayoutPaysRegisteredScript=e.assertPayoutPaysRegisteredScript;exports.assertReturnedGraphMatchesFingerprint=e.assertReturnedGraphMatchesFingerprint;exports.assertTermsMatchVault=e.assertTermsMatchVault;exports.assertVaultProviderHintAccepted=e.assertVaultProviderHintAccepted;exports.buildAndBroadcastReclaim=e.buildAndBroadcastReclaim;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.claimExpiredVault=e.claimExpiredVault;exports.copyAssertConnectorLeaf=e.copyAssertConnectorLeaf;exports.deriveClaimerWotsKeypair=e.deriveClaimerWotsKeypair;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.fingerprintReturnedGraph=e.fingerprintReturnedGraph;exports.isApplicationEntryPointMismatchError=e.isApplicationEntryPointMismatchError;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isHintAccepted=e.isHintAccepted;exports.isParticipantKeyDriftError=e.isParticipantKeyDriftError;exports.isPeginRegistrationMissingError=e.isPeginRegistrationMissingError;exports.isPeginRegistrationNotFinalError=e.isPeginRegistrationNotFinalError;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.matchKeyHint=e.matchKeyHint;exports.matchKeySetHint=e.matchKeySetHint;exports.planDelegatedClaimSigning=e.planDelegatedClaimSigning;exports.readDelegatedClaimVaultContext=e.readDelegatedClaimVaultContext;exports.readStampedParticipantKeys=e.readStampedParticipantKeys;exports.resolveCurrentParticipantKeys=e.resolveCurrentParticipantKeys;exports.resolveParticipantKeysAtEpochs=e.resolveParticipantKeysAtEpochs;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDelegatedClaimPlan=e.signDelegatedClaimPlan;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.summarizeWatchtowerArtifacts=e.summarizeWatchtowerArtifacts;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredParticipantKeys=e.verifyRegisteredParticipantKeys;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginRegistrationDepth=e.waitForPeginRegistrationDepth;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=p.ContractStatus;exports.PeginAction=p.PeginAction;exports.activationDeadlineBlocksRemaining=p.activationDeadlineBlocksRemaining;exports.canPerformAction=p.canPerformAction;exports.getPeginProtocolState=p.getPeginProtocolState;exports.isActivationDeadlinePassedOnChain=p.isActivationDeadlinePassedOnChain;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../verifyScriptPathSchnorrSignature-CgDa9Rcg.cjs"),O=require("../secp256k1-DDHQ1_za.cjs"),o=require("./core/wasm/index.cjs"),R=require("../verifyKeyPathSchnorrSignature-DcxCojp0.cjs"),E=require("../challengeAssert-BE6Wm4x1.cjs"),r=require("../bitcoin-D-O2GjbC.cjs"),F=require("../abortSignals-msbmbqFe.cjs"),I=require("../signing-DvISftFk.cjs"),P=require("../validation-C6XTfZak.cjs"),V=require("./core/utils/eth/index.cjs"),_=require("../PeginManager-CMbRRTnr.cjs"),d=require("../PayoutManager-Dopxq_Jv.cjs"),s=require("./core/clients/mempool/index.cjs"),l=require("../registration-records-CKc0OVuK.cjs"),C=require("../signer-set-reader-CJfV-GDz.cjs"),A=require("../pegin-registration-client-DLlaZbsZ.cjs"),h=require("../types-BnZIbDHb.cjs"),y=require("../ApplicationRegistry.abi-sMiTWmnL.cjs"),N=require("../BTCVaultRegistry.abi-DzbfZ9_s.cjs"),u=require("../BTCVaultRegistryKeyEpochs.abi-CReWFJdu.cjs"),M=require("../ProtocolParams.abi-DWfIh6VH.cjs"),b=require("../VaultErrors.abi-Hjn1CdLs.cjs"),v=require("../buildVaultContextInputForClaim-9XZaqIiw.cjs"),S=require("../deriveVaultRoot-C3uqnJto.cjs"),D=require("../parseFundingOutpoints-C_-PT9BT.cjs"),B=require("../btcTxHash-CGb5BqFL.cjs"),c=require("../psbtInputFields-BrV_ZfL_.cjs"),i=require("../fundPeginTransaction-54-Rwb2k.cjs"),T=require("../reservation-CA5knoQ0.cjs"),m=require("../index-Dn7RlsKK.cjs"),a=require("../state-C4WoNCy1.cjs"),g=require("../primeVpAuth-Ch-ig2My.cjs"),t=require("../toRefundInputs-BSQjDOK9.cjs"),e=require("../buildAndBroadcastReclaim-CVmG3ldA.cjs"),p=require("../peginState-IyE22wWh.cjs");exports.PEGIN_DEPOSITOR_CLAIM_VOUT=n.PEGIN_DEPOSITOR_CLAIM_VOUT;exports.PsbtSubstitutionError=n.PsbtSubstitutionError;exports.assertPsbtUnsignedTxMatches=n.assertPsbtUnsignedTxMatches;exports.assertScriptPathSchnorrSignature=n.assertScriptPathSchnorrSignature;exports.buildPayoutPsbt=n.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=n.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=n.buildPrePeginPsbt;exports.computeNumLocalChallengers=n.computeNumLocalChallengers;exports.createPayoutScript=n.createPayoutScript;exports.deriveDepositorClaimDescriptor=n.deriveDepositorClaimDescriptor;exports.deriveDepositorClaimScriptPubKey=n.deriveDepositorClaimScriptPubKey;exports.extractPayoutSignature=n.extractPayoutSignature;exports.assertValidVaultCoreVersion=O.assertValidVaultCoreVersion;exports.attachFinalizedAssert=o.attachFinalizedAssert;exports.computeMinClaimValue=o.computeMinClaimValue;exports.computeMinPeginFee=o.computeMinPeginFee;exports.deriveVaultId=o.deriveVaultId;exports.expandAuthAnchor=o.expandAuthAnchor;exports.expandHashlockSecret=o.expandHashlockSecret;exports.expandWotsSeed=o.expandWotsSeed;exports.finalizePayout=o.finalizePayout;exports.finalizeWronglyChallenged=o.finalizeWronglyChallenged;exports.peginP2aAnchorOutput=o.peginP2aAnchorOutput;exports.pinPegoutProof=o.pinPegoutProof;exports.supportedTxGraphVersions=o.supportedTxGraphVersions;exports.validatePeginP2aAnchor=o.validatePeginP2aAnchor;exports.assertKeyPathSchnorrSignature=R.assertKeyPathSchnorrSignature;exports.assertReturnedKeyPathSignatures=R.assertReturnedKeyPathSignatures;exports.buildPeginInputPsbt=R.buildPeginInputPsbt;exports.extractPeginInputSignature=R.extractPeginInputSignature;exports.finalizePeginInputPsbt=R.finalizePeginInputPsbt;exports.buildChallengeAssertPsbt=E.buildChallengeAssertPsbt;exports.buildNoPayoutPsbt=E.buildNoPayoutPsbt;exports.buildReclaimPsbt=E.buildReclaimPsbt;exports.buildRefundPsbt=E.buildRefundPsbt;exports.estimateReclaimFeeSats=E.estimateReclaimFeeSats;exports.finalizeScriptPathWithSignatures=E.finalizeScriptPathWithSignatures;exports.reclaimVsize=E.reclaimVsize;exports.canonicalizeBtcPubkey=r.canonicalizeBtcPubkey;exports.deriveBip86ScriptPubKeyHex=r.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=r.deriveNativeSegwitAddress;exports.deriveTaprootAddress=r.deriveTaprootAddress;exports.ensureHexPrefix=r.ensureHexPrefix;exports.formatSatoshisToBtc=r.formatSatoshisToBtc;exports.getNetwork=r.getNetwork;exports.getSortedXOnlyPubkeys=r.getSortedXOnlyPubkeys;exports.hexToUint8Array=r.hexToUint8Array;exports.isAddressFromPublicKey=r.isAddressFromPublicKey;exports.isValidHex=r.isValidHex;exports.processPublicKeyToXOnly=r.processPublicKeyToXOnly;exports.stripHexPrefix=r.stripHexPrefix;exports.toXOnly=r.toXOnly;exports.uint8ArrayToHex=r.uint8ArrayToHex;exports.validateWalletPubkey=r.validateWalletPubkey;exports.combineAbortSignals=F.combineAbortSignals;exports.createTaprootScriptPathSignOptions=I.createTaprootScriptPathSignOptions;exports.createTaprootScriptPathSignOptionsForInput=I.createTaprootScriptPathSignOptionsForInput;exports.BITCOIN_ADDRESS_RE=P.BITCOIN_ADDRESS_RE;exports.COMPRESSED_PUBKEY_HEX_LEN=P.COMPRESSED_PUBKEY_HEX_LEN;exports.HEX_RE=P.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=P.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=P.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=P.TXID_RE;exports.X_ONLY_PUBKEY_HEX_LEN=P.X_ONLY_PUBKEY_HEX_LEN;exports.waitForTransactionReceiptSmartAware=V.waitForTransactionReceiptSmartAware;exports.PeginManager=_.PeginManager;exports.buildDepositTerms=_.buildDepositTerms;exports.computeWotsBlockPublicKeysHash=_.computeWotsBlockPublicKeysHash;exports.deriveWotsBlocksFromSeed=_.deriveWotsBlocksFromSeed;exports.ensurePrePeginTermsApproval=_.ensurePrePeginTermsApproval;exports.PayoutManager=d.PayoutManager;exports.computeHashlock=d.computeHashlock;exports.forwardDepositApproval=d.forwardDepositApproval;exports.requireChangeAddress=d.requireChangeAddress;exports.supportsDepositApproval=d.supportsDepositApproval;exports.validateSecretAgainstHashlock=d.validateSecretAgainstHashlock;exports.MEMPOOL_API_URLS=s.MEMPOOL_API_URLS;exports.MempoolNotFoundError=s.MempoolNotFoundError;exports.getAddressTxs=s.getAddressTxs;exports.getAddressUtxos=s.getAddressUtxos;exports.getMempoolApiUrl=s.getMempoolApiUrl;exports.getNetworkFees=s.getNetworkFees;exports.getOutspend=s.getOutspend;exports.getTipHeight=s.getTipHeight;exports.getTxHex=s.getTxHex;exports.getTxInfo=s.getTxInfo;exports.getUtxoInfo=s.getUtxoInfo;exports.pushTx=s.pushTx;exports.RegistrationLogsUnavailableError=l.RegistrationLogsUnavailableError;exports.VaultClaimableByNotFoundError=l.VaultClaimableByNotFoundError;exports.assertOnChainBtcPubkey=l.assertOnChainBtcPubkey;exports.assertRegisteredPayoutScriptBounds=l.assertRegisteredPayoutScriptBounds;exports.derivePeginVaultId=l.derivePeginVaultId;exports.findRegistrationRecord=l.findRegistrationRecord;exports.isRegistrationLogsUnavailableError=l.isRegistrationLogsUnavailableError;exports.isVaultClaimableByNotFoundError=l.isVaultClaimableByNotFoundError;exports.registrationPrePeginTxHash=l.registrationPrePeginTxHash;exports.validateOffchainParams=l.validateOffchainParams;exports.validatePegInConfiguration=l.validatePegInConfiguration;exports.validateTBVProtocolParams=l.validateTBVProtocolParams;exports.ViemOperationKeyReader=C.ViemOperationKeyReader;exports.ViemUniversalChallengerReader=C.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=C.ViemVaultKeeperReader;exports.resolveProtocolAddresses=C.resolveProtocolAddresses;exports.COMMISSION_BPS_HEADROOM=A.COMMISSION_BPS_HEADROOM;exports.MAX_ACCEPTABLE_COMMISSION_BPS_CAP=A.MAX_ACCEPTABLE_COMMISSION_BPS_CAP;exports.ViemPeginRegistrationClient=A.ViemPeginRegistrationClient;exports.ViemVaultRegistryReader=A.ViemVaultRegistryReader;exports.capMaxAcceptableCommissionBps=A.capMaxAcceptableCommissionBps;exports.OnChainBtcVaultStatus=h.OnChainBtcVaultStatus;exports.ViemProtocolParamsReader=h.ViemProtocolParamsReader;exports.ApplicationRegistryABI=y.ApplicationRegistryABI;exports.BTCVaultRegistryABI=N.BTCVaultRegistryABI;exports.BTCVaultRegistryKeyEpochsABI=u.BTCVaultRegistryKeyEpochsABI;exports.CONTRACT_ERRORS=u.CONTRACT_ERRORS;exports.EMPTY_REVERT_MESSAGE=u.EMPTY_REVERT_MESSAGE;exports.PEGIN_FINGERPRINT_CHANGED_SELECTOR=u.PEGIN_FINGERPRINT_CHANGED_SELECTOR;exports.PeginFingerprintChangedError=u.PeginFingerprintChangedError;exports.extractErrorData=u.extractErrorData;exports.getContractErrorMessage=u.getContractErrorMessage;exports.handleContractError=u.handleContractError;exports.isKnownContractError=u.isKnownContractError;exports.isPeginFingerprintChangedError=u.isPeginFingerprintChangedError;exports.ProtocolParamsABI=M.ProtocolParamsABI;exports.VAULT_ERROR_ABI=b.VAULT_ERROR_ABI;exports.buildVaultContextInputForClaim=v.buildVaultContextInputForClaim;exports.VAULT_APP_NAME=S.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=S.buildFundingOutpointsCommitment;exports.buildVaultContext=S.buildVaultContext;exports.deriveVaultRoot=S.deriveVaultRoot;exports.forwardDeriveContextHash=S.forwardDeriveContextHash;exports.parseFundingOutpointsFromTx=D.parseFundingOutpointsFromTx;exports.calculateBtcTxHash=B.calculateBtcTxHash;exports.BitcoinScriptType=c.BitcoinScriptType;exports.applyChangeOutputPolicy=c.applyChangeOutputPolicy;exports.computeChangeOutputFeeSats=c.computeChangeOutputFeeSats;exports.computeMaxDeposit=c.computeMaxDeposit;exports.computePeginBaseFeeSats=c.computePeginBaseFeeSats;exports.getDustThreshold=c.getDustThreshold;exports.getPsbtInputFields=c.getPsbtInputFields;exports.getScriptType=c.getScriptType;exports.selectUtxosForPegin=c.selectUtxosForPegin;exports.shouldAddChangeOutput=c.shouldAddChangeOutput;exports.BTC_DUST_SAT=i.BTC_DUST_SAT;exports.DUST_THRESHOLD=i.DUST_THRESHOLD;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=i.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=i.MAX_NON_LEGACY_OUTPUT_SIZE;exports.MAX_REASONABLE_PEGIN_VBYTES=i.MAX_REASONABLE_PEGIN_VBYTES;exports.P2TR_INPUT_SIZE=i.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=i.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=i.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=i.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=i.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=i.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=i.fundPeginTransaction;exports.parseUnfundedWasmTransaction=i.parseUnfundedWasmTransaction;exports.peginOutputCount=i.peginOutputCount;exports.rateBasedTxBufferFee=i.rateBasedTxBufferFee;exports.UtxoNotAvailableError=T.UtxoNotAvailableError;exports.assertUtxosAvailable=T.assertUtxosAvailable;exports.extractInputsFromTransaction=T.extractInputsFromTransaction;exports.findOverlappingPendingVaults=T.findOverlappingPendingVaults;exports.validateUtxosAvailable=T.validateUtxosAvailable;exports.VaultProviderRpcClient=m.VaultProviderRpcClient;exports.VpResponseValidationError=m.VpResponseValidationError;exports.batchPollByProvider=m.batchPollByProvider;exports.isUnrecognizedDaemonStatusError=m.isUnrecognizedDaemonStatusError;exports.validateRequestDepositorClaimerArtifactsResponse=m.validateRequestDepositorClaimerArtifactsResponse;exports.AUTH_REJECTED_RPC_CODE=a.AUTH_REJECTED_RPC_CODE;exports.ClaimerPegoutStatusValue=a.ClaimerPegoutStatusValue;exports.DaemonStatus=a.DaemonStatus;exports.JSON_RPC_ERROR_CODES=a.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=a.JsonRpcClient;exports.JsonRpcError=a.JsonRpcError;exports.POST_WOTS_STATUSES=a.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=a.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=a.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=a.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=a.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=a.VP_TRANSIENT_STATUSES;exports.isAuthRejectedError=a.isAuthRejectedError;exports.isPegoutTerminalStatus=a.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=a.isRecognizedPegoutStatus;exports.ServerIdentityError=g.ServerIdentityError;exports.VpTokenRegistry=g.VpTokenRegistry;exports.createAuthenticatedVpClient=g.createAuthenticatedVpClient;exports.primeVpTokenRegistry=g.primeVpTokenRegistry;exports.verifyServerIdentity=g.verifyServerIdentity;exports.vpTokenRegistry=g.vpTokenRegistry;exports.DEPOSIT_TERMS_REJECTED_ERROR_NAME=t.DEPOSIT_TERMS_REJECTED_ERROR_NAME;exports.DepositTermsRejectedError=t.DepositTermsRejectedError;exports.PEGIN_FINGERPRINT_DOMAIN=t.PEGIN_FINGERPRINT_DOMAIN;exports.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE=t.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE;exports.PeginFingerprintInputError=t.PeginFingerprintInputError;exports.PeginParamsAmbiguousError=t.PeginParamsAmbiguousError;exports.PeginParamsIncompleteSpaceError=t.PeginParamsIncompleteSpaceError;exports.PeginParamsNotFoundError=t.PeginParamsNotFoundError;exports.PeginSizingIntegrityError=t.PeginSizingIntegrityError;exports.UnanchoredPrePeginError=t.UnanchoredPrePeginError;exports.VaultRootMismatchError=t.VaultRootMismatchError;exports.assertClaimBatchHomogeneous=t.assertClaimBatchHomogeneous;exports.buildPeginParamsCandidates=t.buildPeginParamsCandidates;exports.computeFundedPrePeginFee=t.computeFundedPrePeginFee;exports.computePeginFingerprint=t.computePeginFingerprint;exports.deriveHashlocksFromPrePegin=t.deriveHashlocksFromPrePegin;exports.describePeginParamsCandidate=t.describePeginParamsCandidate;exports.describeUnresolvedVersion=t.describeUnresolvedVersion;exports.encodePeginFingerprintPreimage=t.encodePeginFingerprintPreimage;exports.isDepositTermsRejectedError=t.isDepositTermsRejectedError;exports.isPeginFingerprintInputError=t.isPeginFingerprintInputError;exports.isWotsMismatchError=t.isWotsMismatchError;exports.orderClaimBatchByHtlcVout=t.orderClaimBatchByHtlcVout;exports.rebuildDepositTermsCore=t.rebuildDepositTermsCore;exports.rebuildDepositTermsForClaim=t.rebuildDepositTermsForClaim;exports.reconstructPeginParams=t.reconstructPeginParams;exports.selectSiblingRegistrations=t.selectSiblingRegistrations;exports.toRefundInputs=t.toRefundInputs;exports.ApplicationEntryPointMismatchError=e.ApplicationEntryPointMismatchError;exports.ArtifactsVaultMismatchError=e.ArtifactsVaultMismatchError;exports.AssertBindingError=e.AssertBindingError;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ChallengerSetMismatchError=e.ChallengerSetMismatchError;exports.DELEGATED_CLAIM_TX_GRAPH_VERSION=e.DELEGATED_CLAIM_TX_GRAPH_VERSION;exports.DelegatedClaimSigningIncompleteError=e.DelegatedClaimSigningIncompleteError;exports.GraphFingerprintError=e.GraphFingerprintError;exports.PEGIN_ETH_CONFIRMATIONS=e.PEGIN_ETH_CONFIRMATIONS;exports.ParticipantKeyDriftError=e.ParticipantKeyDriftError;exports.PayoutDestinationError=e.PayoutDestinationError;exports.PayoutInputLeafError=e.PayoutInputLeafError;exports.PeginRegistrationMissingError=e.PeginRegistrationMissingError;exports.PeginRegistrationNotFinalError=e.PeginRegistrationNotFinalError;exports.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR=e.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR;exports.RECLAIM_MAX_FEE_FRACTION_NUMERATOR=e.RECLAIM_MAX_FEE_FRACTION_NUMERATOR;exports.RECLAIM_MAX_FEE_RATE_SATS_VB=e.RECLAIM_MAX_FEE_RATE_SATS_VB;exports.RECLAIM_WARN_FEE_FRACTION_NUMERATOR=e.RECLAIM_WARN_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=e.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=e.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=e.REFUND_MAX_FEE_RATE_SATS_VB;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.ReclaimUneconomicalError=e.ReclaimUneconomicalError;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.SigningPlanMismatchError=e.SigningPlanMismatchError;exports.VaultIdBindingError=e.VaultIdBindingError;exports.activateVault=e.activateVault;exports.activateVaultAndRedeem=e.activateVaultAndRedeem;exports.assembleWatchtowerArtifacts=e.assembleWatchtowerArtifacts;exports.assembleWatchtowerArtifactsFromSignatures=e.assembleWatchtowerArtifactsFromSignatures;exports.assertArtifactsUsableForVault=e.assertArtifactsUsableForVault;exports.assertAssertBindsClaimAndPayout=e.assertAssertBindsClaimAndPayout;exports.assertChallengerSetMatchesVault=e.assertChallengerSetMatchesVault;exports.assertClaimSpendsVault=e.assertClaimSpendsVault;exports.assertPayoutPaysRegisteredScript=e.assertPayoutPaysRegisteredScript;exports.assertReturnedGraphMatchesFingerprint=e.assertReturnedGraphMatchesFingerprint;exports.assertTermsMatchVault=e.assertTermsMatchVault;exports.assertVaultProviderHintAccepted=e.assertVaultProviderHintAccepted;exports.buildAndBroadcastReclaim=e.buildAndBroadcastReclaim;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.claimExpiredVault=e.claimExpiredVault;exports.copyAssertConnectorLeaf=e.copyAssertConnectorLeaf;exports.deriveClaimerWotsKeypair=e.deriveClaimerWotsKeypair;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.fingerprintReturnedGraph=e.fingerprintReturnedGraph;exports.isApplicationEntryPointMismatchError=e.isApplicationEntryPointMismatchError;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isHintAccepted=e.isHintAccepted;exports.isParticipantKeyDriftError=e.isParticipantKeyDriftError;exports.isPeginRegistrationMissingError=e.isPeginRegistrationMissingError;exports.isPeginRegistrationNotFinalError=e.isPeginRegistrationNotFinalError;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.matchKeyHint=e.matchKeyHint;exports.matchKeySetHint=e.matchKeySetHint;exports.planDelegatedClaimSigning=e.planDelegatedClaimSigning;exports.readDelegatedClaimVaultContext=e.readDelegatedClaimVaultContext;exports.readStampedParticipantKeys=e.readStampedParticipantKeys;exports.resolveCurrentParticipantKeys=e.resolveCurrentParticipantKeys;exports.resolveParticipantKeysAtEpochs=e.resolveParticipantKeysAtEpochs;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDelegatedClaimPlan=e.signDelegatedClaimPlan;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.summarizeWatchtowerArtifacts=e.summarizeWatchtowerArtifacts;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredParticipantKeys=e.verifyRegisteredParticipantKeys;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginRegistrationDepth=e.waitForPeginRegistrationDepth;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=p.ContractStatus;exports.PeginAction=p.PeginAction;exports.activationDeadlineBlocksRemaining=p.activationDeadlineBlocksRemaining;exports.canPerformAction=p.canPerformAction;exports.getPeginProtocolState=p.getPeginProtocolState;exports.isActivationDeadlinePassedOnChain=p.isActivationDeadlinePassedOnChain;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|