@babylonlabs-io/ts-sdk 3.0.2 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/eth/index.cjs +1 -1
- package/dist/tbv/core/utils/eth/index.cjs.map +1 -1
- package/dist/tbv/core/utils/eth/index.js +20 -20
- package/dist/tbv/core/utils/eth/index.js.map +1 -1
- package/dist/tbv/core/utils/eth/waitForTransactionReceiptSmartAware.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 +3 -3
- 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
|
@@ -0,0 +1,698 @@
|
|
|
1
|
+
var se = Object.defineProperty;
|
|
2
|
+
var ie = (e, t, o) => t in e ? se(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
|
+
var z = (e, t, o) => ie(e, typeof t != "symbol" ? t + "" : t, o);
|
|
4
|
+
import { r as S } from "./registration-records-CKLAv3gw.js";
|
|
5
|
+
import { s as g, c as ae, h as ce, p as q, u as ue, e as le } from "./bitcoin-C-TuHb-v.js";
|
|
6
|
+
import { c as H } from "./btcTxHash-BRZ8_EZq.js";
|
|
7
|
+
import { Transaction as M } from "bitcoinjs-lib";
|
|
8
|
+
import { Buffer as he } from "buffer";
|
|
9
|
+
import { getUtxoInfo as de } from "./tbv/core/clients/mempool/index.js";
|
|
10
|
+
import { M as D } from "./validation-OSC0xTHB.js";
|
|
11
|
+
import { keccak256 as J, toHex as me, encodeAbiParameters as pe, isAddress as ge, zeroAddress as fe } from "viem";
|
|
12
|
+
import { s as Pe } from "./sha2-YqVHJiFj.js";
|
|
13
|
+
import { d as _ } from "./PayoutManager-BZ212yml.js";
|
|
14
|
+
import { b as ve, a as be } from "./PeginManager-QRwMUxZg.js";
|
|
15
|
+
import { computeMinClaimValue as Y, computeMinPeginFee as Z, peginP2aAnchorOutput as ee, getPrePeginHtlcConnectorInfo as we, expandAuthAnchor as ye } from "./tbv/core/wasm/index.js";
|
|
16
|
+
import { d as Ce } from "./deriveVaultRoot-BcvmER1E.js";
|
|
17
|
+
import { p as xe } from "./parseFundingOutpoints-GSM-IaaK.js";
|
|
18
|
+
import { o as Ee, H as U } from "./verifyScriptPathSchnorrSignature-B3-VkvnK.js";
|
|
19
|
+
import { c as j } from "./fundPeginTransaction-CwhRbCQC.js";
|
|
20
|
+
const Re = [
|
|
21
|
+
"vaultCoreVersion",
|
|
22
|
+
"offchainParamsVersion",
|
|
23
|
+
"appVaultKeepersVersion",
|
|
24
|
+
"universalChallengersVersion"
|
|
25
|
+
], ke = [
|
|
26
|
+
"applicationEntryPoint",
|
|
27
|
+
"vaultProvider"
|
|
28
|
+
];
|
|
29
|
+
function Ve(e, t) {
|
|
30
|
+
const o = t.depositor.toLowerCase(), r = S(t).toLowerCase();
|
|
31
|
+
return e.filter(
|
|
32
|
+
(n) => n.vaultId !== t.vaultId && n.depositor.toLowerCase() === o && S(n).toLowerCase() === r
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function $e(e, t) {
|
|
36
|
+
for (const o of t) {
|
|
37
|
+
for (const r of Re)
|
|
38
|
+
if (o.vault.protocol[r] !== e.vault.protocol[r])
|
|
39
|
+
throw new Error(
|
|
40
|
+
`Sibling vaults of this Pre-PegIn disagree on ${r} (${o.vault.protocol[r]} vs ${e.vault.protocol[r]}); the batch cannot be described by one set of deposit terms.`
|
|
41
|
+
);
|
|
42
|
+
if (o.maxAcceptableCommissionBps !== e.maxAcceptableCommissionBps)
|
|
43
|
+
throw new Error(
|
|
44
|
+
`Sibling vaults of this Pre-PegIn disagree on maxAcceptableCommissionBps (${o.maxAcceptableCommissionBps} vs ${e.maxAcceptableCommissionBps}); the batch cannot be described by one set of deposit terms.`
|
|
45
|
+
);
|
|
46
|
+
for (const r of ke)
|
|
47
|
+
if (o.vault.basic[r].toLowerCase() !== e.vault.basic[r].toLowerCase())
|
|
48
|
+
throw new Error(
|
|
49
|
+
`Sibling vaults of this Pre-PegIn disagree on ${r} (${o.vault.basic[r]} vs ${e.vault.basic[r]}); the batch cannot be described by one set of deposit terms.`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function Ae(e) {
|
|
54
|
+
const t = [...e].sort(
|
|
55
|
+
(o, r) => o.vault.protocol.htlcVout - r.vault.protocol.htlcVout
|
|
56
|
+
);
|
|
57
|
+
return t.forEach((o, r) => {
|
|
58
|
+
if (o.vault.protocol.htlcVout !== r)
|
|
59
|
+
throw new Error(
|
|
60
|
+
`Sibling discovery produced a non-contiguous HTLC vector (${t.map((n) => n.vault.protocol.htlcVout).join(", ")}).`
|
|
61
|
+
);
|
|
62
|
+
}), t.map((o) => ({
|
|
63
|
+
hashlock: o.vault.protocol.hashlock,
|
|
64
|
+
amount: o.vault.basic.amount
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
const te = "DepositTermsRejectedError";
|
|
68
|
+
class Te extends Error {
|
|
69
|
+
constructor(o, r = "device-envelope") {
|
|
70
|
+
super(o);
|
|
71
|
+
z(this, "reason");
|
|
72
|
+
this.name = te, this.reason = r;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function dt(e) {
|
|
76
|
+
if (e instanceof Te) return !0;
|
|
77
|
+
if (typeof e != "object" || e === null) return !1;
|
|
78
|
+
const t = e;
|
|
79
|
+
return t.name === te && t.reason === "device-envelope";
|
|
80
|
+
}
|
|
81
|
+
async function Be(e, t) {
|
|
82
|
+
const o = M.fromHex(g(e)), n = (await Promise.all(
|
|
83
|
+
o.ins.map(
|
|
84
|
+
(i) => (
|
|
85
|
+
// Bitcoin stores the prev-txid in reverse (internal) byte order.
|
|
86
|
+
de(
|
|
87
|
+
he.from(i.hash).reverse().toString("hex"),
|
|
88
|
+
i.index,
|
|
89
|
+
t
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
)
|
|
93
|
+
)).reduce((i, a) => i + BigInt(a.value), 0n), u = o.outs.reduce((i, a) => i + BigInt(a.value), 0n), s = n - u;
|
|
94
|
+
if (s <= 0n)
|
|
95
|
+
throw new Error(
|
|
96
|
+
`The funded Pre-PegIn transaction's inputs do not cover its outputs plus a fee (computed fee: ${s} sats).`
|
|
97
|
+
);
|
|
98
|
+
if (s > D)
|
|
99
|
+
throw new Error(
|
|
100
|
+
`The funded Pre-PegIn transaction's computed fee (${s} sats) exceeds the maximum reasonable fee (${D} sats); the mempool API may have returned manipulated prevout data.`
|
|
101
|
+
);
|
|
102
|
+
return s;
|
|
103
|
+
}
|
|
104
|
+
async function oe(e) {
|
|
105
|
+
const t = e.siblings.length;
|
|
106
|
+
if (t === 0)
|
|
107
|
+
throw new Error(
|
|
108
|
+
"rebuildDepositTermsCore: at least one sibling is required"
|
|
109
|
+
);
|
|
110
|
+
for (const [l, b] of e.siblings.entries())
|
|
111
|
+
if (b.amount <= 0n)
|
|
112
|
+
throw new Error(
|
|
113
|
+
`rebuildDepositTermsCore: sibling[${l}] has non-positive on-chain pegin amount ${b.amount}; the chain-read vault record is invalid. Resume refused.`
|
|
114
|
+
);
|
|
115
|
+
if (e.prepeginMaxFee <= 0n)
|
|
116
|
+
throw new Error(
|
|
117
|
+
`rebuildDepositTermsCore: prepeginMaxFee must be > 0, got ${e.prepeginMaxFee}`
|
|
118
|
+
);
|
|
119
|
+
const o = g(e.prepeginTxid).toLowerCase(), r = g(
|
|
120
|
+
H(e.fundedPrePeginTxHex)
|
|
121
|
+
).toLowerCase();
|
|
122
|
+
if (r !== o)
|
|
123
|
+
throw new Error(
|
|
124
|
+
`Funded Pre-PegIn tx hashes to ${r}, expected ${o} (on-chain prepeginTxid). Resume refused.`
|
|
125
|
+
);
|
|
126
|
+
const n = _(
|
|
127
|
+
g(e.fundedPrePeginTxHex)
|
|
128
|
+
);
|
|
129
|
+
if (n === void 0)
|
|
130
|
+
throw new Error(
|
|
131
|
+
"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."
|
|
132
|
+
);
|
|
133
|
+
if (n.vout !== t)
|
|
134
|
+
throw new Error(
|
|
135
|
+
`Auth-anchor OP_RETURN at vout ${n.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.`
|
|
136
|
+
);
|
|
137
|
+
const u = e.vaultKeeperBtcPubkeys.length, s = e.universalChallengerBtcPubkeys.length, i = await Y(
|
|
138
|
+
e.vaultCoreVersion,
|
|
139
|
+
u,
|
|
140
|
+
s,
|
|
141
|
+
e.councilQuorum,
|
|
142
|
+
e.councilSize,
|
|
143
|
+
e.protocolFeeRate
|
|
144
|
+
), a = await Z(
|
|
145
|
+
e.vaultCoreVersion,
|
|
146
|
+
u,
|
|
147
|
+
s,
|
|
148
|
+
e.minPeginFeeRate
|
|
149
|
+
), d = await ee(e.vaultCoreVersion), c = (d == null ? void 0 : d.value) ?? 0n;
|
|
150
|
+
if (i <= 0n)
|
|
151
|
+
throw new Error(
|
|
152
|
+
`WASM returned non-positive depositorClaimValue ${i}; expected > 0. Resume refused.`
|
|
153
|
+
);
|
|
154
|
+
if (a <= 0n)
|
|
155
|
+
throw new Error(
|
|
156
|
+
`WASM returned non-positive peginMaxFee ${a}; expected > 0. Resume refused.`
|
|
157
|
+
);
|
|
158
|
+
if (c < 0n)
|
|
159
|
+
throw new Error(
|
|
160
|
+
`WASM returned negative P2A anchor value ${c}. Resume refused.`
|
|
161
|
+
);
|
|
162
|
+
const h = a + c, v = e.minPeginFeeRate * j;
|
|
163
|
+
if (h <= 0n || h > v)
|
|
164
|
+
throw new Error(
|
|
165
|
+
`WASM implied PegIn reserve ${h} sat is outside (0, ${v}] (minPeginFeeRate=${e.minPeginFeeRate} × ${j} vbytes). Resume refused.`
|
|
166
|
+
);
|
|
167
|
+
const y = e.siblings.map(
|
|
168
|
+
(l) => l.amount + i + a + c
|
|
169
|
+
), x = await Promise.all(
|
|
170
|
+
e.siblings.map(async (l) => (await we({
|
|
171
|
+
txGraphVersion: e.vaultCoreVersion,
|
|
172
|
+
depositorPubkey: e.depositorBtcPubkey,
|
|
173
|
+
vaultProviderPubkey: e.vaultProviderBtcPubkey,
|
|
174
|
+
vaultKeeperPubkeys: [...e.vaultKeeperBtcPubkeys],
|
|
175
|
+
universalChallengerPubkeys: [...e.universalChallengerBtcPubkeys],
|
|
176
|
+
hashlock: g(l.hashlock),
|
|
177
|
+
timelockRefund: e.timelockRefund,
|
|
178
|
+
network: e.network
|
|
179
|
+
})).scriptPubKey)
|
|
180
|
+
), C = M.fromHex(
|
|
181
|
+
g(e.fundedPrePeginTxHex)
|
|
182
|
+
).outs.map((l) => ({ value: l.value, script: l.script }));
|
|
183
|
+
return Ee(
|
|
184
|
+
C,
|
|
185
|
+
y,
|
|
186
|
+
x
|
|
187
|
+
), ve({
|
|
188
|
+
vaultCoreVersion: e.vaultCoreVersion,
|
|
189
|
+
protocolFeeRate: e.protocolFeeRate,
|
|
190
|
+
timelockPegin: e.timelockPegin,
|
|
191
|
+
timelockAssert: e.timelockAssert,
|
|
192
|
+
timelockRefund: e.timelockRefund,
|
|
193
|
+
prepeginTxid: e.prepeginTxid,
|
|
194
|
+
prepeginMaxFee: e.prepeginMaxFee,
|
|
195
|
+
vaultProviderBtcPubkey: e.vaultProviderBtcPubkey,
|
|
196
|
+
vaultKeeperBtcPubkeys: e.vaultKeeperBtcPubkeys,
|
|
197
|
+
universalChallengerBtcPubkeys: e.universalChallengerBtcPubkeys,
|
|
198
|
+
maxAcceptableCommissionBps: e.maxAcceptableCommissionBps,
|
|
199
|
+
peginAmounts: e.siblings.map((l) => l.amount),
|
|
200
|
+
depositorClaimValue: i,
|
|
201
|
+
peginMaxFee: a
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
async function mt(e) {
|
|
205
|
+
const { read: t } = e, o = ae(e.depositorBtcPubkey);
|
|
206
|
+
if (o !== t.context.depositorBtcPubkey)
|
|
207
|
+
throw new Error(
|
|
208
|
+
"Connected wallet key is not the vault's depositor key; select the account that made the deposit."
|
|
209
|
+
);
|
|
210
|
+
const r = g(t.prePeginTxHash).toLowerCase(), n = g(
|
|
211
|
+
H(e.fundedPrePeginTxHex)
|
|
212
|
+
).toLowerCase();
|
|
213
|
+
if (n !== r)
|
|
214
|
+
throw new Error(
|
|
215
|
+
`Funded Pre-PegIn tx hashes to ${n}, expected ${r} (on-chain prePeginTxHash).`
|
|
216
|
+
);
|
|
217
|
+
const u = await Promise.all(
|
|
218
|
+
Ve(
|
|
219
|
+
t.registrationRecords,
|
|
220
|
+
t.registrationRecord
|
|
221
|
+
).map(async (d) => {
|
|
222
|
+
const c = await e.siblingReader.getVaultData(d.vaultId);
|
|
223
|
+
if (c.protocol.prePeginTxHash.toLowerCase() !== S(d).toLowerCase())
|
|
224
|
+
throw new Error(
|
|
225
|
+
`Sibling ${d.vaultId} is registered against a different Pre-PegIn on chain than its registration log records; refusing an inconsistent node.`
|
|
226
|
+
);
|
|
227
|
+
return {
|
|
228
|
+
vault: c,
|
|
229
|
+
maxAcceptableCommissionBps: d.maxAcceptableCommissionBps
|
|
230
|
+
};
|
|
231
|
+
})
|
|
232
|
+
), s = {
|
|
233
|
+
vault: t.vault,
|
|
234
|
+
maxAcceptableCommissionBps: t.registrationRecord.maxAcceptableCommissionBps
|
|
235
|
+
};
|
|
236
|
+
$e(s, u);
|
|
237
|
+
const i = Ae([s, ...u]), a = await Be(
|
|
238
|
+
e.fundedPrePeginTxHex,
|
|
239
|
+
e.mempoolApiUrl
|
|
240
|
+
);
|
|
241
|
+
return oe({
|
|
242
|
+
vaultCoreVersion: t.vault.protocol.vaultCoreVersion,
|
|
243
|
+
siblings: i,
|
|
244
|
+
fundedPrePeginTxHex: e.fundedPrePeginTxHex,
|
|
245
|
+
depositorBtcPubkey: o,
|
|
246
|
+
vaultProviderBtcPubkey: t.participantKeys.vaultProvider.operationBtcPubkey,
|
|
247
|
+
vaultKeeperBtcPubkeys: t.participantKeys.vaultKeeperOperationKeysSorted,
|
|
248
|
+
universalChallengerBtcPubkeys: t.participantKeys.universalChallengerOperationKeysSorted,
|
|
249
|
+
protocolFeeRate: t.offchainParams.feeRate,
|
|
250
|
+
minPeginFeeRate: t.offchainParams.minPeginFeeRate,
|
|
251
|
+
councilQuorum: t.offchainParams.councilQuorum,
|
|
252
|
+
councilSize: t.offchainParams.securityCouncilKeys.length,
|
|
253
|
+
timelockPegin: t.context.timelockPegin,
|
|
254
|
+
timelockAssert: t.context.timelockAssert,
|
|
255
|
+
timelockRefund: t.offchainParams.tRefund,
|
|
256
|
+
prepeginTxid: r,
|
|
257
|
+
prepeginMaxFee: a,
|
|
258
|
+
// The submitted ceiling, verbatim: the device must see the terms the
|
|
259
|
+
// depositor originally approved.
|
|
260
|
+
maxAcceptableCommissionBps: t.registrationRecord.maxAcceptableCommissionBps,
|
|
261
|
+
network: e.network
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function pt(e) {
|
|
265
|
+
const t = (e instanceof Error ? e.message : typeof e == "string" ? e : "").toLowerCase();
|
|
266
|
+
return t.includes("wots") && t.includes("hash") && t.includes("does not match");
|
|
267
|
+
}
|
|
268
|
+
const Ie = "TBV.PeginFingerprint.v1", Fe = J(
|
|
269
|
+
me(Ie)
|
|
270
|
+
), G = 65535, Q = 2n ** 64n - 1n, Se = 2n ** 256n - 1n, Ke = /^0x[0-9a-fA-F]{64}$/, W = 1;
|
|
271
|
+
class P extends Error {
|
|
272
|
+
constructor(t) {
|
|
273
|
+
super(t), this.name = "PeginFingerprintInputError";
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function gt(e) {
|
|
277
|
+
return e instanceof P || e instanceof Error && e.name === "PeginFingerprintInputError";
|
|
278
|
+
}
|
|
279
|
+
function I(e, t, o, r) {
|
|
280
|
+
if (typeof t != "bigint")
|
|
281
|
+
throw new P(
|
|
282
|
+
`${e} must be a bigint (Solidity ${r}), got ${typeof t}`
|
|
283
|
+
);
|
|
284
|
+
if (t < 0n || t > o)
|
|
285
|
+
throw new P(
|
|
286
|
+
`${e} must fit Solidity ${r} (0..${o}), got ${t}`
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
function $(e, t) {
|
|
290
|
+
if (!Number.isInteger(t) || t < 0 || t > G)
|
|
291
|
+
throw new P(
|
|
292
|
+
`${e} must be an integer fitting Solidity uint16 (0..${G}), got ${t}`
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
function He(e, t) {
|
|
296
|
+
if (!Ke.test(t))
|
|
297
|
+
throw new P(
|
|
298
|
+
`${e} must be 32 bytes as 0x-prefixed hex (66 characters), got "${t}"`
|
|
299
|
+
);
|
|
300
|
+
return t.toLowerCase();
|
|
301
|
+
}
|
|
302
|
+
function Me(e) {
|
|
303
|
+
if (!ge(e, { strict: !1 }))
|
|
304
|
+
throw new P(
|
|
305
|
+
`registryAddress must be a 20-byte 0x-prefixed address, got "${e}"`
|
|
306
|
+
);
|
|
307
|
+
const t = e.toLowerCase();
|
|
308
|
+
if (t === fe)
|
|
309
|
+
throw new P(
|
|
310
|
+
"registryAddress must not be the zero address; a zero here means the registry address was never resolved"
|
|
311
|
+
);
|
|
312
|
+
return t;
|
|
313
|
+
}
|
|
314
|
+
const _e = [
|
|
315
|
+
{ name: "domain", type: "bytes32" },
|
|
316
|
+
{ name: "chainId", type: "uint256" },
|
|
317
|
+
{ name: "registry", type: "address" },
|
|
318
|
+
{ name: "vaultProviderBtcKey", type: "bytes32" },
|
|
319
|
+
{ name: "appKeeperKeyEpoch", type: "uint64" },
|
|
320
|
+
{ name: "ucKeyEpoch", type: "uint64" },
|
|
321
|
+
{ name: "appVaultKeepersVersion", type: "uint16" },
|
|
322
|
+
{ name: "universalChallengersVersion", type: "uint16" },
|
|
323
|
+
{ name: "offchainParamsVersion", type: "uint16" },
|
|
324
|
+
{ name: "vaultCoreVersion", type: "uint16" }
|
|
325
|
+
];
|
|
326
|
+
function Ne(e) {
|
|
327
|
+
if (I("chainId", e.chainId, Se, "uint256"), e.chainId === 0n)
|
|
328
|
+
throw new P(
|
|
329
|
+
"chainId must not be 0; a zero here means the chain id was never resolved"
|
|
330
|
+
);
|
|
331
|
+
const t = Me(e.registryAddress), o = He(
|
|
332
|
+
"vaultProviderBtcKey",
|
|
333
|
+
e.vaultProviderBtcKey
|
|
334
|
+
);
|
|
335
|
+
if (I(
|
|
336
|
+
"appKeeperKeyEpoch",
|
|
337
|
+
e.appKeeperKeyEpoch,
|
|
338
|
+
Q,
|
|
339
|
+
"uint64"
|
|
340
|
+
), I("ucKeyEpoch", e.ucKeyEpoch, Q, "uint64"), $("appVaultKeepersVersion", e.appVaultKeepersVersion), $(
|
|
341
|
+
"universalChallengersVersion",
|
|
342
|
+
e.universalChallengersVersion
|
|
343
|
+
), $("offchainParamsVersion", e.offchainParamsVersion), $("vaultCoreVersion", e.vaultCoreVersion), e.vaultCoreVersion < W)
|
|
344
|
+
throw new P(
|
|
345
|
+
`vaultCoreVersion must be at least ${W}; ${e.vaultCoreVersion} means the version was never resolved`
|
|
346
|
+
);
|
|
347
|
+
return pe(_e, [
|
|
348
|
+
Fe,
|
|
349
|
+
e.chainId,
|
|
350
|
+
t,
|
|
351
|
+
o,
|
|
352
|
+
e.appKeeperKeyEpoch,
|
|
353
|
+
e.ucKeyEpoch,
|
|
354
|
+
e.appVaultKeepersVersion,
|
|
355
|
+
e.universalChallengersVersion,
|
|
356
|
+
e.offchainParamsVersion,
|
|
357
|
+
e.vaultCoreVersion
|
|
358
|
+
]);
|
|
359
|
+
}
|
|
360
|
+
function ft(e) {
|
|
361
|
+
return J(Ne(e));
|
|
362
|
+
}
|
|
363
|
+
class Oe extends Error {
|
|
364
|
+
constructor(t, o) {
|
|
365
|
+
super(
|
|
366
|
+
`Re-derived vault root does not match this Pre-PegIn: derived auth-anchor hash ${t}, transaction commits to ${o}. Connect the same wallet, on the same account and the same network, that created the deposit.`
|
|
367
|
+
), this.derivedAuthAnchorHash = t, this.onChainAuthAnchorHash = o, this.name = "VaultRootMismatchError";
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
class K extends Error {
|
|
371
|
+
constructor(t) {
|
|
372
|
+
super(t), this.name = "UnanchoredPrePeginError";
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
class Le extends Error {
|
|
376
|
+
constructor(t, o, r = []) {
|
|
377
|
+
super(
|
|
378
|
+
`No candidate parameter set reproduces this Pre-PegIn's HTLC outputs (${t} candidate(s) tried). ` + (r.length > 0 ? `${r.length} version(s) could not be resolved and may hold the answer: ${r.join(" | ")}. ` : "") + `Sample rejections: ${o.join(" | ")}`
|
|
379
|
+
), this.candidatesTried = t, this.sampleRejections = o, this.unresolvedLabels = r, this.name = "PeginParamsNotFoundError";
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
class ze extends Error {
|
|
383
|
+
constructor(t) {
|
|
384
|
+
super(
|
|
385
|
+
`${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.`
|
|
386
|
+
), this.survivorLabels = t, this.name = "PeginParamsAmbiguousError";
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
class De extends Error {
|
|
390
|
+
constructor(t, o) {
|
|
391
|
+
super(
|
|
392
|
+
`A candidate matched this Pre-PegIn (${t}), but ${o.length} version(s) could not be resolved, so the search space did not provably contain the true parameters: ${o.join(" | ")}. A version sharing the matched timelockRefund and participants is indistinguishable from the true one, so the match cannot be trusted. Reconstruction refused.`
|
|
393
|
+
), this.matchedLabel = t, this.unresolvedLabels = o, this.name = "PeginParamsIncompleteSpaceError";
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
class A extends Error {
|
|
397
|
+
constructor(t) {
|
|
398
|
+
super(`${t}. Reconstruction refused.`), this.name = "PeginSizingIntegrityError";
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
async function Pt(e) {
|
|
402
|
+
const { wallet: t, depositorBtcPubkey: o, fundedPrePeginTxHex: r } = e, n = g(r), u = _(n);
|
|
403
|
+
if (u === void 0)
|
|
404
|
+
throw new K(
|
|
405
|
+
"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."
|
|
406
|
+
);
|
|
407
|
+
const s = u.vout;
|
|
408
|
+
if (s === 0)
|
|
409
|
+
throw new K(
|
|
410
|
+
"Pre-PegIn's auth-anchor OP_RETURN is at vout 0, implying zero HTLC outputs; there is nothing to recover."
|
|
411
|
+
);
|
|
412
|
+
const i = xe(n), a = await Ce(t, {
|
|
413
|
+
// The vault context takes the 32-byte x-only key; a wallet's compressed
|
|
414
|
+
// key would otherwise fail a byte-length check deep in the encoder with
|
|
415
|
+
// nothing pointing back at the caller.
|
|
416
|
+
depositorBtcPubkey: ce(
|
|
417
|
+
q(o)
|
|
418
|
+
),
|
|
419
|
+
fundingOutpoints: i
|
|
420
|
+
});
|
|
421
|
+
try {
|
|
422
|
+
const c = await ye(a);
|
|
423
|
+
let h;
|
|
424
|
+
try {
|
|
425
|
+
h = ue(Pe(c));
|
|
426
|
+
} finally {
|
|
427
|
+
c.fill(0);
|
|
428
|
+
}
|
|
429
|
+
if (h !== u.hash)
|
|
430
|
+
throw new Oe(h, u.hash);
|
|
431
|
+
} catch (c) {
|
|
432
|
+
throw a.fill(0), c;
|
|
433
|
+
}
|
|
434
|
+
const { hashlocks: d } = await be(a, s);
|
|
435
|
+
return { vaultCount: s, hashlocks: d, authAnchorHash: u.hash };
|
|
436
|
+
}
|
|
437
|
+
function vt(e) {
|
|
438
|
+
const { vaultCoreVersion: t, offchainParams: o, participantKeySets: r } = e;
|
|
439
|
+
if (!Number.isInteger(t) || t < 1)
|
|
440
|
+
throw new Error(
|
|
441
|
+
`buildPeginParamsCandidates: vaultCoreVersion must be a positive integer, got ${t}`
|
|
442
|
+
);
|
|
443
|
+
if (o.length === 0)
|
|
444
|
+
throw new Error(
|
|
445
|
+
"buildPeginParamsCandidates: at least one offchain-params version is required"
|
|
446
|
+
);
|
|
447
|
+
if (r.length === 0)
|
|
448
|
+
throw new Error(
|
|
449
|
+
"buildPeginParamsCandidates: at least one participant key set is required"
|
|
450
|
+
);
|
|
451
|
+
const n = [];
|
|
452
|
+
for (const u of o)
|
|
453
|
+
for (const s of r)
|
|
454
|
+
n.push({
|
|
455
|
+
vaultCoreVersion: t,
|
|
456
|
+
offchainParams: u,
|
|
457
|
+
participants: s
|
|
458
|
+
});
|
|
459
|
+
return n;
|
|
460
|
+
}
|
|
461
|
+
function Ue(e) {
|
|
462
|
+
return `${e.axis} v${e.version} (${e.reason})`;
|
|
463
|
+
}
|
|
464
|
+
function F(e) {
|
|
465
|
+
const { participants: t } = e;
|
|
466
|
+
return `core=${e.vaultCoreVersion} offchain=${e.offchainParams.version} keepers=${t.appVaultKeepersVersion} challengers=${t.universalChallengersVersion} vp=${t.vaultProvider}`;
|
|
467
|
+
}
|
|
468
|
+
const X = 5;
|
|
469
|
+
function je(e, t) {
|
|
470
|
+
return JSON.stringify(
|
|
471
|
+
{ terms: e, peginAmounts: t },
|
|
472
|
+
(o, r) => typeof r == "bigint" ? `${r}` : r
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
function Ge(e) {
|
|
476
|
+
const { offchainParams: t, participants: o } = e;
|
|
477
|
+
return [
|
|
478
|
+
e.vaultCoreVersion,
|
|
479
|
+
o.vaultKeeperBtcPubkeys.length,
|
|
480
|
+
o.universalChallengerBtcPubkeys.length,
|
|
481
|
+
t.councilQuorum,
|
|
482
|
+
t.councilSize,
|
|
483
|
+
t.protocolFeeRate,
|
|
484
|
+
t.minPeginFeeRate
|
|
485
|
+
].join("|");
|
|
486
|
+
}
|
|
487
|
+
async function Qe(e) {
|
|
488
|
+
const { offchainParams: t, participants: o } = e, r = o.vaultKeeperBtcPubkeys.length, n = o.universalChallengerBtcPubkeys.length, [u, s, i] = await Promise.all([
|
|
489
|
+
Y(
|
|
490
|
+
e.vaultCoreVersion,
|
|
491
|
+
r,
|
|
492
|
+
n,
|
|
493
|
+
t.councilQuorum,
|
|
494
|
+
t.councilSize,
|
|
495
|
+
t.protocolFeeRate
|
|
496
|
+
),
|
|
497
|
+
Z(
|
|
498
|
+
e.vaultCoreVersion,
|
|
499
|
+
r,
|
|
500
|
+
n,
|
|
501
|
+
t.minPeginFeeRate
|
|
502
|
+
),
|
|
503
|
+
ee(e.vaultCoreVersion)
|
|
504
|
+
]), a = (i == null ? void 0 : i.value) ?? 0n;
|
|
505
|
+
if (u <= 0n)
|
|
506
|
+
throw new A(
|
|
507
|
+
`WASM returned non-positive depositorClaimValue ${u} for graph version ${e.vaultCoreVersion}`
|
|
508
|
+
);
|
|
509
|
+
if (s <= 0n)
|
|
510
|
+
throw new A(
|
|
511
|
+
`WASM returned non-positive peginMaxFee ${s} for graph version ${e.vaultCoreVersion}`
|
|
512
|
+
);
|
|
513
|
+
if (a < 0n)
|
|
514
|
+
throw new A(
|
|
515
|
+
`WASM returned negative P2A anchor value ${a} for graph version ${e.vaultCoreVersion}`
|
|
516
|
+
);
|
|
517
|
+
return { depositorClaimValue: u, peginMaxFee: s, p2aAnchorValue: a };
|
|
518
|
+
}
|
|
519
|
+
async function bt(e) {
|
|
520
|
+
const {
|
|
521
|
+
hashlocks: t,
|
|
522
|
+
fundedPrePeginTxHex: o,
|
|
523
|
+
depositorBtcPubkey: r,
|
|
524
|
+
prepeginMaxFee: n,
|
|
525
|
+
maxAcceptableCommissionBps: u,
|
|
526
|
+
network: s,
|
|
527
|
+
candidates: i,
|
|
528
|
+
unresolvedVersions: a
|
|
529
|
+
} = e;
|
|
530
|
+
if (t.length === 0)
|
|
531
|
+
throw new Error(
|
|
532
|
+
"reconstructPeginParams: at least one hashlock is required"
|
|
533
|
+
);
|
|
534
|
+
if (i.length === 0)
|
|
535
|
+
throw new Error("reconstructPeginParams: candidate space is empty");
|
|
536
|
+
const d = q(r), c = g(o), h = _(c);
|
|
537
|
+
if (h === void 0)
|
|
538
|
+
throw new K(
|
|
539
|
+
"Pre-PegIn carries no single, unambiguous auth-anchor OP_RETURN; the sibling set cannot be proven complete. Reconstruction refused."
|
|
540
|
+
);
|
|
541
|
+
if (h.vout !== t.length)
|
|
542
|
+
throw new Error(
|
|
543
|
+
`reconstructPeginParams: ${t.length} hashlock(s) supplied but the auth-anchor OP_RETURN sits at vout ${h.vout}, so the transaction funds ${h.vout} HTLC output(s). Reconstruction refused.`
|
|
544
|
+
);
|
|
545
|
+
const v = M.fromHex(c).outs, y = t.map((m, p) => BigInt(v[p].value)), x = g(
|
|
546
|
+
H(c)
|
|
547
|
+
).toLowerCase(), C = /* @__PURE__ */ new Map(), l = [], b = [], T = [];
|
|
548
|
+
let N = 0;
|
|
549
|
+
for (const m of i)
|
|
550
|
+
try {
|
|
551
|
+
const p = Ge(m);
|
|
552
|
+
let f = C.get(p);
|
|
553
|
+
f === void 0 && (f = await Qe(m), C.set(p, f));
|
|
554
|
+
const E = f.depositorClaimValue + f.peginMaxFee + f.p2aAnchorValue, R = y.map((k) => k - E), V = R.findIndex((k) => k <= 0n);
|
|
555
|
+
if (V !== -1)
|
|
556
|
+
throw new U(
|
|
557
|
+
`HTLC output[${V}] value ${y[V]} is not above this candidate's reserve ${E}, so it implies a non-positive pegin amount ${R[V]}.`
|
|
558
|
+
);
|
|
559
|
+
const { offchainParams: w, participants: B } = m, L = await oe({
|
|
560
|
+
vaultCoreVersion: m.vaultCoreVersion,
|
|
561
|
+
siblings: t.map((k, ne) => ({
|
|
562
|
+
hashlock: k,
|
|
563
|
+
amount: R[ne]
|
|
564
|
+
})),
|
|
565
|
+
fundedPrePeginTxHex: c,
|
|
566
|
+
depositorBtcPubkey: d,
|
|
567
|
+
vaultProviderBtcPubkey: B.vaultProviderBtcPubkey,
|
|
568
|
+
vaultKeeperBtcPubkeys: B.vaultKeeperBtcPubkeys,
|
|
569
|
+
universalChallengerBtcPubkeys: B.universalChallengerBtcPubkeys,
|
|
570
|
+
protocolFeeRate: w.protocolFeeRate,
|
|
571
|
+
minPeginFeeRate: w.minPeginFeeRate,
|
|
572
|
+
councilQuorum: w.councilQuorum,
|
|
573
|
+
councilSize: w.councilSize,
|
|
574
|
+
timelockPegin: w.timelockPegin,
|
|
575
|
+
timelockAssert: w.timelockAssert,
|
|
576
|
+
timelockRefund: w.timelockRefund,
|
|
577
|
+
prepeginTxid: x,
|
|
578
|
+
prepeginMaxFee: n,
|
|
579
|
+
maxAcceptableCommissionBps: u,
|
|
580
|
+
network: s
|
|
581
|
+
});
|
|
582
|
+
l.push({
|
|
583
|
+
candidate: m,
|
|
584
|
+
terms: L,
|
|
585
|
+
peginAmounts: R,
|
|
586
|
+
fingerprint: je(L, R)
|
|
587
|
+
});
|
|
588
|
+
} catch (p) {
|
|
589
|
+
if (p instanceof A)
|
|
590
|
+
throw p;
|
|
591
|
+
const f = F(m), E = p instanceof Error ? p.message : String(p);
|
|
592
|
+
p instanceof U ? b.length < X && b.push(`[${f}] ${E}`) : (N++, T.length < X && T.push(`${f} (${E})`));
|
|
593
|
+
}
|
|
594
|
+
const re = a.length + N, O = [
|
|
595
|
+
...a.map(Ue),
|
|
596
|
+
...T
|
|
597
|
+
];
|
|
598
|
+
if (l.length === 0)
|
|
599
|
+
throw new Le(i.length, b, O);
|
|
600
|
+
if (new Set(l.map((m) => m.fingerprint)).size > 1)
|
|
601
|
+
throw new ze(
|
|
602
|
+
l.map((m) => F(m.candidate))
|
|
603
|
+
);
|
|
604
|
+
if (re > 0)
|
|
605
|
+
throw new De(
|
|
606
|
+
F(l[0].candidate),
|
|
607
|
+
O
|
|
608
|
+
);
|
|
609
|
+
return {
|
|
610
|
+
candidate: l[0].candidate,
|
|
611
|
+
terms: l[0].terms,
|
|
612
|
+
peginAmounts: l[0].peginAmounts,
|
|
613
|
+
authAnchorHash: h.hash,
|
|
614
|
+
candidatesTried: i.length,
|
|
615
|
+
matchedCandidates: l.map((m) => m.candidate)
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
function wt(e, t) {
|
|
619
|
+
const {
|
|
620
|
+
htlcVout: o,
|
|
621
|
+
depositorBtcPubkey: r,
|
|
622
|
+
applicationEntryPoint: n,
|
|
623
|
+
fundedPrePeginTxHex: u,
|
|
624
|
+
hashlocks: s,
|
|
625
|
+
network: i
|
|
626
|
+
} = t, { candidate: a, peginAmounts: d } = e, { offchainParams: c, participants: h } = a;
|
|
627
|
+
if (s.length !== d.length)
|
|
628
|
+
throw new Error(
|
|
629
|
+
`toRefundInputs: ${s.length} hashlock(s) but ${d.length} reconstructed amount(s); the reconstruction and the hashlock vector describe different transactions.`
|
|
630
|
+
);
|
|
631
|
+
if (!Number.isInteger(o) || o < 0 || o >= d.length)
|
|
632
|
+
throw new Error(
|
|
633
|
+
`toRefundInputs: htlcVout ${o} is outside the reconstructed batch of ${d.length} vault(s).`
|
|
634
|
+
);
|
|
635
|
+
const v = d.map((C, l) => ({
|
|
636
|
+
hashlock: le(s[l]),
|
|
637
|
+
amount: C,
|
|
638
|
+
htlcVout: l
|
|
639
|
+
})), y = {
|
|
640
|
+
vaultCoreVersion: a.vaultCoreVersion,
|
|
641
|
+
hashlock: v[o].hashlock,
|
|
642
|
+
htlcVout: o,
|
|
643
|
+
offchainParamsVersion: c.version,
|
|
644
|
+
appVaultKeepersVersion: h.appVaultKeepersVersion,
|
|
645
|
+
universalChallengersVersion: h.universalChallengersVersion,
|
|
646
|
+
vaultProvider: h.vaultProvider,
|
|
647
|
+
applicationEntryPoint: n,
|
|
648
|
+
amount: d[o],
|
|
649
|
+
unsignedPrePeginTxHex: u,
|
|
650
|
+
depositorBtcPubkey: r,
|
|
651
|
+
batch: v
|
|
652
|
+
}, x = {
|
|
653
|
+
vaultProviderPubkey: h.vaultProviderBtcPubkey,
|
|
654
|
+
vaultKeeperPubkeys: h.vaultKeeperBtcPubkeys,
|
|
655
|
+
universalChallengerPubkeys: h.universalChallengerBtcPubkeys,
|
|
656
|
+
timelockRefund: c.timelockRefund,
|
|
657
|
+
feeRate: c.protocolFeeRate,
|
|
658
|
+
minPeginFeeRate: c.minPeginFeeRate,
|
|
659
|
+
// Depositor-as-claimer: the local-challenger count is the keeper count,
|
|
660
|
+
// the vault provider excluded — btc-vault graph.rs derive_challengers.
|
|
661
|
+
numLocalChallengers: h.vaultKeeperBtcPubkeys.length,
|
|
662
|
+
councilQuorum: c.councilQuorum,
|
|
663
|
+
councilSize: c.councilSize,
|
|
664
|
+
network: i
|
|
665
|
+
};
|
|
666
|
+
return { vault: y, context: x };
|
|
667
|
+
}
|
|
668
|
+
export {
|
|
669
|
+
te as D,
|
|
670
|
+
Fe as P,
|
|
671
|
+
K as U,
|
|
672
|
+
Oe as V,
|
|
673
|
+
Ie as a,
|
|
674
|
+
P as b,
|
|
675
|
+
ft as c,
|
|
676
|
+
gt as d,
|
|
677
|
+
Ne as e,
|
|
678
|
+
$e as f,
|
|
679
|
+
Te as g,
|
|
680
|
+
dt as h,
|
|
681
|
+
pt as i,
|
|
682
|
+
Be as j,
|
|
683
|
+
mt as k,
|
|
684
|
+
Pt as l,
|
|
685
|
+
vt as m,
|
|
686
|
+
Ue as n,
|
|
687
|
+
Ae as o,
|
|
688
|
+
F as p,
|
|
689
|
+
bt as q,
|
|
690
|
+
oe as r,
|
|
691
|
+
Ve as s,
|
|
692
|
+
Le as t,
|
|
693
|
+
ze as u,
|
|
694
|
+
De as v,
|
|
695
|
+
A as w,
|
|
696
|
+
wt as x
|
|
697
|
+
};
|
|
698
|
+
//# sourceMappingURL=toRefundInputs-dKDSvpVI.js.map
|