Skip to content

Commit

Permalink
Remove OutputSerialisation datatype from cardano-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbo4350 committed Aug 11, 2022
1 parent 95fb53b commit 876a7be
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 37 deletions.
2 changes: 0 additions & 2 deletions cardano-cli/src/Cardano/CLI/Shelley/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ data TransactionCmd
[MetadataFile]
(Maybe ProtocolParamsSourceSpec)
(Maybe UpdateProposalFile)
OutputSerialisation
TxBodyFile

-- | Like 'TxBuildRaw' but without the fee, and with a change output.
Expand Down Expand Up @@ -233,7 +232,6 @@ data TransactionCmd
[MetadataFile]
(Maybe ProtocolParamsSourceSpec)
(Maybe UpdateProposalFile)
OutputSerialisation
TxBuildOutputOptions
| TxSign InputTxBodyOrTxFile [WitnessSigningData] (Maybe NetworkId) TxFile
| TxCreateWitness TxBodyFile WitnessSigningData (Maybe NetworkId) OutputFile
Expand Down
2 changes: 0 additions & 2 deletions cardano-cli/src/Cardano/CLI/Shelley/Parsers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,6 @@ pTransaction =
<*> many pMetadataFile
<*> optional pProtocolParamsSourceSpec
<*> optional pUpdateProposalFile
<*> pure OutputLedgerCDDLSerialisation
<*> (OutputTxBodyOnly <$> pTxBodyFile Output <|> pCalculatePlutusScriptCost)

pChangeAddress :: Parser TxOutChangeAddress
Expand Down Expand Up @@ -755,7 +754,6 @@ pTransaction =
<*> many pMetadataFile
<*> optional pProtocolParamsSourceSpec
<*> optional pUpdateProposalFile
<*> pure OutputLedgerCDDLSerialisation
<*> pTxBodyFile Output

pTransactionSign :: Parser TransactionCmd
Expand Down
36 changes: 12 additions & 24 deletions cardano-cli/src/Cardano/CLI/Shelley/Run/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -319,17 +319,17 @@ runTransactionCmd cmd =
TxBuild era consensusModeParams nid mScriptValidity mOverrideWits txins readOnlyRefIns
reqSigners txinsc mReturnColl mTotCollateral txouts changeAddr mValue mLowBound
mUpperBound certs wdrls metadataSchema scriptFiles metadataFiles mpparams
mUpProp outputFormat output ->
mUpProp output ->
runTxBuild era consensusModeParams nid mScriptValidity txins readOnlyRefIns txinsc
mReturnColl mTotCollateral txouts changeAddr mValue mLowBound
mUpperBound certs wdrls reqSigners metadataSchema scriptFiles
metadataFiles mpparams mUpProp outputFormat mOverrideWits output
metadataFiles mpparams mUpProp mOverrideWits output
TxBuildRaw era mScriptValidity txins readOnlyRefIns txinsc mReturnColl mTotColl reqSigners
txouts mValue mLowBound mUpperBound fee certs wdrls metadataSchema scriptFiles
metadataFiles mpparams mUpProp outputFormat out ->
metadataFiles mpparams mUpProp out ->
runTxBuildRaw era mScriptValidity txins readOnlyRefIns txinsc mReturnColl mTotColl txouts
mLowBound mUpperBound fee mValue certs wdrls reqSigners metadataSchema
scriptFiles metadataFiles mpparams mUpProp outputFormat out
scriptFiles metadataFiles mpparams mUpProp out
TxSign txinfile skfiles network txoutfile ->
runTxSign txinfile skfiles network txoutfile
TxSubmit anyConensusModeParams network txFp ->
Expand Down Expand Up @@ -385,7 +385,6 @@ runTxBuildRaw
-> [MetadataFile]
-> Maybe ProtocolParamsSourceSpec
-> Maybe UpdateProposalFile
-> OutputSerialisation
-> TxBodyFile
-> ExceptT ShelleyTxCmdError IO ()
runTxBuildRaw (AnyCardanoEra era)
Expand All @@ -397,7 +396,6 @@ runTxBuildRaw (AnyCardanoEra era)
certFiles withdrawals reqSigners
metadataSchema scriptFiles
metadataFiles mpparams mUpdatePropFile
outputFormat
(TxBodyFile fpath) = do

