Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add query future pparams #739

Merged
merged 1 commit into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions cardano-api/internal/Cardano/Api/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ data QueryInShelleyBasedEra era result where
:: QueryInShelleyBasedEra era (Ledger.PParams (ShelleyLedgerEra era))
QueryProtocolParametersUpdate
:: QueryInShelleyBasedEra
era
(Map (Hash GenesisKey) ProtocolParametersUpdate)
era
(Map (Hash GenesisKey) ProtocolParametersUpdate)
QueryStakeDistribution
:: QueryInShelleyBasedEra era (Map (Hash StakePoolKey) Rational)
QueryUTxO
Expand Down Expand Up @@ -282,11 +282,13 @@ data QueryInShelleyBasedEra era result where
:: QueryInShelleyBasedEra era (L.GovState (ShelleyLedgerEra era))
QueryRatifyState
:: QueryInShelleyBasedEra era (L.RatifyState (ShelleyLedgerEra era))
QueryFuturePParams
:: QueryInShelleyBasedEra era (Maybe (Core.PParams (ShelleyLedgerEra era)))
QueryDRepState
:: Set (Shelley.Credential Shelley.DRepRole StandardCrypto)
-> QueryInShelleyBasedEra
era
(Map (Shelley.Credential Shelley.DRepRole StandardCrypto) (L.DRepState StandardCrypto))
era
(Map (Shelley.Credential Shelley.DRepRole StandardCrypto) (L.DRepState StandardCrypto))
QueryDRepStakeDistr
:: Set (Ledger.DRep StandardCrypto)
-> QueryInShelleyBasedEra era (Map (Ledger.DRep StandardCrypto) L.Coin)
Expand Down Expand Up @@ -340,6 +342,7 @@ instance NodeToClientVersionOf (QueryInShelleyBasedEra era result) where
nodeToClientVersionOf QueryStakeVoteDelegatees{} = NodeToClientV_16
nodeToClientVersionOf QueryProposals{} = NodeToClientV_17
nodeToClientVersionOf QueryRatifyState{} = NodeToClientV_17
nodeToClientVersionOf QueryFuturePParams{} = NodeToClientV_18
nodeToClientVersionOf QueryLedgerPeerSnapshot = NodeToClientV_19

deriving instance Show (QueryInShelleyBasedEra era result)
Expand Down Expand Up @@ -538,8 +541,8 @@ fromShelleyPoolDistr =

fromShelleyDelegations
:: Map
(Shelley.Credential Shelley.Staking StandardCrypto)
(Shelley.KeyHash Shelley.StakePool StandardCrypto)
(Shelley.Credential Shelley.Staking StandardCrypto)
(Shelley.KeyHash Shelley.StakePool StandardCrypto)
-> Map StakeCredential PoolId
fromShelleyDelegations =
-- TODO: write an appropriate property to show it is safe to use
Expand Down Expand Up @@ -681,6 +684,13 @@ toConsensusQueryShelleyBased sbe = \case
(const $ error "toConsensusQueryShelleyBased: QueryRatifyState is only available in the Conway era")
CarlosLopezDeLara marked this conversation as resolved.
Show resolved Hide resolved
(const $ Some (consensusQueryInEraInMode era Consensus.GetRatifyState))
sbe
QueryFuturePParams ->
caseShelleyToBabbageOrConwayEraOnwards
( const $
error "toConsensusQueryShelleyBased: QueryFuturePParams is only available in the Conway era onwards"
)
(const $ Some (consensusQueryInEraInMode era Consensus.GetFuturePParams))
sbe
QueryDRepState creds ->
caseShelleyToBabbageOrConwayEraOnwards
(const $ error "toConsensusQueryShelleyBased: QueryDRepState is only available in the Conway era")
Expand Down Expand Up @@ -999,6 +1009,11 @@ fromConsensusQueryResultShelleyBased sbe sbeQuery q' r' =
Consensus.GetRatifyState{} ->
r'
_ -> fromConsensusQueryResultMismatch
QueryFuturePParams{} ->
case q' of
Consensus.GetFuturePParams{} ->
r'
_ -> fromConsensusQueryResultMismatch
QueryDRepState{} ->
case q' of
Consensus.GetDRepState{} ->
Expand Down
Loading
Loading