Skip to content

Commit

Permalink
Example
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbo4350 committed Oct 23, 2023
1 parent 30373af commit 2b91945
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cardano-cli/src/Cardano/CLI/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ parseByron mNetworkId =
, command' "byron" "Byron specific commands" $ parseByronCommands mNetworkId
]

{-
We don't care about the era here because this is simply a backwards compatible
command that is expected to work over all eras.
We need to be able to parse: Inputs, outputs, update proposals, stake registration, stake delegation and
pool registration is all that we need in previous eras.
-}
parseShelleyToBeforeMainnet :: EnvCli -> Parser ClientCommand
parseShelleyToBeforeMainnet _ = PreMainnetCommand <$> error "TODO"


parsePing :: Parser ClientCommand
parsePing = CliPingCommand <$> parsePingCmd

Expand Down
16 changes: 16 additions & 0 deletions cardano-cli/src/Cardano/CLI/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ module Cardano.CLI.Run
, runClientCommand
) where

import Cardano.Api

import Cardano.CLI.Byron.Commands (ByronCommand)
import Cardano.CLI.Byron.Run (ByronClientCmdError, renderByronClientCmdError,
runByronClientCommand)
Expand Down Expand Up @@ -45,6 +47,7 @@ data ClientCommand =

-- | Byron Related Commands
| ByronCommand ByronCommand
| PreMainnetCommand PreMainnetCommand

-- | Legacy shelley-based Commands
| LegacyCmds LegacyCmds
Expand All @@ -54,6 +57,19 @@ data ClientCommand =
| forall a. Help ParserPrefs (ParserInfo a)
| DisplayVersion


data PreMainnetCommand
= PreMainnetTxBuild PreMainnetTransactionBuildCmdArgs

Check notice

Code scanning / HLint

Use newtype instead of data Note

cardano-cli/src/Cardano/CLI/Run.hs:(61,1)-(62,54): Suggestion: Use newtype instead of data
  
Found:
  data PreMainnetCommand
    = PreMainnetTxBuild PreMainnetTransactionBuildCmdArgs
  
Perhaps:
  newtype PreMainnetCommand
    = PreMainnetTxBuild PreMainnetTransactionBuildCmdArgs
  
Note: decreases laziness


-- E.g something like this that offers the minimum required functionality.
-- We also need key generation commands to work to run SPOs etc
data PreMainnetTransactionBuildCmdArgs = TransactionBuildCmdArgs
{ nodeSocketPath :: !SocketPath
, networkId :: !NetworkId
, txins :: ![TxIn]
}

data ClientCommandErrors
= ByronClientError ByronClientCmdError
| CmdError Text CmdError
Expand Down

0 comments on commit 2b91945

Please sign in to comment.