From 8109dd3099dc5b63ef55423c0d8f7295945ce143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Tue, 6 Aug 2024 11:14:23 +0200 Subject: [PATCH 1/6] Make "[era] transaction view" command fail and advice to use "debug transaction view" instead --- .../CLI/EraBased/Commands/Transaction.hs | 4 --- .../CLI/EraBased/Options/Transaction.hs | 13 ++------ .../Cardano/CLI/EraBased/Run/Transaction.hs | 32 ++++--------------- .../src/Cardano/CLI/Legacy/Run/Transaction.hs | 12 +++---- 4 files changed, 13 insertions(+), 48 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs index 0544d0c28e..62e359db9b 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs @@ -248,10 +248,6 @@ newtype TransactionTxIdCmdArgs = TransactionTxIdCmdArgs deriving Show data TransactionViewCmdArgs = TransactionViewCmdArgs - { outputFormat :: !ViewOutputFormat - , mOutFile :: !(Maybe (File () Out)) - , inputTxBodyOrTxFile :: !InputTxBodyOrTxFile - } deriving Show renderTransactionCmds :: TransactionCmds era -> Text diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs index 1d7c7acd84..c503b64986 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs @@ -99,8 +99,9 @@ pTransactionCmds era envCli = Opt.progDesc "Print a transaction identifier." , Just $ subParser "view" $ - Opt.info pTransactionView $ - Opt.progDesc "Print a transaction." + Opt.info + (pure $ TransactionViewCmd TransactionViewCmdArgs) + (Opt.progDesc "This command has been removed. Please use \"debug transaction view\" instead.") ] -- Backwards compatible parsers @@ -376,11 +377,3 @@ pTransactionId = fmap TransactionTxIdCmd $ TransactionTxIdCmdArgs <$> pInputTxOrTxBodyFile - -pTransactionView :: Parser (TransactionCmds era) -pTransactionView = - fmap TransactionViewCmd $ - TransactionViewCmdArgs - <$> pTxViewOutputFormat - <*> pMaybeOutputFile - <*> pInputTxOrTxBodyFile diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index fb135e0d5c..14aa2470e7 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -44,8 +44,6 @@ import qualified Cardano.Chain.Common as Byron import qualified Cardano.CLI.EraBased.Commands.Transaction as Cmd import Cardano.CLI.EraBased.Run.Genesis.Common (readProtocolParameters) import Cardano.CLI.EraBased.Run.Query -import Cardano.CLI.Json.Friendly (friendlyTx, friendlyTxBody, - viewOutputFormatToFriendlyFormat) import Cardano.CLI.Read import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.BootstrapWitnessError @@ -79,6 +77,7 @@ import qualified Data.Text as Text import qualified Data.Text.IO as Text import Data.Type.Equality (TestEquality (..)) import Lens.Micro ((^.)) +import qualified System.Exit as IO import qualified System.IO as IO runTransactionCmds :: Cmd.TransactionCmds era -> ExceptT TxCmdError IO () @@ -1698,30 +1697,11 @@ runTransactionViewCmd => Cmd.TransactionViewCmdArgs -> ExceptT TxCmdError IO () runTransactionViewCmd - Cmd.TransactionViewCmdArgs - { outputFormat - , mOutFile - , inputTxBodyOrTxFile - } = - case inputTxBodyOrTxFile of - InputTxBodyFile (File txbodyFilePath) -> do - txbodyFile <- liftIO $ fileOrPipe txbodyFilePath - unwitnessed <- - firstExceptT TxCmdTextEnvCddlError . newExceptT $ - readFileTxBody txbodyFile - InAnyShelleyBasedEra era txbody <- pure $ unIncompleteCddlTxBody unwitnessed - -- Why are we differentiating between a transaction body and a transaction? - -- In the case of a transaction body, we /could/ simply call @makeSignedTransaction []@ - -- to get a transaction which would allow us to reuse friendlyTxBS. However, - -- this would mean that we'd have an empty list of witnesses mentioned in the output, which - -- is arguably not part of the transaction body. - firstExceptT TxCmdWriteFileError . newExceptT $ - friendlyTxBody (viewOutputFormatToFriendlyFormat outputFormat) mOutFile (toCardanoEra era) txbody - InputTxFile (File txFilePath) -> do - txFile <- liftIO $ fileOrPipe txFilePath - InAnyShelleyBasedEra era tx <- lift (readFileTx txFile) & onLeft (left . TxCmdTextEnvCddlError) - firstExceptT TxCmdWriteFileError . newExceptT $ - friendlyTx (viewOutputFormatToFriendlyFormat outputFormat) mOutFile (toCardanoEra era) tx + Cmd.TransactionViewCmdArgs = + liftIO $ do + putStrLn + "Command \"era transaction view\" has been removed. Please use \"debug transaction view\" instead." + IO.exitWith (IO.ExitFailure 1) -- ---------------------------------------------------------------------------- -- Witness commands diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs index 54ad5bb09c..b9ec1ac508 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs @@ -511,15 +511,11 @@ runLegacyTransactionTxIdCmd txfile = runLegacyTransactionViewCmd :: ViewOutputFormat -> Maybe (File () Out) -> InputTxBodyOrTxFile -> ExceptT TxCmdError IO () runLegacyTransactionViewCmd - yamlOrJson - mOutFile - inputTxBodyOrTxFile = + _yamlOrJson + _mOutFile + _inputTxBodyOrTxFile = runTransactionViewCmd - ( Cmd.TransactionViewCmdArgs - yamlOrJson - mOutFile - inputTxBodyOrTxFile - ) + Cmd.TransactionViewCmdArgs runLegacyTransactionWitnessCmd :: () From 7062433409c5983f69cd5047c9877745cc5cc686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Tue, 6 Aug 2024 11:14:38 +0200 Subject: [PATCH 2/6] Adapt golden files --- .../cardano-cli-golden/files/golden/help.cli | 56 +++++-------------- .../files/golden/help/allegra_transaction.cli | 3 +- .../golden/help/allegra_transaction_view.cli | 16 ------ .../files/golden/help/alonzo_transaction.cli | 3 +- .../golden/help/alonzo_transaction_view.cli | 16 ------ .../files/golden/help/babbage_transaction.cli | 3 +- .../golden/help/babbage_transaction_view.cli | 16 ------ .../files/golden/help/conway_transaction.cli | 3 +- .../golden/help/conway_transaction_view.cli | 16 ------ .../files/golden/help/latest_transaction.cli | 3 +- .../golden/help/latest_transaction_view.cli | 16 ------ .../files/golden/help/mary_transaction.cli | 3 +- .../golden/help/mary_transaction_view.cli | 16 ------ .../files/golden/help/shelley_transaction.cli | 3 +- .../golden/help/shelley_transaction_view.cli | 16 ------ 15 files changed, 28 insertions(+), 161 deletions(-) diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli index 3ebc59652c..177880d979 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -1206,13 +1206,9 @@ Usage: cardano-cli shelley transaction txid Print a transaction identifier. -Usage: cardano-cli shelley transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) +Usage: cardano-cli shelley transaction view - Print a transaction. + This command has been removed. Please use "debug transaction view" instead. Usage: cardano-cli allegra ( address @@ -2405,13 +2401,9 @@ Usage: cardano-cli allegra transaction txid Print a transaction identifier. -Usage: cardano-cli allegra transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) +Usage: cardano-cli allegra transaction view - Print a transaction. + This command has been removed. Please use "debug transaction view" instead. Usage: cardano-cli mary ( address @@ -3718,13 +3710,9 @@ Usage: cardano-cli mary transaction txid (--tx-body-file FILE | --tx-file FILE) Print a transaction identifier. -Usage: cardano-cli mary transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) +Usage: cardano-cli mary transaction view - Print a transaction. + This command has been removed. Please use "debug transaction view" instead. Usage: cardano-cli alonzo ( address @@ -5054,13 +5042,9 @@ Usage: cardano-cli alonzo transaction txid Print a transaction identifier. -Usage: cardano-cli alonzo transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) +Usage: cardano-cli alonzo transaction view - Print a transaction. + This command has been removed. Please use "debug transaction view" instead. Usage: cardano-cli babbage ( address @@ -6412,13 +6396,9 @@ Usage: cardano-cli babbage transaction txid Print a transaction identifier. -Usage: cardano-cli babbage transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) +Usage: cardano-cli babbage transaction view - Print a transaction. + This command has been removed. Please use "debug transaction view" instead. Usage: cardano-cli conway ( address @@ -8301,13 +8281,9 @@ Usage: cardano-cli conway transaction txid Print a transaction identifier. -Usage: cardano-cli conway transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) +Usage: cardano-cli conway transaction view - Print a transaction. + This command has been removed. Please use "debug transaction view" instead. Usage: cardano-cli latest ( address @@ -9656,13 +9632,9 @@ Usage: cardano-cli latest transaction txid Print a transaction identifier. -Usage: cardano-cli latest transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) +Usage: cardano-cli latest transaction view - Print a transaction. + This command has been removed. Please use "debug transaction view" instead. Usage: cardano-cli legacy Legacy commands diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction.cli index aedd2c5223..d90275a383 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction.cli @@ -40,4 +40,5 @@ Available commands: output. hash-script-data Calculate the hash of script data. txid Print a transaction identifier. - view Print a transaction. + view This command has been removed. Please use "debug + transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction_view.cli index 252dff085d..e69de29bb2 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction_view.cli @@ -1,16 +0,0 @@ -Usage: cardano-cli allegra transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) - - Print a transaction. - -Available options: - --output-json Format transaction view output to JSON. - --output-yaml Format transaction view output to YAML. Defaults to - JSON if unspecified. - --out-file FILE Optional output file. Default is to write to stdout. - --tx-body-file FILE Input filepath of the JSON TxBody. - --tx-file FILE Input filepath of the JSON Tx. - -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction.cli index f4069516e8..02c439dac0 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction.cli @@ -44,4 +44,5 @@ Available commands: output. hash-script-data Calculate the hash of script data. txid Print a transaction identifier. - view Print a transaction. + view This command has been removed. Please use "debug + transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction_view.cli index d1345af68e..e69de29bb2 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction_view.cli @@ -1,16 +0,0 @@ -Usage: cardano-cli alonzo transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) - - Print a transaction. - -Available options: - --output-json Format transaction view output to JSON. - --output-yaml Format transaction view output to YAML. Defaults to - JSON if unspecified. - --out-file FILE Optional output file. Default is to write to stdout. - --tx-body-file FILE Input filepath of the JSON TxBody. - --tx-file FILE Input filepath of the JSON Tx. - -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction.cli index d999ca5ec8..6c75fc62f4 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction.cli @@ -44,4 +44,5 @@ Available commands: output. hash-script-data Calculate the hash of script data. txid Print a transaction identifier. - view Print a transaction. + view This command has been removed. Please use "debug + transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction_view.cli index 1b05b01352..e69de29bb2 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction_view.cli @@ -1,16 +0,0 @@ -Usage: cardano-cli babbage transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) - - Print a transaction. - -Available options: - --output-json Format transaction view output to JSON. - --output-yaml Format transaction view output to YAML. Defaults to - JSON if unspecified. - --out-file FILE Optional output file. Default is to write to stdout. - --tx-body-file FILE Input filepath of the JSON TxBody. - --tx-file FILE Input filepath of the JSON Tx. - -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction.cli index 44c0dd0abe..27dfbf3302 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction.cli @@ -44,4 +44,5 @@ Available commands: output. hash-script-data Calculate the hash of script data. txid Print a transaction identifier. - view Print a transaction. + view This command has been removed. Please use "debug + transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction_view.cli index 06a13279d6..e69de29bb2 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction_view.cli @@ -1,16 +0,0 @@ -Usage: cardano-cli conway transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) - - Print a transaction. - -Available options: - --output-json Format transaction view output to JSON. - --output-yaml Format transaction view output to YAML. Defaults to - JSON if unspecified. - --out-file FILE Optional output file. Default is to write to stdout. - --tx-body-file FILE Input filepath of the JSON TxBody. - --tx-file FILE Input filepath of the JSON Tx. - -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction.cli index b420a63295..0a806a33ad 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction.cli @@ -44,4 +44,5 @@ Available commands: output. hash-script-data Calculate the hash of script data. txid Print a transaction identifier. - view Print a transaction. + view This command has been removed. Please use "debug + transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction_view.cli index c23692e67c..e69de29bb2 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction_view.cli @@ -1,16 +0,0 @@ -Usage: cardano-cli latest transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) - - Print a transaction. - -Available options: - --output-json Format transaction view output to JSON. - --output-yaml Format transaction view output to YAML. Defaults to - JSON if unspecified. - --out-file FILE Optional output file. Default is to write to stdout. - --tx-body-file FILE Input filepath of the JSON TxBody. - --tx-file FILE Input filepath of the JSON Tx. - -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction.cli index 24bfb695aa..3a5a5b6704 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction.cli @@ -44,4 +44,5 @@ Available commands: output. hash-script-data Calculate the hash of script data. txid Print a transaction identifier. - view Print a transaction. + view This command has been removed. Please use "debug + transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction_view.cli index aa83478e3a..e69de29bb2 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction_view.cli @@ -1,16 +0,0 @@ -Usage: cardano-cli mary transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) - - Print a transaction. - -Available options: - --output-json Format transaction view output to JSON. - --output-yaml Format transaction view output to YAML. Defaults to - JSON if unspecified. - --out-file FILE Optional output file. Default is to write to stdout. - --tx-body-file FILE Input filepath of the JSON TxBody. - --tx-file FILE Input filepath of the JSON Tx. - -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction.cli index 56647438fb..403262f8fb 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction.cli @@ -40,4 +40,5 @@ Available commands: output. hash-script-data Calculate the hash of script data. txid Print a transaction identifier. - view Print a transaction. + view This command has been removed. Please use "debug + transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction_view.cli index 2f67a19ba9..e69de29bb2 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction_view.cli @@ -1,16 +0,0 @@ -Usage: cardano-cli shelley transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) - - Print a transaction. - -Available options: - --output-json Format transaction view output to JSON. - --output-yaml Format transaction view output to YAML. Defaults to - JSON if unspecified. - --out-file FILE Optional output file. Default is to write to stdout. - --tx-body-file FILE Input filepath of the JSON TxBody. - --tx-file FILE Input filepath of the JSON Tx. - -h,--help Show this help text From cdc61ce0d3d046ba1372f115b927977eb85a6068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Tue, 6 Aug 2024 11:20:21 +0200 Subject: [PATCH 3/6] Make "transaction view" command fail and advice to use "debug transaction view" instead --- .../Cardano/CLI/Legacy/Commands/Transaction.hs | 3 --- cardano-cli/src/Cardano/CLI/Legacy/Options.hs | 7 ++----- .../src/Cardano/CLI/Legacy/Run/Transaction.hs | 16 ++++++---------- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs index b05c4c5bd5..8c8684cc9c 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs @@ -135,9 +135,6 @@ data LegacyTransactionCmds | TransactionTxIdCmd InputTxBodyOrTxFile | TransactionViewCmd - ViewOutputFormat - (Maybe (File () Out)) - InputTxBodyOrTxFile renderLegacyTransactionCmds :: LegacyTransactionCmds -> Text renderLegacyTransactionCmds = \case diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs index 3c3471cfdc..115ab0fcc2 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs @@ -300,7 +300,7 @@ pTransaction envCli = (Opt.info pTransactionId $ Opt.progDesc "Print a transaction identifier.") , subParser "view" $ Opt.info pTransactionView $ - Opt.progDesc "Print a transaction." + Opt.progDesc "This command has been removed. Please use \"debug transaction view\" instead." ] where -- Backwards compatible parsers @@ -488,10 +488,7 @@ pTransaction envCli = pTransactionView :: Parser LegacyTransactionCmds pTransactionView = - TransactionViewCmd - <$> pTxViewOutputFormat - <*> pMaybeOutputFile - <*> pInputTxOrTxBodyFile + pure TransactionViewCmd pNodeCmds :: Parser LegacyNodeCmds pNodeCmds = diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs index b9ec1ac508..11cb62998b 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs @@ -152,8 +152,8 @@ runLegacyTransactionCmds = \case runLegacyTransactionHashScriptDataCmd scriptDataOrFile TransactionTxIdCmd txinfile -> runLegacyTransactionTxIdCmd txinfile - TransactionViewCmd yamlOrJson mOutFile txinfile -> - runLegacyTransactionViewCmd yamlOrJson mOutFile txinfile + TransactionViewCmd -> + runLegacyTransactionViewCmd TransactionPolicyIdCmd sFile -> runLegacyTransactionPolicyIdCmd sFile TransactionWitnessCmd txBodyfile witSignData mbNw outFile -> @@ -508,14 +508,10 @@ runLegacyTransactionTxIdCmd txfile = txfile ) -runLegacyTransactionViewCmd - :: ViewOutputFormat -> Maybe (File () Out) -> InputTxBodyOrTxFile -> ExceptT TxCmdError IO () -runLegacyTransactionViewCmd - _yamlOrJson - _mOutFile - _inputTxBodyOrTxFile = - runTransactionViewCmd - Cmd.TransactionViewCmdArgs +runLegacyTransactionViewCmd :: ExceptT TxCmdError IO () +runLegacyTransactionViewCmd = + runTransactionViewCmd + Cmd.TransactionViewCmdArgs runLegacyTransactionWitnessCmd :: () From 860c43c797e79d03ecf6603c4fadf28dc821cc50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Tue, 6 Aug 2024 11:20:27 +0200 Subject: [PATCH 4/6] Adapt golden files --- .../cardano-cli-golden/files/golden/help.cli | 14 ++++---------- .../files/golden/help/legacy_transaction.cli | 3 ++- .../golden/help/legacy_transaction_view.cli | 16 ---------------- .../files/golden/help/transaction.cli | 3 ++- .../files/golden/help/transaction_view.cli | 14 -------------- 5 files changed, 8 insertions(+), 42 deletions(-) diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli index 177880d979..32cbf2cd40 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -10727,13 +10727,9 @@ Usage: cardano-cli legacy transaction txid Print a transaction identifier. -Usage: cardano-cli legacy transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) +Usage: cardano-cli legacy transaction view - Print a transaction. + This command has been removed. Please use "debug transaction view" instead. Usage: cardano-cli legacy key ( verification-key @@ -11988,11 +11984,9 @@ Usage: cardano-cli transaction txid (--tx-body-file FILE | --tx-file FILE) Print a transaction identifier. -Usage: cardano-cli transaction view [--output-json | --output-yaml] - [--out-file FILE] - (--tx-body-file FILE | --tx-file FILE) +Usage: cardano-cli transaction view - Print a transaction. + This command has been removed. Please use "debug transaction view" instead. Usage: cardano-cli key ( verification-key diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction.cli index b14d2fc707..f85ee539f1 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction.cli @@ -40,4 +40,5 @@ Available commands: output. hash-script-data Calculate the hash of script data. txid Print a transaction identifier. - view Print a transaction. + view This command has been removed. Please use "debug + transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction_view.cli index baaf1fcc69..e69de29bb2 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction_view.cli @@ -1,16 +0,0 @@ -Usage: cardano-cli legacy transaction view [--output-json | --output-yaml] - [--out-file FILE] - ( --tx-body-file FILE - | --tx-file FILE - ) - - Print a transaction. - -Available options: - --output-json Format transaction view output to JSON. - --output-yaml Format transaction view output to YAML. Defaults to - JSON if unspecified. - --out-file FILE Optional output file. Default is to write to stdout. - --tx-body-file FILE Input filepath of the JSON TxBody. - --tx-file FILE Input filepath of the JSON Tx. - -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction.cli index e4764fc013..96e8c293a1 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction.cli @@ -40,4 +40,5 @@ Available commands: output. hash-script-data Calculate the hash of script data. txid Print a transaction identifier. - view Print a transaction. + view This command has been removed. Please use "debug + transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction_view.cli index 2d70809c85..e69de29bb2 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction_view.cli @@ -1,14 +0,0 @@ -Usage: cardano-cli transaction view [--output-json | --output-yaml] - [--out-file FILE] - (--tx-body-file FILE | --tx-file FILE) - - Print a transaction. - -Available options: - --output-json Format transaction view output to JSON. - --output-yaml Format transaction view output to YAML. Defaults to - JSON if unspecified. - --out-file FILE Optional output file. Default is to write to stdout. - --tx-body-file FILE Input filepath of the JSON TxBody. - --tx-file FILE Input filepath of the JSON Tx. - -h,--help Show this help text From b748039c9ca055f6d91f202972473baad21896b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Tue, 6 Aug 2024 17:04:18 +0200 Subject: [PATCH 5/6] [era] transaction view: write error message to stderr --- cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index 14aa2470e7..d2a01e37dc 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -1699,7 +1699,8 @@ runTransactionViewCmd runTransactionViewCmd Cmd.TransactionViewCmdArgs = liftIO $ do - putStrLn + IO.hPutStrLn + IO.stderr "Command \"era transaction view\" has been removed. Please use \"debug transaction view\" instead." IO.exitWith (IO.ExitFailure 1) From a1042ac62b09ff5e578853da9d5cf75ad8af970b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Tue, 6 Aug 2024 17:04:43 +0200 Subject: [PATCH 6/6] Adapt golden files --- .../files/golden/help/allegra_transaction_view.cli | 1 + .../files/golden/help/alonzo_transaction_view.cli | 1 + .../files/golden/help/babbage_transaction_view.cli | 1 + .../files/golden/help/conway_transaction_view.cli | 1 + .../files/golden/help/latest_transaction_view.cli | 1 + .../files/golden/help/legacy_transaction_view.cli | 1 + .../files/golden/help/mary_transaction_view.cli | 1 + .../files/golden/help/shelley_transaction_view.cli | 1 + .../cardano-cli-golden/files/golden/help/transaction_view.cli | 1 + 9 files changed, 9 insertions(+) diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction_view.cli index e69de29bb2..9f804c4d65 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction_view.cli @@ -0,0 +1 @@ +Command "era transaction view" has been removed. Please use "debug transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction_view.cli index e69de29bb2..9f804c4d65 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction_view.cli @@ -0,0 +1 @@ +Command "era transaction view" has been removed. Please use "debug transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction_view.cli index e69de29bb2..9f804c4d65 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction_view.cli @@ -0,0 +1 @@ +Command "era transaction view" has been removed. Please use "debug transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction_view.cli index e69de29bb2..9f804c4d65 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction_view.cli @@ -0,0 +1 @@ +Command "era transaction view" has been removed. Please use "debug transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction_view.cli index e69de29bb2..9f804c4d65 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction_view.cli @@ -0,0 +1 @@ +Command "era transaction view" has been removed. Please use "debug transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction_view.cli index e69de29bb2..9f804c4d65 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction_view.cli @@ -0,0 +1 @@ +Command "era transaction view" has been removed. Please use "debug transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction_view.cli index e69de29bb2..9f804c4d65 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction_view.cli @@ -0,0 +1 @@ +Command "era transaction view" has been removed. Please use "debug transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction_view.cli index e69de29bb2..9f804c4d65 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction_view.cli @@ -0,0 +1 @@ +Command "era transaction view" has been removed. Please use "debug transaction view" instead. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction_view.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction_view.cli index e69de29bb2..9f804c4d65 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction_view.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction_view.cli @@ -0,0 +1 @@ +Command "era transaction view" has been removed. Please use "debug transaction view" instead.