@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
|
@@ -1,878 +0,0 @@
|
|
|
1
|
-
var lt = Object.defineProperty;
|
|
2
|
-
var dt = (t, e, o) => e in t ? lt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
|
|
3
|
-
var m = (t, e, o) => dt(t, typeof e != "symbol" ? e + "" : e, o);
|
|
4
|
-
import { getAbiItem as _, encodeFunctionData as N, isAddressEqual as pt, zeroAddress as gt } from "viem";
|
|
5
|
-
import { B as h } from "./BTCVaultRegistry.abi-B0x9_Bza.js";
|
|
6
|
-
import { B as K, h as T } from "./BTCVaultRegistryKeyEpochs.abi-BWoxwPQv.js";
|
|
7
|
-
import { M as O, b as H } from "./constants-D5vORbQE.js";
|
|
8
|
-
import { waitForTransactionReceiptSmartAware as ft } from "./tbv/core/utils/eth/index.js";
|
|
9
|
-
import { a as C, c as mt, d as Pt } from "./onChainBtcPubkey-CCTdl53s.js";
|
|
10
|
-
import { s as Q, b as w, a as bt } from "./secp256k1-D-H9jmd7.js";
|
|
11
|
-
import { c as yt, H as wt, r as E, a as F, h as Y, b as R, s as Ct } from "./sha2-YqVHJiFj.js";
|
|
12
|
-
const v = 25, Et = 9999;
|
|
13
|
-
function M(t) {
|
|
14
|
-
if (!Number.isInteger(t) || t < 0 || t >= O)
|
|
15
|
-
throw new Error(
|
|
16
|
-
`Quoted commissionBps must be an integer in [0, ${O}), got ${t}`
|
|
17
|
-
);
|
|
18
|
-
return Math.min(
|
|
19
|
-
t + v,
|
|
20
|
-
Et
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
const xt = /* @__PURE__ */ Uint8Array.from([
|
|
24
|
-
7,
|
|
25
|
-
4,
|
|
26
|
-
13,
|
|
27
|
-
1,
|
|
28
|
-
10,
|
|
29
|
-
6,
|
|
30
|
-
15,
|
|
31
|
-
3,
|
|
32
|
-
12,
|
|
33
|
-
0,
|
|
34
|
-
9,
|
|
35
|
-
5,
|
|
36
|
-
2,
|
|
37
|
-
14,
|
|
38
|
-
11,
|
|
39
|
-
8
|
|
40
|
-
]), j = Uint8Array.from(new Array(16).fill(0).map((t, e) => e)), Bt = j.map((t) => (9 * t + 5) % 16), Z = /* @__PURE__ */ (() => {
|
|
41
|
-
const o = [[j], [Bt]];
|
|
42
|
-
for (let n = 0; n < 4; n++)
|
|
43
|
-
for (let i of o)
|
|
44
|
-
i.push(i[n].map((s) => xt[s]));
|
|
45
|
-
return o;
|
|
46
|
-
})(), J = Z[0], tt = Z[1], et = /* @__PURE__ */ [
|
|
47
|
-
[11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
|
|
48
|
-
[12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
|
|
49
|
-
[13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
|
|
50
|
-
[14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
|
|
51
|
-
[15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
|
|
52
|
-
].map((t) => Uint8Array.from(t)), It = /* @__PURE__ */ J.map((t, e) => t.map((o) => et[e][o])), Tt = /* @__PURE__ */ tt.map((t, e) => t.map((o) => et[e][o])), Vt = /* @__PURE__ */ Uint32Array.from([
|
|
53
|
-
0,
|
|
54
|
-
1518500249,
|
|
55
|
-
1859775393,
|
|
56
|
-
2400959708,
|
|
57
|
-
2840853838
|
|
58
|
-
]), At = /* @__PURE__ */ Uint32Array.from([
|
|
59
|
-
1352829926,
|
|
60
|
-
1548603684,
|
|
61
|
-
1836072691,
|
|
62
|
-
2053994217,
|
|
63
|
-
0
|
|
64
|
-
]);
|
|
65
|
-
function U(t, e, o, n) {
|
|
66
|
-
return t === 0 ? e ^ o ^ n : t === 1 ? e & o | ~e & n : t === 2 ? (e | ~o) ^ n : t === 3 ? e & n | o & ~n : e ^ (o | ~n);
|
|
67
|
-
}
|
|
68
|
-
const x = /* @__PURE__ */ new Uint32Array(16);
|
|
69
|
-
class St extends wt {
|
|
70
|
-
constructor() {
|
|
71
|
-
super(64, 20, 8, !0);
|
|
72
|
-
m(this, "h0", 1732584193);
|
|
73
|
-
m(this, "h1", -271733879);
|
|
74
|
-
m(this, "h2", -1732584194);
|
|
75
|
-
m(this, "h3", 271733878);
|
|
76
|
-
m(this, "h4", -1009589776);
|
|
77
|
-
}
|
|
78
|
-
get() {
|
|
79
|
-
const { h0: o, h1: n, h2: i, h3: s, h4: r } = this;
|
|
80
|
-
return [o, n, i, s, r];
|
|
81
|
-
}
|
|
82
|
-
set(o, n, i, s, r) {
|
|
83
|
-
this.h0 = o | 0, this.h1 = n | 0, this.h2 = i | 0, this.h3 = s | 0, this.h4 = r | 0;
|
|
84
|
-
}
|
|
85
|
-
process(o, n) {
|
|
86
|
-
for (let a = 0; a < 16; a++, n += 4)
|
|
87
|
-
x[a] = o.getUint32(n, !0);
|
|
88
|
-
let i = this.h0 | 0, s = i, r = this.h1 | 0, c = r, u = this.h2 | 0, l = u, g = this.h3 | 0, b = g, f = this.h4 | 0, y = f;
|
|
89
|
-
for (let a = 0; a < 5; a++) {
|
|
90
|
-
const d = 4 - a, st = Vt[a], rt = At[a], at = J[a], ct = tt[a], ut = It[a], ht = Tt[a];
|
|
91
|
-
for (let p = 0; p < 16; p++) {
|
|
92
|
-
const I = E(i + U(a, r, u, g) + x[at[p]] + st, ut[p]) + f | 0;
|
|
93
|
-
i = f, f = g, g = E(u, 10) | 0, u = r, r = I;
|
|
94
|
-
}
|
|
95
|
-
for (let p = 0; p < 16; p++) {
|
|
96
|
-
const I = E(s + U(d, c, l, b) + x[ct[p]] + rt, ht[p]) + y | 0;
|
|
97
|
-
s = y, y = b, b = E(l, 10) | 0, l = c, c = I;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
this.set(this.h1 + u + b | 0, this.h2 + g + y | 0, this.h3 + f + s | 0, this.h4 + i + c | 0, this.h0 + r + l | 0);
|
|
101
|
-
}
|
|
102
|
-
roundClean() {
|
|
103
|
-
F(x);
|
|
104
|
-
}
|
|
105
|
-
destroy() {
|
|
106
|
-
this.destroyed = !0, F(this.buffer), this.set(0, 0, 0, 0, 0);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
const vt = /* @__PURE__ */ yt(() => new St()), $t = "5120", $ = "0014", kt = 20, q = 33, Rt = 65, _t = 2, Nt = 3, Kt = 4;
|
|
110
|
-
function ot(t, e) {
|
|
111
|
-
const o = t.startsWith("0x") || t.startsWith("0X") ? t.slice(2) : t;
|
|
112
|
-
if (!/^(?:[0-9a-fA-F]{2})+$/.test(o))
|
|
113
|
-
throw new Error(`${e} must be non-empty, even-length hex`);
|
|
114
|
-
return `0x${o.toLowerCase()}`;
|
|
115
|
-
}
|
|
116
|
-
function Ot(t) {
|
|
117
|
-
const e = Y(t), o = w.utils.lift_x(BigInt(`0x${t}`)), n = w.utils.bytesToNumberBE(
|
|
118
|
-
w.utils.taggedHash("TapTweak", e)
|
|
119
|
-
);
|
|
120
|
-
if (n >= Q.CURVE.n)
|
|
121
|
-
throw new Error("Proof of possession BTC pubkey has an invalid TapTweak");
|
|
122
|
-
const i = n === 0n ? o : o.add(w.Point.BASE.multiply(n));
|
|
123
|
-
return `0x${$t}${R(
|
|
124
|
-
w.utils.pointToBytes(i)
|
|
125
|
-
)}`;
|
|
126
|
-
}
|
|
127
|
-
function Ht(t) {
|
|
128
|
-
const e = ot(t, "depositorBtcPubkeyRaw"), o = Y(e.slice(2));
|
|
129
|
-
if (o.length === 32)
|
|
130
|
-
return {
|
|
131
|
-
xOnlyPubkey: C(e, "Payout BTC pubkey")
|
|
132
|
-
};
|
|
133
|
-
const n = o.length === q && (o[0] === _t || o[0] === Nt), i = o.length === Rt && o[0] === Kt;
|
|
134
|
-
if (!n && !i)
|
|
135
|
-
throw new Error(
|
|
136
|
-
"depositorBtcPubkeyRaw must be x-only, compressed, or uncompressed"
|
|
137
|
-
);
|
|
138
|
-
try {
|
|
139
|
-
Q.Point.fromBytes(o);
|
|
140
|
-
} catch {
|
|
141
|
-
throw new Error("depositorBtcPubkeyRaw is not a valid BTC pubkey");
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
xOnlyPubkey: R(o.subarray(1, q)),
|
|
145
|
-
compressedPubkey: n ? o : void 0
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
function Ft(t) {
|
|
149
|
-
return `0x${$}${R(vt(Ct(t)))}`;
|
|
150
|
-
}
|
|
151
|
-
function Mt(t, e, o) {
|
|
152
|
-
const n = ot(
|
|
153
|
-
t,
|
|
154
|
-
"depositorPayoutScriptPubKey"
|
|
155
|
-
);
|
|
156
|
-
if ((n.length - 2) / 2 > H)
|
|
157
|
-
throw new Error(
|
|
158
|
-
`depositorPayoutScriptPubKey exceeds ${H} bytes`
|
|
159
|
-
);
|
|
160
|
-
const i = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e, s = C(
|
|
161
|
-
`0x${i}`,
|
|
162
|
-
"Proof of possession BTC pubkey"
|
|
163
|
-
), r = Ht(o);
|
|
164
|
-
if (r.xOnlyPubkey !== s)
|
|
165
|
-
throw new Error(
|
|
166
|
-
"depositorBtcPubkeyRaw does not match the proof of possession BTC pubkey"
|
|
167
|
-
);
|
|
168
|
-
if (n === Ot(s))
|
|
169
|
-
return n;
|
|
170
|
-
if (n.startsWith(`0x${$}`) && n.length === 2 + $.length + kt * 2) {
|
|
171
|
-
if (!r.compressedPubkey)
|
|
172
|
-
throw new Error("A P2WPKH payout requires a compressed BTC pubkey");
|
|
173
|
-
if (n === Ft(r.compressedPubkey))
|
|
174
|
-
return n;
|
|
175
|
-
}
|
|
176
|
-
throw new Error(
|
|
177
|
-
"depositorPayoutScriptPubKey does not match the proof of possession BTC pubkey"
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
const V = 65535, D = 1e4, B = 4294967295, W = 255;
|
|
181
|
-
function Ut(t) {
|
|
182
|
-
if (!Number.isInteger(t) || t < 0 || t > B)
|
|
183
|
-
throw new Error(
|
|
184
|
-
`Invalid offchainParamsVersion from contract: must be a uint32, got ${t}`
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
function qt(t) {
|
|
188
|
-
const e = [];
|
|
189
|
-
if (t.timelockAssert <= 0n && e.push(
|
|
190
|
-
`timelockAssert must be positive, got ${t.timelockAssert}`
|
|
191
|
-
), t.timelockAssert > BigInt(V) && e.push(
|
|
192
|
-
`timelockAssert ${t.timelockAssert} exceeds uint16 max (${V})`
|
|
193
|
-
), t.timelockChallengeAssert <= 0n && e.push(
|
|
194
|
-
`timelockChallengeAssert must be positive, got ${t.timelockChallengeAssert}`
|
|
195
|
-
), t.tRefund <= 0 && e.push(`tRefund must be positive, got ${t.tRefund}`), t.tStale <= 0 && e.push(`tStale must be positive, got ${t.tStale}`), t.securityCouncilKeys.length === 0 && e.push("securityCouncilKeys must not be empty"), t.councilQuorum <= 0 && e.push(`councilQuorum must be positive, got ${t.councilQuorum}`), t.councilQuorum > t.securityCouncilKeys.length && e.push(
|
|
196
|
-
`councilQuorum (${t.councilQuorum}) exceeds securityCouncilKeys count (${t.securityCouncilKeys.length})`
|
|
197
|
-
), t.feeRate <= 0n && e.push(`feeRate must be positive, got ${t.feeRate}`), t.minPeginFeeRate <= 0n && e.push(
|
|
198
|
-
`minPeginFeeRate must be positive, got ${t.minPeginFeeRate}`
|
|
199
|
-
), (!Number.isInteger(t.proverCircuitVersion) || t.proverCircuitVersion < 0 || t.proverCircuitVersion > V) && e.push(
|
|
200
|
-
`proverCircuitVersion must be a uint16, got ${t.proverCircuitVersion}`
|
|
201
|
-
), (!Number.isInteger(t.minPrepeginDepth) || t.minPrepeginDepth <= 0 || t.minPrepeginDepth > B) && e.push(
|
|
202
|
-
`minPrepeginDepth must be a uint32 in [1, ${B}], got ${t.minPrepeginDepth}`
|
|
203
|
-
), t.babeTotalInstances <= 0 && e.push(
|
|
204
|
-
`babeTotalInstances must be positive, got ${t.babeTotalInstances}`
|
|
205
|
-
), t.babeInstancesToFinalize <= 0 && e.push(
|
|
206
|
-
`babeInstancesToFinalize must be positive, got ${t.babeInstancesToFinalize}`
|
|
207
|
-
), t.babeInstancesToFinalize > t.babeTotalInstances && e.push(
|
|
208
|
-
`babeInstancesToFinalize (${t.babeInstancesToFinalize}) exceeds babeTotalInstances (${t.babeTotalInstances})`
|
|
209
|
-
), (t.minVpCommissionBps < 0 || t.minVpCommissionBps > D) && e.push(
|
|
210
|
-
`minVpCommissionBps must be in [0, ${D}], got ${t.minVpCommissionBps}`
|
|
211
|
-
), e.length > 0)
|
|
212
|
-
throw new Error(
|
|
213
|
-
`Invalid offchain protocol parameters: ${e.join("; ")}`
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
function Dt(t) {
|
|
217
|
-
const e = [];
|
|
218
|
-
if (t.minimumPegInAmount <= 0n && e.push(
|
|
219
|
-
`minimumPegInAmount must be positive, got ${t.minimumPegInAmount}`
|
|
220
|
-
), t.maxPegInAmount < t.minimumPegInAmount && e.push(
|
|
221
|
-
`maxPegInAmount (${t.maxPegInAmount}) must be >= minimumPegInAmount (${t.minimumPegInAmount})`
|
|
222
|
-
), t.pegInAckTimeout <= 0n && e.push(
|
|
223
|
-
`pegInAckTimeout must be positive, got ${t.pegInAckTimeout}`
|
|
224
|
-
), t.pegInActivationTimeout <= 0n && e.push(
|
|
225
|
-
`pegInActivationTimeout must be positive, got ${t.pegInActivationTimeout}`
|
|
226
|
-
), (!Number.isInteger(t.maxHtlcOutputCount) || t.maxHtlcOutputCount <= 0 || t.maxHtlcOutputCount > W) && e.push(
|
|
227
|
-
`maxHtlcOutputCount must be an integer in [1, ${W}], got ${t.maxHtlcOutputCount}`
|
|
228
|
-
), (typeof t.expiredPegInGraceBlocks != "bigint" || t.expiredPegInGraceBlocks <= 0n) && e.push(
|
|
229
|
-
`expiredPegInGraceBlocks must be a positive bigint, got ${t.expiredPegInGraceBlocks}`
|
|
230
|
-
), e.length > 0)
|
|
231
|
-
throw new Error(`Invalid TBV protocol parameters: ${e.join("; ")}`);
|
|
232
|
-
}
|
|
233
|
-
function ce(t) {
|
|
234
|
-
if (Dt(t), qt(t.offchainParams), !Number.isInteger(t.offchainParamsVersion) || t.offchainParamsVersion < 0 || t.offchainParamsVersion > B)
|
|
235
|
-
throw new Error(
|
|
236
|
-
`Invalid peg-in configuration: offchainParamsVersion must be a uint32, got ${t.offchainParamsVersion}`
|
|
237
|
-
);
|
|
238
|
-
bt(
|
|
239
|
-
t.activeVaultCoreVersion,
|
|
240
|
-
"ProtocolParams.activeVaultCoreVersion()"
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
const nt = "RegistrationLogsUnavailableError";
|
|
244
|
-
class it extends Error {
|
|
245
|
-
constructor(o) {
|
|
246
|
-
super(
|
|
247
|
-
`The Ethereum node returned no registration logs for block ${o}, which holds a vault registration; the node may not have indexed that block yet. Try again.`
|
|
248
|
-
);
|
|
249
|
-
m(this, "blockNumber");
|
|
250
|
-
this.name = nt, this.blockNumber = o;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
function ue(t) {
|
|
254
|
-
return t instanceof it ? !0 : typeof t != "object" || t === null ? !1 : t.name === nt;
|
|
255
|
-
}
|
|
256
|
-
const L = 9999;
|
|
257
|
-
function X(t) {
|
|
258
|
-
return {
|
|
259
|
-
depositor: t.depositor,
|
|
260
|
-
depositorBtcPubKey: t.depositorBtcPubKey,
|
|
261
|
-
amount: t.amount,
|
|
262
|
-
vaultProvider: t.vaultProvider,
|
|
263
|
-
status: t.status,
|
|
264
|
-
applicationEntryPoint: t.applicationEntryPoint,
|
|
265
|
-
createdAt: t.createdAt
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
function A(t) {
|
|
269
|
-
const e = Number(t.offchainParamsVersion);
|
|
270
|
-
return Ut(e), {
|
|
271
|
-
depositorSignedPeginTx: t.depositorSignedPeginTx,
|
|
272
|
-
universalChallengersVersion: t.universalChallengersVersion,
|
|
273
|
-
appVaultKeepersVersion: t.appVaultKeepersVersion,
|
|
274
|
-
offchainParamsVersion: e,
|
|
275
|
-
verifiedAt: t.verifiedAt,
|
|
276
|
-
depositorWotsPkHash: t.depositorWotsPkHash,
|
|
277
|
-
hashlock: t.hashlock,
|
|
278
|
-
htlcVout: t.htlcVout,
|
|
279
|
-
depositorPopSignature: t.depositorPopSignature,
|
|
280
|
-
prePeginTxHash: t.prePeginTxHash,
|
|
281
|
-
vaultProviderCommissionBps: t.vaultProviderCommissionBps,
|
|
282
|
-
vaultCoreVersion: t.vaultCoreVersion
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
const Wt = 1n << 64n, Lt = 0n, Xt = [
|
|
286
|
-
_({ abi: h, name: "PegInSubmitted" }),
|
|
287
|
-
_({ abi: h, name: "PegInSubmittedV2" })
|
|
288
|
-
];
|
|
289
|
-
function S(t, e, o) {
|
|
290
|
-
if (t < 0n || t >= Wt)
|
|
291
|
-
throw new Error(
|
|
292
|
-
`getBtcVaultProtocolInfo returned ${e}=${t} for vault ${o}, outside the uint64 range — the registry may predate RFC-006`
|
|
293
|
-
);
|
|
294
|
-
return t;
|
|
295
|
-
}
|
|
296
|
-
function z(t, e) {
|
|
297
|
-
return {
|
|
298
|
-
vpKeyEpoch: S(t.vpKeyEpoch, "vpKeyEpoch", e),
|
|
299
|
-
appKeeperKeyEpoch: S(
|
|
300
|
-
t.appKeeperKeyEpoch,
|
|
301
|
-
"appKeeperKeyEpoch",
|
|
302
|
-
e
|
|
303
|
-
),
|
|
304
|
-
ucKeyEpoch: S(t.ucKeyEpoch, "ucKeyEpoch", e)
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
class zt {
|
|
308
|
-
constructor(e, o) {
|
|
309
|
-
this.publicClient = e, this.contractAddress = o;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Read the VP's **genesis** (registration) x-only BTC pubkey — the key bonded
|
|
313
|
-
* at version 0, which never moves when the operator rotates.
|
|
314
|
-
*
|
|
315
|
-
* Resolved as "the operation key at epoch 0" rather than through the
|
|
316
|
-
* dedicated `getVaultProviderBTCKey` getter, which
|
|
317
|
-
* https://github.com/babylonlabs-io/vault-contracts-aave-v4/pull/539 removes.
|
|
318
|
-
* Epoch 0 predates any rotation — appended versions are stamped at epoch 1 or
|
|
319
|
-
* later — so it resolves to the registration key, and the contracts team has
|
|
320
|
-
* confirmed that is a property we can rely on rather than an implementation
|
|
321
|
-
* detail. The devnet comparison behind that claim — both getters returning the
|
|
322
|
-
* identical key for a provider that *has* rotated, while
|
|
323
|
-
* `getCurrentOperationBtcKey` differed — is recorded in
|
|
324
|
-
* https://github.com/babylonlabs-io/babylon-toolkit/issues/2188.
|
|
325
|
-
*
|
|
326
|
-
* This makes the read RFC-006-only, where the removed getter also existed on a
|
|
327
|
-
* legacy registry. That costs nothing: every caller of this method already
|
|
328
|
-
* resolves participant keys through `OperationKeyReader`, so all of them
|
|
329
|
-
* require an RFC-006 registry regardless.
|
|
330
|
-
*
|
|
331
|
-
* Validates length, hex form, and secp256k1 curve membership before minting
|
|
332
|
-
* the brand. Returns 64-char lowercase hex without the `0x` prefix.
|
|
333
|
-
*/
|
|
334
|
-
async getVaultProviderGenesisBtcPubKey(e, o) {
|
|
335
|
-
return this.getVaultProviderOperationBtcKeyAtEpoch(
|
|
336
|
-
e,
|
|
337
|
-
Lt,
|
|
338
|
-
o
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Read the VP operation key selected by `epoch`.
|
|
343
|
-
*
|
|
344
|
-
* This is public rather than hidden inside `OperationKeyReader` because
|
|
345
|
-
* subject-specific VP authentication needs exactly one participant: the
|
|
346
|
-
* gRPC bootstrap is signed by the key frozen into the vault, while the
|
|
347
|
-
* JSON-RPC bootstrap is signed by the provider's live key.
|
|
348
|
-
*/
|
|
349
|
-
async getVaultProviderOperationBtcKeyAtEpoch(e, o, n) {
|
|
350
|
-
const i = await this.publicClient.readContract({
|
|
351
|
-
address: this.contractAddress,
|
|
352
|
-
abi: h,
|
|
353
|
-
functionName: "getOperationBtcKeyAtEpoch",
|
|
354
|
-
args: [e, o],
|
|
355
|
-
blockNumber: n
|
|
356
|
-
});
|
|
357
|
-
return C(
|
|
358
|
-
i,
|
|
359
|
-
`getOperationBtcKeyAtEpoch (vp=${e}, epoch=${o})`
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* Read the application entry point a vault provider is registered for.
|
|
364
|
-
*
|
|
365
|
-
* This is the registry's own `vaultProviders[vp].applicationEntryPoint`, and
|
|
366
|
-
* it is the value the peg-in submit path resolves internally — it selects
|
|
367
|
-
* which application's vault-keeper roster, roster version and keeper key
|
|
368
|
-
* epoch a deposit is bonded to. The dApp separately carries an entry point
|
|
369
|
-
* from its own configuration; the two agree today, but they are different
|
|
370
|
-
* sources of truth, so the build path reads this one and asserts the
|
|
371
|
-
* configured value matches it rather than trusting either alone.
|
|
372
|
-
*/
|
|
373
|
-
async getVaultProviderApplication(e, o) {
|
|
374
|
-
return await this.publicClient.readContract({
|
|
375
|
-
address: this.contractAddress,
|
|
376
|
-
abi: h,
|
|
377
|
-
functionName: "getVaultProviderApplication",
|
|
378
|
-
args: [e],
|
|
379
|
-
blockNumber: o
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Read a vault provider's *current* RFC-006 operation BTC key.
|
|
384
|
-
*
|
|
385
|
-
* Falls back on-chain to the registration key when the provider has never
|
|
386
|
-
* rotated, so this returns the same value as
|
|
387
|
-
* `getVaultProviderGenesisBtcPubKey` until the first rotation.
|
|
388
|
-
*
|
|
389
|
-
* This is the key the VP's server uses for JSON-RPC-subject authentication.
|
|
390
|
-
* The gRPC-subject bootstrap is instead bound to the existing vault's frozen
|
|
391
|
-
* epoch and resolves through `getVaultProviderOperationBtcKeyAtEpoch`.
|
|
392
|
-
*/
|
|
393
|
-
async getCurrentVaultProviderOperationBtcKey(e) {
|
|
394
|
-
const o = await this.publicClient.readContract({
|
|
395
|
-
address: this.contractAddress,
|
|
396
|
-
abi: h,
|
|
397
|
-
functionName: "getCurrentOperationBtcKey",
|
|
398
|
-
args: [e]
|
|
399
|
-
});
|
|
400
|
-
return C(
|
|
401
|
-
o,
|
|
402
|
-
`getCurrentOperationBtcKey (vp=${e})`
|
|
403
|
-
);
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Read a vault's frozen RFC-006 operation-key epochs.
|
|
407
|
-
*
|
|
408
|
-
* Reads `getBtcVaultProtocolInfo` through the **extended** ABI, which is only
|
|
409
|
-
* valid against an RFC-006 registry: against one whose `BTCVaultProtocolInfo`
|
|
410
|
-
* struct is not extended this call does not fail for a populated vault, it
|
|
411
|
-
* silently returns three words of tail data as epochs. Nothing here can detect
|
|
412
|
-
* that, so the guarantee is a deployment one — every network this ships to has
|
|
413
|
-
* the RFC-006 getters, and mainnet is a fresh RFC-006 deploy.
|
|
414
|
-
*
|
|
415
|
-
* A registry missing the operation-key getters entirely is the *safer* of the
|
|
416
|
-
* two cases: `resolveParticipantKeysAtEpochs` reverts downstream and these
|
|
417
|
-
* epochs never reach key resolution. See {@link UINT64_EXCLUSIVE_UPPER_BOUND}
|
|
418
|
-
* for which state the range check actually guards, and
|
|
419
|
-
* `BTCVaultRegistryKeyEpochs.abi.ts` for the decode hazard.
|
|
420
|
-
*/
|
|
421
|
-
async getVaultKeyEpochs(e) {
|
|
422
|
-
const o = await this.publicClient.readContract({
|
|
423
|
-
address: this.contractAddress,
|
|
424
|
-
abi: K,
|
|
425
|
-
functionName: "getBtcVaultProtocolInfo",
|
|
426
|
-
args: [e]
|
|
427
|
-
});
|
|
428
|
-
return z(o, e);
|
|
429
|
-
}
|
|
430
|
-
async getVaultKeyEpochsBatch(e) {
|
|
431
|
-
return e.length === 0 ? [] : (await this.publicClient.multicall({
|
|
432
|
-
contracts: e.map((n) => ({
|
|
433
|
-
address: this.contractAddress,
|
|
434
|
-
abi: K,
|
|
435
|
-
functionName: "getBtcVaultProtocolInfo",
|
|
436
|
-
args: [n]
|
|
437
|
-
})),
|
|
438
|
-
allowFailure: !1
|
|
439
|
-
})).map(
|
|
440
|
-
(n, i) => z(n, e[i])
|
|
441
|
-
);
|
|
442
|
-
}
|
|
443
|
-
async getVaultBasicInfo(e) {
|
|
444
|
-
const o = await this.publicClient.readContract({
|
|
445
|
-
address: this.contractAddress,
|
|
446
|
-
abi: h,
|
|
447
|
-
functionName: "getBtcVaultBasicInfo",
|
|
448
|
-
args: [e]
|
|
449
|
-
});
|
|
450
|
-
return X(o);
|
|
451
|
-
}
|
|
452
|
-
async getVaultProtocolInfo(e) {
|
|
453
|
-
const o = await this.publicClient.readContract({
|
|
454
|
-
address: this.contractAddress,
|
|
455
|
-
abi: h,
|
|
456
|
-
functionName: "getBtcVaultProtocolInfo",
|
|
457
|
-
args: [e]
|
|
458
|
-
});
|
|
459
|
-
return A(o);
|
|
460
|
-
}
|
|
461
|
-
async getProtocolInfoBatch(e) {
|
|
462
|
-
return e.length === 0 ? [] : (await this.publicClient.multicall({
|
|
463
|
-
contracts: e.map((n) => ({
|
|
464
|
-
address: this.contractAddress,
|
|
465
|
-
abi: h,
|
|
466
|
-
functionName: "getBtcVaultProtocolInfo",
|
|
467
|
-
args: [n]
|
|
468
|
-
})),
|
|
469
|
-
allowFailure: !1
|
|
470
|
-
})).map((n, i) => {
|
|
471
|
-
const s = n;
|
|
472
|
-
if (!s.depositorSignedPeginTx || s.depositorSignedPeginTx === "0x")
|
|
473
|
-
throw new Error(
|
|
474
|
-
`Vault ${e[i]} not found on-chain or has no pegin transaction`
|
|
475
|
-
);
|
|
476
|
-
return A(s);
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* Read the protocol pegin fee (in wei) for a given vault provider.
|
|
481
|
-
* Mirrors the `getPegInFee(address)` view on BTCVaultRegistry.
|
|
482
|
-
*/
|
|
483
|
-
async getPegInFee(e) {
|
|
484
|
-
return await this.publicClient.readContract({
|
|
485
|
-
address: this.contractAddress,
|
|
486
|
-
abi: h,
|
|
487
|
-
functionName: "getPegInFee",
|
|
488
|
-
args: [e]
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Read a vault provider's current commission in basis points from
|
|
493
|
-
* BTCVaultRegistry. The contract enforces `commissionBps < 10000`, so the
|
|
494
|
-
* legitimate range is `[0, 9999]`; anything outside indicates a wrong
|
|
495
|
-
* contract address or ABI drift and is surfaced as an error rather than
|
|
496
|
-
* trusted.
|
|
497
|
-
*/
|
|
498
|
-
async getVaultProviderCommission(e) {
|
|
499
|
-
const o = await this.publicClient.readContract({
|
|
500
|
-
address: this.contractAddress,
|
|
501
|
-
abi: h,
|
|
502
|
-
functionName: "getVaultProviderCommission",
|
|
503
|
-
args: [e]
|
|
504
|
-
});
|
|
505
|
-
if (!Number.isInteger(o) || o < 0 || o > L)
|
|
506
|
-
throw new Error(
|
|
507
|
-
`getVaultProviderCommission returned ${o} bps for ${e}, outside the protocol range [0, ${L}]`
|
|
508
|
-
);
|
|
509
|
-
return o;
|
|
510
|
-
}
|
|
511
|
-
async getVaultData(e) {
|
|
512
|
-
const [o, n] = await this.publicClient.multicall({
|
|
513
|
-
contracts: [
|
|
514
|
-
{
|
|
515
|
-
address: this.contractAddress,
|
|
516
|
-
abi: h,
|
|
517
|
-
functionName: "getBtcVaultBasicInfo",
|
|
518
|
-
args: [e]
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
address: this.contractAddress,
|
|
522
|
-
abi: h,
|
|
523
|
-
functionName: "getBtcVaultProtocolInfo",
|
|
524
|
-
args: [e]
|
|
525
|
-
}
|
|
526
|
-
],
|
|
527
|
-
allowFailure: !1
|
|
528
|
-
}), i = X(o), s = A(n);
|
|
529
|
-
if (!s.depositorSignedPeginTx || s.depositorSignedPeginTx === "0x")
|
|
530
|
-
throw new Error(
|
|
531
|
-
`Vault ${e} not found on-chain or has no pegin transaction`
|
|
532
|
-
);
|
|
533
|
-
return { basic: i, protocol: s };
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* Read the depositor's commission ceiling (`maxAcceptableCommissionBps`)
|
|
537
|
-
* for vaults registered in the same block, from their `PegInSubmittedV2`
|
|
538
|
-
* logs. Returned in `vaultIds` order.
|
|
539
|
-
*
|
|
540
|
-
* The contract bound-checks the ceiling and discards it (PeginLogic.sol,
|
|
541
|
-
* `VaultProviderCommissionExceeded`), so the registration log is its only
|
|
542
|
-
* on-chain source. One query at exactly `createdAt` — the `block.number`
|
|
543
|
-
* stamped at registration — so no block-range scan is needed and public-RPC
|
|
544
|
-
* range caps do not apply. Vault ids are matched case-insensitively.
|
|
545
|
-
*
|
|
546
|
-
* @throws {RegistrationLogsUnavailableError} (transient, retry) when the
|
|
547
|
-
* node answers with no registration logs for the block at all.
|
|
548
|
-
* @throws when a vault has only its `PegInSubmitted` log — registrations
|
|
549
|
-
* that predate the V2 event (vault-contracts-aave-v4 #548) never emitted
|
|
550
|
-
* the ceiling — no registration log in its own `createdAt` block, or more
|
|
551
|
-
* than one V2 log.
|
|
552
|
-
*/
|
|
553
|
-
async getMaxAcceptableCommissionBpsBatch(e, o) {
|
|
554
|
-
if (e.length === 0) return [];
|
|
555
|
-
const n = await this.publicClient.getLogs({
|
|
556
|
-
address: this.contractAddress,
|
|
557
|
-
events: Xt,
|
|
558
|
-
fromBlock: o,
|
|
559
|
-
toBlock: o,
|
|
560
|
-
strict: !0
|
|
561
|
-
});
|
|
562
|
-
if (n.length === 0)
|
|
563
|
-
throw new it(o);
|
|
564
|
-
return e.map((i) => {
|
|
565
|
-
const s = i.toLowerCase();
|
|
566
|
-
let r = !1;
|
|
567
|
-
const c = [];
|
|
568
|
-
for (const u of n)
|
|
569
|
-
u.args.vaultId.toLowerCase() === s && (r = !0, u.eventName === "PegInSubmittedV2" && c.push(u.args.maxAcceptableCommissionBps));
|
|
570
|
-
if (c.length === 1) return c[0];
|
|
571
|
-
throw c.length > 1 ? new Error(
|
|
572
|
-
`Expected one PegInSubmittedV2 log for vault ${i} at block ${o}, found ${c.length} PegInSubmittedV2 logs`
|
|
573
|
-
) : r ? new Error(
|
|
574
|
-
`Vault ${i} was registered before the registry emitted the depositor's commission ceiling (no PegInSubmittedV2 log at block ${o}), so the ceiling cannot be recovered on-chain`
|
|
575
|
-
) : new Error(
|
|
576
|
-
`Vault ${i} has no registration log at its on-chain registration block ${o}`
|
|
577
|
-
);
|
|
578
|
-
});
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
const Gt = 0, Qt = 255, Yt = 12e4;
|
|
582
|
-
function P(t, e) {
|
|
583
|
-
const o = t.startsWith("0x") ? t : t.startsWith("0X") ? `0x${t.slice(2)}` : `0x${t}`;
|
|
584
|
-
if (!/^0x(?:[0-9a-fA-F]{2})+$/.test(o))
|
|
585
|
-
throw new Error(`${e} must be non-empty, even-length hex`);
|
|
586
|
-
return o;
|
|
587
|
-
}
|
|
588
|
-
function k(t, e) {
|
|
589
|
-
if (!/^0x[0-9a-fA-F]{64}$/.test(t))
|
|
590
|
-
throw new Error(`${e} must be a 32-byte hex value`);
|
|
591
|
-
}
|
|
592
|
-
const jt = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
593
|
-
function G(t) {
|
|
594
|
-
if (k(t, "expectedFingerprint"), t.toLowerCase() === jt)
|
|
595
|
-
throw new Error(
|
|
596
|
-
"expectedFingerprint must not be zero: the registry cannot resolve a zero fingerprint, so this submission would always revert"
|
|
597
|
-
);
|
|
598
|
-
}
|
|
599
|
-
function Zt(t) {
|
|
600
|
-
if (!Number.isInteger(t) || t < 0 || t > Qt)
|
|
601
|
-
throw new Error(`htlcVout must be a uint8, got ${t}`);
|
|
602
|
-
}
|
|
603
|
-
class he {
|
|
604
|
-
constructor(e) {
|
|
605
|
-
this.config = e;
|
|
606
|
-
}
|
|
607
|
-
async registerPeginOnChain(e) {
|
|
608
|
-
const o = {
|
|
609
|
-
...e,
|
|
610
|
-
popSignature: { ...e.popSignature }
|
|
611
|
-
};
|
|
612
|
-
this.assertQuotedCommissionPresentWhenRequired(o.quotedCommissionBps), G(o.expectedFingerprint);
|
|
613
|
-
const n = this.assertPopMatchesEthAccount(o.popSignature), i = this.normalizeBtcPubkey(o.popSignature), s = P(
|
|
614
|
-
o.popSignature.btcPopSignature,
|
|
615
|
-
"btcPopSignature"
|
|
616
|
-
), r = this.normalizeRequest(
|
|
617
|
-
o,
|
|
618
|
-
n,
|
|
619
|
-
i
|
|
620
|
-
);
|
|
621
|
-
await this.assertVaultDoesNotExist(
|
|
622
|
-
r.vaultId,
|
|
623
|
-
r.peginTxHash
|
|
624
|
-
);
|
|
625
|
-
const c = await this.readPeginFee(o.vaultProvider), u = await this.resolveMaxAcceptableCommissionBps(
|
|
626
|
-
o.vaultProvider,
|
|
627
|
-
o.quotedCommissionBps
|
|
628
|
-
), l = N({
|
|
629
|
-
abi: h,
|
|
630
|
-
functionName: "submitPeginRequest",
|
|
631
|
-
args: [
|
|
632
|
-
n,
|
|
633
|
-
i,
|
|
634
|
-
s,
|
|
635
|
-
r.unsignedPrePeginTx,
|
|
636
|
-
r.depositorSignedPeginTx,
|
|
637
|
-
o.vaultProvider,
|
|
638
|
-
u,
|
|
639
|
-
o.hashlock,
|
|
640
|
-
o.htlcVout,
|
|
641
|
-
r.payoutScript,
|
|
642
|
-
o.depositorWotsPkHash,
|
|
643
|
-
// Appended last on the singular overload; the batch takes it at
|
|
644
|
-
// position 4 instead. Order is the selector, so do not "tidy" either.
|
|
645
|
-
o.expectedFingerprint
|
|
646
|
-
]
|
|
647
|
-
});
|
|
648
|
-
return {
|
|
649
|
-
ethTxHash: await this.sendAndWait(
|
|
650
|
-
l,
|
|
651
|
-
c,
|
|
652
|
-
!1,
|
|
653
|
-
n
|
|
654
|
-
),
|
|
655
|
-
vaultId: r.vaultId,
|
|
656
|
-
peginTxHash: r.peginTxHash
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
|
-
async registerPeginBatchOnChain(e) {
|
|
660
|
-
const o = {
|
|
661
|
-
...e,
|
|
662
|
-
popSignature: { ...e.popSignature },
|
|
663
|
-
requests: e.requests.map((a) => ({ ...a }))
|
|
664
|
-
};
|
|
665
|
-
if (o.requests.length === 0)
|
|
666
|
-
throw new Error("Batch pegin requires at least one request");
|
|
667
|
-
this.assertQuotedCommissionPresentWhenRequired(o.quotedCommissionBps), G(o.expectedFingerprint);
|
|
668
|
-
const n = this.assertPopMatchesEthAccount(o.popSignature), i = P(
|
|
669
|
-
o.unsignedPrePeginTx,
|
|
670
|
-
"unsignedPrePeginTx"
|
|
671
|
-
), s = this.normalizeBtcPubkey(o.popSignature), r = P(
|
|
672
|
-
o.popSignature.btcPopSignature,
|
|
673
|
-
"btcPopSignature"
|
|
674
|
-
), c = [], u = [], l = /* @__PURE__ */ new Set();
|
|
675
|
-
for (const a of o.requests) {
|
|
676
|
-
const d = this.normalizeRequest(
|
|
677
|
-
{
|
|
678
|
-
...a,
|
|
679
|
-
unsignedPrePeginTx: o.unsignedPrePeginTx,
|
|
680
|
-
vaultProvider: o.vaultProvider,
|
|
681
|
-
depositorBtcPubkeyRaw: o.depositorBtcPubkeyRaw
|
|
682
|
-
},
|
|
683
|
-
n,
|
|
684
|
-
s
|
|
685
|
-
);
|
|
686
|
-
if (l.has(d.vaultId))
|
|
687
|
-
throw new Error(`Duplicate vault in batch: ${d.vaultId}`);
|
|
688
|
-
l.add(d.vaultId), c.push({
|
|
689
|
-
vaultId: d.vaultId,
|
|
690
|
-
peginTxHash: d.peginTxHash
|
|
691
|
-
}), u.push({
|
|
692
|
-
depositorBtcPubKey: s,
|
|
693
|
-
btcPopSignature: r,
|
|
694
|
-
unsignedPrePeginTx: i,
|
|
695
|
-
depositorSignedPeginTx: d.depositorSignedPeginTx,
|
|
696
|
-
hashlock: a.hashlock,
|
|
697
|
-
htlcVout: a.htlcVout,
|
|
698
|
-
referralCode: Gt,
|
|
699
|
-
depositorPayoutBtcAddress: d.payoutScript,
|
|
700
|
-
depositorWotsPkHash: a.depositorWotsPkHash
|
|
701
|
-
});
|
|
702
|
-
}
|
|
703
|
-
for (const a of c)
|
|
704
|
-
await this.assertVaultDoesNotExist(a.vaultId, a.peginTxHash);
|
|
705
|
-
const g = await this.readPeginFee(o.vaultProvider), b = await this.resolveMaxAcceptableCommissionBps(
|
|
706
|
-
o.vaultProvider,
|
|
707
|
-
o.quotedCommissionBps
|
|
708
|
-
), f = N({
|
|
709
|
-
abi: h,
|
|
710
|
-
functionName: "submitPeginRequestBatch",
|
|
711
|
-
// `expectedFingerprint` sits BEFORE `requests`, not appended. Reordering
|
|
712
|
-
// these five changes the selector and the call stops existing.
|
|
713
|
-
args: [
|
|
714
|
-
n,
|
|
715
|
-
o.vaultProvider,
|
|
716
|
-
b,
|
|
717
|
-
o.expectedFingerprint,
|
|
718
|
-
u
|
|
719
|
-
]
|
|
720
|
-
});
|
|
721
|
-
return { ethTxHash: await this.sendAndWait(
|
|
722
|
-
f,
|
|
723
|
-
g * BigInt(o.requests.length),
|
|
724
|
-
!0,
|
|
725
|
-
n
|
|
726
|
-
), vaults: c };
|
|
727
|
-
}
|
|
728
|
-
assertQuotedCommissionPresentWhenRequired(e) {
|
|
729
|
-
if (e === void 0 && this.config.requireQuotedCommissionBps)
|
|
730
|
-
throw new Error(
|
|
731
|
-
"quotedCommissionBps is required when the wallet approved deposit terms: the registration ceiling must anchor to the approved quote."
|
|
732
|
-
);
|
|
733
|
-
}
|
|
734
|
-
assertPopMatchesEthAccount(e) {
|
|
735
|
-
return this.assertEthAccount(e.depositorEthAddress);
|
|
736
|
-
}
|
|
737
|
-
assertEthAccount(e) {
|
|
738
|
-
const o = this.config.ethWallet.account;
|
|
739
|
-
if (!o) throw new Error("Ethereum wallet account not found");
|
|
740
|
-
if (!pt(e, o.address))
|
|
741
|
-
throw new Error(
|
|
742
|
-
`Proof of possession was signed for ${e} but the Ethereum wallet is currently connected to ${o.address}. Reconnect the original account or sign a new proof of possession.`
|
|
743
|
-
);
|
|
744
|
-
return o.address;
|
|
745
|
-
}
|
|
746
|
-
normalizeBtcPubkey(e) {
|
|
747
|
-
return `0x${C(
|
|
748
|
-
P(e.depositorBtcPubkey, "Proof of possession BTC pubkey"),
|
|
749
|
-
"Proof of possession BTC pubkey"
|
|
750
|
-
)}`;
|
|
751
|
-
}
|
|
752
|
-
// `expectedFingerprint` is omitted rather than accepted and ignored: nothing
|
|
753
|
-
// here normalizes it, and requiring it would force the batch loop to thread a
|
|
754
|
-
// value through a per-request helper that has no use for it. It is validated
|
|
755
|
-
// once per call, at the top of each public method.
|
|
756
|
-
normalizeRequest(e, o, n) {
|
|
757
|
-
k(e.hashlock, "hashlock"), k(e.depositorWotsPkHash, "depositorWotsPkHash"), Zt(e.htlcVout);
|
|
758
|
-
const i = P(
|
|
759
|
-
e.unsignedPrePeginTx,
|
|
760
|
-
"unsignedPrePeginTx"
|
|
761
|
-
), s = P(
|
|
762
|
-
e.depositorSignedPeginTx,
|
|
763
|
-
"depositorSignedPeginTx"
|
|
764
|
-
), r = mt(s);
|
|
765
|
-
return {
|
|
766
|
-
unsignedPrePeginTx: i,
|
|
767
|
-
depositorSignedPeginTx: s,
|
|
768
|
-
payoutScript: Mt(
|
|
769
|
-
e.depositorPayoutScriptPubKey,
|
|
770
|
-
n,
|
|
771
|
-
e.depositorBtcPubkeyRaw
|
|
772
|
-
),
|
|
773
|
-
peginTxHash: r,
|
|
774
|
-
vaultId: P(Pt(r, o), "vaultId")
|
|
775
|
-
};
|
|
776
|
-
}
|
|
777
|
-
async assertVaultDoesNotExist(e, o) {
|
|
778
|
-
if ((await this.config.publicClient.readContract({
|
|
779
|
-
address: this.config.btcVaultRegistry,
|
|
780
|
-
abi: h,
|
|
781
|
-
functionName: "getBtcVaultBasicInfo",
|
|
782
|
-
args: [e]
|
|
783
|
-
})).depositor !== gt)
|
|
784
|
-
throw new Error(
|
|
785
|
-
`Vault already exists (ID: ${e}, peginTxHash: ${o}). Vault IDs are derived from the pegin transaction hash and depositor address. To create a new vault, use different UTXOs or a different amount to generate a unique transaction.`
|
|
786
|
-
);
|
|
787
|
-
}
|
|
788
|
-
async readPeginFee(e) {
|
|
789
|
-
try {
|
|
790
|
-
return await this.config.publicClient.readContract({
|
|
791
|
-
address: this.config.btcVaultRegistry,
|
|
792
|
-
abi: h,
|
|
793
|
-
functionName: "getPegInFee",
|
|
794
|
-
args: [e]
|
|
795
|
-
});
|
|
796
|
-
} catch (o) {
|
|
797
|
-
throw new Error(
|
|
798
|
-
"Failed to query pegin fee from the contract. Please check your network connection and contract address.",
|
|
799
|
-
{ cause: o }
|
|
800
|
-
);
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
async resolveMaxAcceptableCommissionBps(e, o) {
|
|
804
|
-
let n;
|
|
805
|
-
try {
|
|
806
|
-
n = await new zt(
|
|
807
|
-
this.config.publicClient,
|
|
808
|
-
this.config.btcVaultRegistry
|
|
809
|
-
).getVaultProviderCommission(e);
|
|
810
|
-
} catch (i) {
|
|
811
|
-
throw new Error(
|
|
812
|
-
"Failed to query vault provider commission from the contract. Please check your network connection and contract address.",
|
|
813
|
-
{ cause: i }
|
|
814
|
-
);
|
|
815
|
-
}
|
|
816
|
-
if (o !== void 0) {
|
|
817
|
-
if (n > o + v)
|
|
818
|
-
throw new Error(
|
|
819
|
-
`Vault provider commission changed since quote: quoted ${o} bps, chain currently reports ${n} bps (allowed drift ${v} bps). Please refresh and try again.`
|
|
820
|
-
);
|
|
821
|
-
return M(o);
|
|
822
|
-
}
|
|
823
|
-
return M(n);
|
|
824
|
-
}
|
|
825
|
-
async sendAndWait(e, o, n, i) {
|
|
826
|
-
let s = this.assertEthAccount(i), r;
|
|
827
|
-
try {
|
|
828
|
-
r = await this.config.publicClient.estimateGas({
|
|
829
|
-
to: this.config.btcVaultRegistry,
|
|
830
|
-
data: e,
|
|
831
|
-
value: o,
|
|
832
|
-
account: s
|
|
833
|
-
});
|
|
834
|
-
} catch (l) {
|
|
835
|
-
T(l);
|
|
836
|
-
}
|
|
837
|
-
s = this.assertEthAccount(i);
|
|
838
|
-
let c;
|
|
839
|
-
try {
|
|
840
|
-
c = await this.config.ethWallet.sendTransaction({
|
|
841
|
-
to: this.config.btcVaultRegistry,
|
|
842
|
-
data: e,
|
|
843
|
-
value: o,
|
|
844
|
-
gas: r,
|
|
845
|
-
account: s,
|
|
846
|
-
chain: this.config.ethChain
|
|
847
|
-
});
|
|
848
|
-
} catch (l) {
|
|
849
|
-
T(l);
|
|
850
|
-
}
|
|
851
|
-
const u = await ft({
|
|
852
|
-
publicClient: this.config.publicClient,
|
|
853
|
-
walletAddress: i,
|
|
854
|
-
hash: c,
|
|
855
|
-
timeout: this.config.receiptTimeoutMs ?? Yt
|
|
856
|
-
});
|
|
857
|
-
return u.status === "reverted" && T(
|
|
858
|
-
new Error(
|
|
859
|
-
`${n ? "Batch transaction" : "Transaction"} reverted. Hash: ${u.transactionHash}. Check a block explorer for details.`
|
|
860
|
-
)
|
|
861
|
-
), u.transactionHash;
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
export {
|
|
865
|
-
v as C,
|
|
866
|
-
Et as M,
|
|
867
|
-
it as R,
|
|
868
|
-
he as V,
|
|
869
|
-
ce as a,
|
|
870
|
-
Dt as b,
|
|
871
|
-
zt as c,
|
|
872
|
-
M as d,
|
|
873
|
-
Ut as e,
|
|
874
|
-
ue as i,
|
|
875
|
-
vt as r,
|
|
876
|
-
qt as v
|
|
877
|
-
};
|
|
878
|
-
//# sourceMappingURL=pegin-registration-client-ilkV1mLP.js.map
|