From 570573bb55f6e7e419509f73cb89bc9a7655ae16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Fri, 29 Nov 2024 18:16:25 +0100 Subject: [PATCH] Share code of fields of queries --- .../Cardano/CLI/EraBased/Commands/Query.hs | 121 ++------ .../src/Cardano/CLI/EraBased/Options/Query.hs | 114 ++----- .../src/Cardano/CLI/EraBased/Run/Query.hs | 282 +++++++++++------- 3 files changed, 225 insertions(+), 292 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs index 74945dd815..e29df81b8b 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs @@ -5,6 +5,7 @@ module Cardano.CLI.EraBased.Commands.Query ( QueryCmds (..) + , QueryCommons (..) , QueryCommitteeMembersStateCmdArgs (..) , QueryLeadershipScheduleCmdArgs (..) , QueryProtocolParametersCmdArgs (..) @@ -67,17 +68,23 @@ data QueryCmds era | QueryTreasuryValueCmd !(QueryTreasuryValueCmdArgs era) deriving (Generic, Show) -data QueryLeadershipScheduleCmdArgs = QueryLeadershipScheduleCmdArgs +-- | Fields that are common to most queries +data QueryCommons = QueryCommons { nodeSocketPath :: !SocketPath , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId + , target :: !(Consensus.Target ChainPoint) + , mOutFile :: !(Maybe (File () Out)) + } + deriving (Generic, Show) + +data QueryLeadershipScheduleCmdArgs = QueryLeadershipScheduleCmdArgs + { commons :: !QueryCommons , genesisFp :: !GenesisFile , poolColdVerKeyFile :: !(VerificationKeyOrHashOrFile StakePoolKey) , vrkSkeyFp :: !(SigningKeyFile In) , whichSchedule :: !EpochLeadershipSchedule - , target :: !(Consensus.Target ChainPoint) , format :: Maybe OutputFormatJsonOrText - , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) @@ -89,102 +96,56 @@ data QueryProtocolParametersCmdArgs = QueryProtocolParametersCmdArgs } deriving (Generic, Show) -data QueryTipCmdArgs = QueryTipCmdArgs - { nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams - , networkId :: !NetworkId - , target :: !(Consensus.Target ChainPoint) - , mOutFile :: !(Maybe (File () Out)) - } +newtype QueryTipCmdArgs = QueryTipCmdArgs QueryCommons deriving (Generic, Show) data QueryStakePoolsCmdArgs = QueryStakePoolsCmdArgs - { nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams - , networkId :: !NetworkId - , target :: !(Consensus.Target ChainPoint) + { commons :: !QueryCommons , format :: Maybe OutputFormatJsonOrText - , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data QueryStakeDistributionCmdArgs = QueryStakeDistributionCmdArgs - { nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams - , networkId :: !NetworkId - , target :: !(Consensus.Target ChainPoint) + { commons :: !QueryCommons , format :: Maybe OutputFormatJsonOrText - , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data QueryStakeAddressInfoCmdArgs = QueryStakeAddressInfoCmdArgs - { nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams + { commons :: !QueryCommons , addr :: !StakeAddress - , networkId :: !NetworkId - , target :: !(Consensus.Target ChainPoint) - , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data QueryUTxOCmdArgs = QueryUTxOCmdArgs - { nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams + { commons :: !QueryCommons , queryFilter :: !QueryUTxOFilter - , networkId :: !NetworkId - , target :: !(Consensus.Target ChainPoint) , format :: Maybe OutputFormatJsonOrText - , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) -data QueryLedgerStateCmdArgs = QueryLedgerStateCmdArgs - { nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams - , networkId :: !NetworkId - , target :: !(Consensus.Target ChainPoint) - , mOutFile :: !(Maybe (File () Out)) - } +newtype QueryLedgerStateCmdArgs = QueryLedgerStateCmdArgs QueryCommons deriving (Generic, Show) -data QueryProtocolStateCmdArgs = QueryProtocolStateCmdArgs - { nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams - , networkId :: !NetworkId - , target :: !(Consensus.Target ChainPoint) - , mOutFile :: !(Maybe (File () Out)) - } +newtype QueryProtocolStateCmdArgs = QueryProtocolStateCmdArgs QueryCommons deriving (Generic, Show) data QueryStakeSnapshotCmdArgs = QueryStakeSnapshotCmdArgs - { nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams - , networkId :: !NetworkId + { commons :: !QueryCommons , allOrOnlyPoolIds :: !(AllOrOnly (Hash StakePoolKey)) - , target :: !(Consensus.Target ChainPoint) - , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data QueryKesPeriodInfoCmdArgs = QueryKesPeriodInfoCmdArgs - { nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams - , networkId :: !NetworkId + { commons :: !QueryCommons , nodeOpCertFp :: !(File () In) -- ^ Node operational certificate - , target :: !(Consensus.Target ChainPoint) - , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data QueryPoolStateCmdArgs = QueryPoolStateCmdArgs - { nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams - , networkId :: !NetworkId + { commons :: !QueryCommons , allOrOnlyPoolIds :: !(AllOrOnly (Hash StakePoolKey)) - , target :: !(Consensus.Target ChainPoint) - , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) @@ -207,80 +168,52 @@ data QuerySlotNumberCmdArgs = QuerySlotNumberCmdArgs deriving (Generic, Show) data QueryRefScriptSizeCmdArgs = QueryRefScriptSizeCmdArgs - { nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams + { commons :: !QueryCommons , transactionInputs :: !(Set TxIn) - , networkId :: !NetworkId - , target :: !(Consensus.Target ChainPoint) , format :: Maybe OutputFormatJsonOrText - , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data QueryNoArgCmdArgs era = QueryNoArgCmdArgs { eon :: !(ConwayEraOnwards era) - , nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams - , networkId :: !NetworkId - , target :: !(Consensus.Target ChainPoint) - , mOutFile :: !(Maybe (File () Out)) + , commons :: !QueryCommons } deriving Show data QueryDRepStateCmdArgs era = QueryDRepStateCmdArgs { eon :: !(ConwayEraOnwards era) - , nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams - , networkId :: !NetworkId + , commons :: !QueryCommons , drepHashSources :: !(AllOrOnly DRepHashSource) , includeStake :: !IncludeStake - , target :: !(Consensus.Target ChainPoint) - , mOutFile :: !(Maybe (File () Out)) } deriving Show data QueryDRepStakeDistributionCmdArgs era = QueryDRepStakeDistributionCmdArgs { eon :: !(ConwayEraOnwards era) - , nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams - , networkId :: !NetworkId + , commons :: !QueryCommons , drepHashSources :: !(AllOrOnly DRepHashSource) - , target :: !(Consensus.Target ChainPoint) - , mOutFile :: !(Maybe (File () Out)) } deriving Show data QuerySPOStakeDistributionCmdArgs era = QuerySPOStakeDistributionCmdArgs { eon :: !(ConwayEraOnwards era) - , nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams - , networkId :: !NetworkId + , commons :: !QueryCommons , spoHashSources :: !(AllOrOnly SPOHashSource) - , target :: !(Consensus.Target ChainPoint) - , mOutFile :: !(Maybe (File () Out)) } deriving Show data QueryCommitteeMembersStateCmdArgs era = QueryCommitteeMembersStateCmdArgs { eon :: !(ConwayEraOnwards era) - , nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams - , networkId :: !NetworkId + , commons :: !QueryCommons , committeeColdKeys :: ![VerificationKeyOrHashOrFileOrScriptHash CommitteeColdKey] , committeeHotKeys :: ![VerificationKeyOrHashOrFileOrScriptHash CommitteeHotKey] , memberStatuses :: ![MemberStatus] - , target :: !(Consensus.Target ChainPoint) - , mOutFile :: !(Maybe (File () Out)) } deriving Show data QueryTreasuryValueCmdArgs era = QueryTreasuryValueCmdArgs { eon :: !(ConwayEraOnwards era) - , nodeSocketPath :: !SocketPath - , consensusModeParams :: !ConsensusModeParams - , networkId :: !NetworkId - , target :: !(Consensus.Target ChainPoint) - , mOutFile :: !(Maybe (File () Out)) + , commons :: !QueryCommons } deriving Show diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs index 490e81bd0d..b78ca99ba3 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs @@ -283,76 +283,48 @@ pQueryTipCmd :: ShelleyBasedEra era -> EnvCli -> Parser (QueryCmds era) pQueryTipCmd era envCli = fmap QueryTipCmd $ QueryTipCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pTarget era - <*> pMaybeOutputFile + <$> pQueryCommons era envCli pQueryUTxOCmd :: ShelleyBasedEra era -> EnvCli -> Parser (QueryCmds era) pQueryUTxOCmd era envCli = fmap QueryUTxOCmd $ QueryUTxOCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams + <$> pQueryCommons era envCli <*> pQueryUTxOFilter - <*> pNetworkId envCli - <*> pTarget era <*> (optional $ pOutputFormatJsonOrText "utxo") - <*> pMaybeOutputFile pQueryStakePoolsCmd :: ShelleyBasedEra era -> EnvCli -> Parser (QueryCmds era) pQueryStakePoolsCmd era envCli = fmap QueryStakePoolsCmd $ QueryStakePoolsCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pTarget era + <$> pQueryCommons era envCli <*> (optional $ pOutputFormatJsonOrText "stake-pools") - <*> pMaybeOutputFile pQueryStakeDistributionCmd :: ShelleyBasedEra era -> EnvCli -> Parser (QueryCmds era) pQueryStakeDistributionCmd era envCli = fmap QueryStakeDistributionCmd $ QueryStakeDistributionCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pTarget era + <$> pQueryCommons era envCli <*> (optional $ pOutputFormatJsonOrText "stake-distribution") - <*> pMaybeOutputFile pQueryStakeAddressInfoCmd :: ShelleyBasedEra era -> EnvCli -> Parser (QueryCmds era) pQueryStakeAddressInfoCmd era envCli = fmap QueryStakeAddressInfoCmd $ QueryStakeAddressInfoCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams + <$> pQueryCommons era envCli <*> pFilterByStakeAddress - <*> pNetworkId envCli - <*> pTarget era - <*> pMaybeOutputFile pQueryLedgerStateCmd :: ShelleyBasedEra era -> EnvCli -> Parser (QueryCmds era) pQueryLedgerStateCmd era envCli = fmap QueryLedgerStateCmd $ QueryLedgerStateCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pTarget era - <*> pMaybeOutputFile + <$> pQueryCommons era envCli pQueryProtocolStateCmd :: ShelleyBasedEra era -> EnvCli -> Parser (QueryCmds era) pQueryProtocolStateCmd era envCli = fmap QueryProtocolStateCmd $ QueryProtocolStateCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pTarget era - <*> pMaybeOutputFile + <$> pQueryCommons era envCli pAllStakePoolsOrSome :: Parser (AllOrOnly (Hash StakePoolKey)) pAllStakePoolsOrSome = pAll <|> pOnly @@ -371,23 +343,15 @@ pQueryStakeSnapshotCmd :: ShelleyBasedEra era -> EnvCli -> Parser (QueryCmds era pQueryStakeSnapshotCmd era envCli = fmap QueryStakeSnapshotCmd $ QueryStakeSnapshotCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli + <$> pQueryCommons era envCli <*> pAllStakePoolsOrSome - <*> pTarget era - <*> pMaybeOutputFile pQueryPoolStateCmd :: ShelleyBasedEra era -> EnvCli -> Parser (QueryCmds era) pQueryPoolStateCmd era envCli = fmap QueryPoolStateCmd $ QueryPoolStateCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli + <$> pQueryCommons era envCli <*> pAllStakePoolsOrSome - <*> pTarget era - <*> pMaybeOutputFile pQueryTxMempoolCmd :: EnvCli -> Parser (QueryCmds era) pQueryTxMempoolCmd envCli = @@ -417,27 +381,19 @@ pLeadershipScheduleCmd :: ShelleyBasedEra era -> EnvCli -> Parser (QueryCmds era pLeadershipScheduleCmd era envCli = fmap QueryLeadershipScheduleCmd $ QueryLeadershipScheduleCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli + <$> pQueryCommons era envCli <*> pGenesisFile "Shelley genesis filepath" <*> pStakePoolVerificationKeyOrHashOrFile Nothing <*> pVrfSigningKeyFile <*> pWhichLeadershipSchedule - <*> pTarget era <*> (optional $ pOutputFormatJsonOrText "leadership-schedule") - <*> pMaybeOutputFile pKesPeriodInfoCmd :: ShelleyBasedEra era -> EnvCli -> Parser (QueryCmds era) pKesPeriodInfoCmd era envCli = fmap QueryKesPeriodInfoCmd $ QueryKesPeriodInfoCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli + <$> pQueryCommons era envCli <*> pOperationalCertificateFile - <*> pTarget era - <*> pMaybeOutputFile pQuerySlotNumberCmd :: ShelleyBasedEra era -> EnvCli -> Parser (QueryCmds era) pQuerySlotNumberCmd era envCli = @@ -460,13 +416,9 @@ pQueryRefScriptSizeCmd :: ShelleyBasedEra era -> EnvCli -> Parser (QueryCmds era pQueryRefScriptSizeCmd era envCli = fmap QueryRefScriptSizeCmd $ QueryRefScriptSizeCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams + <$> pQueryCommons era envCli <*> (fromList <$> some pByTxIn) - <*> pNetworkId envCli - <*> pTarget era <*> (optional $ pOutputFormatJsonOrText "reference inputs") - <*> pMaybeOutputFile where pByTxIn :: Parser TxIn pByTxIn = @@ -521,9 +473,7 @@ pQueryDRepStateCmd era envCli = do pQueryDRepStateCmdArgs :: ConwayEraOnwards era -> Parser (QueryDRepStateCmdArgs era) pQueryDRepStateCmdArgs w = QueryDRepStateCmdArgs w - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli + <$> pQueryCommons era envCli <*> pAllOrOnlyDRepHashSource <*> Opt.flag NoStake @@ -539,8 +489,6 @@ pQueryDRepStateCmd era envCli = do ] ] ) - <*> pTarget era - <*> optional pOutputFile pQueryDRepStakeDistributionCmd :: () @@ -558,12 +506,8 @@ pQueryDRepStakeDistributionCmd era envCli = do :: ConwayEraOnwards era -> Parser (QueryDRepStakeDistributionCmdArgs era) pQueryDRepStakeDistributionCmdArgs w = QueryDRepStakeDistributionCmdArgs w - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli + <$> pQueryCommons era envCli <*> pAllOrOnlyDRepHashSource - <*> pTarget era - <*> optional pOutputFile pQuerySPOStakeDistributionCmd :: () @@ -581,12 +525,8 @@ pQuerySPOStakeDistributionCmd era envCli = do :: ConwayEraOnwards era -> Parser (QuerySPOStakeDistributionCmdArgs era) pQuerySPOStakeDistributionCmdArgs w = QuerySPOStakeDistributionCmdArgs w - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli + <$> pQueryCommons era envCli <*> pAllOrOnlySPOHashSource - <*> pTarget era - <*> optional pOutputFile pQueryGetCommitteeStateCmd :: () @@ -604,14 +544,10 @@ pQueryGetCommitteeStateCmd era envCli = do :: ConwayEraOnwards era -> Parser (QueryCommitteeMembersStateCmdArgs era) pQueryCommitteeMembersStateArgs w = QueryCommitteeMembersStateCmdArgs w - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli + <$> pQueryCommons era envCli <*> many pCommitteeColdVerificationKeyOrHashOrFileOrScriptHash <*> many pCommitteeHotKeyOrHashOrFileOrScriptHash <*> many pMemberStatus - <*> pTarget era - <*> optional pOutputFile pCommitteeColdVerificationKeyOrHashOrFileOrScriptHash :: Parser (VerificationKeyOrHashOrFileOrScriptHash CommitteeColdKey) @@ -671,11 +607,7 @@ pQueryTreasuryValueCmd era envCli = do :: ConwayEraOnwards era -> Parser (QueryTreasuryValueCmdArgs era) pQueryTreasuryValueArgs w = QueryTreasuryValueCmdArgs w - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pTarget era - <*> optional pOutputFile + <$> pQueryCommons era envCli pQueryNoArgCmdArgs :: forall era @@ -685,8 +617,18 @@ pQueryNoArgCmdArgs -> Parser (QueryNoArgCmdArgs era) pQueryNoArgCmdArgs w envCli = QueryNoArgCmdArgs w + <$> pQueryCommons (inject w :: ShelleyBasedEra era) envCli + +pQueryCommons + :: forall era + . () + => ShelleyBasedEra era + -> EnvCli + -> Parser QueryCommons +pQueryCommons w envCli = + QueryCommons <$> pSocketPath envCli <*> pConsensusModeParams <*> pNetworkId envCli - <*> pTarget (inject w :: ShelleyBasedEra era) + <*> pTarget w <*> optional pOutputFile diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs index 20b5932970..10a81c9292 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -189,13 +189,16 @@ runQueryTipCmd => Cmd.QueryTipCmdArgs -> ExceptT QueryCmdError IO () runQueryTipCmd - Cmd.QueryTipCmdArgs - { Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId - , Cmd.target - , Cmd.mOutFile - } = do + ( Cmd.QueryTipCmdArgs + ( Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } + ) + ) = do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath eLocalState <- ExceptT $ @@ -286,15 +289,19 @@ runQueryUTxOCmd => Cmd.QueryUTxOCmdArgs -> ExceptT QueryCmdError IO () runQueryUTxOCmd - Cmd.QueryUTxOCmdArgs - { Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.queryFilter - , Cmd.networkId - , Cmd.target - , Cmd.format - , Cmd.mOutFile - } = do + ( Cmd.QueryUTxOCmdArgs + { Cmd.queryFilter + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } + , Cmd.format + } + ) = do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath join $ @@ -325,12 +332,15 @@ runQueryKesPeriodInfoCmd -> ExceptT QueryCmdError IO () runQueryKesPeriodInfoCmd Cmd.QueryKesPeriodInfoCmdArgs - { Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId - , Cmd.nodeOpCertFp - , Cmd.target - , Cmd.mOutFile + { Cmd.nodeOpCertFp + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } } = do opCert <- lift (readFileTextEnvelope AsOperationalCertificate nodeOpCertFp) @@ -631,12 +641,15 @@ runQueryPoolStateCmd -> ExceptT QueryCmdError IO () runQueryPoolStateCmd Cmd.QueryPoolStateCmdArgs - { Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId - , Cmd.allOrOnlyPoolIds - , Cmd.target - , Cmd.mOutFile + { Cmd.allOrOnlyPoolIds + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } } = do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath @@ -718,13 +731,16 @@ runQueryRefScriptSizeCmd -> ExceptT QueryCmdError IO () runQueryRefScriptSizeCmd Cmd.QueryRefScriptSizeCmdArgs - { Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.transactionInputs - , Cmd.networkId - , Cmd.target + { Cmd.transactionInputs + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } , Cmd.format - , Cmd.mOutFile } = do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath @@ -770,12 +786,15 @@ runQueryStakeSnapshotCmd -> ExceptT QueryCmdError IO () runQueryStakeSnapshotCmd Cmd.QueryStakeSnapshotCmdArgs - { Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId - , Cmd.allOrOnlyPoolIds - , Cmd.target - , Cmd.mOutFile + { Cmd.allOrOnlyPoolIds + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } } = do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath @@ -812,13 +831,16 @@ runQueryLedgerStateCmd => Cmd.QueryLedgerStateCmdArgs -> ExceptT QueryCmdError IO () runQueryLedgerStateCmd - Cmd.QueryLedgerStateCmdArgs - { Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId - , Cmd.target - , Cmd.mOutFile - } = do + ( Cmd.QueryLedgerStateCmdArgs + ( Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } + ) + ) = do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath join $ @@ -848,13 +870,16 @@ runQueryProtocolStateCmd => Cmd.QueryProtocolStateCmdArgs -> ExceptT QueryCmdError IO () runQueryProtocolStateCmd - Cmd.QueryProtocolStateCmdArgs - { Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId - , Cmd.target - , Cmd.mOutFile - } = do + ( Cmd.QueryProtocolStateCmdArgs + ( Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } + ) + ) = do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath join $ @@ -886,12 +911,15 @@ runQueryStakeAddressInfoCmd -> ExceptT QueryCmdError IO () runQueryStakeAddressInfoCmd Cmd.QueryStakeAddressInfoCmdArgs - { Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.addr = StakeAddress _ addr - , Cmd.networkId - , Cmd.target - , Cmd.mOutFile + { Cmd.addr = StakeAddress _ addr + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } } = do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath @@ -1230,12 +1258,15 @@ runQueryStakePoolsCmd -> ExceptT QueryCmdError IO () runQueryStakePoolsCmd Cmd.QueryStakePoolsCmdArgs - { Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId - , Cmd.target - , Cmd.format - , Cmd.mOutFile + { Cmd.format + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } } = do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath @@ -1300,12 +1331,15 @@ runQueryStakeDistributionCmd -> ExceptT QueryCmdError IO () runQueryStakeDistributionCmd Cmd.QueryStakeDistributionCmdArgs - { Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId - , Cmd.format - , Cmd.target - , Cmd.mOutFile + { Cmd.format + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } } = do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath @@ -1367,16 +1401,19 @@ runQueryLeadershipScheduleCmd -> ExceptT QueryCmdError IO () runQueryLeadershipScheduleCmd Cmd.QueryLeadershipScheduleCmdArgs - { Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId + { Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } , Cmd.genesisFp = GenesisFile genFile , Cmd.poolColdVerKeyFile , Cmd.vrkSkeyFp , Cmd.whichSchedule - , Cmd.target , Cmd.format - , Cmd.mOutFile } = do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath @@ -1555,11 +1592,14 @@ runQueryConstitution runQueryConstitution Cmd.QueryNoArgCmdArgs { Cmd.eon - , Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId - , Cmd.target - , Cmd.mOutFile + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } } = conwayEraOnwardsConstraints eon $ do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath constitution <- runQuery localNodeConnInfo target $ queryConstitution eon @@ -1571,11 +1611,14 @@ runQueryGovState runQueryGovState Cmd.QueryNoArgCmdArgs { Cmd.eon - , Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId - , Cmd.target - , Cmd.mOutFile + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } } = conwayEraOnwardsConstraints eon $ do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath govState <- runQuery localNodeConnInfo target $ queryGovState eon @@ -1587,13 +1630,16 @@ runQueryDRepState runQueryDRepState Cmd.QueryDRepStateCmdArgs { Cmd.eon - , Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId , Cmd.drepHashSources = drepHashSources' , Cmd.includeStake - , Cmd.target - , Cmd.mOutFile + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } } = conwayEraOnwardsConstraints eon $ do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath @@ -1634,12 +1680,15 @@ runQueryDRepStakeDistribution runQueryDRepStakeDistribution Cmd.QueryDRepStakeDistributionCmdArgs { Cmd.eon - , Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } , Cmd.drepHashSources = drepHashSources' - , Cmd.target - , Cmd.mOutFile } = conwayEraOnwardsConstraints eon $ do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath @@ -1662,12 +1711,15 @@ runQuerySPOStakeDistribution runQuerySPOStakeDistribution Cmd.QuerySPOStakeDistributionCmdArgs { Cmd.eon - , Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } , Cmd.spoHashSources = spoHashSources' - , Cmd.target - , Cmd.mOutFile } = conwayEraOnwardsConstraints eon $ do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath spoFromSource = firstExceptT QueryCmdSPOKeyError . readSPOCredential @@ -1687,11 +1739,14 @@ runQueryCommitteeMembersState runQueryCommitteeMembersState Cmd.QueryCommitteeMembersStateCmdArgs { Cmd.eon - , Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId - , Cmd.target - , Cmd.mOutFile + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } , Cmd.committeeColdKeys = coldCredKeys , Cmd.committeeHotKeys = hotCredKeys , Cmd.memberStatuses = memberStatuses @@ -1719,11 +1774,14 @@ runQueryTreasuryValue runQueryTreasuryValue Cmd.QueryTreasuryValueCmdArgs { Cmd.eon - , Cmd.nodeSocketPath - , Cmd.consensusModeParams - , Cmd.networkId - , Cmd.target - , Cmd.mOutFile + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + , Cmd.mOutFile + } } = conwayEraOnwardsConstraints eon $ do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath