module Cardano.CLI.Byron.Parsers
( ByronCommand(..)
, NodeCmd(..)
, backwardsCompatibilityCommands
, parseByronCommands
, parseHeavyDelThd
, parseInstallerHash
, parseMaxBlockSize
, parseMaxHeaderSize
, parseMaxTxSize
, parseMaxProposalSize
, parseMpcThd
, parseScriptVersion
, parseSlotDuration
, parseSoftforkRuleParam
, parseSystemTag
, parseTxFeePolicy
, parseUpdateProposalThd
, parseUpdateProposalTTL
, parseUnlockStakeEpoch
, parseUpdateVoteThd
) where
import Cardano.Prelude hiding (option)
import Prelude (String)
import qualified Data.ByteString.Lazy.Char8 as C8
import qualified Data.List.NonEmpty as NE
import qualified Data.Text as Text
import Data.Time (UTCTime)
import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
import Formatting (build, sformat)
import Options.Applicative
import qualified Options.Applicative as Opt
import Cardano.Binary (Annotated (..))
import Cardano.Crypto (RequiresNetworkMagic (..), decodeHash)
import Cardano.Crypto.Hashing (hashRaw)
import Cardano.Crypto.ProtocolMagic (AProtocolMagic (..), ProtocolMagic,
ProtocolMagicId (..))
import Cardano.Chain.Common (Address (..), BlockCount (..), Lovelace, TxFeePolicy (..),
TxSizeLinear (..), decodeAddressBase58, mkLovelace, rationalToLovelacePortion)
import Cardano.Chain.Genesis (FakeAvvmOptions (..), TestnetBalanceOptions (..))
import Cardano.Chain.Slotting (EpochNumber (..), EpochSlots (..), SlotNumber (..))
import Cardano.Chain.Update (ApplicationName (..), InstallerHash (..), NumSoftwareVersion,
ProtocolVersion (..), SoftforkRule (..), SoftwareVersion (..), SystemTag (..),
checkApplicationName, checkSystemTag)
import Cardano.Chain.UTxO (TxId, TxIn (..), TxOut (..))
import qualified Cardano.Api.Typed as Typed
import Cardano.CLI.Byron.Commands
import Cardano.CLI.Byron.Genesis
import Cardano.CLI.Byron.Key
import Cardano.CLI.Byron.Tx
import Cardano.CLI.Byron.UpdateProposal
import Cardano.CLI.Run (ClientCommand (ByronCommand))
import Cardano.CLI.Types
command' :: String -> String -> Parser a -> Mod CommandFields a
command' :: String -> String -> Parser a -> Mod CommandFields a
command' String
c String
descr Parser a
p =
String -> ParserInfo a -> Mod CommandFields a
forall a. String -> ParserInfo a -> Mod CommandFields a
command String
c (ParserInfo a -> Mod CommandFields a)
-> ParserInfo a -> Mod CommandFields a
forall a b. (a -> b) -> a -> b
$ Parser a -> InfoMod a -> ParserInfo a
forall a. Parser a -> InfoMod a -> ParserInfo a
info (Parser a
p Parser a -> Parser (a -> a) -> Parser a
forall (f :: * -> *) a b. Applicative f => f a -> f (a -> b) -> f b
<**> Parser (a -> a)
forall a. Parser (a -> a)
helper)
(InfoMod a -> ParserInfo a) -> InfoMod a -> ParserInfo a
forall a b. (a -> b) -> a -> b
$ [InfoMod a] -> InfoMod a
forall a. Monoid a => [a] -> a
mconcat [ String -> InfoMod a
forall a. String -> InfoMod a
progDesc String
descr ]
backwardsCompatibilityCommands :: Parser ClientCommand
backwardsCompatibilityCommands :: Parser ClientCommand
backwardsCompatibilityCommands =
[Parser ClientCommand] -> Parser ClientCommand
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser ClientCommand]
hiddenCmds
where
convertToByronCommand :: Mod CommandFields ByronCommand -> Parser ClientCommand
convertToByronCommand :: Mod CommandFields ByronCommand -> Parser ClientCommand
convertToByronCommand Mod CommandFields ByronCommand
p = ByronCommand -> ClientCommand
ByronCommand (ByronCommand -> ClientCommand)
-> Parser ByronCommand -> Parser ClientCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Mod CommandFields ByronCommand -> Parser ByronCommand
forall a. Mod CommandFields a -> Parser a
Opt.subparser (Mod CommandFields ByronCommand
p Mod CommandFields ByronCommand
-> Mod CommandFields ByronCommand -> Mod CommandFields ByronCommand
forall a. Semigroup a => a -> a -> a
<> Mod CommandFields ByronCommand
forall (f :: * -> *) a. Mod f a
Opt.internal)
hiddenCmds :: [Parser ClientCommand]
hiddenCmds :: [Parser ClientCommand]
hiddenCmds = (Mod CommandFields ByronCommand -> Parser ClientCommand)
-> [Mod CommandFields ByronCommand] -> [Parser ClientCommand]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
map Mod CommandFields ByronCommand -> Parser ClientCommand
convertToByronCommand [ Mod CommandFields ByronCommand
parseGenesisRelatedValues
, Mod CommandFields ByronCommand
parseKeyRelatedValues
, Mod CommandFields ByronCommand
parseDelegationRelatedValues
, Mod CommandFields ByronCommand
parseTxRelatedValues
, Mod CommandFields ByronCommand
parseLocalNodeQueryValues
, Mod CommandFields ByronCommand
parseMiscellaneous
]
parseByronCommands :: Parser ByronCommand
parseByronCommands :: Parser ByronCommand
parseByronCommands = [Parser ByronCommand] -> Parser ByronCommand
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
[ String -> ParserInfo ByronCommand -> Parser ByronCommand
subParser String
"key" (Parser ByronCommand
-> InfoMod ByronCommand -> ParserInfo ByronCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (Mod CommandFields ByronCommand -> Parser ByronCommand
forall a. Mod CommandFields a -> Parser a
Opt.subparser Mod CommandFields ByronCommand
parseKeyRelatedValues)
(InfoMod ByronCommand -> ParserInfo ByronCommand)
-> InfoMod ByronCommand -> ParserInfo ByronCommand
forall a b. (a -> b) -> a -> b
$ String -> InfoMod ByronCommand
forall a. String -> InfoMod a
Opt.progDesc String
"Byron key utility commands")
, String -> ParserInfo ByronCommand -> Parser ByronCommand
subParser String
"transaction" (Parser ByronCommand
-> InfoMod ByronCommand -> ParserInfo ByronCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (Mod CommandFields ByronCommand -> Parser ByronCommand
forall a. Mod CommandFields a -> Parser a
Opt.subparser Mod CommandFields ByronCommand
parseTxRelatedValues)
(InfoMod ByronCommand -> ParserInfo ByronCommand)
-> InfoMod ByronCommand -> ParserInfo ByronCommand
forall a b. (a -> b) -> a -> b
$ String -> InfoMod ByronCommand
forall a. String -> InfoMod a
Opt.progDesc String
"Byron transaction commands")
, String -> ParserInfo ByronCommand -> Parser ByronCommand
subParser String
"query" (Parser ByronCommand
-> InfoMod ByronCommand -> ParserInfo ByronCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (Mod CommandFields ByronCommand -> Parser ByronCommand
forall a. Mod CommandFields a -> Parser a
Opt.subparser Mod CommandFields ByronCommand
parseLocalNodeQueryValues)
(InfoMod ByronCommand -> ParserInfo ByronCommand)
-> InfoMod ByronCommand -> ParserInfo ByronCommand
forall a b. (a -> b) -> a -> b
$ String -> InfoMod ByronCommand
forall a. String -> InfoMod a
Opt.progDesc String
"Byron node query commands.")
, String -> ParserInfo ByronCommand -> Parser ByronCommand
subParser String
"genesis" (Parser ByronCommand
-> InfoMod ByronCommand -> ParserInfo ByronCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (Mod CommandFields ByronCommand -> Parser ByronCommand
forall a. Mod CommandFields a -> Parser a
Opt.subparser Mod CommandFields ByronCommand
parseGenesisRelatedValues)
(InfoMod ByronCommand -> ParserInfo ByronCommand)
-> InfoMod ByronCommand -> ParserInfo ByronCommand
forall a b. (a -> b) -> a -> b
$ String -> InfoMod ByronCommand
forall a. String -> InfoMod a
Opt.progDesc String
"Byron genesis block commands")
, String -> ParserInfo ByronCommand -> Parser ByronCommand
subParser String
"governance" (Parser ByronCommand
-> InfoMod ByronCommand -> ParserInfo ByronCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (NodeCmd -> ByronCommand
NodeCmd (NodeCmd -> ByronCommand) -> Parser NodeCmd -> Parser ByronCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Mod CommandFields NodeCmd -> Parser NodeCmd
forall a. Mod CommandFields a -> Parser a
Opt.subparser Mod CommandFields NodeCmd
pNodeCmd)
(InfoMod ByronCommand -> ParserInfo ByronCommand)
-> InfoMod ByronCommand -> ParserInfo ByronCommand
forall a b. (a -> b) -> a -> b
$ String -> InfoMod ByronCommand
forall a. String -> InfoMod a
Opt.progDesc String
"Byron governance commands")
, String -> ParserInfo ByronCommand -> Parser ByronCommand
subParser String
"delegation" (Parser ByronCommand
-> InfoMod ByronCommand -> ParserInfo ByronCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (Mod CommandFields ByronCommand -> Parser ByronCommand
forall a. Mod CommandFields a -> Parser a
Opt.subparser Mod CommandFields ByronCommand
parseDelegationRelatedValues)
(InfoMod ByronCommand -> ParserInfo ByronCommand)
-> InfoMod ByronCommand -> ParserInfo ByronCommand
forall a b. (a -> b) -> a -> b
$ String -> InfoMod ByronCommand
forall a. String -> InfoMod a
Opt.progDesc String
"Byron delegation commands")
, String -> ParserInfo ByronCommand -> Parser ByronCommand
subParser String
"miscellaneous" (Parser ByronCommand
-> InfoMod ByronCommand -> ParserInfo ByronCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (Mod CommandFields ByronCommand -> Parser ByronCommand
forall a. Mod CommandFields a -> Parser a
Opt.subparser Mod CommandFields ByronCommand
parseMiscellaneous)
(InfoMod ByronCommand -> ParserInfo ByronCommand)
-> InfoMod ByronCommand -> ParserInfo ByronCommand
forall a b. (a -> b) -> a -> b
$ String -> InfoMod ByronCommand
forall a. String -> InfoMod a
Opt.progDesc String
"Byron miscellaneous commands")
, NodeCmd -> ByronCommand
NodeCmd (NodeCmd -> ByronCommand) -> Parser NodeCmd -> Parser ByronCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser NodeCmd
pNodeCmdBackwardCompatible
]
where
subParser :: String -> ParserInfo ByronCommand -> Parser ByronCommand
subParser :: String -> ParserInfo ByronCommand -> Parser ByronCommand
subParser String
name ParserInfo ByronCommand
pInfo = Mod CommandFields ByronCommand -> Parser ByronCommand
forall a. Mod CommandFields a -> Parser a
Opt.subparser (Mod CommandFields ByronCommand -> Parser ByronCommand)
-> Mod CommandFields ByronCommand -> Parser ByronCommand
forall a b. (a -> b) -> a -> b
$ String -> ParserInfo ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
name ParserInfo ByronCommand
pInfo
pNodeCmdBackwardCompatible :: Parser NodeCmd
pNodeCmdBackwardCompatible :: Parser NodeCmd
pNodeCmdBackwardCompatible = Mod CommandFields NodeCmd -> Parser NodeCmd
forall a. Mod CommandFields a -> Parser a
Opt.subparser (Mod CommandFields NodeCmd -> Parser NodeCmd)
-> Mod CommandFields NodeCmd -> Parser NodeCmd
forall a b. (a -> b) -> a -> b
$ Mod CommandFields NodeCmd
pNodeCmd Mod CommandFields NodeCmd
-> Mod CommandFields NodeCmd -> Mod CommandFields NodeCmd
forall a. Semigroup a => a -> a -> a
<> Mod CommandFields NodeCmd
forall (f :: * -> *) a. Mod f a
Opt.internal
parseCBORObject :: Parser CBORObject
parseCBORObject :: Parser CBORObject
parseCBORObject = [Parser CBORObject] -> Parser CBORObject
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
[ EpochSlots -> CBORObject
CBORBlockByron (EpochSlots -> CBORObject)
-> Parser EpochSlots -> Parser CBORObject
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM EpochSlots
-> Mod OptionFields EpochSlots -> Parser EpochSlots
forall a. ReadM a -> Mod OptionFields a -> Parser a
option ReadM EpochSlots
forall a. Read a => ReadM a
auto
( String -> Mod OptionFields EpochSlots
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"byron-block"
Mod OptionFields EpochSlots
-> Mod OptionFields EpochSlots -> Mod OptionFields EpochSlots
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields EpochSlots
forall (f :: * -> *) a. String -> Mod f a
help
( String
"The CBOR file is a byron era block."
String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
" Enter the number of slots in an epoch. The default value is 21600")
Mod OptionFields EpochSlots
-> Mod OptionFields EpochSlots -> Mod OptionFields EpochSlots
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields EpochSlots
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"INT"
Mod OptionFields EpochSlots
-> Mod OptionFields EpochSlots -> Mod OptionFields EpochSlots
forall a. Semigroup a => a -> a -> a
<> EpochSlots -> Mod OptionFields EpochSlots
forall (f :: * -> *) a. HasValue f => a -> Mod f a
value (Word64 -> EpochSlots
EpochSlots Word64
21600)
)
, CBORObject -> Mod FlagFields CBORObject -> Parser CBORObject
forall a. a -> Mod FlagFields a -> Parser a
flag' CBORObject
CBORDelegationCertificateByron (Mod FlagFields CBORObject -> Parser CBORObject)
-> Mod FlagFields CBORObject -> Parser CBORObject
forall a b. (a -> b) -> a -> b
$
String -> Mod FlagFields CBORObject
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"byron-delegation-certificate"
Mod FlagFields CBORObject
-> Mod FlagFields CBORObject -> Mod FlagFields CBORObject
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields CBORObject
forall (f :: * -> *) a. String -> Mod f a
help String
"The CBOR file is a byron era delegation certificate"
, CBORObject -> Mod FlagFields CBORObject -> Parser CBORObject
forall a. a -> Mod FlagFields a -> Parser a
flag' CBORObject
CBORTxByron (Mod FlagFields CBORObject -> Parser CBORObject)
-> Mod FlagFields CBORObject -> Parser CBORObject
forall a b. (a -> b) -> a -> b
$
String -> Mod FlagFields CBORObject
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"byron-tx"
Mod FlagFields CBORObject
-> Mod FlagFields CBORObject -> Mod FlagFields CBORObject
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields CBORObject
forall (f :: * -> *) a. String -> Mod f a
help String
"The CBOR file is a byron era tx"
, CBORObject -> Mod FlagFields CBORObject -> Parser CBORObject
forall a. a -> Mod FlagFields a -> Parser a
flag' CBORObject
CBORUpdateProposalByron (Mod FlagFields CBORObject -> Parser CBORObject)
-> Mod FlagFields CBORObject -> Parser CBORObject
forall a b. (a -> b) -> a -> b
$
String -> Mod FlagFields CBORObject
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"byron-update-proposal"
Mod FlagFields CBORObject
-> Mod FlagFields CBORObject -> Mod FlagFields CBORObject
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields CBORObject
forall (f :: * -> *) a. String -> Mod f a
help String
"The CBOR file is a byron era update proposal"
, CBORObject -> Mod FlagFields CBORObject -> Parser CBORObject
forall a. a -> Mod FlagFields a -> Parser a
flag' CBORObject
CBORVoteByron (Mod FlagFields CBORObject -> Parser CBORObject)
-> Mod FlagFields CBORObject -> Parser CBORObject
forall a b. (a -> b) -> a -> b
$
String -> Mod FlagFields CBORObject
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"byron-vote"
Mod FlagFields CBORObject
-> Mod FlagFields CBORObject -> Mod FlagFields CBORObject
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields CBORObject
forall (f :: * -> *) a. String -> Mod f a
help String
"The CBOR file is a byron era vote"
]
parseDelegationRelatedValues :: Mod CommandFields ByronCommand
parseDelegationRelatedValues :: Mod CommandFields ByronCommand
parseDelegationRelatedValues =
[Mod CommandFields ByronCommand] -> Mod CommandFields ByronCommand
forall a. Monoid a => [a] -> a
mconcat
[ String
-> String -> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> String -> Parser a -> Mod CommandFields a
command'
String
"issue-delegation-certificate"
String
"Create a delegation certificate allowing the\
\ delegator to sign blocks on behalf of the issuer"
(Parser ByronCommand -> Mod CommandFields ByronCommand)
-> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a b. (a -> b) -> a -> b
$ NetworkId
-> CardanoEra
-> EpochNumber
-> SigningKeyFile
-> VerificationKeyFile
-> NewCertificateFile
-> ByronCommand
IssueDelegationCertificate
(NetworkId
-> CardanoEra
-> EpochNumber
-> SigningKeyFile
-> VerificationKeyFile
-> NewCertificateFile
-> ByronCommand)
-> Parser NetworkId
-> Parser
(CardanoEra
-> EpochNumber
-> SigningKeyFile
-> VerificationKeyFile
-> NewCertificateFile
-> ByronCommand)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser NetworkId
pNetworkId
Parser
(CardanoEra
-> EpochNumber
-> SigningKeyFile
-> VerificationKeyFile
-> NewCertificateFile
-> ByronCommand)
-> Parser CardanoEra
-> Parser
(EpochNumber
-> SigningKeyFile
-> VerificationKeyFile
-> NewCertificateFile
-> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser CardanoEra
parseCardanoEra
Parser
(EpochNumber
-> SigningKeyFile
-> VerificationKeyFile
-> NewCertificateFile
-> ByronCommand)
-> Parser EpochNumber
-> Parser
(SigningKeyFile
-> VerificationKeyFile -> NewCertificateFile -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ( Word64 -> EpochNumber
EpochNumber
(Word64 -> EpochNumber) -> Parser Word64 -> Parser EpochNumber
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser Word64
forall a. Integral a => String -> String -> Parser a
parseIntegral
String
"since-epoch"
String
"The epoch from which the delegation is valid."
)
Parser
(SigningKeyFile
-> VerificationKeyFile -> NewCertificateFile -> ByronCommand)
-> Parser SigningKeyFile
-> Parser
(VerificationKeyFile -> NewCertificateFile -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser SigningKeyFile
parseSigningKeyFile
String
"secret"
String
"The issuer of the certificate, who delegates\
\ their right to sign blocks."
Parser (VerificationKeyFile -> NewCertificateFile -> ByronCommand)
-> Parser VerificationKeyFile
-> Parser (NewCertificateFile -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser VerificationKeyFile
parseVerificationKeyFile
String
"delegate-key"
String
"The delegate, who gains the right to sign block."
Parser (NewCertificateFile -> ByronCommand)
-> Parser NewCertificateFile -> Parser ByronCommand
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> Parser NewCertificateFile
parseNewCertificateFile String
"certificate"
, String
-> String -> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> String -> Parser a -> Mod CommandFields a
command'
String
"check-delegation"
String
"Verify that a given certificate constitutes a valid\
\ delegation relationship between keys."
(Parser ByronCommand -> Mod CommandFields ByronCommand)
-> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a b. (a -> b) -> a -> b
$ NetworkId
-> CertificateFile
-> VerificationKeyFile
-> VerificationKeyFile
-> ByronCommand
CheckDelegation
(NetworkId
-> CertificateFile
-> VerificationKeyFile
-> VerificationKeyFile
-> ByronCommand)
-> Parser NetworkId
-> Parser
(CertificateFile
-> VerificationKeyFile -> VerificationKeyFile -> ByronCommand)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser NetworkId
pNetworkId
Parser
(CertificateFile
-> VerificationKeyFile -> VerificationKeyFile -> ByronCommand)
-> Parser CertificateFile
-> Parser
(VerificationKeyFile -> VerificationKeyFile -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser CertificateFile
parseCertificateFile
String
"certificate"
String
"The certificate embodying delegation to verify."
Parser (VerificationKeyFile -> VerificationKeyFile -> ByronCommand)
-> Parser VerificationKeyFile
-> Parser (VerificationKeyFile -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser VerificationKeyFile
parseVerificationKeyFile
String
"issuer-key"
String
"The genesis key that supposedly delegates."
Parser (VerificationKeyFile -> ByronCommand)
-> Parser VerificationKeyFile -> Parser ByronCommand
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser VerificationKeyFile
parseVerificationKeyFile
String
"delegate-key"
String
"The operation verification key supposedly delegated to."
]
parseGenesisParameters :: Parser GenesisParameters
parseGenesisParameters :: Parser GenesisParameters
parseGenesisParameters =
UTCTime
-> String
-> BlockCount
-> ProtocolMagic
-> TestnetBalanceOptions
-> FakeAvvmOptions
-> LovelacePortion
-> Maybe Integer
-> GenesisParameters
GenesisParameters
(UTCTime
-> String
-> BlockCount
-> ProtocolMagic
-> TestnetBalanceOptions
-> FakeAvvmOptions
-> LovelacePortion
-> Maybe Integer
-> GenesisParameters)
-> Parser UTCTime
-> Parser
(String
-> BlockCount
-> ProtocolMagic
-> TestnetBalanceOptions
-> FakeAvvmOptions
-> LovelacePortion
-> Maybe Integer
-> GenesisParameters)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser UTCTime
parseUTCTime
String
"start-time"
String
"Start time of the new cluster to be enshrined in the new genesis."
Parser
(String
-> BlockCount
-> ProtocolMagic
-> TestnetBalanceOptions
-> FakeAvvmOptions
-> LovelacePortion
-> Maybe Integer
-> GenesisParameters)
-> Parser String
-> Parser
(BlockCount
-> ProtocolMagic
-> TestnetBalanceOptions
-> FakeAvvmOptions
-> LovelacePortion
-> Maybe Integer
-> GenesisParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser String
parseFilePath
String
"protocol-parameters-file"
String
"JSON file with protocol parameters."
Parser
(BlockCount
-> ProtocolMagic
-> TestnetBalanceOptions
-> FakeAvvmOptions
-> LovelacePortion
-> Maybe Integer
-> GenesisParameters)
-> Parser BlockCount
-> Parser
(ProtocolMagic
-> TestnetBalanceOptions
-> FakeAvvmOptions
-> LovelacePortion
-> Maybe Integer
-> GenesisParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser BlockCount
parseK
Parser
(ProtocolMagic
-> TestnetBalanceOptions
-> FakeAvvmOptions
-> LovelacePortion
-> Maybe Integer
-> GenesisParameters)
-> Parser ProtocolMagic
-> Parser
(TestnetBalanceOptions
-> FakeAvvmOptions
-> LovelacePortion
-> Maybe Integer
-> GenesisParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ProtocolMagic
parseProtocolMagic
Parser
(TestnetBalanceOptions
-> FakeAvvmOptions
-> LovelacePortion
-> Maybe Integer
-> GenesisParameters)
-> Parser TestnetBalanceOptions
-> Parser
(FakeAvvmOptions
-> LovelacePortion -> Maybe Integer -> GenesisParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TestnetBalanceOptions
parseTestnetBalanceOptions
Parser
(FakeAvvmOptions
-> LovelacePortion -> Maybe Integer -> GenesisParameters)
-> Parser FakeAvvmOptions
-> Parser (LovelacePortion -> Maybe Integer -> GenesisParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser FakeAvvmOptions
parseFakeAvvmOptions
Parser (LovelacePortion -> Maybe Integer -> GenesisParameters)
-> Parser LovelacePortion
-> Parser (Maybe Integer -> GenesisParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Rational -> LovelacePortion
rationalToLovelacePortion (Rational -> LovelacePortion)
-> Parser Rational -> Parser LovelacePortion
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
String -> String -> Double -> Parser Rational
parseFractionWithDefault
String
"avvm-balance-factor"
String
"AVVM balances will be multiplied by this factor (defaults to 1)."
Double
1)
Parser (Maybe Integer -> GenesisParameters)
-> Parser (Maybe Integer) -> Parser GenesisParameters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Integer -> Parser (Maybe Integer)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional
( String -> String -> Parser Integer
forall a. Integral a => String -> String -> Parser a
parseIntegral
String
"secret-seed"
String
"Optionally specify the seed of generation."
)
parseGenesisRelatedValues :: Mod CommandFields ByronCommand
parseGenesisRelatedValues :: Mod CommandFields ByronCommand
parseGenesisRelatedValues =
[Mod CommandFields ByronCommand] -> Mod CommandFields ByronCommand
forall a. Monoid a => [a] -> a
mconcat
[ String
-> String -> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> String -> Parser a -> Mod CommandFields a
command' String
"genesis" String
"Create genesis."
(Parser ByronCommand -> Mod CommandFields ByronCommand)
-> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a b. (a -> b) -> a -> b
$ NewDirectory -> GenesisParameters -> CardanoEra -> ByronCommand
Genesis
(NewDirectory -> GenesisParameters -> CardanoEra -> ByronCommand)
-> Parser NewDirectory
-> Parser (GenesisParameters -> CardanoEra -> ByronCommand)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser NewDirectory
parseNewDirectory
String
"genesis-output-dir"
String
"Non-existent directory where genesis JSON file and secrets shall be placed."
Parser (GenesisParameters -> CardanoEra -> ByronCommand)
-> Parser GenesisParameters -> Parser (CardanoEra -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser GenesisParameters
parseGenesisParameters
Parser (CardanoEra -> ByronCommand)
-> Parser CardanoEra -> Parser ByronCommand
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser CardanoEra
parseCardanoEra
, String
-> String -> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> String -> Parser a -> Mod CommandFields a
command' String
"print-genesis-hash" String
"Compute hash of a genesis file."
(Parser ByronCommand -> Mod CommandFields ByronCommand)
-> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a b. (a -> b) -> a -> b
$ GenesisFile -> ByronCommand
PrintGenesisHash
(GenesisFile -> ByronCommand)
-> Parser GenesisFile -> Parser ByronCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> Parser GenesisFile
parseGenesisFile String
"genesis-json"
]
parseKeyRelatedValues :: Mod CommandFields ByronCommand
parseKeyRelatedValues :: Mod CommandFields ByronCommand
parseKeyRelatedValues =
[Mod CommandFields ByronCommand] -> Mod CommandFields ByronCommand
forall a. Monoid a => [a] -> a
mconcat
[ String
-> String -> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> String -> Parser a -> Mod CommandFields a
command' String
"keygen" String
"Generate a signing key."
(Parser ByronCommand -> Mod CommandFields ByronCommand)
-> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a b. (a -> b) -> a -> b
$ CardanoEra
-> NewSigningKeyFile -> PasswordRequirement -> ByronCommand
Keygen
(CardanoEra
-> NewSigningKeyFile -> PasswordRequirement -> ByronCommand)
-> Parser CardanoEra
-> Parser
(NewSigningKeyFile -> PasswordRequirement -> ByronCommand)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser CardanoEra
parseCardanoEra
Parser (NewSigningKeyFile -> PasswordRequirement -> ByronCommand)
-> Parser NewSigningKeyFile
-> Parser (PasswordRequirement -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> Parser NewSigningKeyFile
parseNewSigningKeyFile String
"secret"
Parser (PasswordRequirement -> ByronCommand)
-> Parser PasswordRequirement -> Parser ByronCommand
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser PasswordRequirement
parsePassword
, String
-> String -> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> String -> Parser a -> Mod CommandFields a
command'
String
"to-verification"
String
"Extract a verification key in its base64 form."
(Parser ByronCommand -> Mod CommandFields ByronCommand)
-> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a b. (a -> b) -> a -> b
$ CardanoEra
-> SigningKeyFile -> NewVerificationKeyFile -> ByronCommand
ToVerification
(CardanoEra
-> SigningKeyFile -> NewVerificationKeyFile -> ByronCommand)
-> Parser CardanoEra
-> Parser
(SigningKeyFile -> NewVerificationKeyFile -> ByronCommand)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser CardanoEra
parseCardanoEra
Parser (SigningKeyFile -> NewVerificationKeyFile -> ByronCommand)
-> Parser SigningKeyFile
-> Parser (NewVerificationKeyFile -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser SigningKeyFile
parseSigningKeyFile
String
"secret"
String
"Signing key file to extract the verification part from."
Parser (NewVerificationKeyFile -> ByronCommand)
-> Parser NewVerificationKeyFile -> Parser ByronCommand
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> Parser NewVerificationKeyFile
parseNewVerificationKeyFile String
"to"
, String
-> String -> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> String -> Parser a -> Mod CommandFields a
command'
String
"signing-key-public"
String
"Pretty-print a signing key's verification key (not a secret)."
(Parser ByronCommand -> Mod CommandFields ByronCommand)
-> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a b. (a -> b) -> a -> b
$ CardanoEra -> SigningKeyFile -> ByronCommand
PrettySigningKeyPublic
(CardanoEra -> SigningKeyFile -> ByronCommand)
-> Parser CardanoEra -> Parser (SigningKeyFile -> ByronCommand)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser CardanoEra
parseCardanoEra
Parser (SigningKeyFile -> ByronCommand)
-> Parser SigningKeyFile -> Parser ByronCommand
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser SigningKeyFile
parseSigningKeyFile
String
"secret"
String
"Signing key to pretty-print."
, String
-> String -> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> String -> Parser a -> Mod CommandFields a
command'
String
"signing-key-address"
String
"Print address of a signing key."
(Parser ByronCommand -> Mod CommandFields ByronCommand)
-> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a b. (a -> b) -> a -> b
$ CardanoEra -> NetworkId -> SigningKeyFile -> ByronCommand
PrintSigningKeyAddress
(CardanoEra -> NetworkId -> SigningKeyFile -> ByronCommand)
-> Parser CardanoEra
-> Parser (NetworkId -> SigningKeyFile -> ByronCommand)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser CardanoEra
parseCardanoEra
Parser (NetworkId -> SigningKeyFile -> ByronCommand)
-> Parser NetworkId -> Parser (SigningKeyFile -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
Parser (SigningKeyFile -> ByronCommand)
-> Parser SigningKeyFile -> Parser ByronCommand
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser SigningKeyFile
parseSigningKeyFile
String
"secret"
String
"Signing key, whose address is to be printed."
, String
-> String -> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> String -> Parser a -> Mod CommandFields a
command'
String
"migrate-delegate-key-from"
String
"Migrate a delegate key from an older version."
(Parser ByronCommand -> Mod CommandFields ByronCommand)
-> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a b. (a -> b) -> a -> b
$ CardanoEra
-> SigningKeyFile
-> CardanoEra
-> NewSigningKeyFile
-> ByronCommand
MigrateDelegateKeyFrom
(CardanoEra
-> SigningKeyFile
-> CardanoEra
-> NewSigningKeyFile
-> ByronCommand)
-> Parser CardanoEra
-> Parser
(SigningKeyFile -> CardanoEra -> NewSigningKeyFile -> ByronCommand)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser CardanoEra
parseCardanoEra
Parser
(SigningKeyFile -> CardanoEra -> NewSigningKeyFile -> ByronCommand)
-> Parser SigningKeyFile
-> Parser (CardanoEra -> NewSigningKeyFile -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser SigningKeyFile
parseSigningKeyFile String
"from" String
"Signing key file to migrate."
Parser (CardanoEra -> NewSigningKeyFile -> ByronCommand)
-> Parser CardanoEra -> Parser (NewSigningKeyFile -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser CardanoEra
parseCardanoEra
Parser (NewSigningKeyFile -> ByronCommand)
-> Parser NewSigningKeyFile -> Parser ByronCommand
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> Parser NewSigningKeyFile
parseNewSigningKeyFile String
"to"
]
parseLocalNodeQueryValues :: Mod CommandFields ByronCommand
parseLocalNodeQueryValues :: Mod CommandFields ByronCommand
parseLocalNodeQueryValues =
[Mod CommandFields ByronCommand] -> Mod CommandFields ByronCommand
forall a. Monoid a => [a] -> a
mconcat
[ String
-> String -> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> String -> Parser a -> Mod CommandFields a
command' String
"get-tip" String
"Get the tip of your local node's blockchain"
(Parser ByronCommand -> Mod CommandFields ByronCommand)
-> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a b. (a -> b) -> a -> b
$ NetworkId -> ByronCommand
GetLocalNodeTip
(NetworkId -> ByronCommand)
-> Parser NetworkId -> Parser ByronCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser NetworkId
pNetworkId
]
parseMiscellaneous :: Mod CommandFields ByronCommand
parseMiscellaneous :: Mod CommandFields ByronCommand
parseMiscellaneous = [Mod CommandFields ByronCommand] -> Mod CommandFields ByronCommand
forall a. Monoid a => [a] -> a
mconcat
[ String
-> String -> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> String -> Parser a -> Mod CommandFields a
command'
String
"validate-cbor"
String
"Validate a CBOR blockchain object."
(Parser ByronCommand -> Mod CommandFields ByronCommand)
-> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a b. (a -> b) -> a -> b
$ CBORObject -> String -> ByronCommand
ValidateCBOR
(CBORObject -> String -> ByronCommand)
-> Parser CBORObject -> Parser (String -> ByronCommand)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser CBORObject
parseCBORObject
Parser (String -> ByronCommand)
-> Parser String -> Parser ByronCommand
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser String
parseFilePath String
"filepath" String
"Filepath of CBOR file."
, String
-> String -> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> String -> Parser a -> Mod CommandFields a
command'
String
"pretty-print-cbor"
String
"Pretty print a CBOR file."
(Parser ByronCommand -> Mod CommandFields ByronCommand)
-> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a b. (a -> b) -> a -> b
$ String -> ByronCommand
PrettyPrintCBOR
(String -> ByronCommand) -> Parser String -> Parser ByronCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser String
parseFilePath String
"filepath" String
"Filepath of CBOR file."
]
parseTestnetBalanceOptions :: Parser TestnetBalanceOptions
parseTestnetBalanceOptions :: Parser TestnetBalanceOptions
parseTestnetBalanceOptions =
Word -> Word -> Lovelace -> Rational -> TestnetBalanceOptions
TestnetBalanceOptions
(Word -> Word -> Lovelace -> Rational -> TestnetBalanceOptions)
-> Parser Word
-> Parser (Word -> Lovelace -> Rational -> TestnetBalanceOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser Word
forall a. Integral a => String -> String -> Parser a
parseIntegral
String
"n-poor-addresses"
String
"Number of poor nodes (with small balance)."
Parser (Word -> Lovelace -> Rational -> TestnetBalanceOptions)
-> Parser Word
-> Parser (Lovelace -> Rational -> TestnetBalanceOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser Word
forall a. Integral a => String -> String -> Parser a
parseIntegral
String
"n-delegate-addresses"
String
"Number of delegate nodes (with huge balance)."
Parser (Lovelace -> Rational -> TestnetBalanceOptions)
-> Parser Lovelace -> Parser (Rational -> TestnetBalanceOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser Lovelace
parseLovelace
String
"total-balance"
String
"Total balance owned by these nodes."
Parser (Rational -> TestnetBalanceOptions)
-> Parser Rational -> Parser TestnetBalanceOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser Rational
parseFraction
String
"delegate-share"
String
"Portion of stake owned by all delegates together."
parseTxIn :: Parser TxIn
parseTxIn :: Parser TxIn
parseTxIn =
ReadM TxIn -> Mod OptionFields TxIn -> Parser TxIn
forall a. ReadM a -> Mod OptionFields a -> Parser a
option
( (TxId -> Word32 -> TxIn) -> (TxId, Word32) -> TxIn
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry TxId -> Word32 -> TxIn
TxInUtxo
((TxId, Word32) -> TxIn)
-> ((String, Word32) -> (TxId, Word32)) -> (String, Word32) -> TxIn
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (String -> TxId) -> (String, Word32) -> (TxId, Word32)
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first String -> TxId
cliParseTxId
((String, Word32) -> TxIn) -> ReadM (String, Word32) -> ReadM TxIn
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM (String, Word32)
forall a. Read a => ReadM a
auto
)
(Mod OptionFields TxIn -> Parser TxIn)
-> Mod OptionFields TxIn -> Parser TxIn
forall a b. (a -> b) -> a -> b
$ String -> Mod OptionFields TxIn
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"txin"
Mod OptionFields TxIn
-> Mod OptionFields TxIn -> Mod OptionFields TxIn
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields TxIn
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"(TXID,INDEX)"
Mod OptionFields TxIn
-> Mod OptionFields TxIn -> Mod OptionFields TxIn
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields TxIn
forall (f :: * -> *) a. String -> Mod f a
help String
"Transaction input is a pair of an UTxO TxId and a zero-based output index."
parseTxOut :: Parser TxOut
parseTxOut :: Parser TxOut
parseTxOut =
ReadM TxOut -> Mod OptionFields TxOut -> Parser TxOut
forall a. ReadM a -> Mod OptionFields a -> Parser a
option
( (Address -> Lovelace -> TxOut) -> (Address, Lovelace) -> TxOut
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Address -> Lovelace -> TxOut
TxOut
((Address, Lovelace) -> TxOut)
-> ((Text, Word64) -> (Address, Lovelace))
-> (Text, Word64)
-> TxOut
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Text -> Address) -> (Text, Lovelace) -> (Address, Lovelace)
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first Text -> Address
cliParseBase58Address
((Text, Lovelace) -> (Address, Lovelace))
-> ((Text, Word64) -> (Text, Lovelace))
-> (Text, Word64)
-> (Address, Lovelace)
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Word64 -> Lovelace) -> (Text, Word64) -> (Text, Lovelace)
forall (p :: * -> * -> *) b c a.
Bifunctor p =>
(b -> c) -> p a b -> p a c
second Word64 -> Lovelace
cliParseLovelace
((Text, Word64) -> TxOut) -> ReadM (Text, Word64) -> ReadM TxOut
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM (Text, Word64)
forall a. Read a => ReadM a
auto
)
(Mod OptionFields TxOut -> Parser TxOut)
-> Mod OptionFields TxOut -> Parser TxOut
forall a b. (a -> b) -> a -> b
$ String -> Mod OptionFields TxOut
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"txout"
Mod OptionFields TxOut
-> Mod OptionFields TxOut -> Mod OptionFields TxOut
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields TxOut
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"'(\"ADDR\", LOVELACE)'"
Mod OptionFields TxOut
-> Mod OptionFields TxOut -> Mod OptionFields TxOut
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields TxOut
forall (f :: * -> *) a. String -> Mod f a
help String
"Specify a transaction output, as a pair of an address and lovelace."
parseTxRelatedValues :: Mod CommandFields ByronCommand
parseTxRelatedValues :: Mod CommandFields ByronCommand
parseTxRelatedValues =
[Mod CommandFields ByronCommand] -> Mod CommandFields ByronCommand
forall a. Monoid a => [a] -> a
mconcat
[ String
-> String -> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> String -> Parser a -> Mod CommandFields a
command'
String
"submit-tx"
String
"Submit a raw, signed transaction, in its on-wire representation."
(Parser ByronCommand -> Mod CommandFields ByronCommand)
-> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a b. (a -> b) -> a -> b
$ NetworkId -> TxFile -> ByronCommand
SubmitTx
(NetworkId -> TxFile -> ByronCommand)
-> Parser NetworkId -> Parser (TxFile -> ByronCommand)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser NetworkId
pNetworkId
Parser (TxFile -> ByronCommand)
-> Parser TxFile -> Parser ByronCommand
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> Parser TxFile
parseTxFile String
"tx"
, String
-> String -> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> String -> Parser a -> Mod CommandFields a
command'
String
"issue-genesis-utxo-expenditure"
String
"Write a file with a signed transaction, spending genesis UTxO."
(Parser ByronCommand -> Mod CommandFields ByronCommand)
-> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a b. (a -> b) -> a -> b
$ GenesisFile
-> NetworkId
-> CardanoEra
-> NewTxFile
-> SigningKeyFile
-> Address
-> NonEmpty TxOut
-> ByronCommand
SpendGenesisUTxO
(GenesisFile
-> NetworkId
-> CardanoEra
-> NewTxFile
-> SigningKeyFile
-> Address
-> NonEmpty TxOut
-> ByronCommand)
-> Parser GenesisFile
-> Parser
(NetworkId
-> CardanoEra
-> NewTxFile
-> SigningKeyFile
-> Address
-> NonEmpty TxOut
-> ByronCommand)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> Parser GenesisFile
parseGenesisFile String
"genesis-json"
Parser
(NetworkId
-> CardanoEra
-> NewTxFile
-> SigningKeyFile
-> Address
-> NonEmpty TxOut
-> ByronCommand)
-> Parser NetworkId
-> Parser
(CardanoEra
-> NewTxFile
-> SigningKeyFile
-> Address
-> NonEmpty TxOut
-> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
Parser
(CardanoEra
-> NewTxFile
-> SigningKeyFile
-> Address
-> NonEmpty TxOut
-> ByronCommand)
-> Parser CardanoEra
-> Parser
(NewTxFile
-> SigningKeyFile -> Address -> NonEmpty TxOut -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser CardanoEra
parseCardanoEra
Parser
(NewTxFile
-> SigningKeyFile -> Address -> NonEmpty TxOut -> ByronCommand)
-> Parser NewTxFile
-> Parser
(SigningKeyFile -> Address -> NonEmpty TxOut -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> Parser NewTxFile
parseNewTxFile String
"tx"
Parser
(SigningKeyFile -> Address -> NonEmpty TxOut -> ByronCommand)
-> Parser SigningKeyFile
-> Parser (Address -> NonEmpty TxOut -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser SigningKeyFile
parseSigningKeyFile
String
"wallet-key"
String
"Key that has access to all mentioned genesis UTxO inputs."
Parser (Address -> NonEmpty TxOut -> ByronCommand)
-> Parser Address -> Parser (NonEmpty TxOut -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser Address
parseAddress
String
"rich-addr-from"
String
"Tx source: genesis UTxO richman address (non-HD)."
Parser (NonEmpty TxOut -> ByronCommand)
-> Parser (NonEmpty TxOut) -> Parser ByronCommand
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ([TxOut] -> NonEmpty TxOut
forall a. [a] -> NonEmpty a
NE.fromList ([TxOut] -> NonEmpty TxOut)
-> Parser [TxOut] -> Parser (NonEmpty TxOut)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser TxOut -> Parser [TxOut]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some Parser TxOut
parseTxOut)
, String
-> String -> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a. String -> String -> Parser a -> Mod CommandFields a
command'
String
"issue-utxo-expenditure"
String
"Write a file with a signed transaction, spending normal UTxO."
(Parser ByronCommand -> Mod CommandFields ByronCommand)
-> Parser ByronCommand -> Mod CommandFields ByronCommand
forall a b. (a -> b) -> a -> b
$ NetworkId
-> CardanoEra
-> NewTxFile
-> SigningKeyFile
-> NonEmpty TxIn
-> NonEmpty TxOut
-> ByronCommand
SpendUTxO
(NetworkId
-> CardanoEra
-> NewTxFile
-> SigningKeyFile
-> NonEmpty TxIn
-> NonEmpty TxOut
-> ByronCommand)
-> Parser NetworkId
-> Parser
(CardanoEra
-> NewTxFile
-> SigningKeyFile
-> NonEmpty TxIn
-> NonEmpty TxOut
-> ByronCommand)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser NetworkId
pNetworkId
Parser
(CardanoEra
-> NewTxFile
-> SigningKeyFile
-> NonEmpty TxIn
-> NonEmpty TxOut
-> ByronCommand)
-> Parser CardanoEra
-> Parser
(NewTxFile
-> SigningKeyFile
-> NonEmpty TxIn
-> NonEmpty TxOut
-> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser CardanoEra
parseCardanoEra
Parser
(NewTxFile
-> SigningKeyFile
-> NonEmpty TxIn
-> NonEmpty TxOut
-> ByronCommand)
-> Parser NewTxFile
-> Parser
(SigningKeyFile -> NonEmpty TxIn -> NonEmpty TxOut -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> Parser NewTxFile
parseNewTxFile String
"tx"
Parser
(SigningKeyFile -> NonEmpty TxIn -> NonEmpty TxOut -> ByronCommand)
-> Parser SigningKeyFile
-> Parser (NonEmpty TxIn -> NonEmpty TxOut -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser SigningKeyFile
parseSigningKeyFile
String
"wallet-key"
String
"Key that has access to all mentioned genesis UTxO inputs."
Parser (NonEmpty TxIn -> NonEmpty TxOut -> ByronCommand)
-> Parser (NonEmpty TxIn)
-> Parser (NonEmpty TxOut -> ByronCommand)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ([TxIn] -> NonEmpty TxIn
forall a. [a] -> NonEmpty a
NE.fromList ([TxIn] -> NonEmpty TxIn)
-> Parser [TxIn] -> Parser (NonEmpty TxIn)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser TxIn -> Parser [TxIn]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some Parser TxIn
parseTxIn)
Parser (NonEmpty TxOut -> ByronCommand)
-> Parser (NonEmpty TxOut) -> Parser ByronCommand
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ([TxOut] -> NonEmpty TxOut
forall a. [a] -> NonEmpty a
NE.fromList ([TxOut] -> NonEmpty TxOut)
-> Parser [TxOut] -> Parser (NonEmpty TxOut)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser TxOut -> Parser [TxOut]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some Parser TxOut
parseTxOut)
]
parseVerificationKeyFile :: String -> String -> Parser VerificationKeyFile
parseVerificationKeyFile :: String -> String -> Parser VerificationKeyFile
parseVerificationKeyFile String
opt String
desc = String -> VerificationKeyFile
VerificationKeyFile (String -> VerificationKeyFile)
-> Parser String -> Parser VerificationKeyFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser String
parseFilePath String
opt String
desc
pNodeCmd :: Mod CommandFields NodeCmd
pNodeCmd :: Mod CommandFields NodeCmd
pNodeCmd =
[Mod CommandFields NodeCmd] -> Mod CommandFields NodeCmd
forall a. Monoid a => [a] -> a
mconcat
[ String -> ParserInfo NodeCmd -> Mod CommandFields NodeCmd
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"create-update-proposal"
(Parser NodeCmd -> InfoMod NodeCmd -> ParserInfo NodeCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser NodeCmd
parseByronUpdateProposal (InfoMod NodeCmd -> ParserInfo NodeCmd)
-> InfoMod NodeCmd -> ParserInfo NodeCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod NodeCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create an update proposal.")
, String -> ParserInfo NodeCmd -> Mod CommandFields NodeCmd
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"create-proposal-vote"
(Parser NodeCmd -> InfoMod NodeCmd -> ParserInfo NodeCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser NodeCmd
parseByronVote (InfoMod NodeCmd -> ParserInfo NodeCmd)
-> InfoMod NodeCmd -> ParserInfo NodeCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod NodeCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create an update proposal vote.")
, String -> ParserInfo NodeCmd -> Mod CommandFields NodeCmd
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"submit-update-proposal"
(Parser NodeCmd -> InfoMod NodeCmd -> ParserInfo NodeCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser NodeCmd
parseByronUpdateProposalSubmission (InfoMod NodeCmd -> ParserInfo NodeCmd)
-> InfoMod NodeCmd -> ParserInfo NodeCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod NodeCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Submit an update proposal.")
, String -> ParserInfo NodeCmd -> Mod CommandFields NodeCmd
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"submit-proposal-vote"
(Parser NodeCmd -> InfoMod NodeCmd -> ParserInfo NodeCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser NodeCmd
parseByronVoteSubmission (InfoMod NodeCmd -> ParserInfo NodeCmd)
-> InfoMod NodeCmd -> ParserInfo NodeCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod NodeCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Submit a proposal vote.")
]
parseByronUpdateProposal :: Parser NodeCmd
parseByronUpdateProposal :: Parser NodeCmd
parseByronUpdateProposal = do
NetworkId
-> SigningKeyFile
-> ProtocolVersion
-> SoftwareVersion
-> SystemTag
-> InstallerHash
-> String
-> [ParametersToUpdate]
-> NodeCmd
UpdateProposal
(NetworkId
-> SigningKeyFile
-> ProtocolVersion
-> SoftwareVersion
-> SystemTag
-> InstallerHash
-> String
-> [ParametersToUpdate]
-> NodeCmd)
-> Parser NetworkId
-> Parser
(SigningKeyFile
-> ProtocolVersion
-> SoftwareVersion
-> SystemTag
-> InstallerHash
-> String
-> [ParametersToUpdate]
-> NodeCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser NetworkId
pNetworkId
Parser
(SigningKeyFile
-> ProtocolVersion
-> SoftwareVersion
-> SystemTag
-> InstallerHash
-> String
-> [ParametersToUpdate]
-> NodeCmd)
-> Parser SigningKeyFile
-> Parser
(ProtocolVersion
-> SoftwareVersion
-> SystemTag
-> InstallerHash
-> String
-> [ParametersToUpdate]
-> NodeCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser SigningKeyFile
parseSigningKeyFile String
"signing-key" String
"Path to signing key."
Parser
(ProtocolVersion
-> SoftwareVersion
-> SystemTag
-> InstallerHash
-> String
-> [ParametersToUpdate]
-> NodeCmd)
-> Parser ProtocolVersion
-> Parser
(SoftwareVersion
-> SystemTag
-> InstallerHash
-> String
-> [ParametersToUpdate]
-> NodeCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ProtocolVersion
parseProtocolVersion
Parser
(SoftwareVersion
-> SystemTag
-> InstallerHash
-> String
-> [ParametersToUpdate]
-> NodeCmd)
-> Parser SoftwareVersion
-> Parser
(SystemTag
-> InstallerHash -> String -> [ParametersToUpdate] -> NodeCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser SoftwareVersion
parseSoftwareVersion
Parser
(SystemTag
-> InstallerHash -> String -> [ParametersToUpdate] -> NodeCmd)
-> Parser SystemTag
-> Parser
(InstallerHash -> String -> [ParametersToUpdate] -> NodeCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser SystemTag
parseSystemTag
Parser (InstallerHash -> String -> [ParametersToUpdate] -> NodeCmd)
-> Parser InstallerHash
-> Parser (String -> [ParametersToUpdate] -> NodeCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser InstallerHash
parseInstallerHash
Parser (String -> [ParametersToUpdate] -> NodeCmd)
-> Parser String -> Parser ([ParametersToUpdate] -> NodeCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser String
parseFilePath String
"filepath" String
"Byron proposal output filepath."
Parser ([ParametersToUpdate] -> NodeCmd)
-> Parser [ParametersToUpdate] -> Parser NodeCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [ParametersToUpdate]
parseParametersToUpdate
parseByronVoteSubmission :: Parser NodeCmd
parseByronVoteSubmission :: Parser NodeCmd
parseByronVoteSubmission = do
NetworkId -> String -> NodeCmd
SubmitVote
(NetworkId -> String -> NodeCmd)
-> Parser NetworkId -> Parser (String -> NodeCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser NetworkId
pNetworkId
Parser (String -> NodeCmd) -> Parser String -> Parser NodeCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser String
parseFilePath String
"filepath" String
"Filepath of Byron update proposal vote."
parseParametersToUpdate :: Parser [ParametersToUpdate]
parseParametersToUpdate :: Parser [ParametersToUpdate]
parseParametersToUpdate =
[Maybe ParametersToUpdate] -> [ParametersToUpdate]
forall a. [Maybe a] -> [a]
catMaybes
([Maybe ParametersToUpdate] -> [ParametersToUpdate])
-> Parser [Maybe ParametersToUpdate] -> Parser [ParametersToUpdate]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Parser (Maybe ParametersToUpdate)]
-> Parser [Maybe ParametersToUpdate]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA
[ Parser (Maybe ParametersToUpdate)
parseScriptVersion
, Parser (Maybe ParametersToUpdate)
parseSlotDuration
, Parser (Maybe ParametersToUpdate)
parseMaxBlockSize
, Parser (Maybe ParametersToUpdate)
parseMaxHeaderSize
, Parser (Maybe ParametersToUpdate)
parseMaxTxSize
, Parser (Maybe ParametersToUpdate)
parseMaxProposalSize
, Parser (Maybe ParametersToUpdate)
parseMpcThd
, Parser (Maybe ParametersToUpdate)
parseHeavyDelThd
, Parser (Maybe ParametersToUpdate)
parseUpdateVoteThd
, Parser (Maybe ParametersToUpdate)
parseUpdateProposalThd
, Parser (Maybe ParametersToUpdate)
parseUpdateProposalTTL
, Parser (Maybe ParametersToUpdate)
parseSoftforkRuleParam
, Parser (Maybe ParametersToUpdate)
parseTxFeePolicy
, Parser (Maybe ParametersToUpdate)
parseUnlockStakeEpoch
]
parseByronUpdateProposalSubmission :: Parser NodeCmd
parseByronUpdateProposalSubmission :: Parser NodeCmd
parseByronUpdateProposalSubmission =
NetworkId -> String -> NodeCmd
SubmitUpdateProposal
(NetworkId -> String -> NodeCmd)
-> Parser NetworkId -> Parser (String -> NodeCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser NetworkId
pNetworkId
Parser (String -> NodeCmd) -> Parser String -> Parser NodeCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser String
parseFilePath String
"filepath" String
"Filepath of Byron update proposal."
parseByronVote :: Parser NodeCmd
parseByronVote :: Parser NodeCmd
parseByronVote =
NetworkId -> SigningKeyFile -> String -> Bool -> String -> NodeCmd
CreateVote
(NetworkId
-> SigningKeyFile -> String -> Bool -> String -> NodeCmd)
-> Parser NetworkId
-> Parser (SigningKeyFile -> String -> Bool -> String -> NodeCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser NetworkId
pNetworkId
Parser (SigningKeyFile -> String -> Bool -> String -> NodeCmd)
-> Parser SigningKeyFile
-> Parser (String -> Bool -> String -> NodeCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (String -> SigningKeyFile
SigningKeyFile (String -> SigningKeyFile)
-> Parser String -> Parser SigningKeyFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser String
parseFilePath String
"signing-key" String
"Filepath of signing key.")
Parser (String -> Bool -> String -> NodeCmd)
-> Parser String -> Parser (Bool -> String -> NodeCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser String
parseFilePath String
"proposal-filepath" String
"Filepath of Byron update proposal."
Parser (Bool -> String -> NodeCmd)
-> Parser Bool -> Parser (String -> NodeCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Bool
parseVoteBool
Parser (String -> NodeCmd) -> Parser String -> Parser NodeCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser String
parseFilePath String
"output-filepath" String
"Byron vote output filepath."
parseScriptVersion :: Parser (Maybe ParametersToUpdate)
parseScriptVersion :: Parser (Maybe ParametersToUpdate)
parseScriptVersion = Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate))
-> Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall a b. (a -> b) -> a -> b
$
Word16 -> ParametersToUpdate
ScriptVersion (Word16 -> ParametersToUpdate)
-> Parser Word16 -> Parser ParametersToUpdate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Word16 -> Mod OptionFields Word16 -> Parser Word16
forall a. ReadM a -> Mod OptionFields a -> Parser a
option ReadM Word16
forall a. Read a => ReadM a
auto
( String -> Mod OptionFields Word16
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"script-version"
Mod OptionFields Word16
-> Mod OptionFields Word16 -> Mod OptionFields Word16
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word16
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"WORD16"
Mod OptionFields Word16
-> Mod OptionFields Word16 -> Mod OptionFields Word16
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word16
forall (f :: * -> *) a. String -> Mod f a
help String
"Proposed script version."
)
parseSlotDuration :: Parser (Maybe ParametersToUpdate)
parseSlotDuration :: Parser (Maybe ParametersToUpdate)
parseSlotDuration = Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate))
-> Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall a b. (a -> b) -> a -> b
$
Natural -> ParametersToUpdate
SlotDuration (Natural -> ParametersToUpdate)
-> Parser Natural -> Parser ParametersToUpdate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Natural -> Mod OptionFields Natural -> Parser Natural
forall a. ReadM a -> Mod OptionFields a -> Parser a
option ReadM Natural
forall a. Read a => ReadM a
auto
( String -> Mod OptionFields Natural
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"slot-duration"
Mod OptionFields Natural
-> Mod OptionFields Natural -> Mod OptionFields Natural
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Natural
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"NATURAL"
Mod OptionFields Natural
-> Mod OptionFields Natural -> Mod OptionFields Natural
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Natural
forall (f :: * -> *) a. String -> Mod f a
help String
"Proposed slot duration."
)
parseSystemTag :: Parser SystemTag
parseSystemTag :: Parser SystemTag
parseSystemTag = ReadM SystemTag -> Mod OptionFields SystemTag -> Parser SystemTag
forall a. ReadM a -> Mod OptionFields a -> Parser a
option ((String -> Either String SystemTag) -> ReadM SystemTag
forall a. (String -> Either String a) -> ReadM a
eitherReader String -> Either String SystemTag
checkSysTag)
( String -> Mod OptionFields SystemTag
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"system-tag"
Mod OptionFields SystemTag
-> Mod OptionFields SystemTag -> Mod OptionFields SystemTag
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields SystemTag
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"STRING"
Mod OptionFields SystemTag
-> Mod OptionFields SystemTag -> Mod OptionFields SystemTag
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields SystemTag
forall (f :: * -> *) a. String -> Mod f a
help String
"Identify which system (linux, win64, etc) the update proposal is for."
)
where
checkSysTag :: String -> Either String SystemTag
checkSysTag :: String -> Either String SystemTag
checkSysTag String
name =
let tag :: SystemTag
tag = Text -> SystemTag
SystemTag (Text -> SystemTag) -> Text -> SystemTag
forall a b. (a -> b) -> a -> b
$ String -> Text
forall a b. ConvertText a b => a -> b
toS String
name
in case SystemTag -> Either SystemTagError ()
forall (m :: * -> *).
MonadError SystemTagError m =>
SystemTag -> m ()
checkSystemTag SystemTag
tag of
Left SystemTagError
err -> String -> Either String SystemTag
forall a b. a -> Either a b
Left (String -> Either String SystemTag)
-> (Text -> String) -> Text -> Either String SystemTag
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Text -> String
forall a b. ConvertText a b => a -> b
toS (Text -> Either String SystemTag)
-> Text -> Either String SystemTag
forall a b. (a -> b) -> a -> b
$ Format Text (SystemTagError -> Text) -> SystemTagError -> Text
forall a. Format Text a -> a
sformat Format Text (SystemTagError -> Text)
forall a r. Buildable a => Format r (a -> r)
build SystemTagError
err
Right () -> SystemTag -> Either String SystemTag
forall a b. b -> Either a b
Right SystemTag
tag
parseInstallerHash :: Parser InstallerHash
parseInstallerHash :: Parser InstallerHash
parseInstallerHash =
Hash Raw -> InstallerHash
InstallerHash (Hash Raw -> InstallerHash)
-> (String -> Hash Raw) -> String -> InstallerHash
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> Hash Raw
hashRaw (ByteString -> Hash Raw)
-> (String -> ByteString) -> String -> Hash Raw
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> ByteString
C8.pack
(String -> InstallerHash) -> Parser String -> Parser InstallerHash
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Mod OptionFields String -> Parser String
forall s. IsString s => Mod OptionFields s -> Parser s
strOption ( String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"installer-hash"
Mod OptionFields String
-> Mod OptionFields String -> Mod OptionFields String
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields String
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"HASH"
Mod OptionFields String
-> Mod OptionFields String -> Mod OptionFields String
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields String
forall (f :: * -> *) a. String -> Mod f a
help String
"Software hash."
)
parseMaxBlockSize :: Parser (Maybe ParametersToUpdate)
parseMaxBlockSize :: Parser (Maybe ParametersToUpdate)
parseMaxBlockSize = Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate))
-> Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall a b. (a -> b) -> a -> b
$
Natural -> ParametersToUpdate
MaxBlockSize (Natural -> ParametersToUpdate)
-> Parser Natural -> Parser ParametersToUpdate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Natural -> Mod OptionFields Natural -> Parser Natural
forall a. ReadM a -> Mod OptionFields a -> Parser a
option ReadM Natural
forall a. Read a => ReadM a
auto
( String -> Mod OptionFields Natural
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"max-block-size"
Mod OptionFields Natural
-> Mod OptionFields Natural -> Mod OptionFields Natural
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Natural
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"NATURAL"
Mod OptionFields Natural
-> Mod OptionFields Natural -> Mod OptionFields Natural
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Natural
forall (f :: * -> *) a. String -> Mod f a
help String
"Proposed max block size."
)
parseMaxHeaderSize :: Parser (Maybe ParametersToUpdate)
= Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate))
-> Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall a b. (a -> b) -> a -> b
$
Natural -> ParametersToUpdate
MaxHeaderSize (Natural -> ParametersToUpdate)
-> Parser Natural -> Parser ParametersToUpdate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Natural -> Mod OptionFields Natural -> Parser Natural
forall a. ReadM a -> Mod OptionFields a -> Parser a
option ReadM Natural
forall a. Read a => ReadM a
auto
( String -> Mod OptionFields Natural
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"max-header-size"
Mod OptionFields Natural
-> Mod OptionFields Natural -> Mod OptionFields Natural
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Natural
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"NATURAL"
Mod OptionFields Natural
-> Mod OptionFields Natural -> Mod OptionFields Natural
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Natural
forall (f :: * -> *) a. String -> Mod f a
help String
"Proposed max block header size."
)
parseMaxTxSize :: Parser (Maybe ParametersToUpdate)
parseMaxTxSize :: Parser (Maybe ParametersToUpdate)
parseMaxTxSize = Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate))
-> Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall a b. (a -> b) -> a -> b
$
Natural -> ParametersToUpdate
MaxTxSize (Natural -> ParametersToUpdate)
-> Parser Natural -> Parser ParametersToUpdate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Natural -> Mod OptionFields Natural -> Parser Natural
forall a. ReadM a -> Mod OptionFields a -> Parser a
option ReadM Natural
forall a. Read a => ReadM a
auto
( String -> Mod OptionFields Natural
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"max-tx-size"
Mod OptionFields Natural
-> Mod OptionFields Natural -> Mod OptionFields Natural
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Natural
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"NATURAL"
Mod OptionFields Natural
-> Mod OptionFields Natural -> Mod OptionFields Natural
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Natural
forall (f :: * -> *) a. String -> Mod f a
help String
"Proposed max transaction size."
)
parseMaxProposalSize :: Parser (Maybe ParametersToUpdate)
parseMaxProposalSize :: Parser (Maybe ParametersToUpdate)
parseMaxProposalSize = Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate))
-> Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall a b. (a -> b) -> a -> b
$
Natural -> ParametersToUpdate
MaxProposalSize (Natural -> ParametersToUpdate)
-> Parser Natural -> Parser ParametersToUpdate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Natural -> Mod OptionFields Natural -> Parser Natural
forall a. ReadM a -> Mod OptionFields a -> Parser a
option ReadM Natural
forall a. Read a => ReadM a
auto
( String -> Mod OptionFields Natural
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"max-proposal-size"
Mod OptionFields Natural
-> Mod OptionFields Natural -> Mod OptionFields Natural
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Natural
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"NATURAL"
Mod OptionFields Natural
-> Mod OptionFields Natural -> Mod OptionFields Natural
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Natural
forall (f :: * -> *) a. String -> Mod f a
help String
"Proposed max update proposal size."
)
parseMpcThd :: Parser (Maybe ParametersToUpdate)
parseMpcThd :: Parser (Maybe ParametersToUpdate)
parseMpcThd = Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate))
-> Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall a b. (a -> b) -> a -> b
$
LovelacePortion -> ParametersToUpdate
MpcThd (LovelacePortion -> ParametersToUpdate)
-> (Rational -> LovelacePortion) -> Rational -> ParametersToUpdate
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Rational -> LovelacePortion
rationalToLovelacePortion
(Rational -> ParametersToUpdate)
-> Parser Rational -> Parser ParametersToUpdate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser Rational
parseFraction String
"max-mpc-thd" String
"Proposed max mpc threshold."
parseProtocolVersion :: Parser ProtocolVersion
parseProtocolVersion :: Parser ProtocolVersion
parseProtocolVersion =
Word16 -> Word16 -> Word8 -> ProtocolVersion
ProtocolVersion (Word16 -> Word16 -> Word8 -> ProtocolVersion)
-> Parser Word16 -> Parser (Word16 -> Word8 -> ProtocolVersion)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (String -> String -> String -> Parser Word16
forall a. Integral a => String -> String -> String -> Parser a
parseWord String
"protocol-version-major" String
"Protocol verson major." String
"WORD16" :: Parser Word16)
Parser (Word16 -> Word8 -> ProtocolVersion)
-> Parser Word16 -> Parser (Word8 -> ProtocolVersion)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (String -> String -> String -> Parser Word16
forall a. Integral a => String -> String -> String -> Parser a
parseWord String
"protocol-version-minor" String
"Protocol verson minor." String
"WORD16" :: Parser Word16)
Parser (Word8 -> ProtocolVersion)
-> Parser Word8 -> Parser ProtocolVersion
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (String -> String -> String -> Parser Word8
forall a. Integral a => String -> String -> String -> Parser a
parseWord String
"protocol-version-alt" String
"Protocol verson alt." String
"WORD8" :: Parser Word8)
parseHeavyDelThd :: Parser (Maybe ParametersToUpdate)
parseHeavyDelThd :: Parser (Maybe ParametersToUpdate)
parseHeavyDelThd = Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate))
-> Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall a b. (a -> b) -> a -> b
$
LovelacePortion -> ParametersToUpdate
HeavyDelThd (LovelacePortion -> ParametersToUpdate)
-> (Rational -> LovelacePortion) -> Rational -> ParametersToUpdate
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Rational -> LovelacePortion
rationalToLovelacePortion
(Rational -> ParametersToUpdate)
-> Parser Rational -> Parser ParametersToUpdate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser Rational
parseFraction String
"heavy-del-thd" String
"Proposed heavy delegation threshold."
parseUpdateVoteThd :: Parser (Maybe ParametersToUpdate)
parseUpdateVoteThd :: Parser (Maybe ParametersToUpdate)
parseUpdateVoteThd = Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate))
-> Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall a b. (a -> b) -> a -> b
$
LovelacePortion -> ParametersToUpdate
UpdateVoteThd (LovelacePortion -> ParametersToUpdate)
-> (Rational -> LovelacePortion) -> Rational -> ParametersToUpdate
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Rational -> LovelacePortion
rationalToLovelacePortion
(Rational -> ParametersToUpdate)
-> Parser Rational -> Parser ParametersToUpdate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser Rational
parseFraction String
"update-vote-thd" String
"Propose update vote threshold."
parseUpdateProposalThd :: Parser (Maybe ParametersToUpdate)
parseUpdateProposalThd :: Parser (Maybe ParametersToUpdate)
parseUpdateProposalThd = Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate))
-> Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall a b. (a -> b) -> a -> b
$
LovelacePortion -> ParametersToUpdate
UpdateProposalThd (LovelacePortion -> ParametersToUpdate)
-> (Rational -> LovelacePortion) -> Rational -> ParametersToUpdate
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Rational -> LovelacePortion
rationalToLovelacePortion
(Rational -> ParametersToUpdate)
-> Parser Rational -> Parser ParametersToUpdate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser Rational
parseFraction String
"update-proposal-thd" String
"Propose update proposal threshold."
parseUpdateProposalTTL :: Parser (Maybe ParametersToUpdate)
parseUpdateProposalTTL :: Parser (Maybe ParametersToUpdate)
parseUpdateProposalTTL = Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate))
-> Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall a b. (a -> b) -> a -> b
$
SlotNumber -> ParametersToUpdate
UpdateProposalTTL (SlotNumber -> ParametersToUpdate)
-> (Word64 -> SlotNumber) -> Word64 -> ParametersToUpdate
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Word64 -> SlotNumber
SlotNumber
(Word64 -> ParametersToUpdate)
-> Parser Word64 -> Parser ParametersToUpdate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Word64 -> Mod OptionFields Word64 -> Parser Word64
forall a. ReadM a -> Mod OptionFields a -> Parser a
option ReadM Word64
forall a. Read a => ReadM a
auto
( String -> Mod OptionFields Word64
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"time-to-live"
Mod OptionFields Word64
-> Mod OptionFields Word64 -> Mod OptionFields Word64
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word64
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"WORD64"
Mod OptionFields Word64
-> Mod OptionFields Word64 -> Mod OptionFields Word64
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word64
forall (f :: * -> *) a. String -> Mod f a
help String
"Proposed time for an update proposal to live."
)
parseSoftforkRuleParam :: Parser (Maybe ParametersToUpdate)
parseSoftforkRuleParam :: Parser (Maybe ParametersToUpdate)
parseSoftforkRuleParam = Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate))
-> Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall a b. (a -> b) -> a -> b
$
SoftforkRule -> ParametersToUpdate
SoftforkRuleParam
(SoftforkRule -> ParametersToUpdate)
-> Parser SoftforkRule -> Parser ParametersToUpdate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (LovelacePortion
-> LovelacePortion -> LovelacePortion -> SoftforkRule
SoftforkRule
(LovelacePortion
-> LovelacePortion -> LovelacePortion -> SoftforkRule)
-> Parser LovelacePortion
-> Parser (LovelacePortion -> LovelacePortion -> SoftforkRule)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Rational -> LovelacePortion
rationalToLovelacePortion (Rational -> LovelacePortion)
-> Parser Rational -> Parser LovelacePortion
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser Rational
parseFraction String
"softfork-init-thd" String
"Propose initial threshold (right after proposal is confirmed).")
Parser (LovelacePortion -> LovelacePortion -> SoftforkRule)
-> Parser LovelacePortion
-> Parser (LovelacePortion -> SoftforkRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Rational -> LovelacePortion
rationalToLovelacePortion (Rational -> LovelacePortion)
-> Parser Rational -> Parser LovelacePortion
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser Rational
parseFraction String
"softfork-min-thd" String
"Propose minimum threshold (threshold can't be less than this).")
Parser (LovelacePortion -> SoftforkRule)
-> Parser LovelacePortion -> Parser SoftforkRule
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Rational -> LovelacePortion
rationalToLovelacePortion (Rational -> LovelacePortion)
-> Parser Rational -> Parser LovelacePortion
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser Rational
parseFraction String
"softfork-thd-dec" String
"Propose threshold decrement (threshold will decrease by this amount after each epoch).")
)
parseSoftwareVersion :: Parser SoftwareVersion
parseSoftwareVersion :: Parser SoftwareVersion
parseSoftwareVersion =
ApplicationName -> Word32 -> SoftwareVersion
SoftwareVersion (ApplicationName -> Word32 -> SoftwareVersion)
-> Parser ApplicationName -> Parser (Word32 -> SoftwareVersion)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser ApplicationName
parseApplicationName Parser (Word32 -> SoftwareVersion)
-> Parser Word32 -> Parser SoftwareVersion
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Word32
parseNumSoftwareVersion
parseApplicationName :: Parser ApplicationName
parseApplicationName :: Parser ApplicationName
parseApplicationName = ReadM ApplicationName
-> Mod OptionFields ApplicationName -> Parser ApplicationName
forall a. ReadM a -> Mod OptionFields a -> Parser a
option ((String -> Either String ApplicationName) -> ReadM ApplicationName
forall a. (String -> Either String a) -> ReadM a
eitherReader String -> Either String ApplicationName
checkAppNameLength)
( String -> Mod OptionFields ApplicationName
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"application-name"
Mod OptionFields ApplicationName
-> Mod OptionFields ApplicationName
-> Mod OptionFields ApplicationName
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields ApplicationName
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"STRING"
Mod OptionFields ApplicationName
-> Mod OptionFields ApplicationName
-> Mod OptionFields ApplicationName
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields ApplicationName
forall (f :: * -> *) a. String -> Mod f a
help String
"The name of the application."
)
where
checkAppNameLength :: String -> Either String ApplicationName
checkAppNameLength :: String -> Either String ApplicationName
checkAppNameLength String
name =
let appName :: ApplicationName
appName = Text -> ApplicationName
ApplicationName (Text -> ApplicationName) -> Text -> ApplicationName
forall a b. (a -> b) -> a -> b
$ String -> Text
forall a b. ConvertText a b => a -> b
toS String
name
in case ApplicationName -> Either ApplicationNameError ()
forall (m :: * -> *).
MonadError ApplicationNameError m =>
ApplicationName -> m ()
checkApplicationName ApplicationName
appName of
Left ApplicationNameError
err -> String -> Either String ApplicationName
forall a b. a -> Either a b
Left (String -> Either String ApplicationName)
-> (Text -> String) -> Text -> Either String ApplicationName
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Text -> String
forall a b. ConvertText a b => a -> b
toS (Text -> Either String ApplicationName)
-> Text -> Either String ApplicationName
forall a b. (a -> b) -> a -> b
$ Format Text (ApplicationNameError -> Text)
-> ApplicationNameError -> Text
forall a. Format Text a -> a
sformat Format Text (ApplicationNameError -> Text)
forall a r. Buildable a => Format r (a -> r)
build ApplicationNameError
err
Right () -> ApplicationName -> Either String ApplicationName
forall a b. b -> Either a b
Right ApplicationName
appName
parseNumSoftwareVersion :: Parser NumSoftwareVersion
parseNumSoftwareVersion :: Parser Word32
parseNumSoftwareVersion =
String -> String -> String -> Parser Word32
forall a. Integral a => String -> String -> String -> Parser a
parseWord
String
"software-version-num"
String
"Numeric software version associated with application name."
String
"WORD32"
parseTxFeePolicy :: Parser (Maybe ParametersToUpdate)
parseTxFeePolicy :: Parser (Maybe ParametersToUpdate)
parseTxFeePolicy = Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate))
-> Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall a b. (a -> b) -> a -> b
$
TxFeePolicy -> ParametersToUpdate
TxFeePolicy (TxFeePolicy -> ParametersToUpdate)
-> (TxSizeLinear -> TxFeePolicy)
-> TxSizeLinear
-> ParametersToUpdate
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. TxSizeLinear -> TxFeePolicy
TxFeePolicyTxSizeLinear
(TxSizeLinear -> ParametersToUpdate)
-> Parser TxSizeLinear -> Parser ParametersToUpdate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ( Lovelace -> Rational -> TxSizeLinear
TxSizeLinear (Lovelace -> Rational -> TxSizeLinear)
-> Parser Lovelace -> Parser (Rational -> TxSizeLinear)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser Lovelace
parseLovelace String
"tx-fee-a-constant" String
"Propose the constant a for txfee = a + b*s where s is the size."
Parser (Rational -> TxSizeLinear)
-> Parser Rational -> Parser TxSizeLinear
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser Rational
parseFraction String
"tx-fee-b-constant" String
"Propose the constant b for txfee = a + b*s where s is the size."
)
parseVoteBool :: Parser Bool
parseVoteBool :: Parser Bool
parseVoteBool = Bool -> Mod FlagFields Bool -> Parser Bool
forall a. a -> Mod FlagFields a -> Parser a
flag' Bool
True (String -> Mod FlagFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"vote-yes" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields Bool
forall (f :: * -> *) a. String -> Mod f a
help String
"Vote yes with respect to an update proposal.")
Parser Bool -> Parser Bool -> Parser Bool
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Bool -> Mod FlagFields Bool -> Parser Bool
forall a. a -> Mod FlagFields a -> Parser a
flag' Bool
False (String -> Mod FlagFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"vote-no" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields Bool
forall (f :: * -> *) a. String -> Mod f a
help String
"Vote no with respect to an update proposal.")
parseUnlockStakeEpoch :: Parser (Maybe ParametersToUpdate)
parseUnlockStakeEpoch :: Parser (Maybe ParametersToUpdate)
parseUnlockStakeEpoch = Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate))
-> Parser ParametersToUpdate -> Parser (Maybe ParametersToUpdate)
forall a b. (a -> b) -> a -> b
$
EpochNumber -> ParametersToUpdate
UnlockStakeEpoch (EpochNumber -> ParametersToUpdate)
-> (Word64 -> EpochNumber) -> Word64 -> ParametersToUpdate
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Word64 -> EpochNumber
EpochNumber
(Word64 -> ParametersToUpdate)
-> Parser Word64 -> Parser ParametersToUpdate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Word64 -> Mod OptionFields Word64 -> Parser Word64
forall a. ReadM a -> Mod OptionFields a -> Parser a
option ReadM Word64
forall a. Read a => ReadM a
auto
( String -> Mod OptionFields Word64
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"unlock-stake-epoch"
Mod OptionFields Word64
-> Mod OptionFields Word64 -> Mod OptionFields Word64
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word64
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"WORD64"
Mod OptionFields Word64
-> Mod OptionFields Word64 -> Mod OptionFields Word64
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word64
forall (f :: * -> *) a. String -> Mod f a
help String
"Proposed epoch to unlock all stake."
)
parseWord :: Integral a => String -> String -> String -> Parser a
parseWord :: String -> String -> String -> Parser a
parseWord String
optname String
desc String
metvar = ReadM a -> Mod OptionFields a -> Parser a
forall a. ReadM a -> Mod OptionFields a -> Parser a
option (Integer -> a
forall a. Num a => Integer -> a
fromInteger (Integer -> a) -> ReadM Integer -> ReadM a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Integer
forall a. Read a => ReadM a
auto)
(Mod OptionFields a -> Parser a) -> Mod OptionFields a -> Parser a
forall a b. (a -> b) -> a -> b
$ String -> Mod OptionFields a
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
optname Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields a
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
metvar Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields a
forall (f :: * -> *) a. String -> Mod f a
help String
desc
parseAddress :: String -> String -> Parser Address
parseAddress :: String -> String -> Parser Address
parseAddress String
opt String
desc =
ReadM Address -> Mod OptionFields Address -> Parser Address
forall a. ReadM a -> Mod OptionFields a -> Parser a
option (Text -> Address
cliParseBase58Address (Text -> Address) -> ReadM Text -> ReadM Address
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Text
forall s. IsString s => ReadM s
str)
(Mod OptionFields Address -> Parser Address)
-> Mod OptionFields Address -> Parser Address
forall a b. (a -> b) -> a -> b
$ String -> Mod OptionFields Address
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
opt Mod OptionFields Address
-> Mod OptionFields Address -> Mod OptionFields Address
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Address
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"ADDR" Mod OptionFields Address
-> Mod OptionFields Address -> Mod OptionFields Address
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Address
forall (f :: * -> *) a. String -> Mod f a
help String
desc
parseCardanoEra :: Parser CardanoEra
parseCardanoEra :: Parser CardanoEra
parseCardanoEra = [Parser CardanoEra] -> Parser CardanoEra
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
[ CardanoEra -> Mod FlagFields CardanoEra -> Parser CardanoEra
forall a. a -> Mod FlagFields a -> Parser a
flag' CardanoEra
ByronEraLegacy (Mod FlagFields CardanoEra -> Parser CardanoEra)
-> Mod FlagFields CardanoEra -> Parser CardanoEra
forall a b. (a -> b) -> a -> b
$
String -> Mod FlagFields CardanoEra
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"byron-legacy-formats"
Mod FlagFields CardanoEra
-> Mod FlagFields CardanoEra -> Mod FlagFields CardanoEra
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields CardanoEra
forall (f :: * -> *) a. String -> Mod f a
help String
"Byron/cardano-sl formats and compatibility"
, CardanoEra -> Mod FlagFields CardanoEra -> Parser CardanoEra
forall a. a -> Mod FlagFields a -> Parser a
flag' CardanoEra
ByronEra (Mod FlagFields CardanoEra -> Parser CardanoEra)
-> Mod FlagFields CardanoEra -> Parser CardanoEra
forall a b. (a -> b) -> a -> b
$
String -> Mod FlagFields CardanoEra
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"byron-formats"
Mod FlagFields CardanoEra
-> Mod FlagFields CardanoEra -> Mod FlagFields CardanoEra
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields CardanoEra
forall (f :: * -> *) a. String -> Mod f a
help String
"Byron era formats and compatibility"
, CardanoEra -> Mod FlagFields CardanoEra -> Parser CardanoEra
forall a. a -> Mod FlagFields a -> Parser a
flag' CardanoEra
ByronEraLegacy (Mod FlagFields CardanoEra -> Parser CardanoEra)
-> Mod FlagFields CardanoEra -> Parser CardanoEra
forall a b. (a -> b) -> a -> b
$ Mod FlagFields CardanoEra
forall (f :: * -> *) a. Mod f a
hidden Mod FlagFields CardanoEra
-> Mod FlagFields CardanoEra -> Mod FlagFields CardanoEra
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields CardanoEra
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"byron-legacy"
, CardanoEra -> Mod FlagFields CardanoEra -> Parser CardanoEra
forall a. a -> Mod FlagFields a -> Parser a
flag' CardanoEra
ByronEra (Mod FlagFields CardanoEra -> Parser CardanoEra)
-> Mod FlagFields CardanoEra -> Parser CardanoEra
forall a b. (a -> b) -> a -> b
$ Mod FlagFields CardanoEra
forall (f :: * -> *) a. Mod f a
hidden Mod FlagFields CardanoEra
-> Mod FlagFields CardanoEra -> Mod FlagFields CardanoEra
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields CardanoEra
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"real-pbft"
]
parseCertificateFile :: String -> String -> Parser CertificateFile
parseCertificateFile :: String -> String -> Parser CertificateFile
parseCertificateFile String
opt String
desc = String -> CertificateFile
CertificateFile (String -> CertificateFile)
-> Parser String -> Parser CertificateFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser String
parseFilePath String
opt String
desc
parseFakeAvvmOptions :: Parser FakeAvvmOptions
parseFakeAvvmOptions :: Parser FakeAvvmOptions
parseFakeAvvmOptions =
Word -> Lovelace -> FakeAvvmOptions
FakeAvvmOptions
(Word -> Lovelace -> FakeAvvmOptions)
-> Parser Word -> Parser (Lovelace -> FakeAvvmOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser Word
forall a. Integral a => String -> String -> Parser a
parseIntegral String
"avvm-entry-count" String
"Number of AVVM addresses."
Parser (Lovelace -> FakeAvvmOptions)
-> Parser Lovelace -> Parser FakeAvvmOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser Lovelace
parseLovelace String
"avvm-entry-balance" String
"AVVM address."
parseK :: Parser BlockCount
parseK :: Parser BlockCount
parseK =
Word64 -> BlockCount
BlockCount
(Word64 -> BlockCount) -> Parser Word64 -> Parser BlockCount
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser Word64
forall a. Integral a => String -> String -> Parser a
parseIntegral String
"k" String
"The security parameter of the Ouroboros protocol."
parseNewDirectory :: String -> String -> Parser NewDirectory
parseNewDirectory :: String -> String -> Parser NewDirectory
parseNewDirectory String
opt String
desc = String -> NewDirectory
NewDirectory (String -> NewDirectory) -> Parser String -> Parser NewDirectory
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser String
parseFilePath String
opt String
desc
parseFractionWithDefault
:: String
-> String
-> Double
-> Parser Rational
parseFractionWithDefault :: String -> String -> Double -> Parser Rational
parseFractionWithDefault String
optname String
desc Double
w =
Double -> Rational
forall a. Real a => a -> Rational
toRational (Double -> Rational) -> Parser Double -> Parser Rational
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Double -> Mod OptionFields Double -> Parser Double
forall a. ReadM a -> Mod OptionFields a -> Parser a
option ReadM Double
readDouble
( String -> Mod OptionFields Double
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
optname
Mod OptionFields Double
-> Mod OptionFields Double -> Mod OptionFields Double
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Double
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"DOUBLE"
Mod OptionFields Double
-> Mod OptionFields Double -> Mod OptionFields Double
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Double
forall (f :: * -> *) a. String -> Mod f a
help String
desc
Mod OptionFields Double
-> Mod OptionFields Double -> Mod OptionFields Double
forall a. Semigroup a => a -> a -> a
<> Double -> Mod OptionFields Double
forall (f :: * -> *) a. HasValue f => a -> Mod f a
value Double
w
)
pNetworkId :: Parser Typed.NetworkId
pNetworkId :: Parser NetworkId
pNetworkId =
Parser NetworkId
pMainnet' Parser NetworkId -> Parser NetworkId -> Parser NetworkId
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (NetworkMagic -> NetworkId)
-> Parser NetworkMagic -> Parser NetworkId
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap NetworkMagic -> NetworkId
Typed.Testnet Parser NetworkMagic
pTestnetMagic
where
pMainnet' :: Parser Typed.NetworkId
pMainnet' :: Parser NetworkId
pMainnet' =
NetworkId -> Mod FlagFields NetworkId -> Parser NetworkId
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' NetworkId
Typed.Mainnet
( String -> Mod FlagFields NetworkId
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"mainnet"
Mod FlagFields NetworkId
-> Mod FlagFields NetworkId -> Mod FlagFields NetworkId
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields NetworkId
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use the mainnet magic id."
)
pTestnetMagic :: Parser Typed.NetworkMagic
pTestnetMagic :: Parser NetworkMagic
pTestnetMagic =
Word32 -> NetworkMagic
Typed.NetworkMagic (Word32 -> NetworkMagic) -> Parser Word32 -> Parser NetworkMagic
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
ReadM Word32 -> Mod OptionFields Word32 -> Parser Word32
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Word32
forall a. Read a => ReadM a
Opt.auto
( String -> Mod OptionFields Word32
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"testnet-magic"
Mod OptionFields Word32
-> Mod OptionFields Word32 -> Mod OptionFields Word32
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word32
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"NATURAL"
Mod OptionFields Word32
-> Mod OptionFields Word32 -> Mod OptionFields Word32
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word32
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Specify a testnet magic id."
)
parseNewCertificateFile :: String -> Parser NewCertificateFile
parseNewCertificateFile :: String -> Parser NewCertificateFile
parseNewCertificateFile String
opt =
String -> NewCertificateFile
NewCertificateFile
(String -> NewCertificateFile)
-> Parser String -> Parser NewCertificateFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser String
parseFilePath String
opt String
"Non-existent file to write the certificate to."
parseNewSigningKeyFile :: String -> Parser NewSigningKeyFile
parseNewSigningKeyFile :: String -> Parser NewSigningKeyFile
parseNewSigningKeyFile String
opt =
String -> NewSigningKeyFile
NewSigningKeyFile
(String -> NewSigningKeyFile)
-> Parser String -> Parser NewSigningKeyFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser String
parseFilePath String
opt String
"Non-existent file to write the signing key to."
parseNewTxFile :: String -> Parser NewTxFile
parseNewTxFile :: String -> Parser NewTxFile
parseNewTxFile String
opt =
String -> NewTxFile
NewTxFile
(String -> NewTxFile) -> Parser String -> Parser NewTxFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser String
parseFilePath String
opt String
"Non-existent file to write the signed transaction to."
parseNewVerificationKeyFile :: String -> Parser NewVerificationKeyFile
parseNewVerificationKeyFile :: String -> Parser NewVerificationKeyFile
parseNewVerificationKeyFile String
opt =
String -> NewVerificationKeyFile
NewVerificationKeyFile
(String -> NewVerificationKeyFile)
-> Parser String -> Parser NewVerificationKeyFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser String
parseFilePath String
opt String
"Non-existent file to write the verification key to."
parseProtocolMagicId :: String -> Parser ProtocolMagicId
parseProtocolMagicId :: String -> Parser ProtocolMagicId
parseProtocolMagicId String
arg =
Word32 -> ProtocolMagicId
ProtocolMagicId
(Word32 -> ProtocolMagicId)
-> Parser Word32 -> Parser ProtocolMagicId
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser Word32
forall a. Integral a => String -> String -> Parser a
parseIntegral String
arg String
"The magic number unique to any instance of Cardano."
parseProtocolMagic :: Parser ProtocolMagic
parseProtocolMagic :: Parser ProtocolMagic
parseProtocolMagic =
(Annotated ProtocolMagicId ()
-> RequiresNetworkMagic -> ProtocolMagic)
-> RequiresNetworkMagic
-> Annotated ProtocolMagicId ()
-> ProtocolMagic
forall a b c. (a -> b -> c) -> b -> a -> c
flip Annotated ProtocolMagicId ()
-> RequiresNetworkMagic -> ProtocolMagic
forall a.
Annotated ProtocolMagicId a
-> RequiresNetworkMagic -> AProtocolMagic a
AProtocolMagic RequiresNetworkMagic
RequiresMagic (Annotated ProtocolMagicId () -> ProtocolMagic)
-> (ProtocolMagicId -> Annotated ProtocolMagicId ())
-> ProtocolMagicId
-> ProtocolMagic
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (ProtocolMagicId -> () -> Annotated ProtocolMagicId ())
-> () -> ProtocolMagicId -> Annotated ProtocolMagicId ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip ProtocolMagicId -> () -> Annotated ProtocolMagicId ()
forall b a. b -> a -> Annotated b a
Annotated ()
(ProtocolMagicId -> ProtocolMagic)
-> Parser ProtocolMagicId -> Parser ProtocolMagic
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> Parser ProtocolMagicId
parseProtocolMagicId String
"protocol-magic"
parseTxFile :: String -> Parser TxFile
parseTxFile :: String -> Parser TxFile
parseTxFile String
opt =
String -> TxFile
TxFile
(String -> TxFile) -> Parser String -> Parser TxFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser String
parseFilePath String
opt String
"File containing the signed transaction."
parseUTCTime :: String -> String -> Parser UTCTime
parseUTCTime :: String -> String -> Parser UTCTime
parseUTCTime String
optname String
desc =
ReadM UTCTime -> Mod OptionFields UTCTime -> Parser UTCTime
forall a. ReadM a -> Mod OptionFields a -> Parser a
option (POSIXTime -> UTCTime
posixSecondsToUTCTime (POSIXTime -> UTCTime)
-> (Integer -> POSIXTime) -> Integer -> UTCTime
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Integer -> POSIXTime
forall a. Num a => Integer -> a
fromInteger (Integer -> UTCTime) -> ReadM Integer -> ReadM UTCTime
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Integer
forall a. Read a => ReadM a
auto)
(Mod OptionFields UTCTime -> Parser UTCTime)
-> Mod OptionFields UTCTime -> Parser UTCTime
forall a b. (a -> b) -> a -> b
$ String -> Mod OptionFields UTCTime
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
optname Mod OptionFields UTCTime
-> Mod OptionFields UTCTime -> Mod OptionFields UTCTime
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields UTCTime
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"POSIXSECONDS" Mod OptionFields UTCTime
-> Mod OptionFields UTCTime -> Mod OptionFields UTCTime
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields UTCTime
forall (f :: * -> *) a. String -> Mod f a
help String
desc
cliParseLovelace :: Word64 -> Lovelace
cliParseLovelace :: Word64 -> Lovelace
cliParseLovelace =
(LovelaceError -> Lovelace)
-> (Lovelace -> Lovelace)
-> Either LovelaceError Lovelace
-> Lovelace
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (Text -> Lovelace
forall a. HasCallStack => Text -> a
panic (Text -> Lovelace)
-> (LovelaceError -> Text) -> LovelaceError -> Lovelace
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Text
"Bad Lovelace value: " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>) (Text -> Text) -> (LovelaceError -> Text) -> LovelaceError -> Text
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. LovelaceError -> Text
forall a b. (Show a, ConvertText String b) => a -> b
show) Lovelace -> Lovelace
forall (cat :: * -> * -> *) a. Category cat => cat a a
identity
(Either LovelaceError Lovelace -> Lovelace)
-> (Word64 -> Either LovelaceError Lovelace) -> Word64 -> Lovelace
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Word64 -> Either LovelaceError Lovelace
mkLovelace
cliParseBase58Address :: Text -> Address
cliParseBase58Address :: Text -> Address
cliParseBase58Address =
(DecoderError -> Address)
-> (Address -> Address) -> Either DecoderError Address -> Address
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (Text -> Address
forall a. HasCallStack => Text -> a
panic (Text -> Address)
-> (DecoderError -> Text) -> DecoderError -> Address
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Text
"Bad Base58 address: " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>) (Text -> Text) -> (DecoderError -> Text) -> DecoderError -> Text
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. DecoderError -> Text
forall a b. (Show a, ConvertText String b) => a -> b
show) Address -> Address
forall (cat :: * -> * -> *) a. Category cat => cat a a
identity
(Either DecoderError Address -> Address)
-> (Text -> Either DecoderError Address) -> Text -> Address
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Text -> Either DecoderError Address
decodeAddressBase58
cliParseTxId :: String -> TxId
cliParseTxId :: String -> TxId
cliParseTxId =
(Text -> TxId) -> (TxId -> TxId) -> Either Text TxId -> TxId
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (Text -> TxId
forall a. HasCallStack => Text -> a
panic (Text -> TxId) -> (Text -> Text) -> Text -> TxId
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Text
"Bad Lovelace value: " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>) (Text -> Text) -> (Text -> Text) -> Text -> Text
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Text -> Text
forall a b. (Show a, ConvertText String b) => a -> b
show) TxId -> TxId
forall (cat :: * -> * -> *) a. Category cat => cat a a
identity
(Either Text TxId -> TxId)
-> (String -> Either Text TxId) -> String -> TxId
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Text -> Either Text TxId
forall a. Text -> Either Text (Hash a)
decodeHash (Text -> Either Text TxId)
-> (String -> Text) -> String -> Either Text TxId
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> Text
Text.pack
parseFraction :: String -> String -> Parser Rational
parseFraction :: String -> String -> Parser Rational
parseFraction String
optname String
desc =
ReadM Rational -> Mod OptionFields Rational -> Parser Rational
forall a. ReadM a -> Mod OptionFields a -> Parser a
option (Double -> Rational
forall a. Real a => a -> Rational
toRational (Double -> Rational) -> ReadM Double -> ReadM Rational
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Double
readDouble) (Mod OptionFields Rational -> Parser Rational)
-> Mod OptionFields Rational -> Parser Rational
forall a b. (a -> b) -> a -> b
$
String -> Mod OptionFields Rational
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
optname
Mod OptionFields Rational
-> Mod OptionFields Rational -> Mod OptionFields Rational
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Rational
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"DOUBLE"
Mod OptionFields Rational
-> Mod OptionFields Rational -> Mod OptionFields Rational
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Rational
forall (f :: * -> *) a. String -> Mod f a
help String
desc
parseIntegral :: Integral a => String -> String -> Parser a
parseIntegral :: String -> String -> Parser a
parseIntegral String
optname String
desc = ReadM a -> Mod OptionFields a -> Parser a
forall a. ReadM a -> Mod OptionFields a -> Parser a
option (Integer -> a
forall a. Num a => Integer -> a
fromInteger (Integer -> a) -> ReadM Integer -> ReadM a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Integer
forall a. Read a => ReadM a
auto)
(Mod OptionFields a -> Parser a) -> Mod OptionFields a -> Parser a
forall a b. (a -> b) -> a -> b
$ String -> Mod OptionFields a
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
optname Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields a
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"INT" Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields a
forall (f :: * -> *) a. String -> Mod f a
help String
desc
parseLovelace :: String -> String -> Parser Lovelace
parseLovelace :: String -> String -> Parser Lovelace
parseLovelace String
optname String
desc =
(LovelaceError -> Lovelace)
-> (Lovelace -> Lovelace)
-> Either LovelaceError Lovelace
-> Lovelace
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (Text -> Lovelace
forall a. HasCallStack => Text -> a
panic (Text -> Lovelace)
-> (LovelaceError -> Text) -> LovelaceError -> Lovelace
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. LovelaceError -> Text
forall a b. (Show a, ConvertText String b) => a -> b
show) Lovelace -> Lovelace
forall (cat :: * -> * -> *) a. Category cat => cat a a
identity (Either LovelaceError Lovelace -> Lovelace)
-> (Word64 -> Either LovelaceError Lovelace) -> Word64 -> Lovelace
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Word64 -> Either LovelaceError Lovelace
mkLovelace
(Word64 -> Lovelace) -> Parser Word64 -> Parser Lovelace
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser Word64
forall a. Integral a => String -> String -> Parser a
parseIntegral String
optname String
desc
readDouble :: ReadM Double
readDouble :: ReadM Double
readDouble = do
Double
f <- ReadM Double
forall a. Read a => ReadM a
auto
Bool -> ReadM () -> ReadM ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Double
f Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
< Double
0) (ReadM () -> ReadM ()) -> ReadM () -> ReadM ()
forall a b. (a -> b) -> a -> b
$ String -> ReadM ()
forall a. String -> ReadM a
readerError String
"fraction must be >= 0"
Bool -> ReadM () -> ReadM ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Double
f Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
> Double
1) (ReadM () -> ReadM ()) -> ReadM () -> ReadM ()
forall a b. (a -> b) -> a -> b
$ String -> ReadM ()
forall a. String -> ReadM a
readerError String
"fraction must be <= 1"
Double -> ReadM Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
f
parseFilePath :: String -> String -> Parser FilePath
parseFilePath :: String -> String -> Parser String
parseFilePath String
optname String
desc =
Mod OptionFields String -> Parser String
forall s. IsString s => Mod OptionFields s -> Parser s
strOption
( String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
optname
Mod OptionFields String
-> Mod OptionFields String -> Mod OptionFields String
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields String
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"FILEPATH"
Mod OptionFields String
-> Mod OptionFields String -> Mod OptionFields String
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields String
forall (f :: * -> *) a. String -> Mod f a
help String
desc
Mod OptionFields String
-> Mod OptionFields String -> Mod OptionFields String
forall a. Semigroup a => a -> a -> a
<> Completer -> Mod OptionFields String
forall (f :: * -> *) a. HasCompleter f => Completer -> Mod f a
completer (String -> Completer
bashCompleter String
"file")
)
parseSigningKeyFile :: String -> String -> Parser SigningKeyFile
parseSigningKeyFile :: String -> String -> Parser SigningKeyFile
parseSigningKeyFile String
opt String
desc = String -> SigningKeyFile
SigningKeyFile (String -> SigningKeyFile)
-> Parser String -> Parser SigningKeyFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser String
parseFilePath String
opt String
desc
parseGenesisFile :: String -> Parser GenesisFile
parseGenesisFile :: String -> Parser GenesisFile
parseGenesisFile String
opt =
String -> GenesisFile
GenesisFile (String -> GenesisFile) -> Parser String -> Parser GenesisFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser String
parseFilePath String
opt String
"Genesis JSON file."
parsePassword :: Parser PasswordRequirement
parsePassword :: Parser PasswordRequirement
parsePassword =
PasswordRequirement
-> PasswordRequirement
-> Mod FlagFields PasswordRequirement
-> Parser PasswordRequirement
forall a. a -> a -> Mod FlagFields a -> Parser a
flag PasswordRequirement
GetPassword PasswordRequirement
EmptyPassword
( String -> Mod FlagFields PasswordRequirement
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"no-password"
Mod FlagFields PasswordRequirement
-> Mod FlagFields PasswordRequirement
-> Mod FlagFields PasswordRequirement
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields PasswordRequirement
forall (f :: * -> *) a. String -> Mod f a
help String
"Disable password protection."
)