Skip to content

Commit

Permalink
Update cli from refactors in cardano-api
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosLopezDeLara committed Jul 2, 2024
1 parent 28fdabd commit 4d56d79
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ pTransactionBuildCmd era envCli = do
Nothing
"Filepath of auxiliary script(s)")
<*> many pMetadataFile
<*> pFeatured (shelleyBasedToCardanoEra sbe) (optional pUpdateProposalFile)
<*> pFeatured (toCardanoEra sbe) (optional pUpdateProposalFile)
<*> pVoteFiles sbe AutoBalance
<*> pProposalFiles sbe AutoBalance
<*> pTreasuryDonation sbe
Expand Down Expand Up @@ -235,7 +235,7 @@ pTransactionBuildEstimateCmd era _envCli = do
Nothing
"Filepath of auxiliary script(s)")
<*> many pMetadataFile
<*> pFeatured (shelleyBasedToCardanoEra sbe) (optional pUpdateProposalFile)
<*> pFeatured (toCardanoEra sbe) (optional pUpdateProposalFile)
<*> pVoteFiles sbe ManualBalance
<*> pProposalFiles sbe ManualBalance
<*> pCurrentTreasuryValue sbe
Expand Down
7 changes: 3 additions & 4 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ runQueryProtocolParametersCmd
, Cmd.mOutFile
} = do
let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath
AnyCardanoEra era <- firstExceptT QueryCmdAcquireFailure $ newExceptT $ determineEra localNodeConnInfo
AnyCardanoEra era <- firstExceptT QueryCmdAcquireFailure $ determineEra localNodeConnInfo
sbe <- forEraInEon @ShelleyBasedEra era (left QueryCmdByronEra) pure
let qInMode = QueryInEra $ QueryInShelleyBasedEra sbe Api.QueryProtocolParameters
pp <- firstExceptT QueryCmdConvenienceError
. newExceptT $ executeQueryAnyMode localNodeConnInfo qInMode
$ executeQueryAnyMode localNodeConnInfo qInMode
writeProtocolParameters sbe mOutFile pp
where
writeProtocolParameters
Expand Down Expand Up @@ -654,8 +654,7 @@ runQueryTxMempoolCmd

localQuery <- case query of
TxMempoolQueryTxExists tx -> do
AnyCardanoEra era <- lift (determineEra localNodeConnInfo)
& onLeft (left . QueryCmdAcquireFailure)
AnyCardanoEra era <- modifyError QueryCmdAcquireFailure (determineEra localNodeConnInfo)
pure $ LocalTxMonitoringQueryTx $ TxIdInMode era tx
TxMempoolQueryNextTx -> pure LocalTxMonitoringSendNextTx
TxMempoolQueryInfo -> pure LocalTxMonitoringMempoolInformation
Expand Down
8 changes: 4 additions & 4 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ runTransactionBuildCmd
, treasuryDonation
, buildOutputOptions
} = shelleyBasedEraConstraints eon $ do
let era = shelleyBasedToCardanoEra eon
let era = toCardanoEra eon

-- The user can specify an era prior to the era that the node is currently in.
-- We cannot use the user specified era to construct a query against a node because it may differ
Expand Down Expand Up @@ -766,7 +766,7 @@ runTxBuild

-- TODO: All functions should be parameterized by ShelleyBasedEra
-- as it's not possible to call this function with ByronEra
let era = shelleyBasedToCardanoEra sbe
let era = toCardanoEra sbe
inputsThatRequireWitnessing = [input | (input,_) <- inputsAndMaybeScriptWits]

let allReferenceInputs = getAllReferenceInputs
Expand Down Expand Up @@ -1078,7 +1078,7 @@ toTxAlonzoDatum supp cliDatum =
sData <- firstExceptT TxCmdScriptDataError $ readScriptDataOrFile sDataOrFile
pure (TxOutDatumInTx supp sData)
TxOutInlineDatumByValue sDataOrFile -> do
let cEra = alonzoEraOnwardsToCardanoEra supp
let cEra = toCardanoEra supp
forEraInEon cEra (txFeatureMismatch cEra TxFeatureInlineDatums) $ \babbageOnwards -> do
sData <- firstExceptT TxCmdScriptDataError $ readScriptDataOrFile sDataOrFile
pure $ TxOutDatumInline babbageOnwards sData
Expand Down Expand Up @@ -1521,7 +1521,7 @@ runTransactionSignWitnessCmd
lift (readFileTxKeyWitness file) & onLeft (left . TxCmdCddlWitnessError)

case testEquality era era' of
Nothing -> left $ TxCmdWitnessEraMismatch (AnyCardanoEra $ shelleyBasedToCardanoEra era) (AnyCardanoEra $ shelleyBasedToCardanoEra era') witnessFile
Nothing -> left $ TxCmdWitnessEraMismatch (AnyCardanoEra $ toCardanoEra era) (AnyCardanoEra $ toCardanoEra era') witnessFile
Just Refl -> return witness
| witnessFile@(WitnessFile file) <- witnessFiles ]

Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ runLegacyTransactionBuildCmd
outputOptions = do

mUpdateProposalFile <-
validateUpdateProposalFile (shelleyBasedToCardanoEra sbe) mUpdateProposal
validateUpdateProposalFile (toCardanoEra sbe) mUpdateProposal
& hoistEither
& firstExceptT TxCmdNotSupportedInEraValidationError

Expand Down

0 comments on commit 4d56d79

Please sign in to comment.