From 6397a0cdf41d2eab706723fb100899eb3d73832d Mon Sep 17 00:00:00 2001 From: John Ky Date: Fri, 29 Sep 2023 13:01:35 +1000 Subject: [PATCH] Add field names to query command types --- .../Cardano/CLI/EraBased/Commands/Query.hs | 179 +++++++++--------- .../src/Cardano/CLI/EraBased/Options/Query.hs | 4 +- .../src/Cardano/CLI/EraBased/Run/Query.hs | 34 ++-- .../src/Cardano/CLI/Legacy/Commands/Query.hs | 169 +++++++++-------- .../src/Cardano/CLI/Legacy/Run/Query.hs | 64 +++---- 5 files changed, 226 insertions(+), 224 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs index a0d4bab351..1ee65d5c56 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs @@ -1,5 +1,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE LambdaCase #-} module Cardano.CLI.EraBased.Commands.Query @@ -12,7 +13,7 @@ module Cardano.CLI.EraBased.Commands.Query , QueryStakeDistributionCmdArgs(..) , QueryStakeAddressInfoCmdArgs(..) , QueryUTxOCmdArgs(..) - , QueryDebugLedgerStateCmdArgs(..) + , QueryLedgerStateCmdArgs(..) , QueryProtocolStateCmdArgs(..) , QueryStakeSnapshotCmdArgs(..) , QueryKesPeriodInfoCmdArgs(..) @@ -40,7 +41,7 @@ data QueryCmds era | QueryStakeDistributionCmd !QueryStakeDistributionCmdArgs | QueryStakeAddressInfoCmd !QueryStakeAddressInfoCmdArgs | QueryUTxOCmd !QueryUTxOCmdArgs - | QueryDebugLedgerStateCmd !QueryDebugLedgerStateCmdArgs + | QueryLedgerStateCmd !QueryLedgerStateCmdArgs | QueryProtocolStateCmd !QueryProtocolStateCmdArgs | QueryStakeSnapshotCmd !QueryStakeSnapshotCmdArgs | QueryKesPeriodInfoCmd !QueryKesPeriodInfoCmdArgs @@ -50,119 +51,119 @@ data QueryCmds era deriving (Generic, Show) data QueryLeadershipScheduleCmdArgs = QueryLeadershipScheduleCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !GenesisFile - !(VerificationKeyOrHashOrFile StakePoolKey) - !(SigningKeyFile In) - !EpochLeadershipSchedule - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , genesisFp :: !GenesisFile + , poolId :: !(VerificationKeyOrHashOrFile StakePoolKey) + , vrkSkeyFp :: !(SigningKeyFile In) + , whichSchedule :: !EpochLeadershipSchedule + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data QueryProtocolParametersCmdArgs = QueryProtocolParametersCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data QueryConstitutionHashCmdArgs = QueryConstitutionHashCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data QueryTipCmdArgs = QueryTipCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data QueryStakePoolsCmdArgs = QueryStakePoolsCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data QueryStakeDistributionCmdArgs = QueryStakeDistributionCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data QueryStakeAddressInfoCmdArgs = QueryStakeAddressInfoCmdArgs - !SocketPath - !AnyConsensusModeParams - !StakeAddress - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { mNodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , addr :: !StakeAddress + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data QueryUTxOCmdArgs = QueryUTxOCmdArgs - !SocketPath - !AnyConsensusModeParams - !QueryUTxOFilter - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) - -data QueryDebugLedgerStateCmdArgs = QueryDebugLedgerStateCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , queryFilter :: !QueryUTxOFilter + , networkId :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) + +data QueryLedgerStateCmdArgs = QueryLedgerStateCmdArgs + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data QueryProtocolStateCmdArgs = QueryProtocolStateCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data QueryStakeSnapshotCmdArgs = QueryStakeSnapshotCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(AllOrOnly [Hash StakePoolKey]) - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , allOrOnlyPoolIds :: !(AllOrOnly [Hash StakePoolKey]) + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data QueryKesPeriodInfoCmdArgs = QueryKesPeriodInfoCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(File () In) - -- ^ Node operational certificate - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , nodeOpCert :: !(File () In) -- ^ Node operational certificate + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data QueryPoolStateCmdArgs = QueryPoolStateCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - ![Hash StakePoolKey] - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , poolid :: ![Hash StakePoolKey] + } deriving (Generic, Show) data QueryTxMempoolCmdArgs = QueryTxMempoolCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !TxMempoolQuery - !(Maybe (File () Out)) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , op :: !TxMempoolQuery + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data QuerySlotNumberCmdArgs = QuerySlotNumberCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !UTCTime - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , utcTime :: !UTCTime + } deriving (Generic, Show) renderQueryCmds :: QueryCmds era -> Text renderQueryCmds = \case @@ -182,7 +183,7 @@ renderQueryCmds = \case "query stake-address-info" QueryUTxOCmd {} -> "query utxo" - QueryDebugLedgerStateCmd {} -> + QueryLedgerStateCmd {} -> "query ledger-state" QueryProtocolStateCmd {} -> "query protocol-state" diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs index e14e3da817..36fcca6068 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs @@ -179,8 +179,8 @@ pQueryStakeAddressInfoCmd envCli = pQueryLedgerStateCmd :: EnvCli -> Parser (QueryCmds era) pQueryLedgerStateCmd envCli = - fmap QueryDebugLedgerStateCmd $ - QueryDebugLedgerStateCmdArgs + fmap QueryLedgerStateCmd $ + QueryLedgerStateCmdArgs <$> pSocketPath envCli <*> pConsensusModeParams <*> pNetworkId envCli diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs index 307f567232..1499ad36a7 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -42,7 +42,7 @@ import Cardano.Api.Byron hiding (QueryInShelleyBasedEra (..)) import qualified Cardano.Api.Ledger as Ledger import Cardano.Api.Shelley hiding (QueryInShelleyBasedEra (..)) -import Cardano.CLI.EraBased.Commands.Query +import qualified Cardano.CLI.EraBased.Commands.Query as Cmd import Cardano.CLI.EraBased.Run.Genesis (readAndDecodeShelleyGenesis) import Cardano.CLI.Helpers (pPrintCBOR) import Cardano.CLI.Pretty @@ -104,37 +104,37 @@ import Text.Printf (printf) {- HLINT ignore "Move brackets to avoid $" -} {- HLINT ignore "Redundant flip" -} -runQueryCmds :: QueryCmds era -> ExceptT QueryCmdError IO () +runQueryCmds :: Cmd.QueryCmds era -> ExceptT QueryCmdError IO () runQueryCmds = \case - QueryLeadershipScheduleCmd (QueryLeadershipScheduleCmdArgs mNodeSocketPath consensusModeParams network shelleyGenFp poolid vrkSkeyFp whichSchedule outputAs) -> + Cmd.QueryLeadershipScheduleCmd (Cmd.QueryLeadershipScheduleCmdArgs mNodeSocketPath consensusModeParams network shelleyGenFp poolid vrkSkeyFp whichSchedule outputAs) -> runQueryLeadershipScheduleCmd mNodeSocketPath consensusModeParams network shelleyGenFp poolid vrkSkeyFp whichSchedule outputAs - QueryProtocolParametersCmd (QueryProtocolParametersCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> + Cmd.QueryProtocolParametersCmd (Cmd.QueryProtocolParametersCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> runQueryProtocolParametersCmd mNodeSocketPath consensusModeParams network mOutFile - QueryConstitutionHashCmd (QueryConstitutionHashCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> + Cmd.QueryConstitutionHashCmd (Cmd.QueryConstitutionHashCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> runQueryConstitutionHashCmd mNodeSocketPath consensusModeParams network mOutFile - QueryTipCmd (QueryTipCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> + Cmd.QueryTipCmd (Cmd.QueryTipCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> runQueryTipCmd mNodeSocketPath consensusModeParams network mOutFile - QueryStakePoolsCmd (QueryStakePoolsCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> + Cmd.QueryStakePoolsCmd (Cmd.QueryStakePoolsCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> runQueryStakePoolsCmd mNodeSocketPath consensusModeParams network mOutFile - QueryStakeDistributionCmd (QueryStakeDistributionCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> + Cmd.QueryStakeDistributionCmd (Cmd.QueryStakeDistributionCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> runQueryStakeDistributionCmd mNodeSocketPath consensusModeParams network mOutFile - QueryStakeAddressInfoCmd (QueryStakeAddressInfoCmdArgs mNodeSocketPath consensusModeParams addr network mOutFile) -> + Cmd.QueryStakeAddressInfoCmd (Cmd.QueryStakeAddressInfoCmdArgs mNodeSocketPath consensusModeParams addr network mOutFile) -> runQueryStakeAddressInfoCmd mNodeSocketPath consensusModeParams addr network mOutFile - QueryDebugLedgerStateCmd (QueryDebugLedgerStateCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> + Cmd.QueryLedgerStateCmd (Cmd.QueryLedgerStateCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> runQueryLedgerStateCmd mNodeSocketPath consensusModeParams network mOutFile - QueryStakeSnapshotCmd (QueryStakeSnapshotCmdArgs mNodeSocketPath consensusModeParams network allOrOnlyPoolIds mOutFile) -> + Cmd.QueryStakeSnapshotCmd (Cmd.QueryStakeSnapshotCmdArgs mNodeSocketPath consensusModeParams network allOrOnlyPoolIds mOutFile) -> runQueryStakeSnapshotCmd mNodeSocketPath consensusModeParams network allOrOnlyPoolIds mOutFile - QueryProtocolStateCmd (QueryProtocolStateCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> + Cmd.QueryProtocolStateCmd (Cmd.QueryProtocolStateCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> runQueryProtocolStateCmd mNodeSocketPath consensusModeParams network mOutFile - QueryUTxOCmd (QueryUTxOCmdArgs mNodeSocketPath consensusModeParams qFilter networkId mOutFile) -> + Cmd.QueryUTxOCmd (Cmd.QueryUTxOCmdArgs mNodeSocketPath consensusModeParams qFilter networkId mOutFile) -> runQueryUTxOCmd mNodeSocketPath consensusModeParams qFilter networkId mOutFile - QueryKesPeriodInfoCmd (QueryKesPeriodInfoCmdArgs mNodeSocketPath consensusModeParams network nodeOpCert mOutFile) -> + Cmd.QueryKesPeriodInfoCmd (Cmd.QueryKesPeriodInfoCmdArgs mNodeSocketPath consensusModeParams network nodeOpCert mOutFile) -> runQueryKesPeriodInfoCmd mNodeSocketPath consensusModeParams network nodeOpCert mOutFile - QueryPoolStateCmd (QueryPoolStateCmdArgs mNodeSocketPath consensusModeParams network poolid) -> + Cmd.QueryPoolStateCmd (Cmd.QueryPoolStateCmdArgs mNodeSocketPath consensusModeParams network poolid) -> runQueryPoolStateCmd mNodeSocketPath consensusModeParams network poolid - QueryTxMempoolCmd (QueryTxMempoolCmdArgs mNodeSocketPath consensusModeParams network op mOutFile) -> + Cmd.QueryTxMempoolCmd (Cmd.QueryTxMempoolCmdArgs mNodeSocketPath consensusModeParams network op mOutFile) -> runQueryTxMempoolCmd mNodeSocketPath consensusModeParams network op mOutFile - QuerySlotNumberCmd (QuerySlotNumberCmdArgs mNodeSocketPath consensusModeParams network utcTime) -> + Cmd.QuerySlotNumberCmd (Cmd.QuerySlotNumberCmdArgs mNodeSocketPath consensusModeParams network utcTime) -> runQuerySlotNumberCmd mNodeSocketPath consensusModeParams network utcTime runQueryConstitutionHashCmd diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Query.hs b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Query.hs index 8535727dee..ac621cae0c 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Query.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Query.hs @@ -1,5 +1,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE LambdaCase #-} module Cardano.CLI.Legacy.Commands.Query @@ -50,119 +51,119 @@ data LegacyQueryCmds deriving (Generic, Show) data LegacyQueryLeadershipScheduleCmdArgs = LegacyQueryLeadershipScheduleCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !GenesisFile - !(VerificationKeyOrHashOrFile StakePoolKey) - !(SigningKeyFile In) - !EpochLeadershipSchedule - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , genesisFp :: !GenesisFile + , poolId :: !(VerificationKeyOrHashOrFile StakePoolKey) + , vrkSkeyFp :: !(SigningKeyFile In) + , whichSchedule :: !EpochLeadershipSchedule + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data LegacyQueryProtocolParametersCmdArgs = LegacyQueryProtocolParametersCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data LegacyQueryConstitutionHashCmdArgs = LegacyQueryConstitutionHashCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data LegacyQueryTipCmdArgs = LegacyQueryTipCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data LegacyQueryStakePoolsCmdArgs = LegacyQueryStakePoolsCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data LegacyQueryStakeDistributionCmdArgs = LegacyQueryStakeDistributionCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data LegacyQueryStakeAddressInfoCmdArgs = LegacyQueryStakeAddressInfoCmdArgs - !SocketPath - !AnyConsensusModeParams - !StakeAddress - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { mNodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , addr :: !StakeAddress + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data LegacyQueryUTxOCmdArgs = LegacyQueryUTxOCmdArgs - !SocketPath - !AnyConsensusModeParams - !QueryUTxOFilter - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , queryFilter :: !QueryUTxOFilter + , networkId :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data LegacyQueryLedgerStateCmdArgs = LegacyQueryLedgerStateCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data LegacyQueryProtocolStateCmdArgs = LegacyQueryProtocolStateCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data LegacyQueryStakeSnapshotCmdArgs = LegacyQueryStakeSnapshotCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(AllOrOnly [Hash StakePoolKey]) - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , allOrOnlyPoolIds :: !(AllOrOnly [Hash StakePoolKey]) + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data LegacyQueryKesPeriodInfoCmdArgs = LegacyQueryKesPeriodInfoCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !(File () In) - -- ^ Node operational certificate - !(Maybe (File () Out)) - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , nodeOpCert :: !(File () In) -- ^ Node operational certificate + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data LegacyQueryPoolStateCmdArgs = LegacyQueryPoolStateCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - ![Hash StakePoolKey] - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , poolid :: ![Hash StakePoolKey] + } deriving (Generic, Show) data LegacyQueryTxMempoolCmdArgs = LegacyQueryTxMempoolCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !TxMempoolQuery - !(Maybe (File () Out)) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , op :: !TxMempoolQuery + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) data LegacyQuerySlotNumberCmdArgs = LegacyQuerySlotNumberCmdArgs - !SocketPath - !AnyConsensusModeParams - !NetworkId - !UTCTime - deriving (Generic, Show) + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , network :: !NetworkId + , utcTime :: !UTCTime + } deriving (Generic, Show) renderLegacyQueryCmds :: LegacyQueryCmds -> Text renderLegacyQueryCmds = \case diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Query.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Query.hs index 5d3ee24dd3..e6f90f3ec7 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Query.hs @@ -12,7 +12,7 @@ import Cardano.Api hiding (QueryInShelleyBasedEra (..)) import Cardano.Api.Shelley hiding (QueryInShelleyBasedEra (..)) import qualified Cardano.CLI.EraBased.Run.Query as EraBased -import Cardano.CLI.Legacy.Commands.Query +import qualified Cardano.CLI.Legacy.Commands.Query as Cmd import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.QueryCmdError import Cardano.CLI.Types.Key (VerificationKeyOrHashOrFile) @@ -20,52 +20,52 @@ import Cardano.CLI.Types.Key (VerificationKeyOrHashOrFile) import Control.Monad.Trans.Except import Data.Time.Clock -runLegacyQueryCmds :: LegacyQueryCmds -> ExceptT QueryCmdError IO () +runLegacyQueryCmds :: Cmd.LegacyQueryCmds -> ExceptT QueryCmdError IO () runLegacyQueryCmds = \case - QueryLeadershipScheduleCmd - (LegacyQueryLeadershipScheduleCmdArgs mNodeSocketPath consensusModeParams network shelleyGenFp poolid vrkSkeyFp whichSchedule outputAs) -> + Cmd.QueryLeadershipScheduleCmd + (Cmd.LegacyQueryLeadershipScheduleCmdArgs mNodeSocketPath consensusModeParams network shelleyGenFp poolid vrkSkeyFp whichSchedule outputAs) -> runLegacyQueryLeadershipScheduleCmd mNodeSocketPath consensusModeParams network shelleyGenFp poolid vrkSkeyFp whichSchedule outputAs - QueryProtocolParametersCmd - (LegacyQueryProtocolParametersCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> + Cmd.QueryProtocolParametersCmd + (Cmd.LegacyQueryProtocolParametersCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> runLegacyQueryProtocolParametersCmd mNodeSocketPath consensusModeParams network mOutFile - QueryConstitutionHashCmd - (LegacyQueryConstitutionHashCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> + Cmd.QueryConstitutionHashCmd + (Cmd.LegacyQueryConstitutionHashCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> runLegacyQueryConstitutionHashCmd mNodeSocketPath consensusModeParams network mOutFile - QueryTipCmd - (LegacyQueryTipCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> + Cmd.QueryTipCmd + (Cmd.LegacyQueryTipCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> runLegacyQueryTipCmd mNodeSocketPath consensusModeParams network mOutFile - QueryStakePoolsCmd - (LegacyQueryStakePoolsCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> + Cmd.QueryStakePoolsCmd + (Cmd.LegacyQueryStakePoolsCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> runLegacyQueryStakePoolsCmd mNodeSocketPath consensusModeParams network mOutFile - QueryStakeDistributionCmd - (LegacyQueryStakeDistributionCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> + Cmd.QueryStakeDistributionCmd + (Cmd.LegacyQueryStakeDistributionCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> runLegacyQueryStakeDistributionCmd mNodeSocketPath consensusModeParams network mOutFile - QueryStakeAddressInfoCmd - (LegacyQueryStakeAddressInfoCmdArgs mNodeSocketPath consensusModeParams addr network mOutFile) -> + Cmd.QueryStakeAddressInfoCmd + (Cmd.LegacyQueryStakeAddressInfoCmdArgs mNodeSocketPath consensusModeParams addr network mOutFile) -> runLegacyQueryStakeAddressInfoCmd mNodeSocketPath consensusModeParams addr network mOutFile - QueryLedgerStateCmd - (LegacyQueryLedgerStateCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> + Cmd.QueryLedgerStateCmd + (Cmd.LegacyQueryLedgerStateCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> runLegacyQueryLedgerStateCmd mNodeSocketPath consensusModeParams network mOutFile - QueryStakeSnapshotCmd - (LegacyQueryStakeSnapshotCmdArgs mNodeSocketPath consensusModeParams network allOrOnlyPoolIds mOutFile) -> + Cmd.QueryStakeSnapshotCmd + (Cmd.LegacyQueryStakeSnapshotCmdArgs mNodeSocketPath consensusModeParams network allOrOnlyPoolIds mOutFile) -> runLegacyQueryStakeSnapshotCmd mNodeSocketPath consensusModeParams network allOrOnlyPoolIds mOutFile - QueryProtocolStateCmd - (LegacyQueryProtocolStateCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> + Cmd.QueryProtocolStateCmd + (Cmd.LegacyQueryProtocolStateCmdArgs mNodeSocketPath consensusModeParams network mOutFile) -> runLegacyQueryProtocolStateCmd mNodeSocketPath consensusModeParams network mOutFile - QueryUTxOCmd - (LegacyQueryUTxOCmdArgs mNodeSocketPath consensusModeParams qFilter networkId mOutFile) -> + Cmd.QueryUTxOCmd + (Cmd.LegacyQueryUTxOCmdArgs mNodeSocketPath consensusModeParams qFilter networkId mOutFile) -> runLegacyQueryUTxOCmd mNodeSocketPath consensusModeParams qFilter networkId mOutFile - QueryKesPeriodInfoCmd - (LegacyQueryKesPeriodInfoCmdArgs mNodeSocketPath consensusModeParams network nodeOpCert mOutFile) -> + Cmd.QueryKesPeriodInfoCmd + (Cmd.LegacyQueryKesPeriodInfoCmdArgs mNodeSocketPath consensusModeParams network nodeOpCert mOutFile) -> runLegacyQueryKesPeriodInfoCmd mNodeSocketPath consensusModeParams network nodeOpCert mOutFile - QueryPoolStateCmd - (LegacyQueryPoolStateCmdArgs mNodeSocketPath consensusModeParams network poolid) -> + Cmd.QueryPoolStateCmd + (Cmd.LegacyQueryPoolStateCmdArgs mNodeSocketPath consensusModeParams network poolid) -> runLegacyQueryPoolStateCmd mNodeSocketPath consensusModeParams network poolid - QueryTxMempoolCmd - (LegacyQueryTxMempoolCmdArgs mNodeSocketPath consensusModeParams network op mOutFile) -> + Cmd.QueryTxMempoolCmd + (Cmd.LegacyQueryTxMempoolCmdArgs mNodeSocketPath consensusModeParams network op mOutFile) -> runLegacyQueryTxMempoolCmd mNodeSocketPath consensusModeParams network op mOutFile - QuerySlotNumberCmd - (LegacyQuerySlotNumberCmdArgs mNodeSocketPath consensusModeParams network utcTime) -> + Cmd.QuerySlotNumberCmd + (Cmd.LegacyQuerySlotNumberCmdArgs mNodeSocketPath consensusModeParams network utcTime) -> runLegacyQuerySlotNumberCmd mNodeSocketPath consensusModeParams network utcTime runLegacyQueryConstitutionHashCmd :: ()