diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Genesis.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Genesis.hs index 7f10967d4c..f9b99eec00 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Genesis.hs @@ -9,6 +9,7 @@ module Cardano.CLI.EraBased.Commands.Genesis , GenesisCreateStakedCmdArgs (..) , GenesisKeyGenGenesisCmdArgs (..) , GenesisKeyGenDelegateCmdArgs (..) + , GenesisKeyGenUTxOCmdArgs (..) , renderGenesisCmds ) where @@ -25,9 +26,7 @@ data GenesisCmds era | GenesisCreateStaked !GenesisCreateStakedCmdArgs | GenesisKeyGenGenesis !GenesisKeyGenGenesisCmdArgs | GenesisKeyGenDelegate !GenesisKeyGenDelegateCmdArgs - | GenesisKeyGenUTxO - (VerificationKeyFile Out) - (SigningKeyFile Out) + | GenesisKeyGenUTxO !GenesisKeyGenUTxOCmdArgs | GenesisCmdKeyHash (VerificationKeyFile In) | GenesisVerKey @@ -100,6 +99,12 @@ data GenesisKeyGenDelegateCmdArgs = GenesisKeyGenDelegateCmdArgs , opCertCounterPath :: !(OpCertCounterFile Out) } deriving Show +data GenesisKeyGenUTxOCmdArgs = GenesisKeyGenUTxOCmdArgs + { verificationKeyPath :: !(VerificationKeyFile Out) + , signingKeyPath :: !(SigningKeyFile Out) + } deriving Show + + renderGenesisCmds :: GenesisCmds era -> Text renderGenesisCmds = \case GenesisCreate {} -> diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Genesis.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Genesis.hs index 46b824fd95..70a2b34671 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Genesis.hs @@ -107,7 +107,7 @@ pGenesisDelegateKeyGen = pGenesisUTxOKeyGen :: Parser (GenesisCmds era) pGenesisUTxOKeyGen = - GenesisKeyGenUTxO + fmap GenesisKeyGenUTxO $ GenesisKeyGenUTxOCmdArgs <$> pVerificationKeyFileOut <*> pSigningKeyFileOut diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs index e46d958028..3af2f335b9 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs @@ -147,8 +147,8 @@ runGenesisCmds = \case runGenesisKeyGenGenesisCmd args GenesisKeyGenDelegate args -> runGenesisKeyGenDelegateCmd args - GenesisKeyGenUTxO vk sk -> - runGenesisKeyGenUTxOCmd vk sk + GenesisKeyGenUTxO args -> + runGenesisKeyGenUTxOCmd args GenesisCmdKeyHash vk -> runGenesisKeyHashCmd vk GenesisVerKey vk sk -> @@ -248,20 +248,23 @@ runGenesisKeyGenDelegateVRF vkeyPath skeyPath = do vkeyDesc = "VRF Verification Key" -runGenesisKeyGenUTxOCmd :: - VerificationKeyFile Out - -> SigningKeyFile Out +runGenesisKeyGenUTxOCmd + :: GenesisKeyGenUTxOCmdArgs -> ExceptT GenesisCmdError IO () -runGenesisKeyGenUTxOCmd vkeyPath skeyPath = do +runGenesisKeyGenUTxOCmd + Cmd.GenesisKeyGenUTxOCmdArgs + { Cmd.verificationKeyPath + , Cmd.signingKeyPath + } = do skey <- liftIO $ generateSigningKey AsGenesisUTxOKey let vkey = getVerificationKey skey firstExceptT GenesisCmdGenesisFileError . newExceptT - $ writeLazyByteStringFile skeyPath + $ writeLazyByteStringFile signingKeyPath $ textEnvelopeToJSON (Just skeyDesc) skey firstExceptT GenesisCmdGenesisFileError . newExceptT - $ writeLazyByteStringFile vkeyPath + $ writeLazyByteStringFile verificationKeyPath $ textEnvelopeToJSON (Just vkeyDesc) vkey where skeyDesc, vkeyDesc :: TextEnvelopeDescr @@ -834,8 +837,10 @@ createUtxoKeys dir index = do liftIO $ createDirectoryIfMissing False dir let strIndex = show index runGenesisKeyGenUTxOCmd - (File @(VerificationKey ()) $ dir "utxo" ++ strIndex ++ ".vkey") - (File @(SigningKey ()) $ dir "utxo" ++ strIndex ++ ".skey") + Cmd.GenesisKeyGenUTxOCmdArgs + { Cmd.verificationKeyPath = File @(VerificationKey ()) $ dir "utxo" ++ strIndex ++ ".vkey" + , Cmd.signingKeyPath = File @(SigningKey ()) $ dir "utxo" ++ strIndex ++ ".skey" + } createPoolCredentials :: KeyOutputFormat -> FilePath -> Word -> ExceptT GenesisCmdError IO () createPoolCredentials fmt dir index = do diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Genesis.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Genesis.hs index 4872bbeb24..0e807eaf1a 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Genesis.hs @@ -69,7 +69,12 @@ runLegacyGenesisKeyGenUTxOCmd :: () => VerificationKeyFile Out -> SigningKeyFile Out -> ExceptT GenesisCmdError IO () -runLegacyGenesisKeyGenUTxOCmd = runGenesisKeyGenUTxOCmd +runLegacyGenesisKeyGenUTxOCmd vk sk = + runGenesisKeyGenUTxOCmd + Cmd.GenesisKeyGenUTxOCmdArgs + { Cmd.verificationKeyPath = vk + , Cmd.signingKeyPath = sk + } runLegacyGenesisKeyHashCmd :: VerificationKeyFile In -> ExceptT GenesisCmdError IO () runLegacyGenesisKeyHashCmd = runGenesisKeyHashCmd