diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs index ba0c1dcfd5..07e25a8565 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs @@ -62,7 +62,6 @@ import Control.Exception (evaluate) import Control.Monad (forM, forM_, unless, when) import Data.Aeson hiding (Key) import qualified Data.Aeson as Aeson -import Data.Aeson.Encode.Pretty (encodePretty) import qualified Data.Aeson.KeyMap as Aeson import Data.Bifunctor (Bifunctor (..)) import Data.ByteString (ByteString) @@ -275,9 +274,12 @@ runGenesisCreateCmd [] template - void $ TN.writeFileGenesis (rootdir "genesis.json") $ WritePretty shelleyGenesis - void $ TN.writeFileGenesis (rootdir "genesis.alonzo.json") $ WritePretty alonzoGenesis - void $ TN.writeFileGenesis (rootdir "genesis.conway.json") $ WritePretty conwayGenesis + forM_ + [ ("genesis.json", WritePretty shelleyGenesis) + , ("genesis.alonzo.json", WritePretty alonzoGenesis) + , ("genesis.conway.json", WritePretty conwayGenesis) + ] + $ \(filename, genesis) -> TN.writeFileGenesis (rootdir filename) genesis where -- TODO: rationalise the naming convention on these genesis json files. @@ -685,10 +687,12 @@ runGenesisCreateStakedCmd stuffedUtxoAddrs template - liftIO $ LBS.writeFile (rootdir "genesis.json") $ encodePretty shelleyGenesis - - void $ TN.writeFileGenesis (rootdir "genesis.alonzo.json") $ WritePretty alonzoGenesis - void $ TN.writeFileGenesis (rootdir "genesis.conway.json") $ WritePretty conwayGenesis + forM_ + [ ("genesis.json", WritePretty shelleyGenesis) + , ("genesis.alonzo.json", WritePretty alonzoGenesis) + , ("genesis.conway.json", WritePretty conwayGenesis) + ] + $ \(filename, genesis) -> TN.writeFileGenesis (rootdir filename) genesis -- TODO: rationalise the naming convention on these genesis json files. liftIO $ diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/CreateTestnetData.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/CreateTestnetData.hs index b50c52f153..b896921ada 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/CreateTestnetData.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/CreateTestnetData.hs @@ -58,7 +58,6 @@ import Ouroboros.Consensus.Shelley.Node (ShelleyGenesisStaking (..)) import Control.DeepSeq (NFData, deepseq) import Control.Monad (forM, forM_, unless, void, when) -import qualified Data.Aeson as Aeson import qualified Data.Aeson.Encode.Pretty as Aeson import Data.Bifunctor (Bifunctor (..)) import Data.ByteString (ByteString) @@ -380,9 +379,12 @@ runGenesisCreateTestNetDataCmd shelleyGenesis -- Write genesis.json file to output - liftIO $ LBS.writeFile (outputDir "conway-genesis.json") $ Aeson.encode conwayGenesis' - liftIO $ LBS.writeFile (outputDir "shelley-genesis.json") $ Aeson.encode shelleyGenesis' - liftIO $ LBS.writeFile (outputDir "alonzo-genesis.json") $ Aeson.encode alonzoGenesis + forM_ + [ ("conway-genesis.json", WritePretty conwayGenesis') + , ("shelley-genesis.json", WritePretty shelleyGenesis') + , ("alonzo-genesis.json", WritePretty alonzoGenesis) + ] + $ \(filename, genesis) -> writeFileGenesis (outputDir filename) genesis where genesisDir = outputDir "genesis-keys" delegateDir = outputDir "delegate-keys"