@babylonlabs-io/ts-sdk 3.0.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ApplicationRegistry.abi-s8cQ1ooR.js +160 -0
- package/dist/ApplicationRegistry.abi-s8cQ1ooR.js.map +1 -0
- package/dist/ApplicationRegistry.abi-sMiTWmnL.cjs +2 -0
- package/dist/ApplicationRegistry.abi-sMiTWmnL.cjs.map +1 -0
- package/dist/{BTCVaultRegistry.abi-BQ5tFNSu.cjs → BTCVaultRegistry.abi-CohlJX7c.cjs} +2 -2
- package/dist/{BTCVaultRegistry.abi-BQ5tFNSu.cjs.map → BTCVaultRegistry.abi-CohlJX7c.cjs.map} +1 -1
- package/dist/{BTCVaultRegistry.abi-B0x9_Bza.js → BTCVaultRegistry.abi-DBW0dyqH.js} +63 -1
- package/dist/{BTCVaultRegistry.abi-B0x9_Bza.js.map → BTCVaultRegistry.abi-DBW0dyqH.js.map} +1 -1
- package/dist/{PayoutManager-BSwbUQeF.js → PayoutManager-BZ212yml.js} +124 -123
- package/dist/PayoutManager-BZ212yml.js.map +1 -0
- package/dist/PayoutManager-DOdsgcUR.cjs +2 -0
- package/dist/PayoutManager-DOdsgcUR.cjs.map +1 -0
- package/dist/PeginManager-8EUlm10F.cjs +2 -0
- package/dist/{PeginManager-IgDHy_eU.cjs.map → PeginManager-8EUlm10F.cjs.map} +1 -1
- package/dist/{PeginManager-D8WGB8eN.js → PeginManager-QRwMUxZg.js} +45 -43
- package/dist/{PeginManager-D8WGB8eN.js.map → PeginManager-QRwMUxZg.js.map} +1 -1
- package/dist/{ProtocolParams.abi-q0AidvYX.js → ProtocolParams.abi-CKOVqFJP.js} +2 -158
- package/dist/ProtocolParams.abi-CKOVqFJP.js.map +1 -0
- package/dist/ProtocolParams.abi-CjrT0545.cjs +2 -0
- package/dist/ProtocolParams.abi-CjrT0545.cjs.map +1 -0
- package/dist/btcTxHash-BRZ8_EZq.js +9 -0
- package/dist/btcTxHash-BRZ8_EZq.js.map +1 -0
- package/dist/btcTxHash-CGb5BqFL.cjs +2 -0
- package/dist/btcTxHash-CGb5BqFL.cjs.map +1 -0
- package/dist/buildAndBroadcastReclaim-DjX7wVb2.cjs +2 -0
- package/dist/buildAndBroadcastReclaim-DjX7wVb2.cjs.map +1 -0
- package/dist/buildAndBroadcastReclaim-DoprHX7o.js +3077 -0
- package/dist/buildAndBroadcastReclaim-DoprHX7o.js.map +1 -0
- package/dist/buildVaultContextInputForClaim-9XZaqIiw.cjs +2 -0
- package/dist/buildVaultContextInputForClaim-9XZaqIiw.cjs.map +1 -0
- package/dist/buildVaultContextInputForClaim-DhBoQKyN.js +25 -0
- package/dist/buildVaultContextInputForClaim-DhBoQKyN.js.map +1 -0
- package/dist/constants-BeYquVd-.js +36 -0
- package/dist/constants-BeYquVd-.js.map +1 -0
- package/dist/constants-BwCg5K6R.cjs +2 -0
- package/dist/constants-BwCg5K6R.cjs.map +1 -0
- package/dist/{index-D2mybjXD.js → index-CVBtBjQ5.js} +2 -2
- package/dist/{index-D2mybjXD.js.map → index-CVBtBjQ5.js.map} +1 -1
- package/dist/{index-MRdle0fs.cjs → index-DpjYs5yr.cjs} +2 -2
- package/dist/{index-MRdle0fs.cjs.map → index-DpjYs5yr.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +288 -260
- package/dist/index.js.map +1 -1
- package/dist/{noPayout-qBXWKwav.js → noPayout-B-vGXJ-V.js} +3 -3
- package/dist/{noPayout-qBXWKwav.js.map → noPayout-B-vGXJ-V.js.map} +1 -1
- package/dist/{noPayout-DAWBQ0eG.cjs → noPayout-DOHak0ui.cjs} +2 -2
- package/dist/{noPayout-DAWBQ0eG.cjs.map → noPayout-DOHak0ui.cjs.map} +1 -1
- package/dist/pegin-registration-client-BWMwxtr8.js +718 -0
- package/dist/pegin-registration-client-BWMwxtr8.js.map +1 -0
- package/dist/pegin-registration-client-D4EguWaz.cjs +2 -0
- package/dist/pegin-registration-client-D4EguWaz.cjs.map +1 -0
- package/dist/{primeVpAuth-BDWBKYhv.cjs → primeVpAuth-BPj2TPdD.cjs} +2 -2
- package/dist/{primeVpAuth-BDWBKYhv.cjs.map → primeVpAuth-BPj2TPdD.cjs.map} +1 -1
- package/dist/{primeVpAuth-D0ZnsjRi.js → primeVpAuth-CiCdRNGf.js} +2 -2
- package/dist/{primeVpAuth-D0ZnsjRi.js.map → primeVpAuth-CiCdRNGf.js.map} +1 -1
- package/dist/registration-records-CKLAv3gw.js +447 -0
- package/dist/registration-records-CKLAv3gw.js.map +1 -0
- package/dist/registration-records-DFQgBaYi.cjs +2 -0
- package/dist/registration-records-DFQgBaYi.cjs.map +1 -0
- package/dist/{secp256k1-D-H9jmd7.js → secp256k1-BuxBFUHm.js} +3 -3
- package/dist/{secp256k1-D-H9jmd7.js.map → secp256k1-BuxBFUHm.js.map} +1 -1
- package/dist/signer-set-reader-C1VmC9_U.js +264 -0
- package/dist/signer-set-reader-C1VmC9_U.js.map +1 -0
- package/dist/signer-set-reader-C6g47hdk.cjs +2 -0
- package/dist/signer-set-reader-C6g47hdk.cjs.map +1 -0
- package/dist/{signing-Dhr2t0Z6.js → signing-C1rR4tqs.js} +9 -15
- package/dist/signing-C1rR4tqs.js.map +1 -0
- package/dist/signing-DvISftFk.cjs +2 -0
- package/dist/signing-DvISftFk.cjs.map +1 -0
- package/dist/tbv/core/clients/eth/__tests__/registration-records.test.d.ts +2 -0
- package/dist/tbv/core/clients/eth/__tests__/registration-records.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/eth/claimable-event-error.d.ts +14 -0
- package/dist/tbv/core/clients/eth/claimable-event-error.d.ts.map +1 -0
- package/dist/tbv/core/clients/eth/index.cjs +1 -1
- package/dist/tbv/core/clients/eth/index.d.ts +3 -1
- package/dist/tbv/core/clients/eth/index.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/index.js +27 -21
- package/dist/tbv/core/clients/eth/index.js.map +1 -1
- package/dist/tbv/core/clients/eth/payout-script.d.ts +8 -0
- package/dist/tbv/core/clients/eth/payout-script.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/protocol-params-reader.d.ts +13 -0
- package/dist/tbv/core/clients/eth/protocol-params-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/registration-logs-error.d.ts +11 -1
- package/dist/tbv/core/clients/eth/registration-logs-error.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/registration-records.d.ts +29 -0
- package/dist/tbv/core/clients/eth/registration-records.d.ts.map +1 -0
- package/dist/tbv/core/clients/eth/types.d.ts +120 -3
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +9 -10
- 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 +56 -50
- package/dist/tbv/core/clients/index.js.map +1 -1
- 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 +45 -0
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/index.cjs +1 -1
- package/dist/tbv/core/contracts/index.js +16 -15
- package/dist/tbv/core/contracts/index.js.map +1 -1
- package/dist/tbv/core/deposit-terms/__tests__/claimSiblings.test.d.ts +2 -0
- package/dist/tbv/core/deposit-terms/__tests__/claimSiblings.test.d.ts.map +1 -0
- package/dist/tbv/core/deposit-terms/__tests__/fixtures/realFundedPrePegin.d.ts +29 -0
- package/dist/tbv/core/deposit-terms/__tests__/fixtures/realFundedPrePegin.d.ts.map +1 -0
- package/dist/tbv/core/deposit-terms/__tests__/fundedPrePeginFee.test.d.ts +2 -0
- package/dist/tbv/core/deposit-terms/__tests__/fundedPrePeginFee.test.d.ts.map +1 -0
- package/dist/tbv/core/deposit-terms/__tests__/rebuildDepositTermsForClaim.golden.test.d.ts +2 -0
- package/dist/tbv/core/deposit-terms/__tests__/rebuildDepositTermsForClaim.golden.test.d.ts.map +1 -0
- package/dist/tbv/core/deposit-terms/__tests__/rebuildDepositTermsForClaim.test.d.ts +2 -0
- package/dist/tbv/core/deposit-terms/__tests__/rebuildDepositTermsForClaim.test.d.ts.map +1 -0
- package/dist/tbv/core/deposit-terms/claimSiblings.d.ts +23 -0
- package/dist/tbv/core/deposit-terms/claimSiblings.d.ts.map +1 -0
- package/dist/tbv/core/deposit-terms/fundedPrePeginFee.d.ts +15 -0
- package/dist/tbv/core/deposit-terms/fundedPrePeginFee.d.ts.map +1 -0
- package/dist/tbv/core/deposit-terms/index.d.ts +3 -0
- package/dist/tbv/core/deposit-terms/index.d.ts.map +1 -1
- package/dist/tbv/core/deposit-terms/rebuildDepositTermsForClaim.d.ts +40 -0
- package/dist/tbv/core/deposit-terms/rebuildDepositTermsForClaim.d.ts.map +1 -0
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +287 -259
- package/dist/tbv/core/index.js.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/managers/pegin/signPsbtsWithFallback.d.ts +6 -2
- package/dist/tbv/core/managers/pegin/signPsbtsWithFallback.d.ts.map +1 -1
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.js +4 -4
- package/dist/tbv/core/primitives/psbt/constants.d.ts +54 -6
- package/dist/tbv/core/primitives/psbt/constants.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/__tests__/assembleWatchtowerArtifactsFromSignatures.test.d.ts +2 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/assembleWatchtowerArtifactsFromSignatures.test.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/assertBinding.test.d.ts +2 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/assertBinding.test.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/assertPayoutFeeAndTimelocks.test.d.ts +2 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/assertPayoutFeeAndTimelocks.test.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/fixtures/delegatedClaimPsbts.d.ts +49 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/fixtures/delegatedClaimPsbts.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/payoutBinding.test.d.ts +2 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/payoutBinding.test.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/payoutInputLeaf.test.d.ts +2 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/payoutInputLeaf.test.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/planDelegatedClaimSigning.test.d.ts +2 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/planDelegatedClaimSigning.test.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/readDelegatedClaimVaultContext.test.d.ts +2 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/readDelegatedClaimVaultContext.test.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/realSchnorrVerification.test.d.ts +2 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/realSchnorrVerification.test.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/signDelegatedClaimPlan.test.d.ts +2 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/signDelegatedClaimPlan.test.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/signingRequests.test.d.ts +2 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/signingRequests.test.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifacts.d.ts +34 -9
- package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifacts.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifactsFromSignatures.d.ts +36 -0
- package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifactsFromSignatures.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/assertBinding.d.ts +37 -0
- package/dist/tbv/core/services/delegated-claim/assertBinding.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/assertPayoutFeeAndTimelocks.d.ts +35 -0
- package/dist/tbv/core/services/delegated-claim/assertPayoutFeeAndTimelocks.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/index.d.ts +22 -4
- package/dist/tbv/core/services/delegated-claim/index.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/payoutBinding.d.ts +10 -4
- package/dist/tbv/core/services/delegated-claim/payoutBinding.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/payoutInputLeaf.d.ts +34 -0
- package/dist/tbv/core/services/delegated-claim/payoutInputLeaf.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/planDelegatedClaimSigning.d.ts +43 -0
- package/dist/tbv/core/services/delegated-claim/planDelegatedClaimSigning.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/readDelegatedClaimVaultContext.d.ts +70 -0
- package/dist/tbv/core/services/delegated-claim/readDelegatedClaimVaultContext.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/readWatchtowerArtifacts.d.ts +31 -2
- package/dist/tbv/core/services/delegated-claim/readWatchtowerArtifacts.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/signDelegatedClaimPlan.d.ts +110 -0
- package/dist/tbv/core/services/delegated-claim/signDelegatedClaimPlan.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/signingRequests.d.ts +24 -0
- package/dist/tbv/core/services/delegated-claim/signingRequests.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/types.d.ts +110 -9
- package/dist/tbv/core/services/delegated-claim/types.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/vaultIdBinding.d.ts +16 -1
- package/dist/tbv/core/services/delegated-claim/vaultIdBinding.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/verifySignatureForRequest.d.ts +19 -0
- package/dist/tbv/core/services/delegated-claim/verifySignatureForRequest.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/verifyingKeyBinding.d.ts +40 -0
- package/dist/tbv/core/services/delegated-claim/verifyingKeyBinding.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/walletIdentity.d.ts +23 -0
- package/dist/tbv/core/services/delegated-claim/walletIdentity.d.ts.map +1 -0
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +89 -76
- package/dist/tbv/core/services/participants/__tests__/readStampedParticipantKeys.test.d.ts +2 -0
- package/dist/tbv/core/services/participants/__tests__/readStampedParticipantKeys.test.d.ts.map +1 -0
- package/dist/tbv/core/services/participants/index.d.ts +1 -0
- package/dist/tbv/core/services/participants/index.d.ts.map +1 -1
- package/dist/tbv/core/services/participants/readStampedParticipantKeys.d.ts +29 -0
- package/dist/tbv/core/services/participants/readStampedParticipantKeys.d.ts.map +1 -0
- package/dist/tbv/core/services/participants/resolveParticipantKeys.d.ts +1 -1
- package/dist/tbv/core/services/participants/resolveParticipantKeys.d.ts.map +1 -1
- package/dist/tbv/core/utils/index.cjs +1 -1
- package/dist/tbv/core/utils/index.js +47 -46
- package/dist/tbv/core/utils/index.js.map +1 -1
- package/dist/tbv/core/vault-secrets/__tests__/buildVaultContextInputForClaim.test.d.ts +2 -0
- package/dist/tbv/core/vault-secrets/__tests__/buildVaultContextInputForClaim.test.d.ts.map +1 -0
- package/dist/tbv/core/vault-secrets/buildVaultContextInputForClaim.d.ts +18 -0
- package/dist/tbv/core/vault-secrets/buildVaultContextInputForClaim.d.ts.map +1 -0
- package/dist/tbv/core/vault-secrets/index.cjs +1 -1
- package/dist/tbv/core/vault-secrets/index.d.ts +1 -0
- package/dist/tbv/core/vault-secrets/index.d.ts.map +1 -1
- package/dist/tbv/core/vault-secrets/index.js +12 -10
- package/dist/tbv/core/vault-secrets/index.js.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +287 -259
- package/dist/tbv/index.js.map +1 -1
- package/dist/toRefundInputs-BZXvuOMY.cjs +2 -0
- package/dist/toRefundInputs-BZXvuOMY.cjs.map +1 -0
- package/dist/toRefundInputs-dKDSvpVI.js +698 -0
- package/dist/toRefundInputs-dKDSvpVI.js.map +1 -0
- package/dist/types-Bda75Od0.cjs +2 -0
- package/dist/types-Bda75Od0.cjs.map +1 -0
- package/dist/types-C5jj3Cc-.js +198 -0
- package/dist/types-C5jj3Cc-.js.map +1 -0
- package/dist/{verifyKeyPathSchnorrSignature-Gm9EmZkx.cjs → verifyKeyPathSchnorrSignature-CQUut2-O.cjs} +2 -2
- package/dist/{verifyKeyPathSchnorrSignature-Gm9EmZkx.cjs.map → verifyKeyPathSchnorrSignature-CQUut2-O.cjs.map} +1 -1
- package/dist/{verifyKeyPathSchnorrSignature-BQHNhRj6.js → verifyKeyPathSchnorrSignature-DxPbeSdQ.js} +2 -2
- package/dist/{verifyKeyPathSchnorrSignature-BQHNhRj6.js.map → verifyKeyPathSchnorrSignature-DxPbeSdQ.js.map} +1 -1
- package/dist/{verifyScriptPathSchnorrSignature-CpjSTfMj.js → verifyScriptPathSchnorrSignature-B3-VkvnK.js} +6 -4
- package/dist/{verifyScriptPathSchnorrSignature-CpjSTfMj.js.map → verifyScriptPathSchnorrSignature-B3-VkvnK.js.map} +1 -1
- package/dist/{verifyScriptPathSchnorrSignature-BKZihCjk.cjs → verifyScriptPathSchnorrSignature-D2t1yACC.cjs} +2 -2
- package/dist/{verifyScriptPathSchnorrSignature-BKZihCjk.cjs.map → verifyScriptPathSchnorrSignature-D2t1yACC.cjs.map} +1 -1
- package/package.json +4 -4
- package/dist/PayoutManager-B6GFbG3X.cjs +0 -2
- package/dist/PayoutManager-B6GFbG3X.cjs.map +0 -1
- package/dist/PayoutManager-BSwbUQeF.js.map +0 -1
- package/dist/PeginManager-IgDHy_eU.cjs +0 -2
- package/dist/ProtocolParams.abi-Db2USqQm.cjs +0 -2
- package/dist/ProtocolParams.abi-Db2USqQm.cjs.map +0 -1
- package/dist/ProtocolParams.abi-q0AidvYX.js.map +0 -1
- package/dist/buildAndBroadcastReclaim-B8aFMGf-.cjs +0 -2
- package/dist/buildAndBroadcastReclaim-B8aFMGf-.cjs.map +0 -1
- package/dist/buildAndBroadcastReclaim-D5520lbL.js +0 -2210
- package/dist/buildAndBroadcastReclaim-D5520lbL.js.map +0 -1
- package/dist/constants-BTZdyOuk.cjs +0 -2
- package/dist/constants-BTZdyOuk.cjs.map +0 -1
- package/dist/constants-D5vORbQE.js +0 -29
- package/dist/constants-D5vORbQE.js.map +0 -1
- package/dist/onChainBtcPubkey-BlzxYImF.cjs +0 -2
- package/dist/onChainBtcPubkey-BlzxYImF.cjs.map +0 -1
- package/dist/onChainBtcPubkey-CCTdl53s.js +0 -159
- package/dist/onChainBtcPubkey-CCTdl53s.js.map +0 -1
- package/dist/pegin-registration-client-B0j6ugt9.cjs +0 -2
- package/dist/pegin-registration-client-B0j6ugt9.cjs.map +0 -1
- package/dist/pegin-registration-client-ilkV1mLP.js +0 -878
- package/dist/pegin-registration-client-ilkV1mLP.js.map +0 -1
- package/dist/signing-3l5Aqd-H.cjs +0 -2
- package/dist/signing-3l5Aqd-H.cjs.map +0 -1
- package/dist/signing-Dhr2t0Z6.js.map +0 -1
- package/dist/toRefundInputs-10RYIfh1.js +0 -559
- package/dist/toRefundInputs-10RYIfh1.js.map +0 -1
- package/dist/toRefundInputs-a-0HRyrl.cjs +0 -2
- package/dist/toRefundInputs-a-0HRyrl.cjs.map +0 -1
- package/dist/types-BueQoMjO.cjs +0 -2
- package/dist/types-BueQoMjO.cjs.map +0 -1
- package/dist/types-DGkejGZH.js +0 -456
- package/dist/types-DGkejGZH.js.map +0 -1
|
@@ -1,559 +0,0 @@
|
|
|
1
|
-
var re = Object.defineProperty;
|
|
2
|
-
var ne = (e, t, r) => t in e ? re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
-
var _ = (e, t, r) => ne(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { keccak256 as G, toHex as oe, encodeAbiParameters as se, isAddress as ie, zeroAddress as ae } from "viem";
|
|
5
|
-
import { s as ce } from "./sha2-YqVHJiFj.js";
|
|
6
|
-
import { a as M } from "./PayoutManager-BSwbUQeF.js";
|
|
7
|
-
import { b as ue, a as le } from "./PeginManager-D8WGB8eN.js";
|
|
8
|
-
import { s as f, h as he, p as W, u as de, e as me } from "./bitcoin-C-TuHb-v.js";
|
|
9
|
-
import { computeMinClaimValue as Q, computeMinPeginFee as q, peginP2aAnchorOutput as X, getPrePeginHtlcConnectorInfo as pe, expandAuthAnchor as ge } from "./tbv/core/wasm/index.js";
|
|
10
|
-
import { d as Pe } from "./deriveVaultRoot-BcvmER1E.js";
|
|
11
|
-
import { p as fe } from "./parseFundingOutpoints-GSM-IaaK.js";
|
|
12
|
-
import { Transaction as J } from "bitcoinjs-lib";
|
|
13
|
-
import { o as ve, H as z } from "./verifyScriptPathSchnorrSignature-CpjSTfMj.js";
|
|
14
|
-
import { c as O } from "./fundPeginTransaction-CwhRbCQC.js";
|
|
15
|
-
import { c as Y } from "./signing-Dhr2t0Z6.js";
|
|
16
|
-
const Z = "DepositTermsRejectedError";
|
|
17
|
-
class be extends Error {
|
|
18
|
-
constructor(r, n = "device-envelope") {
|
|
19
|
-
super(r);
|
|
20
|
-
_(this, "reason");
|
|
21
|
-
this.name = Z, this.reason = n;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function Je(e) {
|
|
25
|
-
if (e instanceof be) return !0;
|
|
26
|
-
if (typeof e != "object" || e === null) return !1;
|
|
27
|
-
const t = e;
|
|
28
|
-
return t.name === Z && t.reason === "device-envelope";
|
|
29
|
-
}
|
|
30
|
-
async function ye(e) {
|
|
31
|
-
const t = e.siblings.length;
|
|
32
|
-
if (t === 0)
|
|
33
|
-
throw new Error(
|
|
34
|
-
"rebuildDepositTermsCore: at least one sibling is required"
|
|
35
|
-
);
|
|
36
|
-
for (const [o, b] of e.siblings.entries())
|
|
37
|
-
if (b.amount <= 0n)
|
|
38
|
-
throw new Error(
|
|
39
|
-
`rebuildDepositTermsCore: sibling[${o}] has non-positive on-chain pegin amount ${b.amount}; the chain-read vault record is invalid. Resume refused.`
|
|
40
|
-
);
|
|
41
|
-
if (e.prepeginMaxFee <= 0n)
|
|
42
|
-
throw new Error(
|
|
43
|
-
`rebuildDepositTermsCore: prepeginMaxFee must be > 0, got ${e.prepeginMaxFee}`
|
|
44
|
-
);
|
|
45
|
-
const r = f(e.prepeginTxid).toLowerCase(), n = f(
|
|
46
|
-
Y(e.fundedPrePeginTxHex)
|
|
47
|
-
).toLowerCase();
|
|
48
|
-
if (n !== r)
|
|
49
|
-
throw new Error(
|
|
50
|
-
`Funded Pre-PegIn tx hashes to ${n}, expected ${r} (on-chain prepeginTxid). Resume refused.`
|
|
51
|
-
);
|
|
52
|
-
const h = M(
|
|
53
|
-
f(e.fundedPrePeginTxHex)
|
|
54
|
-
);
|
|
55
|
-
if (h === void 0)
|
|
56
|
-
throw new Error(
|
|
57
|
-
"Funded Pre-PegIn carries no single, unambiguous auth-anchor OP_RETURN commitment — it either predates auth anchoring or is malformed. The intent resume path requires the anchor to prove sibling completeness. Resume refused."
|
|
58
|
-
);
|
|
59
|
-
if (h.vout !== t)
|
|
60
|
-
throw new Error(
|
|
61
|
-
`Auth-anchor OP_RETURN at vout ${h.vout} does not match the discovered sibling count ${t}; the discovered sibling set does not cover this transaction's HTLC outputs (a lagging index can cause this — retry later). Resume refused.`
|
|
62
|
-
);
|
|
63
|
-
const c = e.vaultKeeperBtcPubkeys.length, u = e.universalChallengerBtcPubkeys.length, l = await Q(
|
|
64
|
-
e.vaultCoreVersion,
|
|
65
|
-
c,
|
|
66
|
-
u,
|
|
67
|
-
e.councilQuorum,
|
|
68
|
-
e.councilSize,
|
|
69
|
-
e.protocolFeeRate
|
|
70
|
-
), a = await q(
|
|
71
|
-
e.vaultCoreVersion,
|
|
72
|
-
c,
|
|
73
|
-
u,
|
|
74
|
-
e.minPeginFeeRate
|
|
75
|
-
), d = await X(e.vaultCoreVersion), s = (d == null ? void 0 : d.value) ?? 0n;
|
|
76
|
-
if (l <= 0n)
|
|
77
|
-
throw new Error(
|
|
78
|
-
`WASM returned non-positive depositorClaimValue ${l}; expected > 0. Resume refused.`
|
|
79
|
-
);
|
|
80
|
-
if (a <= 0n)
|
|
81
|
-
throw new Error(
|
|
82
|
-
`WASM returned non-positive peginMaxFee ${a}; expected > 0. Resume refused.`
|
|
83
|
-
);
|
|
84
|
-
if (s < 0n)
|
|
85
|
-
throw new Error(
|
|
86
|
-
`WASM returned negative P2A anchor value ${s}. Resume refused.`
|
|
87
|
-
);
|
|
88
|
-
const i = a + s, v = e.minPeginFeeRate * O;
|
|
89
|
-
if (i <= 0n || i > v)
|
|
90
|
-
throw new Error(
|
|
91
|
-
`WASM implied PegIn reserve ${i} sat is outside (0, ${v}] (minPeginFeeRate=${e.minPeginFeeRate} × ${O} vbytes). Resume refused.`
|
|
92
|
-
);
|
|
93
|
-
const w = e.siblings.map(
|
|
94
|
-
(o) => o.amount + l + a + s
|
|
95
|
-
), C = await Promise.all(
|
|
96
|
-
e.siblings.map(async (o) => (await pe({
|
|
97
|
-
txGraphVersion: e.vaultCoreVersion,
|
|
98
|
-
depositorPubkey: e.depositorBtcPubkey,
|
|
99
|
-
vaultProviderPubkey: e.vaultProviderBtcPubkey,
|
|
100
|
-
vaultKeeperPubkeys: [...e.vaultKeeperBtcPubkeys],
|
|
101
|
-
universalChallengerPubkeys: [...e.universalChallengerBtcPubkeys],
|
|
102
|
-
hashlock: f(o.hashlock),
|
|
103
|
-
timelockRefund: e.timelockRefund,
|
|
104
|
-
network: e.network
|
|
105
|
-
})).scriptPubKey)
|
|
106
|
-
), E = J.fromHex(
|
|
107
|
-
f(e.fundedPrePeginTxHex)
|
|
108
|
-
).outs.map((o) => ({ value: o.value, script: o.script }));
|
|
109
|
-
return ve(
|
|
110
|
-
E,
|
|
111
|
-
w,
|
|
112
|
-
C
|
|
113
|
-
), ue({
|
|
114
|
-
vaultCoreVersion: e.vaultCoreVersion,
|
|
115
|
-
protocolFeeRate: e.protocolFeeRate,
|
|
116
|
-
timelockPegin: e.timelockPegin,
|
|
117
|
-
timelockAssert: e.timelockAssert,
|
|
118
|
-
timelockRefund: e.timelockRefund,
|
|
119
|
-
prepeginTxid: e.prepeginTxid,
|
|
120
|
-
prepeginMaxFee: e.prepeginMaxFee,
|
|
121
|
-
vaultProviderBtcPubkey: e.vaultProviderBtcPubkey,
|
|
122
|
-
vaultKeeperBtcPubkeys: e.vaultKeeperBtcPubkeys,
|
|
123
|
-
universalChallengerBtcPubkeys: e.universalChallengerBtcPubkeys,
|
|
124
|
-
maxAcceptableCommissionBps: e.maxAcceptableCommissionBps,
|
|
125
|
-
peginAmounts: e.siblings.map((o) => o.amount),
|
|
126
|
-
depositorClaimValue: l,
|
|
127
|
-
peginMaxFee: a
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
function Ye(e) {
|
|
131
|
-
const t = (e instanceof Error ? e.message : typeof e == "string" ? e : "").toLowerCase();
|
|
132
|
-
return t.includes("wots") && t.includes("hash") && t.includes("does not match");
|
|
133
|
-
}
|
|
134
|
-
const we = "TBV.PeginFingerprint.v1", Ee = G(
|
|
135
|
-
oe(we)
|
|
136
|
-
), U = 65535, D = 2n ** 64n - 1n, Ce = 2n ** 256n - 1n, Re = /^0x[0-9a-fA-F]{64}$/, L = 1;
|
|
137
|
-
class P extends Error {
|
|
138
|
-
constructor(t) {
|
|
139
|
-
super(t), this.name = "PeginFingerprintInputError";
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function Ze(e) {
|
|
143
|
-
return e instanceof P || e instanceof Error && e.name === "PeginFingerprintInputError";
|
|
144
|
-
}
|
|
145
|
-
function F(e, t, r, n) {
|
|
146
|
-
if (typeof t != "bigint")
|
|
147
|
-
throw new P(
|
|
148
|
-
`${e} must be a bigint (Solidity ${n}), got ${typeof t}`
|
|
149
|
-
);
|
|
150
|
-
if (t < 0n || t > r)
|
|
151
|
-
throw new P(
|
|
152
|
-
`${e} must fit Solidity ${n} (0..${r}), got ${t}`
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
function $(e, t) {
|
|
156
|
-
if (!Number.isInteger(t) || t < 0 || t > U)
|
|
157
|
-
throw new P(
|
|
158
|
-
`${e} must be an integer fitting Solidity uint16 (0..${U}), got ${t}`
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
function ke(e, t) {
|
|
162
|
-
if (!Re.test(t))
|
|
163
|
-
throw new P(
|
|
164
|
-
`${e} must be 32 bytes as 0x-prefixed hex (66 characters), got "${t}"`
|
|
165
|
-
);
|
|
166
|
-
return t.toLowerCase();
|
|
167
|
-
}
|
|
168
|
-
function xe(e) {
|
|
169
|
-
if (!ie(e, { strict: !1 }))
|
|
170
|
-
throw new P(
|
|
171
|
-
`registryAddress must be a 20-byte 0x-prefixed address, got "${e}"`
|
|
172
|
-
);
|
|
173
|
-
const t = e.toLowerCase();
|
|
174
|
-
if (t === ae)
|
|
175
|
-
throw new P(
|
|
176
|
-
"registryAddress must not be the zero address; a zero here means the registry address was never resolved"
|
|
177
|
-
);
|
|
178
|
-
return t;
|
|
179
|
-
}
|
|
180
|
-
const Ve = [
|
|
181
|
-
{ name: "domain", type: "bytes32" },
|
|
182
|
-
{ name: "chainId", type: "uint256" },
|
|
183
|
-
{ name: "registry", type: "address" },
|
|
184
|
-
{ name: "vaultProviderBtcKey", type: "bytes32" },
|
|
185
|
-
{ name: "appKeeperKeyEpoch", type: "uint64" },
|
|
186
|
-
{ name: "ucKeyEpoch", type: "uint64" },
|
|
187
|
-
{ name: "appVaultKeepersVersion", type: "uint16" },
|
|
188
|
-
{ name: "universalChallengersVersion", type: "uint16" },
|
|
189
|
-
{ name: "offchainParamsVersion", type: "uint16" },
|
|
190
|
-
{ name: "vaultCoreVersion", type: "uint16" }
|
|
191
|
-
];
|
|
192
|
-
function $e(e) {
|
|
193
|
-
if (F("chainId", e.chainId, Ce, "uint256"), e.chainId === 0n)
|
|
194
|
-
throw new P(
|
|
195
|
-
"chainId must not be 0; a zero here means the chain id was never resolved"
|
|
196
|
-
);
|
|
197
|
-
const t = xe(e.registryAddress), r = ke(
|
|
198
|
-
"vaultProviderBtcKey",
|
|
199
|
-
e.vaultProviderBtcKey
|
|
200
|
-
);
|
|
201
|
-
if (F(
|
|
202
|
-
"appKeeperKeyEpoch",
|
|
203
|
-
e.appKeeperKeyEpoch,
|
|
204
|
-
D,
|
|
205
|
-
"uint64"
|
|
206
|
-
), F("ucKeyEpoch", e.ucKeyEpoch, D, "uint64"), $("appVaultKeepersVersion", e.appVaultKeepersVersion), $(
|
|
207
|
-
"universalChallengersVersion",
|
|
208
|
-
e.universalChallengersVersion
|
|
209
|
-
), $("offchainParamsVersion", e.offchainParamsVersion), $("vaultCoreVersion", e.vaultCoreVersion), e.vaultCoreVersion < L)
|
|
210
|
-
throw new P(
|
|
211
|
-
`vaultCoreVersion must be at least ${L}; ${e.vaultCoreVersion} means the version was never resolved`
|
|
212
|
-
);
|
|
213
|
-
return se(Ve, [
|
|
214
|
-
Ee,
|
|
215
|
-
e.chainId,
|
|
216
|
-
t,
|
|
217
|
-
r,
|
|
218
|
-
e.appKeeperKeyEpoch,
|
|
219
|
-
e.ucKeyEpoch,
|
|
220
|
-
e.appVaultKeepersVersion,
|
|
221
|
-
e.universalChallengersVersion,
|
|
222
|
-
e.offchainParamsVersion,
|
|
223
|
-
e.vaultCoreVersion
|
|
224
|
-
]);
|
|
225
|
-
}
|
|
226
|
-
function et(e) {
|
|
227
|
-
return G($e(e));
|
|
228
|
-
}
|
|
229
|
-
class Te extends Error {
|
|
230
|
-
constructor(t, r) {
|
|
231
|
-
super(
|
|
232
|
-
`Re-derived vault root does not match this Pre-PegIn: derived auth-anchor hash ${t}, transaction commits to ${r}. Connect the same wallet, on the same account and the same network, that created the deposit.`
|
|
233
|
-
), this.derivedAuthAnchorHash = t, this.onChainAuthAnchorHash = r, this.name = "VaultRootMismatchError";
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
class K extends Error {
|
|
237
|
-
constructor(t) {
|
|
238
|
-
super(t), this.name = "UnanchoredPrePeginError";
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
class Ae extends Error {
|
|
242
|
-
constructor(t, r, n = []) {
|
|
243
|
-
super(
|
|
244
|
-
`No candidate parameter set reproduces this Pre-PegIn's HTLC outputs (${t} candidate(s) tried). ` + (n.length > 0 ? `${n.length} version(s) could not be resolved and may hold the answer: ${n.join(" | ")}. ` : "") + `Sample rejections: ${r.join(" | ")}`
|
|
245
|
-
), this.candidatesTried = t, this.sampleRejections = r, this.unresolvedLabels = n, this.name = "PeginParamsNotFoundError";
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
class Ie extends Error {
|
|
249
|
-
constructor(t) {
|
|
250
|
-
super(
|
|
251
|
-
`${t.length} candidate parameter sets reproduce this Pre-PegIn's HTLC outputs, so the vault's stamped versions cannot be determined: ${t.join(" | ")}. Reconstruction refused.`
|
|
252
|
-
), this.survivorLabels = t, this.name = "PeginParamsAmbiguousError";
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
class Fe extends Error {
|
|
256
|
-
constructor(t, r) {
|
|
257
|
-
super(
|
|
258
|
-
`A candidate matched this Pre-PegIn (${t}), but ${r.length} version(s) could not be resolved, so the search space did not provably contain the true parameters: ${r.join(" | ")}. A version sharing the matched timelockRefund and participants is indistinguishable from the true one, so the match cannot be trusted. Reconstruction refused.`
|
|
259
|
-
), this.matchedLabel = t, this.unresolvedLabels = r, this.name = "PeginParamsIncompleteSpaceError";
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
class T extends Error {
|
|
263
|
-
constructor(t) {
|
|
264
|
-
super(`${t}. Reconstruction refused.`), this.name = "PeginSizingIntegrityError";
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
async function tt(e) {
|
|
268
|
-
const { wallet: t, depositorBtcPubkey: r, fundedPrePeginTxHex: n } = e, h = f(n), c = M(h);
|
|
269
|
-
if (c === void 0)
|
|
270
|
-
throw new K(
|
|
271
|
-
"Pre-PegIn carries no single, unambiguous auth-anchor OP_RETURN, so the number of HTLC outputs it funds cannot be determined. Legacy pre-anchor deposits are not recoverable by this path."
|
|
272
|
-
);
|
|
273
|
-
const u = c.vout;
|
|
274
|
-
if (u === 0)
|
|
275
|
-
throw new K(
|
|
276
|
-
"Pre-PegIn's auth-anchor OP_RETURN is at vout 0, implying zero HTLC outputs; there is nothing to recover."
|
|
277
|
-
);
|
|
278
|
-
const l = fe(h), a = await Pe(t, {
|
|
279
|
-
// The vault context takes the 32-byte x-only key; a wallet's compressed
|
|
280
|
-
// key would otherwise fail a byte-length check deep in the encoder with
|
|
281
|
-
// nothing pointing back at the caller.
|
|
282
|
-
depositorBtcPubkey: he(
|
|
283
|
-
W(r)
|
|
284
|
-
),
|
|
285
|
-
fundingOutpoints: l
|
|
286
|
-
});
|
|
287
|
-
try {
|
|
288
|
-
const s = await ge(a);
|
|
289
|
-
let i;
|
|
290
|
-
try {
|
|
291
|
-
i = de(ce(s));
|
|
292
|
-
} finally {
|
|
293
|
-
s.fill(0);
|
|
294
|
-
}
|
|
295
|
-
if (i !== c.hash)
|
|
296
|
-
throw new Te(i, c.hash);
|
|
297
|
-
} catch (s) {
|
|
298
|
-
throw a.fill(0), s;
|
|
299
|
-
}
|
|
300
|
-
const { hashlocks: d } = await le(a, u);
|
|
301
|
-
return { vaultCount: u, hashlocks: d, authAnchorHash: c.hash };
|
|
302
|
-
}
|
|
303
|
-
function rt(e) {
|
|
304
|
-
const { vaultCoreVersion: t, offchainParams: r, participantKeySets: n } = e;
|
|
305
|
-
if (!Number.isInteger(t) || t < 1)
|
|
306
|
-
throw new Error(
|
|
307
|
-
`buildPeginParamsCandidates: vaultCoreVersion must be a positive integer, got ${t}`
|
|
308
|
-
);
|
|
309
|
-
if (r.length === 0)
|
|
310
|
-
throw new Error(
|
|
311
|
-
"buildPeginParamsCandidates: at least one offchain-params version is required"
|
|
312
|
-
);
|
|
313
|
-
if (n.length === 0)
|
|
314
|
-
throw new Error(
|
|
315
|
-
"buildPeginParamsCandidates: at least one participant key set is required"
|
|
316
|
-
);
|
|
317
|
-
const h = [];
|
|
318
|
-
for (const c of r)
|
|
319
|
-
for (const u of n)
|
|
320
|
-
h.push({
|
|
321
|
-
vaultCoreVersion: t,
|
|
322
|
-
offchainParams: c,
|
|
323
|
-
participants: u
|
|
324
|
-
});
|
|
325
|
-
return h;
|
|
326
|
-
}
|
|
327
|
-
function Be(e) {
|
|
328
|
-
return `${e.axis} v${e.version} (${e.reason})`;
|
|
329
|
-
}
|
|
330
|
-
function B(e) {
|
|
331
|
-
const { participants: t } = e;
|
|
332
|
-
return `core=${e.vaultCoreVersion} offchain=${e.offchainParams.version} keepers=${t.appVaultKeepersVersion} challengers=${t.universalChallengersVersion} vp=${t.vaultProvider}`;
|
|
333
|
-
}
|
|
334
|
-
const j = 5;
|
|
335
|
-
function Ke(e, t) {
|
|
336
|
-
return JSON.stringify(
|
|
337
|
-
{ terms: e, peginAmounts: t },
|
|
338
|
-
(r, n) => typeof n == "bigint" ? `${n}` : n
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
function Me(e) {
|
|
342
|
-
const { offchainParams: t, participants: r } = e;
|
|
343
|
-
return [
|
|
344
|
-
e.vaultCoreVersion,
|
|
345
|
-
r.vaultKeeperBtcPubkeys.length,
|
|
346
|
-
r.universalChallengerBtcPubkeys.length,
|
|
347
|
-
t.councilQuorum,
|
|
348
|
-
t.councilSize,
|
|
349
|
-
t.protocolFeeRate,
|
|
350
|
-
t.minPeginFeeRate
|
|
351
|
-
].join("|");
|
|
352
|
-
}
|
|
353
|
-
async function Se(e) {
|
|
354
|
-
const { offchainParams: t, participants: r } = e, n = r.vaultKeeperBtcPubkeys.length, h = r.universalChallengerBtcPubkeys.length, [c, u, l] = await Promise.all([
|
|
355
|
-
Q(
|
|
356
|
-
e.vaultCoreVersion,
|
|
357
|
-
n,
|
|
358
|
-
h,
|
|
359
|
-
t.councilQuorum,
|
|
360
|
-
t.councilSize,
|
|
361
|
-
t.protocolFeeRate
|
|
362
|
-
),
|
|
363
|
-
q(
|
|
364
|
-
e.vaultCoreVersion,
|
|
365
|
-
n,
|
|
366
|
-
h,
|
|
367
|
-
t.minPeginFeeRate
|
|
368
|
-
),
|
|
369
|
-
X(e.vaultCoreVersion)
|
|
370
|
-
]), a = (l == null ? void 0 : l.value) ?? 0n;
|
|
371
|
-
if (c <= 0n)
|
|
372
|
-
throw new T(
|
|
373
|
-
`WASM returned non-positive depositorClaimValue ${c} for graph version ${e.vaultCoreVersion}`
|
|
374
|
-
);
|
|
375
|
-
if (u <= 0n)
|
|
376
|
-
throw new T(
|
|
377
|
-
`WASM returned non-positive peginMaxFee ${u} for graph version ${e.vaultCoreVersion}`
|
|
378
|
-
);
|
|
379
|
-
if (a < 0n)
|
|
380
|
-
throw new T(
|
|
381
|
-
`WASM returned negative P2A anchor value ${a} for graph version ${e.vaultCoreVersion}`
|
|
382
|
-
);
|
|
383
|
-
return { depositorClaimValue: c, peginMaxFee: u, p2aAnchorValue: a };
|
|
384
|
-
}
|
|
385
|
-
async function nt(e) {
|
|
386
|
-
const {
|
|
387
|
-
hashlocks: t,
|
|
388
|
-
fundedPrePeginTxHex: r,
|
|
389
|
-
depositorBtcPubkey: n,
|
|
390
|
-
prepeginMaxFee: h,
|
|
391
|
-
maxAcceptableCommissionBps: c,
|
|
392
|
-
network: u,
|
|
393
|
-
candidates: l,
|
|
394
|
-
unresolvedVersions: a
|
|
395
|
-
} = e;
|
|
396
|
-
if (t.length === 0)
|
|
397
|
-
throw new Error(
|
|
398
|
-
"reconstructPeginParams: at least one hashlock is required"
|
|
399
|
-
);
|
|
400
|
-
if (l.length === 0)
|
|
401
|
-
throw new Error("reconstructPeginParams: candidate space is empty");
|
|
402
|
-
const d = W(n), s = f(r), i = M(s);
|
|
403
|
-
if (i === void 0)
|
|
404
|
-
throw new K(
|
|
405
|
-
"Pre-PegIn carries no single, unambiguous auth-anchor OP_RETURN; the sibling set cannot be proven complete. Reconstruction refused."
|
|
406
|
-
);
|
|
407
|
-
if (i.vout !== t.length)
|
|
408
|
-
throw new Error(
|
|
409
|
-
`reconstructPeginParams: ${t.length} hashlock(s) supplied but the auth-anchor OP_RETURN sits at vout ${i.vout}, so the transaction funds ${i.vout} HTLC output(s). Reconstruction refused.`
|
|
410
|
-
);
|
|
411
|
-
const v = J.fromHex(s).outs, w = t.map((m, p) => BigInt(v[p].value)), C = f(
|
|
412
|
-
Y(s)
|
|
413
|
-
).toLowerCase(), E = /* @__PURE__ */ new Map(), o = [], b = [], A = [];
|
|
414
|
-
let S = 0;
|
|
415
|
-
for (const m of l)
|
|
416
|
-
try {
|
|
417
|
-
const p = Me(m);
|
|
418
|
-
let g = E.get(p);
|
|
419
|
-
g === void 0 && (g = await Se(m), E.set(p, g));
|
|
420
|
-
const R = g.depositorClaimValue + g.peginMaxFee + g.p2aAnchorValue, k = w.map((x) => x - R), V = k.findIndex((x) => x <= 0n);
|
|
421
|
-
if (V !== -1)
|
|
422
|
-
throw new z(
|
|
423
|
-
`HTLC output[${V}] value ${w[V]} is not above this candidate's reserve ${R}, so it implies a non-positive pegin amount ${k[V]}.`
|
|
424
|
-
);
|
|
425
|
-
const { offchainParams: y, participants: I } = m, N = await ye({
|
|
426
|
-
vaultCoreVersion: m.vaultCoreVersion,
|
|
427
|
-
siblings: t.map((x, te) => ({
|
|
428
|
-
hashlock: x,
|
|
429
|
-
amount: k[te]
|
|
430
|
-
})),
|
|
431
|
-
fundedPrePeginTxHex: s,
|
|
432
|
-
depositorBtcPubkey: d,
|
|
433
|
-
vaultProviderBtcPubkey: I.vaultProviderBtcPubkey,
|
|
434
|
-
vaultKeeperBtcPubkeys: I.vaultKeeperBtcPubkeys,
|
|
435
|
-
universalChallengerBtcPubkeys: I.universalChallengerBtcPubkeys,
|
|
436
|
-
protocolFeeRate: y.protocolFeeRate,
|
|
437
|
-
minPeginFeeRate: y.minPeginFeeRate,
|
|
438
|
-
councilQuorum: y.councilQuorum,
|
|
439
|
-
councilSize: y.councilSize,
|
|
440
|
-
timelockPegin: y.timelockPegin,
|
|
441
|
-
timelockAssert: y.timelockAssert,
|
|
442
|
-
timelockRefund: y.timelockRefund,
|
|
443
|
-
prepeginTxid: C,
|
|
444
|
-
prepeginMaxFee: h,
|
|
445
|
-
maxAcceptableCommissionBps: c,
|
|
446
|
-
network: u
|
|
447
|
-
});
|
|
448
|
-
o.push({
|
|
449
|
-
candidate: m,
|
|
450
|
-
terms: N,
|
|
451
|
-
peginAmounts: k,
|
|
452
|
-
fingerprint: Ke(N, k)
|
|
453
|
-
});
|
|
454
|
-
} catch (p) {
|
|
455
|
-
if (p instanceof T)
|
|
456
|
-
throw p;
|
|
457
|
-
const g = B(m), R = p instanceof Error ? p.message : String(p);
|
|
458
|
-
p instanceof z ? b.length < j && b.push(`[${g}] ${R}`) : (S++, A.length < j && A.push(`${g} (${R})`));
|
|
459
|
-
}
|
|
460
|
-
const ee = a.length + S, H = [
|
|
461
|
-
...a.map(Be),
|
|
462
|
-
...A
|
|
463
|
-
];
|
|
464
|
-
if (o.length === 0)
|
|
465
|
-
throw new Ae(l.length, b, H);
|
|
466
|
-
if (new Set(o.map((m) => m.fingerprint)).size > 1)
|
|
467
|
-
throw new Ie(
|
|
468
|
-
o.map((m) => B(m.candidate))
|
|
469
|
-
);
|
|
470
|
-
if (ee > 0)
|
|
471
|
-
throw new Fe(
|
|
472
|
-
B(o[0].candidate),
|
|
473
|
-
H
|
|
474
|
-
);
|
|
475
|
-
return {
|
|
476
|
-
candidate: o[0].candidate,
|
|
477
|
-
terms: o[0].terms,
|
|
478
|
-
peginAmounts: o[0].peginAmounts,
|
|
479
|
-
authAnchorHash: i.hash,
|
|
480
|
-
candidatesTried: l.length,
|
|
481
|
-
matchedCandidates: o.map((m) => m.candidate)
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
function ot(e, t) {
|
|
485
|
-
const {
|
|
486
|
-
htlcVout: r,
|
|
487
|
-
depositorBtcPubkey: n,
|
|
488
|
-
applicationEntryPoint: h,
|
|
489
|
-
fundedPrePeginTxHex: c,
|
|
490
|
-
hashlocks: u,
|
|
491
|
-
network: l
|
|
492
|
-
} = t, { candidate: a, peginAmounts: d } = e, { offchainParams: s, participants: i } = a;
|
|
493
|
-
if (u.length !== d.length)
|
|
494
|
-
throw new Error(
|
|
495
|
-
`toRefundInputs: ${u.length} hashlock(s) but ${d.length} reconstructed amount(s); the reconstruction and the hashlock vector describe different transactions.`
|
|
496
|
-
);
|
|
497
|
-
if (!Number.isInteger(r) || r < 0 || r >= d.length)
|
|
498
|
-
throw new Error(
|
|
499
|
-
`toRefundInputs: htlcVout ${r} is outside the reconstructed batch of ${d.length} vault(s).`
|
|
500
|
-
);
|
|
501
|
-
const v = d.map((E, o) => ({
|
|
502
|
-
hashlock: me(u[o]),
|
|
503
|
-
amount: E,
|
|
504
|
-
htlcVout: o
|
|
505
|
-
})), w = {
|
|
506
|
-
vaultCoreVersion: a.vaultCoreVersion,
|
|
507
|
-
hashlock: v[r].hashlock,
|
|
508
|
-
htlcVout: r,
|
|
509
|
-
offchainParamsVersion: s.version,
|
|
510
|
-
appVaultKeepersVersion: i.appVaultKeepersVersion,
|
|
511
|
-
universalChallengersVersion: i.universalChallengersVersion,
|
|
512
|
-
vaultProvider: i.vaultProvider,
|
|
513
|
-
applicationEntryPoint: h,
|
|
514
|
-
amount: d[r],
|
|
515
|
-
unsignedPrePeginTxHex: c,
|
|
516
|
-
depositorBtcPubkey: n,
|
|
517
|
-
batch: v
|
|
518
|
-
}, C = {
|
|
519
|
-
vaultProviderPubkey: i.vaultProviderBtcPubkey,
|
|
520
|
-
vaultKeeperPubkeys: i.vaultKeeperBtcPubkeys,
|
|
521
|
-
universalChallengerPubkeys: i.universalChallengerBtcPubkeys,
|
|
522
|
-
timelockRefund: s.timelockRefund,
|
|
523
|
-
feeRate: s.protocolFeeRate,
|
|
524
|
-
minPeginFeeRate: s.minPeginFeeRate,
|
|
525
|
-
// Depositor-as-claimer: the local-challenger count is the keeper count,
|
|
526
|
-
// the vault provider excluded — btc-vault graph.rs derive_challengers.
|
|
527
|
-
numLocalChallengers: i.vaultKeeperBtcPubkeys.length,
|
|
528
|
-
councilQuorum: s.councilQuorum,
|
|
529
|
-
councilSize: s.councilSize,
|
|
530
|
-
network: l
|
|
531
|
-
};
|
|
532
|
-
return { vault: w, context: C };
|
|
533
|
-
}
|
|
534
|
-
export {
|
|
535
|
-
Z as D,
|
|
536
|
-
Ee as P,
|
|
537
|
-
K as U,
|
|
538
|
-
Te as V,
|
|
539
|
-
we as a,
|
|
540
|
-
P as b,
|
|
541
|
-
et as c,
|
|
542
|
-
Ze as d,
|
|
543
|
-
$e as e,
|
|
544
|
-
be as f,
|
|
545
|
-
Je as g,
|
|
546
|
-
tt as h,
|
|
547
|
-
Ye as i,
|
|
548
|
-
rt as j,
|
|
549
|
-
Be as k,
|
|
550
|
-
B as l,
|
|
551
|
-
nt as m,
|
|
552
|
-
Ae as n,
|
|
553
|
-
Ie as o,
|
|
554
|
-
Fe as p,
|
|
555
|
-
T as q,
|
|
556
|
-
ye as r,
|
|
557
|
-
ot as t
|
|
558
|
-
};
|
|
559
|
-
//# sourceMappingURL=toRefundInputs-10RYIfh1.js.map
|