From 4a84aa17d0a3a69db449d989d470381f1c82f81b Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Fri, 11 Oct 2024 10:22:13 -0400 Subject: [PATCH] Parameterize pGenesisCmds on ShelleyBasedEra era --- .../src/Cardano/CLI/EraBased/Commands.hs | 5 ++-- .../Cardano/CLI/EraBased/Options/Genesis.hs | 27 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands.hs index f2280e6a9f..225fca494f 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands.hs @@ -11,7 +11,7 @@ module Cardano.CLI.EraBased.Commands ) where -import Cardano.Api (ShelleyBasedEra (..), toCardanoEra) +import Cardano.Api (ShelleyBasedEra (..)) import Cardano.CLI.Commands.Address import Cardano.CLI.Commands.Key @@ -114,12 +114,11 @@ pAnyEraCommand envCli = pCmds :: ShelleyBasedEra era -> EnvCli -> Parser (Cmds era) pCmds sbe' envCli = do - let cEra = toCardanoEra sbe' asum $ catMaybes [ Just (AddressCmds <$> pAddressCmds envCli) , Just (KeyCmds <$> pKeyCmds) - , fmap GenesisCmds <$> pGenesisCmds cEra envCli + , fmap GenesisCmds <$> pGenesisCmds sbe' envCli , fmap GovernanceCmds <$> pGovernanceCmds sbe' , Just (NodeCmds <$> pNodeCmds) , fmap QueryCmds <$> pQueryCmds sbe' envCli diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Genesis.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Genesis.hs index 559d3e001f..18c64d6913 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Genesis.hs @@ -26,7 +26,7 @@ import qualified Options.Applicative as Opt pGenesisCmds :: () - => CardanoEra era + => ShelleyBasedEra era -> EnvCli -> Maybe (Parser (GenesisCmds era)) pGenesisCmds era envCli = @@ -65,15 +65,18 @@ pGenesisCmds era envCli = subParser "initial-txin" $ Opt.info (pGenesisTxIn envCli) $ Opt.progDesc "Get the TxIn for an initial UTxO based on the verification key" - , forEraInEonMaybe era $ \sbe -> - subParser "create-cardano" $ - Opt.info (pGenesisCreateCardano sbe envCli) $ - Opt.progDesc $ - mconcat - [ "Create a Byron and Shelley genesis file from a genesis " - , "template and genesis/delegation/spending keys." - ] - , forEraInEonMaybe era $ \sbe -> + , forShelleyBasedEraInEonMaybe + era + ( \sbe -> + subParser "create-cardano" $ + Opt.info (pGenesisCreateCardano sbe envCli) $ + Opt.progDesc $ + mconcat + [ "Create a Byron and Shelley genesis file from a genesis " + , "template and genesis/delegation/spending keys." + ] + ) + , forShelleyBasedEraInEonMaybe era $ \sbe -> subParser "create" $ Opt.info (pGenesisCreate sbe envCli) $ Opt.progDesc $ @@ -81,7 +84,7 @@ pGenesisCmds era envCli = [ "Create a Shelley genesis file from a genesis " , "template and genesis/delegation/spending keys." ] - , forEraInEonMaybe era $ \sbe -> + , forShelleyBasedEraInEonMaybe era $ \sbe -> subParser "create-staked" $ Opt.info (pGenesisCreateStaked sbe envCli) $ Opt.progDesc $ @@ -89,7 +92,7 @@ pGenesisCmds era envCli = [ "Create a staked Shelley genesis file from a genesis " , "template and genesis/delegation/spending keys." ] - , forEraInEonMaybe era $ \sbe -> + , forShelleyBasedEraInEonMaybe era $ \sbe -> subParser "create-testnet-data" $ Opt.info (pGenesisCreateTestNetData sbe envCli) $ Opt.progDesc $