@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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-BueQoMjO.cjs","sources":["../src/tbv/core/clients/eth/contract-address-resolver.ts","../src/tbv/core/clients/eth/operation-key-reader.ts","../src/tbv/core/clients/eth/protocol-params-reader.ts","../src/tbv/core/clients/eth/signer-set-reader.ts","../src/tbv/core/clients/eth/types.ts"],"sourcesContent":["/**\n * Contract Address Resolver\n *\n * Resolves ProtocolParams and ApplicationRegistry contract addresses\n * from the BTCVaultRegistry contract. These addresses are needed to\n * construct the SDK's contract readers.\n *\n * @module clients/eth/contract-address-resolver\n */\n\nimport type { Address, PublicClient } from \"viem\";\n\nimport { BTCVaultRegistryABI } from \"../../contracts/abis/BTCVaultRegistry.abi\";\n\nexport interface ProtocolAddresses {\n /** Address of the ProtocolParams contract */\n protocolParams: Address;\n /** Address of the ApplicationRegistry contract */\n applicationRegistry: Address;\n}\n\n/**\n * Resolve ProtocolParams and ApplicationRegistry addresses from BTCVaultRegistry.\n *\n * Uses a single multicall for atomicity and efficiency.\n *\n * @param publicClient - viem PublicClient instance\n * @param btcVaultRegistryAddress - Address of the BTCVaultRegistry contract\n * @returns Resolved contract addresses\n */\nexport async function resolveProtocolAddresses(\n publicClient: PublicClient,\n btcVaultRegistryAddress: Address,\n): Promise<ProtocolAddresses> {\n const [protocolParams, applicationRegistry] = await publicClient.multicall({\n contracts: [\n {\n address: btcVaultRegistryAddress,\n abi: BTCVaultRegistryABI,\n functionName: \"protocolParams\",\n },\n {\n address: btcVaultRegistryAddress,\n abi: BTCVaultRegistryABI,\n functionName: \"applicationRegistry\",\n },\n ],\n allowFailure: false,\n });\n\n return {\n protocolParams: protocolParams as Address,\n applicationRegistry: applicationRegistry as Address,\n };\n}\n","/**\n * Concrete RFC-006 operation-key reader spanning all three registries.\n *\n * This is an optional utility — callers can use their own implementation of\n * the {@link OperationKeyReader} interface.\n */\n\nimport type { Abi, Address, Hex, PublicClient } from \"viem\";\n\nimport { ApplicationRegistryABI } from \"../../contracts/abis/ApplicationRegistry.abi\";\nimport { BTCVaultRegistryABI } from \"../../contracts/abis/BTCVaultRegistry.abi\";\nimport { ProtocolParamsABI } from \"../../contracts/abis/ProtocolParams.abi\";\nimport type {\n KeyEpochs,\n OperationKeyQuery,\n OperationKeyReader,\n RawOperationKeys,\n RawPayoutScripts,\n} from \"./types\";\n\n/** Addresses of the three registries an operation-key resolution spans. */\nexport interface OperationKeyContracts {\n btcVaultRegistry: Address;\n applicationRegistry: Address;\n protocolParams: Address;\n}\n\n/** One `multicall` entry. Loosely typed because the three ABIs differ. */\ntype Call = {\n address: Address;\n abi: Abi;\n functionName: string;\n args: readonly unknown[];\n};\n\n/**\n * Reject a multicall result that is not one-per-call.\n *\n * Every method here relies on positional alignment between calls and results,\n * so a short array does not fail — it silently hands back `undefined` for the\n * tail entries. Downstream that surfaces as a complaint about whichever\n * operator happens to occupy the missing slot, blaming a participant that is\n * perfectly fine for a read that came back incomplete. Assert the length where\n * the array arrives so the error names the real fault.\n */\nfunction assertMulticallLength(\n actual: number,\n expected: number,\n label: string,\n): void {\n if (actual !== expected) {\n throw new Error(\n `${label}: multicall returned ${actual} results for ${expected} calls, ` +\n `so the results are not roster-aligned; refusing to use them`,\n );\n }\n}\n\n/**\n * Split a flat multicall result into VP / keepers / challengers.\n *\n * Every method below builds its calls in the same order — vault provider\n * first, then keepers in roster order, then challengers in roster order — so\n * the results stay index-aligned with `query.vaultKeepers` /\n * `query.universalChallengers`. That alignment is what lets the resolver pair\n * a resolved key back to its admin address; the sorted key arrays it exposes\n * are derived from those pairs, never the other way round.\n */\nfunction partition<T>(\n results: readonly T[],\n keeperCount: number,\n): { vaultProvider: T; vaultKeepers: T[]; universalChallengers: T[] } {\n return {\n vaultProvider: results[0],\n vaultKeepers: results.slice(1, 1 + keeperCount),\n universalChallengers: results.slice(1 + keeperCount),\n };\n}\n\n/**\n * Reads RFC-006 operation keys and payout scripts.\n *\n * Usage:\n * ```ts\n * const reader = new ViemOperationKeyReader(publicClient, contracts);\n * const keys = await reader.getCurrentOperationKeys(query);\n * ```\n */\nexport class ViemOperationKeyReader implements OperationKeyReader {\n constructor(\n private publicClient: PublicClient,\n private contracts: OperationKeyContracts,\n ) {}\n\n /**\n * One multicall, `allowFailure: false`, so every key in the set is read at\n * the same block. A rotation landing between two separate `eth_call`s would\n * otherwise produce a mixed-epoch key set and a lock no counterparty agrees\n * with.\n */\n private async readAll<T>(\n calls: Call[],\n keeperCount: number,\n challengerCount: number,\n label: string,\n blockNumber?: bigint,\n ) {\n const results = (await this.publicClient.multicall({\n contracts: calls,\n allowFailure: false,\n blockNumber,\n })) as readonly T[];\n\n assertMulticallLength(\n results.length,\n 1 + keeperCount + challengerCount,\n label,\n );\n\n return partition(results, keeperCount);\n }\n\n async getCurrentOperationKeys(\n query: OperationKeyQuery,\n blockNumber?: bigint,\n ): Promise<RawOperationKeys> {\n const calls: Call[] = [\n {\n address: this.contracts.btcVaultRegistry,\n abi: BTCVaultRegistryABI as Abi,\n functionName: \"getCurrentOperationBtcKey\",\n args: [query.vaultProviderEthAddress],\n },\n ...query.vaultKeepers.map((keeper) => ({\n address: this.contracts.applicationRegistry,\n abi: ApplicationRegistryABI as Abi,\n functionName: \"getCurrentOperationBtcKey\",\n args: [query.applicationEntryPoint, keeper.ethAddress],\n })),\n ...query.universalChallengers.map((challenger) => ({\n address: this.contracts.protocolParams,\n abi: ProtocolParamsABI as Abi,\n functionName: \"getCurrentOperationBtcKey\",\n args: [challenger.ethAddress],\n })),\n ];\n\n return this.readAll<Hex>(\n calls,\n query.vaultKeepers.length,\n query.universalChallengers.length,\n \"getCurrentOperationKeys\",\n blockNumber,\n );\n }\n\n async getOperationKeysAtEpochs(\n query: OperationKeyQuery,\n epochs: KeyEpochs,\n ): Promise<RawOperationKeys> {\n const calls: Call[] = [\n // The VP takes the plain `AtEpoch` variant: it has no membership\n // version, so its genesis (the registration key at version 0) is\n // unambiguous and the contract resolves it internally.\n {\n address: this.contracts.btcVaultRegistry,\n abi: BTCVaultRegistryABI as Abi,\n functionName: \"getOperationBtcKeyAtEpoch\",\n args: [query.vaultProviderEthAddress, epochs.vpKeyEpoch],\n },\n // Keepers and challengers take `...OrGenesis` with their roster key\n // passed explicitly, because the correct genesis for them is their key\n // in *this vault's frozen membership version*. An operator dropped from\n // the current roster, or listed under a different key in an older\n // version, would otherwise resolve against the wrong genesis.\n ...query.vaultKeepers.map((keeper) => ({\n address: this.contracts.applicationRegistry,\n abi: ApplicationRegistryABI as Abi,\n functionName: \"getOperationBtcKeyAtEpochOrGenesis\",\n args: [\n query.applicationEntryPoint,\n keeper.ethAddress,\n epochs.appKeeperKeyEpoch,\n keeper.btcPubKey,\n ],\n })),\n ...query.universalChallengers.map((challenger) => ({\n address: this.contracts.protocolParams,\n abi: ProtocolParamsABI as Abi,\n functionName: \"getOperationBtcKeyAtEpochOrGenesis\",\n args: [challenger.ethAddress, epochs.ucKeyEpoch, challenger.btcPubKey],\n })),\n ];\n\n return this.readAll<Hex>(\n calls,\n query.vaultKeepers.length,\n query.universalChallengers.length,\n \"getOperationKeysAtEpochs\",\n );\n }\n\n async getPayoutScriptsAtEpochs(\n query: OperationKeyQuery,\n epochs: KeyEpochs,\n ): Promise<RawPayoutScripts> {\n // Universal challengers are never claimers, so they have no payout script\n // and no call here.\n const results = (await this.publicClient.multicall({\n contracts: [\n {\n address: this.contracts.btcVaultRegistry,\n abi: BTCVaultRegistryABI as Abi,\n functionName: \"getPayoutScriptAtEpoch\",\n args: [query.vaultProviderEthAddress, epochs.vpKeyEpoch],\n },\n ...query.vaultKeepers.map((keeper) => ({\n address: this.contracts.applicationRegistry,\n abi: ApplicationRegistryABI as Abi,\n functionName: \"getPayoutScriptAtEpoch\",\n args: [\n query.applicationEntryPoint,\n keeper.ethAddress,\n epochs.appKeeperKeyEpoch,\n ],\n })),\n ],\n allowFailure: false,\n })) as readonly Hex[];\n\n // Expected length is `1 + keepers`, with no challenger term — see the\n // comment above on why universal challengers have no call here.\n assertMulticallLength(\n results.length,\n 1 + query.vaultKeepers.length,\n \"getPayoutScriptsAtEpochs\",\n );\n\n return {\n vaultProvider: results[0],\n vaultKeepers: [...results.slice(1)],\n };\n }\n}\n","/**\n * Concrete ProtocolParams reader using viem's readContract and multicall.\n *\n * This is an optional utility — callers can use their own implementation\n * of the ProtocolParamsReader interface.\n */\n\nimport type { Abi, Address, Hex, PublicClient } from \"viem\";\n\nimport { ProtocolParamsABI } from \"../../contracts/abis/ProtocolParams.abi\";\nimport {\n assertValidOffchainParamsVersion,\n validateOffchainParams,\n validatePegInConfiguration,\n validateTBVProtocolParams,\n} from \"./protocol-params-validation\";\nimport type {\n AllOffchainParamsData,\n OnSkippedOffchainParamsVersion,\n PegInConfiguration,\n ProtocolParamsReader,\n TBVProtocolParams,\n VersionedOffchainParams,\n} from \"./types\";\n\n/**\n * Maximum value for a Solidity uint16.\n * PeginLogic.sol casts timelockAssert to uint16, so values above this are invalid.\n */\nconst UINT16_MAX = 65535;\n\n\n/**\n * Raw shape viem returns for VersionedOffchainParams struct.\n * viem resolves ABI struct outputs to named objects (not tuples).\n */\ninterface RawOffchainParams {\n timelockAssert: bigint;\n timelockChallengeAssert: bigint;\n securityCouncilKeys: readonly Hex[];\n councilQuorum: number;\n feeRate: bigint;\n babeTotalInstances: number;\n babeInstancesToFinalize: number;\n minVpCommissionBps: number;\n tRefund: number;\n tStale: number;\n minPeginFeeRate: bigint;\n proverCircuitVersion: number;\n minPrepeginDepth: number;\n}\n\n/** Raw shape viem returns for TBVProtocolParams struct. */\ninterface RawTBVParams {\n minimumPegInAmount: bigint;\n maxPegInAmount: bigint;\n pegInAckTimeout: bigint;\n pegInActivationTimeout: bigint;\n maxHtlcOutputCount: number;\n expiredPegInGraceBlocks: bigint;\n}\n\n/** Map viem struct result to VersionedOffchainParams. */\nfunction mapOffchainParams(result: RawOffchainParams): VersionedOffchainParams {\n return {\n timelockAssert: result.timelockAssert,\n timelockChallengeAssert: result.timelockChallengeAssert,\n securityCouncilKeys: [...result.securityCouncilKeys],\n councilQuorum: result.councilQuorum,\n feeRate: result.feeRate,\n babeTotalInstances: result.babeTotalInstances,\n babeInstancesToFinalize: result.babeInstancesToFinalize,\n minVpCommissionBps: result.minVpCommissionBps,\n tRefund: result.tRefund,\n tStale: result.tStale,\n minPeginFeeRate: result.minPeginFeeRate,\n proverCircuitVersion: result.proverCircuitVersion,\n minPrepeginDepth: result.minPrepeginDepth,\n };\n}\n\n/** Map viem struct result to TBVProtocolParams. */\nfunction mapTBVParams(result: RawTBVParams): TBVProtocolParams {\n return {\n minimumPegInAmount: result.minimumPegInAmount,\n maxPegInAmount: result.maxPegInAmount,\n pegInAckTimeout: result.pegInAckTimeout,\n pegInActivationTimeout: result.pegInActivationTimeout,\n maxHtlcOutputCount: result.maxHtlcOutputCount,\n expiredPegInGraceBlocks: result.expiredPegInGraceBlocks,\n };\n}\n\n/**\n * Derive timelockPegin from timelockAssert.\n *\n * Matches PeginLogic.sol: `uint16(timelockAssert)`.\n * The contract validates `timelockAssert <= type(uint16).max` on write,\n * but we enforce the same bound here to reject invalid values early\n * rather than silently truncating.\n *\n * @throws if timelockAssert exceeds uint16 max (65535)\n */\nfunction deriveTimelockPegin(timelockAssert: bigint): number {\n if (timelockAssert > BigInt(UINT16_MAX)) {\n throw new Error(\n `timelockAssert value ${timelockAssert} exceeds uint16 max (${UINT16_MAX})`,\n );\n }\n return Number(timelockAssert);\n}\n\n/**\n * Concrete protocol params reader using viem.\n *\n * Every read method runs the matching validator from\n * `protocol-params-validation` before returning, so callers don't have to\n * remember to validate.\n *\n * Usage:\n * ```ts\n * const reader = new ViemProtocolParamsReader(publicClient, protocolParamsAddress);\n * const config = await reader.getPegInConfiguration();\n * ```\n */\nexport class ViemProtocolParamsReader implements ProtocolParamsReader {\n constructor(\n private publicClient: PublicClient,\n private contractAddress: Address,\n ) {}\n\n async getTBVProtocolParams(): Promise<TBVProtocolParams> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"getTBVProtocolParams\",\n })) as RawTBVParams;\n\n const params = mapTBVParams(result);\n validateTBVProtocolParams(params);\n return params;\n }\n\n async getLatestOffchainParams(): Promise<VersionedOffchainParams> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"getLatestOffchainParams\",\n })) as RawOffchainParams;\n\n const params = mapOffchainParams(result);\n validateOffchainParams(params);\n return params;\n }\n\n async getOffchainParamsByVersion(\n version: number,\n ): Promise<VersionedOffchainParams> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"getOffchainParamsByVersion\",\n args: [version],\n })) as RawOffchainParams;\n\n const params = mapOffchainParams(result);\n validateOffchainParams(params);\n return params;\n }\n\n async getLatestOffchainParamsVersion(): Promise<number> {\n const raw = await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"latestOffchainParamsVersion\",\n });\n const version = Number(raw);\n assertValidOffchainParamsVersion(version);\n return version;\n }\n\n async getTimelockPeginByVersion(version: number): Promise<number> {\n const params = await this.getOffchainParamsByVersion(version);\n return deriveTimelockPegin(params.timelockAssert);\n }\n\n /**\n * Returned as `bigint` with no `Number` narrowing: the registry compares it\n * against `block.number`, so callers must do the same arithmetic the\n * contract does. `0` is the documented \"disabled\" case and is returned as\n * `0n`. A missing getter or a non-bigint payload throws — never coerced to\n * `0`, which would fail open and skip the observation window.\n *\n * @throws If the deployment does not expose `peginActivationDelay()`, or\n * the decoded payload is not a `bigint`.\n */\n async getPeginActivationDelay(): Promise<bigint> {\n const raw: unknown = await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"peginActivationDelay\",\n });\n if (typeof raw !== \"bigint\") {\n throw new Error(\n `Invalid peginActivationDelay from contract: must be a bigint, got ${typeof raw}`,\n );\n }\n return raw;\n }\n\n /**\n * Read TBV protocol params, latest offchain params, and the latest version\n * label atomically via multicall. The version is paired with the params so\n * that a governance update between separate reads cannot let JS build BTC\n * scripts with version N params while the contract registers the vault\n * under version N+1.\n *\n * That guarantee holds only within this multicall. A caller that also reads\n * participant keys — every fresh peg-in build does — must pass the same\n * `blockNumber` here and to those reads, or the two describe different\n * blocks and the pairing above buys nothing across the seam.\n */\n async getPegInConfiguration(\n blockNumber?: bigint,\n ): Promise<PegInConfiguration> {\n const results = await this.publicClient.multicall({\n blockNumber,\n contracts: [\n {\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"getTBVProtocolParams\",\n },\n {\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"getLatestOffchainParams\",\n },\n {\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"latestOffchainParamsVersion\",\n },\n {\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"activeVaultCoreVersion\",\n },\n ],\n allowFailure: false,\n });\n\n const tbvParams = mapTBVParams(results[0] as RawTBVParams);\n const offchainParams = mapOffchainParams(results[1] as RawOffchainParams);\n const offchainParamsVersion = Number(results[2]);\n const activeVaultCoreVersion = Number(results[3]);\n\n const config: PegInConfiguration = {\n minimumPegInAmount: tbvParams.minimumPegInAmount,\n maxPegInAmount: tbvParams.maxPegInAmount,\n pegInAckTimeout: tbvParams.pegInAckTimeout,\n pegInActivationTimeout: tbvParams.pegInActivationTimeout,\n maxHtlcOutputCount: tbvParams.maxHtlcOutputCount,\n expiredPegInGraceBlocks: tbvParams.expiredPegInGraceBlocks,\n timelockPegin: deriveTimelockPegin(offchainParams.timelockAssert),\n timelockRefund: offchainParams.tRefund,\n minVpCommissionBps: offchainParams.minVpCommissionBps,\n offchainParams,\n offchainParamsVersion,\n activeVaultCoreVersion,\n };\n\n validatePegInConfiguration(config);\n return config;\n }\n\n /**\n * Fetch every historical offchain params version in a single multicall.\n * Iterates 1..latestVersion and calls `getOffchainParamsByVersion` for each.\n * Versions whose payload fails validation are skipped (not included in the\n * returned map) so a single bad historical version doesn't block the\n * lookup of the rest.\n *\n * @param onSkippedVersion - optional observer invoked once per skipped\n * version. Use to log/telemeter without coupling the SDK to a logger.\n */\n async fetchAllOffchainParams(\n onSkippedVersion?: OnSkippedOffchainParamsVersion,\n ): Promise<AllOffchainParamsData> {\n const latestVersion = await this.getLatestOffchainParamsVersion();\n if (latestVersion === 0) {\n return { byVersion: new Map(), latestVersion: 0 };\n }\n\n const versions = Array.from({ length: latestVersion }, (_, i) => i + 1);\n const contracts = versions.map((v) => ({\n address: this.contractAddress,\n abi: ProtocolParamsABI as Abi,\n functionName: \"getOffchainParamsByVersion\" as const,\n args: [v] as const,\n }));\n\n const results = await this.publicClient.multicall({\n contracts,\n allowFailure: false,\n });\n\n const byVersion = new Map<number, VersionedOffchainParams>();\n for (let i = 0; i < versions.length; i++) {\n const params = mapOffchainParams(results[i] as RawOffchainParams);\n try {\n validateOffchainParams(params);\n byVersion.set(versions[i], params);\n } catch (error) {\n // A malformed historical version mustn't block lookup of the rest.\n // Surface the skip to the caller's observer if one was supplied.\n onSkippedVersion?.(\n versions[i],\n error instanceof Error ? error : new Error(String(error)),\n );\n }\n }\n\n return { byVersion, latestVersion };\n }\n}\n","/**\n * Concrete signer-set readers for vault keepers and universal challengers.\n *\n * These are optional utilities — callers can use their own implementations\n * of the VaultKeeperReader and UniversalChallengerReader interfaces.\n */\n\nimport type { Address, Hex, PublicClient } from \"viem\";\n\nimport { ApplicationRegistryABI } from \"../../contracts/abis/ApplicationRegistry.abi\";\nimport { ProtocolParamsABI } from \"../../contracts/abis/ProtocolParams.abi\";\nimport type {\n AddressBTCKeyPair,\n UniversalChallengerReader,\n VaultKeeperReader,\n} from \"./types\";\n\n/** Map viem tuple array to AddressBTCKeyPair[]. */\nfunction mapKeyPairs(\n result: readonly { ethAddress: Address; btcPubKey: Hex }[],\n): AddressBTCKeyPair[] {\n return result.map((pair) => ({\n ethAddress: pair.ethAddress,\n btcPubKey: pair.btcPubKey,\n }));\n}\n\n/**\n * Both key-epoch getters return `uint64` and feed the peg-in config\n * fingerprint, where the contract encodes them as `uint64`. A `Number`\n * narrowing would silently truncate above 2^53 and produce a fingerprint the\n * registry cannot reproduce, so the payload is asserted to be a `bigint` and\n * carried as one — never coerced, never defaulted.\n */\nfunction assertKeyEpoch(raw: unknown, label: string): bigint {\n if (typeof raw !== \"bigint\") {\n throw new Error(\n `Invalid ${label} from contract: must be a bigint, got ${typeof raw}`,\n );\n }\n return raw;\n}\n\n/**\n * Reads vault keepers from the ApplicationRegistry contract.\n *\n * Usage:\n * ```ts\n * const reader = new ViemVaultKeeperReader(publicClient, applicationRegistryAddress);\n * const keepers = await reader.getCurrentVaultKeepers(appEntryPoint);\n * ```\n */\nexport class ViemVaultKeeperReader implements VaultKeeperReader {\n constructor(\n private publicClient: PublicClient,\n private contractAddress: Address,\n ) {}\n\n async getVaultKeepersByVersion(\n appEntryPoint: Address,\n version: number,\n blockNumber?: bigint,\n ): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"getVaultKeepersByVersion\",\n args: [appEntryPoint, version],\n blockNumber,\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getCurrentVaultKeepers(\n appEntryPoint: Address,\n ): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"getCurrentVaultKeepers\",\n args: [appEntryPoint],\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getCurrentVaultKeepersVersion(\n appEntryPoint: Address,\n blockNumber?: bigint,\n ): Promise<number> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"getCurrentVaultKeepersVersion\",\n args: [appEntryPoint],\n blockNumber,\n })) as number;\n\n return result;\n }\n\n async getCurrentAppKeeperKeyEpoch(\n appEntryPoint: Address,\n blockNumber?: bigint,\n ): Promise<bigint> {\n const raw: unknown = await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"appKeeperKeyEpochCurrent\",\n args: [appEntryPoint],\n blockNumber,\n });\n\n return assertKeyEpoch(raw, \"appKeeperKeyEpochCurrent\");\n }\n}\n\n/**\n * Reads universal challengers from the ProtocolParams contract.\n *\n * Usage:\n * ```ts\n * const reader = new ViemUniversalChallengerReader(publicClient, protocolParamsAddress);\n * const challengers = await reader.getCurrentUniversalChallengers();\n * ```\n */\nexport class ViemUniversalChallengerReader implements UniversalChallengerReader {\n constructor(\n private publicClient: PublicClient,\n private contractAddress: Address,\n ) {}\n\n async getUniversalChallengersByVersion(\n version: number,\n blockNumber?: bigint,\n ): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"getUniversalChallengersByVersion\",\n args: [version],\n blockNumber,\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getCurrentUniversalChallengers(): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"getCurrentUniversalChallengers\",\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getLatestUniversalChallengersVersion(\n blockNumber?: bigint,\n ): Promise<number> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"latestUniversalChallengersVersion\",\n blockNumber,\n })) as number;\n\n return result;\n }\n\n async getCurrentUcKeyEpoch(blockNumber?: bigint): Promise<bigint> {\n const raw: unknown = await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"ucKeyEpochCurrent\",\n blockNumber,\n });\n\n return assertKeyEpoch(raw, \"ucKeyEpochCurrent\");\n }\n}\n","/**\n * Types and interfaces for ETH contract readers.\n *\n * These are optional utilities — callers can use them or build their own.\n * Core service functions never import from this module.\n */\n\nimport type { Address, Hex } from \"viem\";\n\n// ============================================================================\n// Vault Registry Types\n// ============================================================================\n\ndeclare const onChainBtcPubkeyBrand: unique symbol;\n\n/**\n * 64-char lowercase hex (no `0x`) x-only BTC pubkey sourced from an on-chain\n * registry. Minted only by `assertOnChainBtcPubkey`, which is the shared\n * validator behind both producers:\n * {@link VaultRegistryReader.getVaultProviderGenesisBtcPubKey} (the fixed\n * registration key) and {@link OperationKeyReader} (RFC-006 operation keys,\n * resolved current or at a vault's frozen epoch).\n *\n * @stability frozen\n */\nexport type OnChainBtcPubkey = string & {\n readonly [onChainBtcPubkeyBrand]: true;\n};\n\n/**\n * Mirrors `IBTCVaultRegistry.BTCVaultStatus` in BTCVaultRegistry.sol exactly.\n * Use this when consuming `status` from `getVaultBasicInfo` /\n * `getBtcVaultBasicInfo`.\n *\n * Do NOT confuse with the app-side `ContractStatus` enum\n * (`services/deposit/peginState.ts`) — that one is for the indexer and\n * extends this with values 5-7, reassigning 4 to LIQUIDATED. Reading an\n * on-chain status through `ContractStatus[n]` for labels will mislabel\n * Expired(4) as LIQUIDATED.\n */\nexport enum OnChainBtcVaultStatus {\n PENDING = 0,\n VERIFIED = 1,\n ACTIVE = 2,\n REDEEMED = 3,\n EXPIRED = 4,\n}\n\n/** Basic vault info from BTCVaultRegistry.getBtcVaultBasicInfo */\nexport interface VaultBasicInfo {\n depositor: Address;\n depositorBtcPubKey: Hex;\n amount: bigint;\n vaultProvider: Address;\n status: number;\n applicationEntryPoint: Address;\n createdAt: bigint;\n}\n\n/** Protocol info from BTCVaultRegistry.getBtcVaultProtocolInfo */\nexport interface VaultProtocolInfo {\n depositorSignedPeginTx: Hex;\n universalChallengersVersion: number;\n appVaultKeepersVersion: number;\n offchainParamsVersion: number;\n /**\n * ETH block number stamped at the Pending→Verified transition.\n * Compared against `block.number` (inclusive:\n * `block.number >= verifiedAt + peginActivationDelay`), never a unix timestamp.\n */\n verifiedAt: bigint;\n depositorWotsPkHash: Hex;\n hashlock: Hex;\n htlcVout: number;\n depositorPopSignature: Hex;\n prePeginTxHash: Hex;\n vaultProviderCommissionBps: number;\n /** Vault core version (uint16) stamped at registration. VP-side gating only — see #1690. */\n vaultCoreVersion: number;\n}\n\n/** Combined vault data (basic + protocol) */\nexport interface VaultData {\n basic: VaultBasicInfo;\n protocol: VaultProtocolInfo;\n}\n\n/**\n * RFC-006 operation-key epochs a vault froze at `submitPeginRequest`.\n *\n * Each registry keeps a monotonic epoch counter that every key/payout setter\n * pre-increments. A vault stamps the counters live at its creation, and every\n * participant resolves \"which key did this vault bond?\" by asking the registry\n * for the key whose appended version is the latest stamped `<=` this epoch. A\n * rotation after the vault was created therefore never moves its keys.\n *\n * `uint64` — kept as `bigint` end-to-end and passed straight back to the\n * `...AtEpoch` getters, never narrowed through `Number`.\n *\n * Only ever read through {@link VaultRegistryReader.getVaultKeyEpochs}, which\n * uses the extended ABI. See `BTCVaultRegistryKeyEpochs.abi.ts` for why that\n * read is quarantined to its own ABI.\n */\nexport interface KeyEpochs {\n vpKeyEpoch: bigint;\n appKeeperKeyEpoch: bigint;\n ucKeyEpoch: bigint;\n}\n\n/** Interface for reading vault data from the BTCVaultRegistry contract. */\nexport interface VaultRegistryReader {\n getVaultBasicInfo(vaultId: Hex): Promise<VaultBasicInfo>;\n getVaultProtocolInfo(vaultId: Hex): Promise<VaultProtocolInfo>;\n getProtocolInfoBatch(vaultIds: readonly Hex[]): Promise<VaultProtocolInfo[]>;\n getVaultData(vaultId: Hex): Promise<VaultData>;\n /**\n * Read a vault provider's *genesis* (registration) BTC key — the key bonded\n * at version 0, which never moves when the operator rotates.\n *\n * Used only as the genesis fallback for epoch-based resolution and as a\n * candidate when cross-checking an indexer hint. Never the key to build a\n * Bitcoin lock with; that comes from `OperationKeyReader`.\n *\n * Resolves via `getOperationBtcKeyAtEpoch` at epoch 0, so it requires an\n * RFC-006 registry — as does every caller.\n */\n getVaultProviderGenesisBtcPubKey(\n vpAddress: Address,\n blockNumber?: bigint,\n ): Promise<OnChainBtcPubkey>;\n /**\n * Read the vault provider operation key selected by an RFC-006 epoch.\n * Existing-vault consumers pass the vault's frozen `vpKeyEpoch` here so a\n * later rotation cannot move the result.\n */\n getVaultProviderOperationBtcKeyAtEpoch(\n vpAddress: Address,\n epoch: bigint,\n blockNumber?: bigint,\n ): Promise<OnChainBtcPubkey>;\n /** Read the protocol pegin fee (in wei) for a given vault provider. */\n getPegInFee(vaultProvider: Address): Promise<bigint>;\n /**\n * Read a vault provider's current commission in basis points.\n *\n * Validates the contract-enforced `[0, 9999]` range — an out-of-range\n * value signals a wrong contract address or ABI drift, not a real rate.\n */\n getVaultProviderCommission(vaultProvider: Address): Promise<number>;\n /**\n * Read a vault's frozen RFC-006 key epochs.\n *\n * Uses the extended `getBtcVaultProtocolInfo` ABI. Against a registry whose\n * `BTCVaultProtocolInfo` struct is not extended this returns silent garbage\n * for a populated vault rather than throwing, so it must only be called\n * against an RFC-006 registry — a deployment invariant, not something this\n * call can detect. A registry missing the operation-key getters altogether is\n * the safer case: key resolution reverts downstream and these epochs are never\n * used. See `BTCVaultRegistryKeyEpochs.abi.ts`.\n */\n getVaultKeyEpochs(vaultId: Hex): Promise<KeyEpochs>;\n /** {@link getVaultKeyEpochs} for many vaults in one multicall. */\n getVaultKeyEpochsBatch(vaultIds: readonly Hex[]): Promise<KeyEpochs[]>;\n /**\n * Read a vault provider's *current* RFC-006 operation BTC key — the key its\n * server uses for the JSON-RPC token subject. Falls back to the registration\n * key when the provider has never rotated.\n */\n getCurrentVaultProviderOperationBtcKey(\n vpAddress: Address,\n ): Promise<OnChainBtcPubkey>;\n /**\n * Read the depositor's commission ceiling (`maxAcceptableCommissionBps`)\n * for vaults registered in the same block `createdAt`, from their\n * `PegInSubmittedV2` logs, in `vaultIds` order. The contract discards the\n * ceiling after bound-checking it, so the log is its only on-chain source.\n *\n * @throws {RegistrationLogsUnavailableError} (transient, retry) when the\n * node answers with no registration logs for the block at all.\n * @throws when a vault has only its `PegInSubmitted` log (a registration\n * that predates the V2 event), none, or more than one V2 log.\n */\n getMaxAcceptableCommissionBpsBatch(\n vaultIds: readonly Hex[],\n createdAt: bigint,\n ): Promise<number[]>;\n /**\n * Read the application entry point a vault provider is registered for.\n *\n * The peg-in submit path resolves this internally and uses it to pick the\n * keeper roster, the roster version and the keeper key epoch a deposit is\n * bonded to. Pass `blockNumber` when the result will shape a Bitcoin lock,\n * so it describes the same block as the roster reads that follow it.\n */\n getVaultProviderApplication(\n vpAddress: Address,\n blockNumber?: bigint,\n ): Promise<Address>;\n}\n\n// ============================================================================\n// Protocol Params Types (from IProtocolParams.sol)\n// ============================================================================\n\n/**\n * TBV protocol parameters from the ProtocolParams contract.\n * Matches Solidity struct `IProtocolParams.TBVProtocolParams` exactly.\n *\n * All uint64 amounts use bigint (satoshi values can exceed 2^53).\n * uint8 uses number (bounded, max 255).\n */\nexport interface TBVProtocolParams {\n minimumPegInAmount: bigint;\n maxPegInAmount: bigint;\n pegInAckTimeout: bigint;\n pegInActivationTimeout: bigint;\n maxHtlcOutputCount: number;\n /**\n * Number of blocks added to the activation deadline as a grace window\n * during which a depositor may still reclaim an expired pegin via the\n * HTLC preimage. Source: `IProtocolParams.TBVProtocolParams.expiredPegInGraceBlocks`.\n */\n expiredPegInGraceBlocks: bigint;\n}\n\n/**\n * Versioned offchain parameters from the ProtocolParams contract.\n * Matches Solidity struct `IProtocolParams.VersionedOffchainParams` exactly.\n *\n * bigint for: uint256 timelocks, uint64 fee rates/amounts.\n * number for: uint8/uint16/uint32 fields (bounded, safe for JS arithmetic).\n */\nexport interface VersionedOffchainParams {\n timelockAssert: bigint;\n timelockChallengeAssert: bigint;\n securityCouncilKeys: Hex[];\n councilQuorum: number;\n feeRate: bigint;\n babeTotalInstances: number;\n babeInstancesToFinalize: number;\n minVpCommissionBps: number;\n tRefund: number;\n tStale: number;\n minPeginFeeRate: bigint;\n proverCircuitVersion: number;\n minPrepeginDepth: number;\n}\n\n/**\n * Combined peg-in configuration read atomically via multicall.\n * Prevents TOCTOU inconsistency if governance updates params between reads.\n */\nexport interface PegInConfiguration {\n minimumPegInAmount: bigint;\n maxPegInAmount: bigint;\n pegInAckTimeout: bigint;\n pegInActivationTimeout: bigint;\n maxHtlcOutputCount: number;\n expiredPegInGraceBlocks: bigint;\n timelockPegin: number;\n timelockRefund: number;\n minVpCommissionBps: number;\n offchainParams: VersionedOffchainParams;\n /**\n * Version label paired atomically with `offchainParams`.\n * Read in the same multicall as the params struct so that, if a parameter\n * update lands between separate reads, the script-construction code and\n * the version label stay consistent.\n */\n offchainParamsVersion: number;\n /**\n * Currently-active vault core (tx-graph) version\n * (`ProtocolParams.activeVaultCoreVersion()`, uint16 ≥ 1). Stamped onto\n * every new vault at peg-in submission; fresh deposits must build this\n * graph version. Read in the same multicall so a governance version bump\n * can't land between reading the params and reading the version.\n */\n activeVaultCoreVersion: number;\n}\n\n/**\n * All offchain params snapshots indexed by version, plus the latest version\n * number known when the snapshot was taken. Used by consumers that need to\n * resolve any historical version (e.g. signing for an existing vault locked\n * to an older version).\n */\nexport interface AllOffchainParamsData {\n byVersion: Map<number, VersionedOffchainParams>;\n latestVersion: number;\n}\n\n/**\n * Optional observer invoked by `fetchAllOffchainParams` when a historical\n * version fails validation. Called once per skipped version so callers can\n * log/telemeter without coupling the SDK to a specific logger.\n */\nexport type OnSkippedOffchainParamsVersion = (\n version: number,\n error: Error,\n) => void;\n\n/** Interface for reading protocol parameters from the ProtocolParams contract. */\nexport interface ProtocolParamsReader {\n getTBVProtocolParams(): Promise<TBVProtocolParams>;\n getOffchainParamsByVersion(version: number): Promise<VersionedOffchainParams>;\n getLatestOffchainParams(): Promise<VersionedOffchainParams>;\n getLatestOffchainParamsVersion(): Promise<number>;\n getTimelockPeginByVersion(version: number): Promise<number>;\n /**\n * Pass `blockNumber` when the result will shape a Bitcoin lock, so this\n * multicall and the participant-key reads describe the same block. Omit it\n * for display-only reads, where a slightly stale value is harmless.\n */\n getPegInConfiguration(blockNumber?: bigint): Promise<PegInConfiguration>;\n /**\n * Observation window enforced between a vault's final ACK and its\n * activation, in ETH blocks measured from `verifiedAt`. `0` disables it.\n *\n * Deliberately its own read rather than a field on\n * {@link PegInConfiguration}: the parameter is absent from deployments that\n * predate it, so folding it into the shared multicall would make every\n * protocol-param read fail wherever it is missing.\n *\n * @throws If the deployment does not expose `peginActivationDelay()`, or\n * the decoded payload is not a `bigint`.\n */\n getPeginActivationDelay(): Promise<bigint>;\n fetchAllOffchainParams(\n onSkippedVersion?: OnSkippedOffchainParamsVersion,\n ): Promise<AllOffchainParamsData>;\n}\n\n// ============================================================================\n// Signer-Set Types (from BTCVaultTypes.sol)\n// ============================================================================\n\n/**\n * Matches Solidity struct `BTCVaultTypes.AddressBTCKeyPair` exactly.\n * Used for vault keepers and universal challengers.\n */\nexport interface AddressBTCKeyPair {\n ethAddress: Address;\n btcPubKey: Hex;\n}\n\n/**\n * Interface for reading vault keepers from the ApplicationRegistry contract.\n *\n * The reads used to build a peg-in — here and on the sibling reader interfaces\n * — take an optional `blockNumber` that pins them to one block instead of\n * `latest`. Omitting it, the historical behaviour, is correct for every read\n * that resolves against a vault's already-frozen epochs, because those are\n * immutable once stamped. It is NOT correct for a fresh peg-in build: the\n * participant keys, roster versions and protocol params that shape the Bitcoin\n * lock must all describe the same block, or the lock commits to a mixture of\n * chain states that never existed at once. See\n * `services/deposit/validateOnChainParticipantKeys`.\n *\n * The `getCurrent*` roster reads are the exception and take no block. Nothing\n * on the build path uses them — it resolves rosters by version instead — so\n * they were left alone rather than given a pin no caller would pass.\n */\nexport interface VaultKeeperReader {\n getVaultKeepersByVersion(\n appEntryPoint: Address,\n version: number,\n blockNumber?: bigint,\n ): Promise<AddressBTCKeyPair[]>;\n getCurrentVaultKeepers(appEntryPoint: Address): Promise<AddressBTCKeyPair[]>;\n getCurrentVaultKeepersVersion(\n appEntryPoint: Address,\n blockNumber?: bigint,\n ): Promise<number>;\n /**\n * Read the application's current vault-keeper operation-key epoch.\n *\n * One counter for the whole application, bumped by any keeper's\n * operation-key or payout-script append. The peg-in config fingerprint\n * commits to it in place of the N resolved keeper keys, so it must be read\n * at the same block as the roster it labels. Returned as `bigint`; the\n * contract encodes it as `uint64` and a `Number` would truncate.\n */\n getCurrentAppKeeperKeyEpoch(\n appEntryPoint: Address,\n blockNumber?: bigint,\n ): Promise<bigint>;\n}\n\n/** Interface for reading universal challengers from the ProtocolParams contract. */\nexport interface UniversalChallengerReader {\n getUniversalChallengersByVersion(\n version: number,\n blockNumber?: bigint,\n ): Promise<AddressBTCKeyPair[]>;\n getCurrentUniversalChallengers(): Promise<AddressBTCKeyPair[]>;\n getLatestUniversalChallengersVersion(blockNumber?: bigint): Promise<number>;\n /**\n * Read the protocol's current universal-challenger operation-key epoch.\n *\n * The challenger-axis counterpart to\n * {@link VaultKeeperReader.getCurrentAppKeeperKeyEpoch}: one protocol-wide\n * counter the fingerprint commits to in place of the M resolved challenger\n * keys. Returned as `bigint` for the same `uint64` reason.\n */\n getCurrentUcKeyEpoch(blockNumber?: bigint): Promise<bigint>;\n}\n\n// ============================================================================\n// RFC-006 Operation-Key Types\n// ============================================================================\n\n/**\n * The participants whose operation keys are being resolved, and the roster\n * they are resolved against.\n *\n * A roster entry's `ethAddress` is the operator's **admin** address — the\n * lookup key for its key history — and its `btcPubKey` is the operator's\n * **genesis** key. Both are needed: the `...AtEpochOrGenesis` getters take the\n * roster key explicitly because the correct genesis for a keeper/challenger is\n * its key in the vault's *frozen membership version*, which an operator that\n * was later dropped from the roster no longer has a current entry for.\n */\nexport interface OperationKeyQuery {\n vaultProviderEthAddress: Address;\n /**\n * The VP's genesis (registration) key, from\n * {@link VaultRegistryReader.getVaultProviderGenesisBtcPubKey}.\n *\n * The VP has no roster entry to carry a genesis key the way keepers and\n * challengers do, so it is supplied here. Every call site already reads it:\n * it is what the indexer hint is compared against, and what makes the VP's\n * `rotated` flag mean the same thing as everyone else's.\n */\n vaultProviderGenesisBtcPubkey: Hex;\n applicationEntryPoint: Address;\n /** Keeper roster at the membership version being resolved against. */\n vaultKeepers: readonly AddressBTCKeyPair[];\n /** Challenger roster at the membership version being resolved against. */\n universalChallengers: readonly AddressBTCKeyPair[];\n}\n\n/** Raw registry-returned operation keys, index-aligned with the query rosters. */\nexport interface RawOperationKeys {\n vaultProvider: Hex;\n vaultKeepers: Hex[];\n universalChallengers: Hex[];\n}\n\n/**\n * Registry-returned payout scriptPubKeys, index-aligned with the query\n * rosters. `universalChallengers` has no counterpart: a UC is never a claimer,\n * so it has no payout script.\n */\nexport interface RawPayoutScripts {\n vaultProvider: Hex;\n vaultKeepers: Hex[];\n}\n\n/**\n * Reads RFC-006 operation keys and payout scripts across all three registries\n * (BTCVaultRegistry, ApplicationRegistry, ProtocolParams).\n *\n * Every method resolves the whole participant set in a **single** multicall so\n * the keys are pinned to one block. That atomicity is load-bearing: a rotation\n * landing between two `eth_call`s would yield a self-inconsistent key set that\n * builds a lock no counterparty agrees with.\n */\nexport interface OperationKeyReader {\n /**\n * Resolve every participant's *current* operation key.\n *\n * Used for new peg-ins. The VP-only current getter separately supplies the\n * JSON-RPC auth pin. Needs no epoch read at all — each registry's\n * `getCurrentOperationBtcKey` resolves its own genesis fallback, so an\n * operator that never rotated yields its registration key.\n */\n getCurrentOperationKeys(\n query: OperationKeyQuery,\n blockNumber?: bigint,\n ): Promise<RawOperationKeys>;\n /**\n * Resolve every participant's operation key bonded at a vault's frozen\n * epochs. Used for every existing-vault path (resume, payout, refund).\n */\n getOperationKeysAtEpochs(\n query: OperationKeyQuery,\n epochs: KeyEpochs,\n ): Promise<RawOperationKeys>;\n /**\n * Resolve the VP's commission payout script and each keeper's payout script\n * at a vault's frozen epochs.\n *\n * The registry backfills BIP-86 P2TR of the epoch's operation key for any\n * operator that never called `setPayoutScript`, so this returns byte-identical\n * results to local BIP-86 derivation until an operator registers a custom\n * script.\n */\n getPayoutScriptsAtEpochs(\n query: OperationKeyQuery,\n epochs: KeyEpochs,\n ): Promise<RawPayoutScripts>;\n}\n"],"names":["resolveProtocolAddresses","publicClient","btcVaultRegistryAddress","protocolParams","applicationRegistry","BTCVaultRegistryABI","assertMulticallLength","actual","expected","label","partition","results","keeperCount","ViemOperationKeyReader","contracts","calls","challengerCount","blockNumber","query","keeper","ApplicationRegistryABI","challenger","ProtocolParamsABI","epochs","UINT16_MAX","mapOffchainParams","result","mapTBVParams","deriveTimelockPegin","timelockAssert","ViemProtocolParamsReader","contractAddress","params","validateTBVProtocolParams","validateOffchainParams","version","raw","assertValidOffchainParamsVersion","tbvParams","offchainParams","offchainParamsVersion","activeVaultCoreVersion","config","validatePegInConfiguration","onSkippedVersion","latestVersion","versions","_","i","v","byVersion","error","mapKeyPairs","pair","assertKeyEpoch","ViemVaultKeeperReader","appEntryPoint","ViemUniversalChallengerReader","OnChainBtcVaultStatus"],"mappings":"yKA8BA,eAAsBA,EACpBC,EACAC,EAC4B,CAC5B,KAAM,CAACC,EAAgBC,CAAmB,EAAI,MAAMH,EAAa,UAAU,CACzE,UAAW,CACT,CACE,QAASC,EACT,IAAKG,EAAAA,oBACL,aAAc,gBAAA,EAEhB,CACE,QAASH,EACT,IAAKG,EAAAA,oBACL,aAAc,qBAAA,CAChB,EAEF,aAAc,EAAA,CACf,EAED,MAAO,CACL,eAAAF,EACA,oBAAAC,CAAA,CAEJ,CCTA,SAASE,EACPC,EACAC,EACAC,EACM,CACN,GAAIF,IAAWC,EACb,MAAM,IAAI,MACR,GAAGC,CAAK,wBAAwBF,CAAM,gBAAgBC,CAAQ,qEAAA,CAIpE,CAYA,SAASE,EACPC,EACAC,EACoE,CACpE,MAAO,CACL,cAAeD,EAAQ,CAAC,EACx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nD,QAAS,KAAK,gBACd,IAAKJ,EAAAA,kBACL,aAAc,gCAAA,CACf,EAED,OAAO8B,EAAY1B,CAAM,CAC3B,CAEA,MAAM,qCACJT,EACiB,CAQjB,OAPgB,MAAM,KAAK,aAAa,aAAa,CACnD,QAAS,KAAK,gBACd,IAAKK,EAAAA,kBACL,aAAc,oCACd,YAAAL,CAAA,CACD,CAGH,CAEA,MAAM,qBAAqBA,EAAuC,CAChE,MAAMmB,EAAe,MAAM,KAAK,aAAa,aAAa,CACxD,QAAS,KAAK,gBACd,IAAKd,EAAAA,kBACL,aAAc,oBACd,YAAAL,CAAA,CACD,EAED,OAAOqC,EAAelB,EAAK,mBAAmB,CAChD,CACF,CC7IO,IAAKsB,GAAAA,IACVA,EAAAA,EAAA,QAAU,CAAA,EAAV,UACAA,EAAAA,EAAA,SAAW,CAAA,EAAX,WACAA,EAAAA,EAAA,OAAS,CAAA,EAAT,SACAA,EAAAA,EAAA,SAAW,CAAA,EAAX,WACAA,EAAAA,EAAA,QAAU,CAAA,EAAV,UALUA,IAAAA,GAAA,CAAA,CAAA"}
|
package/dist/types-DGkejGZH.js
DELETED
|
@@ -1,456 +0,0 @@
|
|
|
1
|
-
import { B as u } from "./BTCVaultRegistry.abi-B0x9_Bza.js";
|
|
2
|
-
import { A as o, P as n } from "./ProtocolParams.abi-q0AidvYX.js";
|
|
3
|
-
import { b as C, v as h, e as v, a as E } from "./pegin-registration-client-ilkV1mLP.js";
|
|
4
|
-
async function R(a, t) {
|
|
5
|
-
const [e, r] = await a.multicall({
|
|
6
|
-
contracts: [
|
|
7
|
-
{
|
|
8
|
-
address: t,
|
|
9
|
-
abi: u,
|
|
10
|
-
functionName: "protocolParams"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
address: t,
|
|
14
|
-
abi: u,
|
|
15
|
-
functionName: "applicationRegistry"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
allowFailure: !1
|
|
19
|
-
});
|
|
20
|
-
return {
|
|
21
|
-
protocolParams: e,
|
|
22
|
-
applicationRegistry: r
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function f(a, t, e) {
|
|
26
|
-
if (a !== t)
|
|
27
|
-
throw new Error(
|
|
28
|
-
`${e}: multicall returned ${a} results for ${t} calls, so the results are not roster-aligned; refusing to use them`
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
function K(a, t) {
|
|
32
|
-
return {
|
|
33
|
-
vaultProvider: a[0],
|
|
34
|
-
vaultKeepers: a.slice(1, 1 + t),
|
|
35
|
-
universalChallengers: a.slice(1 + t)
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
class B {
|
|
39
|
-
constructor(t, e) {
|
|
40
|
-
this.publicClient = t, this.contracts = e;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* One multicall, `allowFailure: false`, so every key in the set is read at
|
|
44
|
-
* the same block. A rotation landing between two separate `eth_call`s would
|
|
45
|
-
* otherwise produce a mixed-epoch key set and a lock no counterparty agrees
|
|
46
|
-
* with.
|
|
47
|
-
*/
|
|
48
|
-
async readAll(t, e, r, s, l) {
|
|
49
|
-
const c = await this.publicClient.multicall({
|
|
50
|
-
contracts: t,
|
|
51
|
-
allowFailure: !1,
|
|
52
|
-
blockNumber: l
|
|
53
|
-
});
|
|
54
|
-
return f(
|
|
55
|
-
c.length,
|
|
56
|
-
1 + e + r,
|
|
57
|
-
s
|
|
58
|
-
), K(c, e);
|
|
59
|
-
}
|
|
60
|
-
async getCurrentOperationKeys(t, e) {
|
|
61
|
-
const r = [
|
|
62
|
-
{
|
|
63
|
-
address: this.contracts.btcVaultRegistry,
|
|
64
|
-
abi: u,
|
|
65
|
-
functionName: "getCurrentOperationBtcKey",
|
|
66
|
-
args: [t.vaultProviderEthAddress]
|
|
67
|
-
},
|
|
68
|
-
...t.vaultKeepers.map((s) => ({
|
|
69
|
-
address: this.contracts.applicationRegistry,
|
|
70
|
-
abi: o,
|
|
71
|
-
functionName: "getCurrentOperationBtcKey",
|
|
72
|
-
args: [t.applicationEntryPoint, s.ethAddress]
|
|
73
|
-
})),
|
|
74
|
-
...t.universalChallengers.map((s) => ({
|
|
75
|
-
address: this.contracts.protocolParams,
|
|
76
|
-
abi: n,
|
|
77
|
-
functionName: "getCurrentOperationBtcKey",
|
|
78
|
-
args: [s.ethAddress]
|
|
79
|
-
}))
|
|
80
|
-
];
|
|
81
|
-
return this.readAll(
|
|
82
|
-
r,
|
|
83
|
-
t.vaultKeepers.length,
|
|
84
|
-
t.universalChallengers.length,
|
|
85
|
-
"getCurrentOperationKeys",
|
|
86
|
-
e
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
async getOperationKeysAtEpochs(t, e) {
|
|
90
|
-
const r = [
|
|
91
|
-
// The VP takes the plain `AtEpoch` variant: it has no membership
|
|
92
|
-
// version, so its genesis (the registration key at version 0) is
|
|
93
|
-
// unambiguous and the contract resolves it internally.
|
|
94
|
-
{
|
|
95
|
-
address: this.contracts.btcVaultRegistry,
|
|
96
|
-
abi: u,
|
|
97
|
-
functionName: "getOperationBtcKeyAtEpoch",
|
|
98
|
-
args: [t.vaultProviderEthAddress, e.vpKeyEpoch]
|
|
99
|
-
},
|
|
100
|
-
// Keepers and challengers take `...OrGenesis` with their roster key
|
|
101
|
-
// passed explicitly, because the correct genesis for them is their key
|
|
102
|
-
// in *this vault's frozen membership version*. An operator dropped from
|
|
103
|
-
// the current roster, or listed under a different key in an older
|
|
104
|
-
// version, would otherwise resolve against the wrong genesis.
|
|
105
|
-
...t.vaultKeepers.map((s) => ({
|
|
106
|
-
address: this.contracts.applicationRegistry,
|
|
107
|
-
abi: o,
|
|
108
|
-
functionName: "getOperationBtcKeyAtEpochOrGenesis",
|
|
109
|
-
args: [
|
|
110
|
-
t.applicationEntryPoint,
|
|
111
|
-
s.ethAddress,
|
|
112
|
-
e.appKeeperKeyEpoch,
|
|
113
|
-
s.btcPubKey
|
|
114
|
-
]
|
|
115
|
-
})),
|
|
116
|
-
...t.universalChallengers.map((s) => ({
|
|
117
|
-
address: this.contracts.protocolParams,
|
|
118
|
-
abi: n,
|
|
119
|
-
functionName: "getOperationBtcKeyAtEpochOrGenesis",
|
|
120
|
-
args: [s.ethAddress, e.ucKeyEpoch, s.btcPubKey]
|
|
121
|
-
}))
|
|
122
|
-
];
|
|
123
|
-
return this.readAll(
|
|
124
|
-
r,
|
|
125
|
-
t.vaultKeepers.length,
|
|
126
|
-
t.universalChallengers.length,
|
|
127
|
-
"getOperationKeysAtEpochs"
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
async getPayoutScriptsAtEpochs(t, e) {
|
|
131
|
-
const r = await this.publicClient.multicall({
|
|
132
|
-
contracts: [
|
|
133
|
-
{
|
|
134
|
-
address: this.contracts.btcVaultRegistry,
|
|
135
|
-
abi: u,
|
|
136
|
-
functionName: "getPayoutScriptAtEpoch",
|
|
137
|
-
args: [t.vaultProviderEthAddress, e.vpKeyEpoch]
|
|
138
|
-
},
|
|
139
|
-
...t.vaultKeepers.map((s) => ({
|
|
140
|
-
address: this.contracts.applicationRegistry,
|
|
141
|
-
abi: o,
|
|
142
|
-
functionName: "getPayoutScriptAtEpoch",
|
|
143
|
-
args: [
|
|
144
|
-
t.applicationEntryPoint,
|
|
145
|
-
s.ethAddress,
|
|
146
|
-
e.appKeeperKeyEpoch
|
|
147
|
-
]
|
|
148
|
-
}))
|
|
149
|
-
],
|
|
150
|
-
allowFailure: !1
|
|
151
|
-
});
|
|
152
|
-
return f(
|
|
153
|
-
r.length,
|
|
154
|
-
1 + t.vaultKeepers.length,
|
|
155
|
-
"getPayoutScriptsAtEpochs"
|
|
156
|
-
), {
|
|
157
|
-
vaultProvider: r[0],
|
|
158
|
-
vaultKeepers: [...r.slice(1)]
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
const b = 65535;
|
|
163
|
-
function d(a) {
|
|
164
|
-
return {
|
|
165
|
-
timelockAssert: a.timelockAssert,
|
|
166
|
-
timelockChallengeAssert: a.timelockChallengeAssert,
|
|
167
|
-
securityCouncilKeys: [...a.securityCouncilKeys],
|
|
168
|
-
councilQuorum: a.councilQuorum,
|
|
169
|
-
feeRate: a.feeRate,
|
|
170
|
-
babeTotalInstances: a.babeTotalInstances,
|
|
171
|
-
babeInstancesToFinalize: a.babeInstancesToFinalize,
|
|
172
|
-
minVpCommissionBps: a.minVpCommissionBps,
|
|
173
|
-
tRefund: a.tRefund,
|
|
174
|
-
tStale: a.tStale,
|
|
175
|
-
minPeginFeeRate: a.minPeginFeeRate,
|
|
176
|
-
proverCircuitVersion: a.proverCircuitVersion,
|
|
177
|
-
minPrepeginDepth: a.minPrepeginDepth
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
function P(a) {
|
|
181
|
-
return {
|
|
182
|
-
minimumPegInAmount: a.minimumPegInAmount,
|
|
183
|
-
maxPegInAmount: a.maxPegInAmount,
|
|
184
|
-
pegInAckTimeout: a.pegInAckTimeout,
|
|
185
|
-
pegInActivationTimeout: a.pegInActivationTimeout,
|
|
186
|
-
maxHtlcOutputCount: a.maxHtlcOutputCount,
|
|
187
|
-
expiredPegInGraceBlocks: a.expiredPegInGraceBlocks
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
function A(a) {
|
|
191
|
-
if (a > BigInt(b))
|
|
192
|
-
throw new Error(
|
|
193
|
-
`timelockAssert value ${a} exceeds uint16 max (${b})`
|
|
194
|
-
);
|
|
195
|
-
return Number(a);
|
|
196
|
-
}
|
|
197
|
-
class O {
|
|
198
|
-
constructor(t, e) {
|
|
199
|
-
this.publicClient = t, this.contractAddress = e;
|
|
200
|
-
}
|
|
201
|
-
async getTBVProtocolParams() {
|
|
202
|
-
const t = await this.publicClient.readContract({
|
|
203
|
-
address: this.contractAddress,
|
|
204
|
-
abi: n,
|
|
205
|
-
functionName: "getTBVProtocolParams"
|
|
206
|
-
}), e = P(t);
|
|
207
|
-
return C(e), e;
|
|
208
|
-
}
|
|
209
|
-
async getLatestOffchainParams() {
|
|
210
|
-
const t = await this.publicClient.readContract({
|
|
211
|
-
address: this.contractAddress,
|
|
212
|
-
abi: n,
|
|
213
|
-
functionName: "getLatestOffchainParams"
|
|
214
|
-
}), e = d(t);
|
|
215
|
-
return h(e), e;
|
|
216
|
-
}
|
|
217
|
-
async getOffchainParamsByVersion(t) {
|
|
218
|
-
const e = await this.publicClient.readContract({
|
|
219
|
-
address: this.contractAddress,
|
|
220
|
-
abi: n,
|
|
221
|
-
functionName: "getOffchainParamsByVersion",
|
|
222
|
-
args: [t]
|
|
223
|
-
}), r = d(e);
|
|
224
|
-
return h(r), r;
|
|
225
|
-
}
|
|
226
|
-
async getLatestOffchainParamsVersion() {
|
|
227
|
-
const t = await this.publicClient.readContract({
|
|
228
|
-
address: this.contractAddress,
|
|
229
|
-
abi: n,
|
|
230
|
-
functionName: "latestOffchainParamsVersion"
|
|
231
|
-
}), e = Number(t);
|
|
232
|
-
return v(e), e;
|
|
233
|
-
}
|
|
234
|
-
async getTimelockPeginByVersion(t) {
|
|
235
|
-
const e = await this.getOffchainParamsByVersion(t);
|
|
236
|
-
return A(e.timelockAssert);
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Returned as `bigint` with no `Number` narrowing: the registry compares it
|
|
240
|
-
* against `block.number`, so callers must do the same arithmetic the
|
|
241
|
-
* contract does. `0` is the documented "disabled" case and is returned as
|
|
242
|
-
* `0n`. A missing getter or a non-bigint payload throws — never coerced to
|
|
243
|
-
* `0`, which would fail open and skip the observation window.
|
|
244
|
-
*
|
|
245
|
-
* @throws If the deployment does not expose `peginActivationDelay()`, or
|
|
246
|
-
* the decoded payload is not a `bigint`.
|
|
247
|
-
*/
|
|
248
|
-
async getPeginActivationDelay() {
|
|
249
|
-
const t = await this.publicClient.readContract({
|
|
250
|
-
address: this.contractAddress,
|
|
251
|
-
abi: n,
|
|
252
|
-
functionName: "peginActivationDelay"
|
|
253
|
-
});
|
|
254
|
-
if (typeof t != "bigint")
|
|
255
|
-
throw new Error(
|
|
256
|
-
`Invalid peginActivationDelay from contract: must be a bigint, got ${typeof t}`
|
|
257
|
-
);
|
|
258
|
-
return t;
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Read TBV protocol params, latest offchain params, and the latest version
|
|
262
|
-
* label atomically via multicall. The version is paired with the params so
|
|
263
|
-
* that a governance update between separate reads cannot let JS build BTC
|
|
264
|
-
* scripts with version N params while the contract registers the vault
|
|
265
|
-
* under version N+1.
|
|
266
|
-
*
|
|
267
|
-
* That guarantee holds only within this multicall. A caller that also reads
|
|
268
|
-
* participant keys — every fresh peg-in build does — must pass the same
|
|
269
|
-
* `blockNumber` here and to those reads, or the two describe different
|
|
270
|
-
* blocks and the pairing above buys nothing across the seam.
|
|
271
|
-
*/
|
|
272
|
-
async getPegInConfiguration(t) {
|
|
273
|
-
const e = await this.publicClient.multicall({
|
|
274
|
-
blockNumber: t,
|
|
275
|
-
contracts: [
|
|
276
|
-
{
|
|
277
|
-
address: this.contractAddress,
|
|
278
|
-
abi: n,
|
|
279
|
-
functionName: "getTBVProtocolParams"
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
address: this.contractAddress,
|
|
283
|
-
abi: n,
|
|
284
|
-
functionName: "getLatestOffchainParams"
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
address: this.contractAddress,
|
|
288
|
-
abi: n,
|
|
289
|
-
functionName: "latestOffchainParamsVersion"
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
address: this.contractAddress,
|
|
293
|
-
abi: n,
|
|
294
|
-
functionName: "activeVaultCoreVersion"
|
|
295
|
-
}
|
|
296
|
-
],
|
|
297
|
-
allowFailure: !1
|
|
298
|
-
}), r = P(e[0]), s = d(e[1]), l = Number(e[2]), c = Number(e[3]), i = {
|
|
299
|
-
minimumPegInAmount: r.minimumPegInAmount,
|
|
300
|
-
maxPegInAmount: r.maxPegInAmount,
|
|
301
|
-
pegInAckTimeout: r.pegInAckTimeout,
|
|
302
|
-
pegInActivationTimeout: r.pegInActivationTimeout,
|
|
303
|
-
maxHtlcOutputCount: r.maxHtlcOutputCount,
|
|
304
|
-
expiredPegInGraceBlocks: r.expiredPegInGraceBlocks,
|
|
305
|
-
timelockPegin: A(s.timelockAssert),
|
|
306
|
-
timelockRefund: s.tRefund,
|
|
307
|
-
minVpCommissionBps: s.minVpCommissionBps,
|
|
308
|
-
offchainParams: s,
|
|
309
|
-
offchainParamsVersion: l,
|
|
310
|
-
activeVaultCoreVersion: c
|
|
311
|
-
};
|
|
312
|
-
return E(i), i;
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Fetch every historical offchain params version in a single multicall.
|
|
316
|
-
* Iterates 1..latestVersion and calls `getOffchainParamsByVersion` for each.
|
|
317
|
-
* Versions whose payload fails validation are skipped (not included in the
|
|
318
|
-
* returned map) so a single bad historical version doesn't block the
|
|
319
|
-
* lookup of the rest.
|
|
320
|
-
*
|
|
321
|
-
* @param onSkippedVersion - optional observer invoked once per skipped
|
|
322
|
-
* version. Use to log/telemeter without coupling the SDK to a logger.
|
|
323
|
-
*/
|
|
324
|
-
async fetchAllOffchainParams(t) {
|
|
325
|
-
const e = await this.getLatestOffchainParamsVersion();
|
|
326
|
-
if (e === 0)
|
|
327
|
-
return { byVersion: /* @__PURE__ */ new Map(), latestVersion: 0 };
|
|
328
|
-
const r = Array.from({ length: e }, (i, m) => m + 1), s = r.map((i) => ({
|
|
329
|
-
address: this.contractAddress,
|
|
330
|
-
abi: n,
|
|
331
|
-
functionName: "getOffchainParamsByVersion",
|
|
332
|
-
args: [i]
|
|
333
|
-
})), l = await this.publicClient.multicall({
|
|
334
|
-
contracts: s,
|
|
335
|
-
allowFailure: !1
|
|
336
|
-
}), c = /* @__PURE__ */ new Map();
|
|
337
|
-
for (let i = 0; i < r.length; i++) {
|
|
338
|
-
const m = d(l[i]);
|
|
339
|
-
try {
|
|
340
|
-
h(m), c.set(r[i], m);
|
|
341
|
-
} catch (g) {
|
|
342
|
-
t == null || t(
|
|
343
|
-
r[i],
|
|
344
|
-
g instanceof Error ? g : new Error(String(g))
|
|
345
|
-
);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return { byVersion: c, latestVersion: e };
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
function p(a) {
|
|
352
|
-
return a.map((t) => ({
|
|
353
|
-
ethAddress: t.ethAddress,
|
|
354
|
-
btcPubKey: t.btcPubKey
|
|
355
|
-
}));
|
|
356
|
-
}
|
|
357
|
-
function y(a, t) {
|
|
358
|
-
if (typeof a != "bigint")
|
|
359
|
-
throw new Error(
|
|
360
|
-
`Invalid ${t} from contract: must be a bigint, got ${typeof a}`
|
|
361
|
-
);
|
|
362
|
-
return a;
|
|
363
|
-
}
|
|
364
|
-
class T {
|
|
365
|
-
constructor(t, e) {
|
|
366
|
-
this.publicClient = t, this.contractAddress = e;
|
|
367
|
-
}
|
|
368
|
-
async getVaultKeepersByVersion(t, e, r) {
|
|
369
|
-
const s = await this.publicClient.readContract({
|
|
370
|
-
address: this.contractAddress,
|
|
371
|
-
abi: o,
|
|
372
|
-
functionName: "getVaultKeepersByVersion",
|
|
373
|
-
args: [t, e],
|
|
374
|
-
blockNumber: r
|
|
375
|
-
});
|
|
376
|
-
return p(s);
|
|
377
|
-
}
|
|
378
|
-
async getCurrentVaultKeepers(t) {
|
|
379
|
-
const e = await this.publicClient.readContract({
|
|
380
|
-
address: this.contractAddress,
|
|
381
|
-
abi: o,
|
|
382
|
-
functionName: "getCurrentVaultKeepers",
|
|
383
|
-
args: [t]
|
|
384
|
-
});
|
|
385
|
-
return p(e);
|
|
386
|
-
}
|
|
387
|
-
async getCurrentVaultKeepersVersion(t, e) {
|
|
388
|
-
return await this.publicClient.readContract({
|
|
389
|
-
address: this.contractAddress,
|
|
390
|
-
abi: o,
|
|
391
|
-
functionName: "getCurrentVaultKeepersVersion",
|
|
392
|
-
args: [t],
|
|
393
|
-
blockNumber: e
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
async getCurrentAppKeeperKeyEpoch(t, e) {
|
|
397
|
-
const r = await this.publicClient.readContract({
|
|
398
|
-
address: this.contractAddress,
|
|
399
|
-
abi: o,
|
|
400
|
-
functionName: "appKeeperKeyEpochCurrent",
|
|
401
|
-
args: [t],
|
|
402
|
-
blockNumber: e
|
|
403
|
-
});
|
|
404
|
-
return y(r, "appKeeperKeyEpochCurrent");
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
class D {
|
|
408
|
-
constructor(t, e) {
|
|
409
|
-
this.publicClient = t, this.contractAddress = e;
|
|
410
|
-
}
|
|
411
|
-
async getUniversalChallengersByVersion(t, e) {
|
|
412
|
-
const r = await this.publicClient.readContract({
|
|
413
|
-
address: this.contractAddress,
|
|
414
|
-
abi: n,
|
|
415
|
-
functionName: "getUniversalChallengersByVersion",
|
|
416
|
-
args: [t],
|
|
417
|
-
blockNumber: e
|
|
418
|
-
});
|
|
419
|
-
return p(r);
|
|
420
|
-
}
|
|
421
|
-
async getCurrentUniversalChallengers() {
|
|
422
|
-
const t = await this.publicClient.readContract({
|
|
423
|
-
address: this.contractAddress,
|
|
424
|
-
abi: n,
|
|
425
|
-
functionName: "getCurrentUniversalChallengers"
|
|
426
|
-
});
|
|
427
|
-
return p(t);
|
|
428
|
-
}
|
|
429
|
-
async getLatestUniversalChallengersVersion(t) {
|
|
430
|
-
return await this.publicClient.readContract({
|
|
431
|
-
address: this.contractAddress,
|
|
432
|
-
abi: n,
|
|
433
|
-
functionName: "latestUniversalChallengersVersion",
|
|
434
|
-
blockNumber: t
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
async getCurrentUcKeyEpoch(t) {
|
|
438
|
-
const e = await this.publicClient.readContract({
|
|
439
|
-
address: this.contractAddress,
|
|
440
|
-
abi: n,
|
|
441
|
-
functionName: "ucKeyEpochCurrent",
|
|
442
|
-
blockNumber: t
|
|
443
|
-
});
|
|
444
|
-
return y(e, "ucKeyEpochCurrent");
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
var V = /* @__PURE__ */ ((a) => (a[a.PENDING = 0] = "PENDING", a[a.VERIFIED = 1] = "VERIFIED", a[a.ACTIVE = 2] = "ACTIVE", a[a.REDEEMED = 3] = "REDEEMED", a[a.EXPIRED = 4] = "EXPIRED", a))(V || {});
|
|
448
|
-
export {
|
|
449
|
-
V as O,
|
|
450
|
-
B as V,
|
|
451
|
-
O as a,
|
|
452
|
-
D as b,
|
|
453
|
-
T as c,
|
|
454
|
-
R as r
|
|
455
|
-
};
|
|
456
|
-
//# sourceMappingURL=types-DGkejGZH.js.map
|