Skip to content

Commit

Permalink
Merge pull request #119 from input-output-hk/newhoggy/rename-Cardano.…
Browse files Browse the repository at this point in the history
…CLI.Run.EraBased

Move more era-based code to under `Cardano.CLI.EraBased` module
  • Loading branch information
newhoggy authored Aug 5, 2023
2 parents aebdcce + 00fe0fa commit 2f36a1e
Show file tree
Hide file tree
Showing 14 changed files with 289 additions and 369 deletions.
7 changes: 3 additions & 4 deletions cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,19 @@ library
Cardano.CLI.Byron.Tx
Cardano.CLI.Byron.UpdateProposal
Cardano.CLI.Byron.Vote
Cardano.CLI.Commands.EraBased
Cardano.CLI.Commands.Governance
Cardano.CLI.Commands.Legacy
Cardano.CLI.Environment
Cardano.CLI.EraBased.Certificate
Cardano.CLI.EraBased.Commands
Cardano.CLI.EraBased.Commands.Governance
Cardano.CLI.EraBased.Commands.Governance.Committee
Cardano.CLI.EraBased.Governance
Cardano.CLI.EraBased.Legacy
Cardano.CLI.EraBased.Options.Common
Cardano.CLI.EraBased.Options.Governance
Cardano.CLI.EraBased.Options.Governance.Committee
Cardano.CLI.EraBased.Run
Cardano.CLI.EraBased.Run.Certificate
Cardano.CLI.EraBased.Run.Governance
Cardano.CLI.EraBased.Run.Governance.Committee
Cardano.CLI.EraBased.Vote
Expand All @@ -86,12 +87,10 @@ library
Cardano.CLI.Pretty
Cardano.CLI.Render
Cardano.CLI.Run
Cardano.CLI.Run.EraBased
Cardano.CLI.Run.Legacy
Cardano.CLI.Run.Legacy.Address
Cardano.CLI.Run.Legacy.Address.Info
Cardano.CLI.Run.Legacy.Genesis
Cardano.CLI.Run.Legacy.Governance
Cardano.CLI.Run.Legacy.Key
Cardano.CLI.Run.Legacy.Node
Cardano.CLI.Run.Legacy.Pool
Expand Down
8 changes: 4 additions & 4 deletions cardano-cli/src/Cardano/CLI/Commands/Governance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ data GovernanceCmdError
| GovernanceCmdVerifyPollError !GovernancePollError
| GovernanceCmdWriteFileError !(FileError ())
-- Legacy - remove me after cardano-cli transitions to new era based structure
| ShelleyGovernanceCmdMIRCertNotSupportedInConway
| ShelleyGovernanceCmdGenesisDelegationNotSupportedInConway
| GovernanceCmdMIRCertNotSupportedInConway
| GovernanceCmdGenesisDelegationNotSupportedInConway
deriving Show

instance Error GovernanceCmdError where
Expand Down Expand Up @@ -109,9 +109,9 @@ instance Error GovernanceCmdError where
toS (renderGovernancePollError pollError)
GovernanceCmdWriteFileError fileError ->
"Cannot write file: " <> displayError fileError
ShelleyGovernanceCmdMIRCertNotSupportedInConway ->
GovernanceCmdMIRCertNotSupportedInConway ->
"MIR certificates are not supported in Conway era onwards."
ShelleyGovernanceCmdGenesisDelegationNotSupportedInConway ->
GovernanceCmdGenesisDelegationNotSupportedInConway ->
"Genesis delegation is not supported in Conway era onwards."
where
renderDecoderError = toS . TL.toLazyText . B.build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}

module Cardano.CLI.Commands.EraBased
module Cardano.CLI.EraBased.Commands
( EraBasedCommand (..)
, AnyEraCommand (..)
, renderEraBasedCommand
Expand Down
1 change: 1 addition & 0 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Governance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import Data.String
import Options.Applicative
import qualified Options.Applicative as Opt

-- TODO: Conway era - move to Cardano.CLI.Conway.Parsers
pEraBasedGovernanceCmd :: EnvCli -> CardanoEra era -> Parser (EraBasedGovernanceCmd era)
pEraBasedGovernanceCmd envCli era =
asum $ catMaybes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}

module Cardano.CLI.Run.EraBased
module Cardano.CLI.EraBased.Run
( AnyEraCmdError(..)
, runAnyEraCommand
, runEraBasedCommand
Expand All @@ -12,9 +12,9 @@ module Cardano.CLI.Run.EraBased

import Cardano.Api

import Cardano.CLI.Commands.EraBased
import Cardano.CLI.EraBased.Certificate
import Cardano.CLI.EraBased.Commands
import Cardano.CLI.EraBased.Options.Governance
import Cardano.CLI.EraBased.Run.Certificate
import Cardano.CLI.EraBased.Run.Governance
import Cardano.CLI.EraBased.Run.Governance.Committee
import Cardano.CLI.EraBased.Vote
Expand Down Expand Up @@ -59,8 +59,8 @@ runEraBasedGovernanceCmd = \case
$ runGovernanceMIRCertificateTransfer w ll oFp direction

EraBasedGovernanceDelegationCertificateCmd stakeIdentifier delegationTarget outFp ->
firstExceptT (const ()) -- TODO: Conway era - fix error handling
$ runGovernanceDelegrationCertificate stakeIdentifier delegationTarget outFp
firstExceptT (const ()) -- TODO fix error handling
$ runGovernanceDelegationCertificate stakeIdentifier delegationTarget outFp

EraBasedGovernanceRegistrationCertificateCmd regTarget outFp ->
firstExceptT (const ()) -- TODO: Conway era - fix error handling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}

module Cardano.CLI.EraBased.Certificate
module Cardano.CLI.EraBased.Run.Certificate
( EraBasedDelegationError(..)
, runGovernanceDelegrationCertificate

, EraBasedRegistrationError(..)

, runGovernanceRegistrationCertificate
, runGovernanceDelegationCertificate
) where

import Cardano.Api
Expand All @@ -34,12 +34,12 @@ data EraBasedDelegationError
| EraBasedDRepReadError !(FileError InputDecodeError)
| EraBasedDelegationGenericError -- TODO Delete and replace with more specific errors

runGovernanceDelegrationCertificate
runGovernanceDelegationCertificate
:: StakeIdentifier
-> AnyDelegationTarget
-> File () Out
-> ExceptT EraBasedDelegationError IO ()
runGovernanceDelegrationCertificate stakeIdentifier delegationTarget outFp = do
runGovernanceDelegationCertificate stakeIdentifier delegationTarget outFp = do
stakeCred <-
getStakeCredentialFromIdentifier stakeIdentifier
& firstExceptT EraBasedCredentialError
Expand Down
Loading

0 comments on commit 2f36a1e

Please sign in to comment.