allReferenceInputs
Expand Down Expand Up @@ -428,14 +426,10 @@ runTxBuildRaw (AnyCardanoEra era)
txBody <-
firstExceptT ShelleyTxCmdTxBodyError . hoistEither $
makeTransactionBody txBodyContent
case outputFormat of
OutputCliSerialisation ->
firstExceptT ShelleyTxCmdWriteFileError . newExceptT $
writeFileTextEnvelope fpath Nothing txBody
OutputLedgerCDDLSerialisation ->
let noWitTx = makeSignedTransaction [] txBody
in firstExceptT ShelleyTxCmdWriteFileError . newExceptT $
writeTxFileTextEnvelopeCddl fpath noWitTx

let noWitTx = makeSignedTransaction [] txBody
firstExceptT ShelleyTxCmdWriteFileError . newExceptT $
writeTxFileTextEnvelopeCddl fpath noWitTx

getSbe :: Monad m => CardanoEraStyle era -> ExceptT ShelleyTxCmdError m (Api.ShelleyBasedEra era)
getSbe LegacyByronEra = left ShelleyTxCmdByronEra
Expand Down Expand Up @@ -492,14 +486,13 @@ runTxBuild
-> [MetadataFile]
-> Maybe ProtocolParamsSourceSpec
-> Maybe UpdateProposalFile
-> OutputSerialisation
-> Maybe Word
-> TxBuildOutputOptions
-> ExceptT ShelleyTxCmdError IO ()
runTxBuild (AnyCardanoEra era) (AnyConsensusModeParams cModeParams) networkId mScriptValidity
txins readOnlyRefIns txinsc mReturnCollateral mtotcoll txouts (TxOutChangeAddress changeAddr) mValue mLowerBound mUpperBound
certFiles withdrawals reqSigners metadataSchema scriptFiles metadataFiles mpparams
mUpdatePropFile outputFormat mOverrideWits outputOptions = do
mUpdatePropFile mOverrideWits outputOptions = do
SocketPath sockPath <- firstExceptT ShelleyTxCmdSocketEnvError readEnvSocketPath
let localNodeConnInfo = LocalNodeConnectInfo cModeParams networkId sockPath
consensusMode = consensusModeOnly cModeParams
Expand Down Expand Up @@ -596,14 +589,9 @@ runTxBuild (AnyCardanoEra era) (AnyConsensusModeParams cModeParams) networkId mS

Nothing -> left ShelleyTxCmdPParamExecutionUnitsNotAvailable
OutputTxBodyOnly (TxBodyFile fpath) ->
case outputFormat of
OutputCliSerialisation ->
firstExceptT ShelleyTxCmdWriteFileError . newExceptT $
writeFileTextEnvelope fpath Nothing balancedTxBody
OutputLedgerCDDLSerialisation ->
let noWitTx = makeSignedTransaction [] balancedTxBody
in firstExceptT ShelleyTxCmdWriteFileError . newExceptT $
writeTxFileTextEnvelopeCddl fpath noWitTx
let noWitTx = makeSignedTransaction [] balancedTxBody
in firstExceptT ShelleyTxCmdWriteFileError . newExceptT $
writeTxFileTextEnvelopeCddl fpath noWitTx

(CardanoMode, LegacyByronEra) -> left ShelleyTxCmdByronEra

Expand Down
9 changes: 0 additions & 9 deletions cardano-cli/src/Cardano/CLI/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module Cardano.CLI.Types
, OpCertNodeStateCounter (..)
, OpCertStartingKesPeriod (..)
, OutputFormat (..)
, OutputSerialisation (..)
, TxBuildOutputOptions(..)
, ReferenceScriptAnyEra (..)
, SigningKeyFile (..)
Expand Down Expand Up @@ -186,14 +185,6 @@ data OutputFormat
| OutputFormatBech32
deriving (Eq, Show)

-- | Specify whether to serialise a value according to the ledger's CDDL spec
-- or the cli's intermediate format. Note the intermediate format is defined
-- within SerialiseAsCBOR instances. The plan is to merge TextEnvelope with
-- SerialiseAsCBOR.
data OutputSerialisation
= OutputLedgerCDDLSerialisation
| OutputCliSerialisation
deriving Show

-- | This data structure is used to allow nicely formatted output within the query stake-snapshot command.
--
Expand Down

0 comments on commit 876a7be

Please sign in to comment.