Skip to content

Commit

Permalink
Merge pull request #245 from input-output-hk/mgalazyn/fix/execute-dre…
Browse files Browse the repository at this point in the history
…p-queries-for-empty-dreps-list

Fix DRep Stake and DRep Stake queries for empty lists
  • Loading branch information
carbolymer authored Sep 14, 2023
2 parents 22e2b29 + 770961b commit eabf9fc
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cardano-api/internal/Cardano/Api/Query/Expr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,17 @@ queryDRepState :: ()
=> EraInMode era mode
-> ShelleyBasedEra era
-> Set (L.Credential L.DRepRole L.StandardCrypto)
-- ^ An empty credentials set means that states for all DReps will be returned
-> LocalStateQueryExpr block point (QueryInMode mode) r IO (Either UnsupportedNtcVersionError (Either EraMismatch (Map (L.Credential L.DRepRole L.StandardCrypto) (L.DRepState L.StandardCrypto))))
queryDRepState eraInMode sbe drepCreds
| S.null drepCreds = pure . pure $ pure mempty
| otherwise = queryExpr $ QueryInEra eraInMode $ QueryInShelleyBasedEra sbe $ QueryDRepState drepCreds
queryDRepState eraInMode sbe drepCreds = queryExpr $ QueryInEra eraInMode $ QueryInShelleyBasedEra sbe $ QueryDRepState drepCreds

queryDRepStakeDistribution :: ()
=> EraInMode era mode
-> ShelleyBasedEra era
-> Set (L.DRep L.StandardCrypto)
-- ^ An empty DRep set means that distributions for all DReps will be returned
-> LocalStateQueryExpr block point (QueryInMode mode) r IO (Either UnsupportedNtcVersionError (Either EraMismatch (Map (L.DRep L.StandardCrypto) Lovelace)))
queryDRepStakeDistribution eraInMode sbe dreps
| S.null dreps = pure . pure $ pure mempty
| otherwise = queryExpr $ QueryInEra eraInMode $ QueryInShelleyBasedEra sbe $ QueryDRepStakeDistr dreps
queryDRepStakeDistribution eraInMode sbe dreps = queryExpr $ QueryInEra eraInMode $ QueryInShelleyBasedEra sbe $ QueryDRepStakeDistr dreps

queryCommitteeState :: ()
=> EraInMode era mode
Expand Down

0 comments on commit eabf9fc

Please sign in to comment.