{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}

module Cardano.CLI.Shelley.Parsers
  ( -- * CLI command parser
    parseShelleyCommands

    -- * CLI command and flag types
  , module Cardano.CLI.Shelley.Commands

    -- * Field parser and renderers
  , parseTxIn
  ) where

import           Cardano.Prelude hiding (All, Any, option)
import           Prelude (String)

import           Control.Monad.Fail (fail)
import qualified Data.Aeson as Aeson
import qualified Data.Aeson.Parser as Aeson.Parser
import qualified Data.Attoparsec.ByteString.Char8 as Atto
import qualified Data.ByteString.Base16 as B16
import qualified Data.ByteString.Char8 as BSC
import qualified Data.IP as IP
import qualified Data.List.NonEmpty as NE
import qualified Data.Set as Set
import qualified Data.Text as Text
import qualified Data.Text.Encoding as Text
import           Data.Time.Clock (UTCTime)
import           Data.Time.Format (defaultTimeLocale, iso8601DateFormat, parseTimeOrError)
import           Network.Socket (PortNumber)
import           Options.Applicative hiding (help, str)
import qualified Options.Applicative as Opt
import qualified Options.Applicative.Help as H
import           Prettyprinter (line, pretty)
import           Text.Parsec ((<?>))
import qualified Text.Parsec as Parsec
import qualified Text.Parsec.Error as Parsec
import qualified Text.Parsec.Language as Parsec
import qualified Text.Parsec.String as Parsec
import qualified Text.Parsec.Token as Parsec

import qualified Cardano.Ledger.BaseTypes as Shelley
import qualified Cardano.Ledger.Shelley.TxBody as Shelley
import           Ouroboros.Consensus.BlockchainTime (SystemStart (..))

import           Cardano.Api
import           Cardano.Api.Shelley

import           Cardano.CLI.Shelley.Commands
import           Cardano.CLI.Shelley.Key (InputFormat (..), PaymentVerifier (..),
                   StakeVerifier (..), VerificationKeyOrFile (..), VerificationKeyOrHashOrFile (..),
                   VerificationKeyTextOrFile (..), deserialiseInput, renderInputDecodeError)
import           Cardano.CLI.Types
import           Cardano.Chain.Common (BlockCount (BlockCount))

{- HLINT ignore "Use <$>" -}

--
-- Shelley CLI command parsers
--

parseShelleyCommands :: Parser ShelleyCommand
parseShelleyCommands :: Parser ShelleyCommand
parseShelleyCommands =
  Mod CommandFields ShelleyCommand -> Parser ShelleyCommand
forall a. Mod CommandFields a -> Parser a
Opt.hsubparser (Mod CommandFields ShelleyCommand -> Parser ShelleyCommand)
-> Mod CommandFields ShelleyCommand -> Parser ShelleyCommand
forall a b. (a -> b) -> a -> b
$
    [Mod CommandFields ShelleyCommand]
-> Mod CommandFields ShelleyCommand
forall a. Monoid a => [a] -> a
mconcat
      [ String -> Mod CommandFields ShelleyCommand
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"Era based commands"
      , String -> Mod CommandFields ShelleyCommand
forall a. String -> Mod CommandFields a
Opt.commandGroup String
"Era based commands"
      , String
-> ParserInfo ShelleyCommand -> Mod CommandFields ShelleyCommand
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"address"
          (Parser ShelleyCommand
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (AddressCmd -> ShelleyCommand
AddressCmd (AddressCmd -> ShelleyCommand)
-> Parser AddressCmd -> Parser ShelleyCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AddressCmd
pAddressCmd) (InfoMod ShelleyCommand -> ParserInfo ShelleyCommand)
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a b. (a -> b) -> a -> b
$ String -> InfoMod ShelleyCommand
forall a. String -> InfoMod a
Opt.progDesc String
"Payment address commands")
      , String
-> ParserInfo ShelleyCommand -> Mod CommandFields ShelleyCommand
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"stake-address"
          (Parser ShelleyCommand
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (StakeAddressCmd -> ShelleyCommand
StakeAddressCmd (StakeAddressCmd -> ShelleyCommand)
-> Parser StakeAddressCmd -> Parser ShelleyCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser StakeAddressCmd
pStakeAddressCmd) (InfoMod ShelleyCommand -> ParserInfo ShelleyCommand)
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a b. (a -> b) -> a -> b
$ String -> InfoMod ShelleyCommand
forall a. String -> InfoMod a
Opt.progDesc String
"Stake address commands")
      , String
-> ParserInfo ShelleyCommand -> Mod CommandFields ShelleyCommand
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"key"
          (Parser ShelleyCommand
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (KeyCmd -> ShelleyCommand
KeyCmd (KeyCmd -> ShelleyCommand)
-> Parser KeyCmd -> Parser ShelleyCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser KeyCmd
pKeyCmd) (InfoMod ShelleyCommand -> ParserInfo ShelleyCommand)
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a b. (a -> b) -> a -> b
$ String -> InfoMod ShelleyCommand
forall a. String -> InfoMod a
Opt.progDesc String
"Key utility commands")
      , String
-> ParserInfo ShelleyCommand -> Mod CommandFields ShelleyCommand
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"transaction"
          (Parser ShelleyCommand
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (TransactionCmd -> ShelleyCommand
TransactionCmd (TransactionCmd -> ShelleyCommand)
-> Parser TransactionCmd -> Parser ShelleyCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser TransactionCmd
pTransaction) (InfoMod ShelleyCommand -> ParserInfo ShelleyCommand)
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a b. (a -> b) -> a -> b
$ String -> InfoMod ShelleyCommand
forall a. String -> InfoMod a
Opt.progDesc String
"Transaction commands")
      , String
-> ParserInfo ShelleyCommand -> Mod CommandFields ShelleyCommand
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"node"
          (Parser ShelleyCommand
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (NodeCmd -> ShelleyCommand
NodeCmd (NodeCmd -> ShelleyCommand)
-> Parser NodeCmd -> Parser ShelleyCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser NodeCmd
pNodeCmd) (InfoMod ShelleyCommand -> ParserInfo ShelleyCommand)
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a b. (a -> b) -> a -> b
$ String -> InfoMod ShelleyCommand
forall a. String -> InfoMod a
Opt.progDesc String
"Node operation commands")
      , String
-> ParserInfo ShelleyCommand -> Mod CommandFields ShelleyCommand
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"stake-pool"
          (Parser ShelleyCommand
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (PoolCmd -> ShelleyCommand
PoolCmd (PoolCmd -> ShelleyCommand)
-> Parser PoolCmd -> Parser ShelleyCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser PoolCmd
pPoolCmd) (InfoMod ShelleyCommand -> ParserInfo ShelleyCommand)
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a b. (a -> b) -> a -> b
$ String -> InfoMod ShelleyCommand
forall a. String -> InfoMod a
Opt.progDesc String
"Stake pool commands")
      , String
-> ParserInfo ShelleyCommand -> Mod CommandFields ShelleyCommand
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"query"
          (Parser ShelleyCommand
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (QueryCmd -> ShelleyCommand
QueryCmd (QueryCmd -> ShelleyCommand)
-> Parser QueryCmd -> Parser ShelleyCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser QueryCmd
pQueryCmd) (InfoMod ShelleyCommand -> ParserInfo ShelleyCommand)
-> (String -> InfoMod ShelleyCommand)
-> String
-> ParserInfo ShelleyCommand
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> InfoMod ShelleyCommand
forall a. String -> InfoMod a
Opt.progDesc (String -> ParserInfo ShelleyCommand)
-> String -> ParserInfo ShelleyCommand
forall a b. (a -> b) -> a -> b
$
             [String] -> String
forall a. Monoid a => [a] -> a
mconcat
               [ String
"Node query commands. Will query the local node whose Unix domain socket "
               , String
"is obtained from the CARDANO_NODE_SOCKET_PATH environment variable."
               ]
            )
      , String
-> ParserInfo ShelleyCommand -> Mod CommandFields ShelleyCommand
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"genesis"
          (Parser ShelleyCommand
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (GenesisCmd -> ShelleyCommand
GenesisCmd (GenesisCmd -> ShelleyCommand)
-> Parser GenesisCmd -> Parser ShelleyCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser GenesisCmd
pGenesisCmd) (InfoMod ShelleyCommand -> ParserInfo ShelleyCommand)
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a b. (a -> b) -> a -> b
$ String -> InfoMod ShelleyCommand
forall a. String -> InfoMod a
Opt.progDesc String
"Genesis block commands")
      , String
-> ParserInfo ShelleyCommand -> Mod CommandFields ShelleyCommand
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"governance"
          (Parser ShelleyCommand
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (GovernanceCmd -> ShelleyCommand
GovernanceCmd (GovernanceCmd -> ShelleyCommand)
-> Parser GovernanceCmd -> Parser ShelleyCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser GovernanceCmd
pGovernanceCmd) (InfoMod ShelleyCommand -> ParserInfo ShelleyCommand)
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a b. (a -> b) -> a -> b
$ String -> InfoMod ShelleyCommand
forall a. String -> InfoMod a
Opt.progDesc String
"Governance commands")
      , String
-> ParserInfo ShelleyCommand -> Mod CommandFields ShelleyCommand
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"text-view"
          (Parser ShelleyCommand
-> InfoMod ShelleyCommand -> ParserInfo ShelleyCommand
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (TextViewCmd -> ShelleyCommand
TextViewCmd (TextViewCmd -> ShelleyCommand)
-> Parser TextViewCmd -> Parser ShelleyCommand
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser TextViewCmd
pTextViewCmd) (InfoMod ShelleyCommand -> ParserInfo ShelleyCommand)
-> (String -> InfoMod ShelleyCommand)
-> String
-> ParserInfo ShelleyCommand
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> InfoMod ShelleyCommand
forall a. String -> InfoMod a
Opt.progDesc (String -> ParserInfo ShelleyCommand)
-> String -> ParserInfo ShelleyCommand
forall a b. (a -> b) -> a -> b
$
             [String] -> String
forall a. Monoid a => [a] -> a
mconcat
               [ String
"Commands for dealing with Shelley TextView files. "
               , String
"Transactions, addresses etc are stored on disk as TextView files."
               ]
            )

      ]

pTextViewCmd :: Parser TextViewCmd
pTextViewCmd :: Parser TextViewCmd
pTextViewCmd =
  [Parser TextViewCmd] -> Parser TextViewCmd
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
    [ String -> ParserInfo TextViewCmd -> Parser TextViewCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"decode-cbor"
        (Parser TextViewCmd -> InfoMod TextViewCmd -> ParserInfo TextViewCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (String -> Maybe OutputFile -> TextViewCmd
TextViewInfo (String -> Maybe OutputFile -> TextViewCmd)
-> Parser String -> Parser (Maybe OutputFile -> TextViewCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser String
pCBORInFile Parser (Maybe OutputFile -> TextViewCmd)
-> Parser (Maybe OutputFile) -> Parser TextViewCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile)
          (InfoMod TextViewCmd -> ParserInfo TextViewCmd)
-> InfoMod TextViewCmd -> ParserInfo TextViewCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod TextViewCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Print a TextView file as decoded CBOR."
          )
    ]

pCBORInFile :: Parser FilePath
pCBORInFile :: Parser String
pCBORInFile =
  Mod OptionFields String -> Parser String
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
    (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"in-file"
    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
Opt.metavar String
"FILE"
    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
Opt.help String
"CBOR input file."
    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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
    )
  Parser String -> Parser String -> Parser String
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
  Mod OptionFields String -> Parser String
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
    (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"file"
    Mod OptionFields String
-> Mod OptionFields String -> Mod OptionFields String
forall a. Semigroup a => a -> a -> a
<> Mod OptionFields String
forall (f :: * -> *) a. Mod f a
Opt.internal
    )

pAddressCmd :: Parser AddressCmd
pAddressCmd :: Parser AddressCmd
pAddressCmd =
   [Parser AddressCmd] -> Parser AddressCmd
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
     [ String -> ParserInfo AddressCmd -> Parser AddressCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"key-gen"
         (Parser AddressCmd -> InfoMod AddressCmd -> ParserInfo AddressCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser AddressCmd
pAddressKeyGen (InfoMod AddressCmd -> ParserInfo AddressCmd)
-> InfoMod AddressCmd -> ParserInfo AddressCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod AddressCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create an address key pair.")
     , String -> ParserInfo AddressCmd -> Parser AddressCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"key-hash"
         (Parser AddressCmd -> InfoMod AddressCmd -> ParserInfo AddressCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser AddressCmd
pAddressKeyHash (InfoMod AddressCmd -> ParserInfo AddressCmd)
-> InfoMod AddressCmd -> ParserInfo AddressCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod AddressCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Print the hash of an address key.")
     , String -> ParserInfo AddressCmd -> Parser AddressCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"build"
         (Parser AddressCmd -> InfoMod AddressCmd -> ParserInfo AddressCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser AddressCmd
pAddressBuild (InfoMod AddressCmd -> ParserInfo AddressCmd)
-> InfoMod AddressCmd -> ParserInfo AddressCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod AddressCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Build a Shelley payment address, with optional delegation to a stake address.")
     , String -> ParserInfo AddressCmd -> Parser AddressCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"build-script"
         (Parser AddressCmd -> InfoMod AddressCmd -> ParserInfo AddressCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser AddressCmd
pAddressBuildScript (InfoMod AddressCmd -> ParserInfo AddressCmd)
-> InfoMod AddressCmd -> ParserInfo AddressCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod AddressCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Build a Shelley script address. (deprecated; use 'build' instead with '--payment-script-file')")
     , String -> ParserInfo AddressCmd -> Parser AddressCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"info"
         (Parser AddressCmd -> InfoMod AddressCmd -> ParserInfo AddressCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser AddressCmd
pAddressInfo (InfoMod AddressCmd -> ParserInfo AddressCmd)
-> InfoMod AddressCmd -> ParserInfo AddressCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod AddressCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Print information about an address.")
     ]
  where
    pAddressKeyGen :: Parser AddressCmd
    pAddressKeyGen :: Parser AddressCmd
pAddressKeyGen = AddressKeyType
-> VerificationKeyFile -> SigningKeyFile -> AddressCmd
AddressKeyGen (AddressKeyType
 -> VerificationKeyFile -> SigningKeyFile -> AddressCmd)
-> Parser AddressKeyType
-> Parser (VerificationKeyFile -> SigningKeyFile -> AddressCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AddressKeyType
pAddressKeyType
                                   Parser (VerificationKeyFile -> SigningKeyFile -> AddressCmd)
-> Parser VerificationKeyFile
-> Parser (SigningKeyFile -> AddressCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile FileDirection
Output
                                   Parser (SigningKeyFile -> AddressCmd)
-> Parser SigningKeyFile -> Parser AddressCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FileDirection -> Parser SigningKeyFile
pSigningKeyFile FileDirection
Output

    pAddressKeyHash :: Parser AddressCmd
    pAddressKeyHash :: Parser AddressCmd
pAddressKeyHash =
      VerificationKeyTextOrFile -> Maybe OutputFile -> AddressCmd
AddressKeyHash
        (VerificationKeyTextOrFile -> Maybe OutputFile -> AddressCmd)
-> Parser VerificationKeyTextOrFile
-> Parser (Maybe OutputFile -> AddressCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser VerificationKeyTextOrFile
pPaymentVerificationKeyTextOrFile
        Parser (Maybe OutputFile -> AddressCmd)
-> Parser (Maybe OutputFile) -> Parser AddressCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pAddressBuild :: Parser AddressCmd
    pAddressBuild :: Parser AddressCmd
pAddressBuild = PaymentVerifier
-> Maybe StakeVerifier
-> NetworkId
-> Maybe OutputFile
-> AddressCmd
AddressBuild
      (PaymentVerifier
 -> Maybe StakeVerifier
 -> NetworkId
 -> Maybe OutputFile
 -> AddressCmd)
-> Parser PaymentVerifier
-> Parser
     (Maybe StakeVerifier
      -> NetworkId -> Maybe OutputFile -> AddressCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser PaymentVerifier
pPaymentVerifier
      Parser
  (Maybe StakeVerifier
   -> NetworkId -> Maybe OutputFile -> AddressCmd)
-> Parser (Maybe StakeVerifier)
-> Parser (NetworkId -> Maybe OutputFile -> AddressCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser StakeVerifier -> Parser (Maybe StakeVerifier)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional Parser StakeVerifier
pStakeVerifier
      Parser (NetworkId -> Maybe OutputFile -> AddressCmd)
-> Parser NetworkId -> Parser (Maybe OutputFile -> AddressCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
      Parser (Maybe OutputFile -> AddressCmd)
-> Parser (Maybe OutputFile) -> Parser AddressCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pAddressBuildScript :: Parser AddressCmd
    pAddressBuildScript :: Parser AddressCmd
pAddressBuildScript = ScriptFile -> NetworkId -> Maybe OutputFile -> AddressCmd
AddressBuildMultiSig
      (ScriptFile -> NetworkId -> Maybe OutputFile -> AddressCmd)
-> Parser ScriptFile
-> Parser (NetworkId -> Maybe OutputFile -> AddressCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser ScriptFile
pScript
      Parser (NetworkId -> Maybe OutputFile -> AddressCmd)
-> Parser NetworkId -> Parser (Maybe OutputFile -> AddressCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
      Parser (Maybe OutputFile -> AddressCmd)
-> Parser (Maybe OutputFile) -> Parser AddressCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pAddressInfo :: Parser AddressCmd
    pAddressInfo :: Parser AddressCmd
pAddressInfo = Text -> Maybe OutputFile -> AddressCmd
AddressInfo (Text -> Maybe OutputFile -> AddressCmd)
-> Parser Text -> Parser (Maybe OutputFile -> AddressCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text
pAddress Parser (Maybe OutputFile -> AddressCmd)
-> Parser (Maybe OutputFile) -> Parser AddressCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

pPaymentVerifier :: Parser PaymentVerifier
pPaymentVerifier :: Parser PaymentVerifier
pPaymentVerifier =
        VerificationKeyTextOrFile -> PaymentVerifier
PaymentVerifierKey (VerificationKeyTextOrFile -> PaymentVerifier)
-> Parser VerificationKeyTextOrFile -> Parser PaymentVerifier
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser VerificationKeyTextOrFile
pPaymentVerificationKeyTextOrFile
    Parser PaymentVerifier
-> Parser PaymentVerifier -> Parser PaymentVerifier
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ScriptFile -> PaymentVerifier
PaymentVerifierScriptFile (ScriptFile -> PaymentVerifier)
-> Parser ScriptFile -> Parser PaymentVerifier
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
          String -> Maybe String -> String -> Parser ScriptFile
pScriptFor String
"payment-script-file" Maybe String
forall a. Maybe a
Nothing
                     String
"Filepath of the payment script."

pStakeVerifier :: Parser StakeVerifier
pStakeVerifier :: Parser StakeVerifier
pStakeVerifier =
        VerificationKeyOrFile StakeKey -> StakeVerifier
StakeVerifierKey (VerificationKeyOrFile StakeKey -> StakeVerifier)
-> Parser (VerificationKeyOrFile StakeKey) -> Parser StakeVerifier
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (VerificationKeyOrFile StakeKey)
pStakeVerificationKeyOrFile
    Parser StakeVerifier
-> Parser StakeVerifier -> Parser StakeVerifier
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ScriptFile -> StakeVerifier
StakeVerifierScriptFile (ScriptFile -> StakeVerifier)
-> Parser ScriptFile -> Parser StakeVerifier
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
          String -> Maybe String -> String -> Parser ScriptFile
pScriptFor String
"stake-script-file" Maybe String
forall a. Maybe a
Nothing
                     String
"Filepath of the staking script."

pPaymentVerificationKeyTextOrFile :: Parser VerificationKeyTextOrFile
pPaymentVerificationKeyTextOrFile :: Parser VerificationKeyTextOrFile
pPaymentVerificationKeyTextOrFile =
        Text -> VerificationKeyTextOrFile
VktofVerificationKeyText (Text -> VerificationKeyTextOrFile)
-> Parser Text -> Parser VerificationKeyTextOrFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text
pPaymentVerificationKeyText
    Parser VerificationKeyTextOrFile
-> Parser VerificationKeyTextOrFile
-> Parser VerificationKeyTextOrFile
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> VerificationKeyFile -> VerificationKeyTextOrFile
VktofVerificationKeyFile (VerificationKeyFile -> VerificationKeyTextOrFile)
-> Parser VerificationKeyFile -> Parser VerificationKeyTextOrFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser VerificationKeyFile
pPaymentVerificationKeyFile

pPaymentVerificationKeyText :: Parser Text
pPaymentVerificationKeyText :: Parser Text
pPaymentVerificationKeyText =
  String -> Text
Text.pack (String -> Text) -> Parser String -> Parser Text
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
Opt.strOption
      (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"payment-verification-key"
      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
Opt.metavar String
"STRING"
      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
Opt.help String
"Payment verification key (Bech32-encoded)"
      )

pPaymentVerificationKeyFile :: Parser VerificationKeyFile
pPaymentVerificationKeyFile :: Parser VerificationKeyFile
pPaymentVerificationKeyFile =
  String -> VerificationKeyFile
VerificationKeyFile (String -> VerificationKeyFile)
-> Parser String -> Parser VerificationKeyFile
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
Opt.strOption
        (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"payment-verification-key-file"
        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
Opt.metavar String
"FILE"
        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
Opt.help String
"Filepath of the payment verification key."
        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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
        )
    Parser String -> Parser String -> Parser String
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
      Mod OptionFields String -> Parser String
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
        (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"verification-key-file"
        Mod OptionFields String
-> Mod OptionFields String -> Mod OptionFields String
forall a. Semigroup a => a -> a -> a
<> Mod OptionFields String
forall (f :: * -> *) a. Mod f a
Opt.internal
        )
    )

pScript :: Parser ScriptFile
pScript :: Parser ScriptFile
pScript = String -> Maybe String -> String -> Parser ScriptFile
pScriptFor String
"script-file" Maybe String
forall a. Maybe a
Nothing String
"Filepath of the script."

pScriptFor :: String -> Maybe String -> String -> Parser ScriptFile
pScriptFor :: String -> Maybe String -> String -> Parser ScriptFile
pScriptFor String
name Maybe String
Nothing String
help =
  String -> ScriptFile
ScriptFile (String -> ScriptFile) -> Parser String -> Parser ScriptFile
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
Opt.strOption
    (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
name
    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
Opt.metavar String
"FILE"
    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
Opt.help String
help
    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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
    )

pScriptFor String
name (Just String
deprecated) String
help =
      String -> Maybe String -> String -> Parser ScriptFile
pScriptFor String
name Maybe String
forall a. Maybe a
Nothing String
help
  Parser ScriptFile -> Parser ScriptFile -> Parser ScriptFile
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> ScriptFile
ScriptFile (String -> ScriptFile) -> Parser String -> Parser ScriptFile
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
Opt.strOption
        (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
deprecated
        Mod OptionFields String
-> Mod OptionFields String -> Mod OptionFields String
forall a. Semigroup a => a -> a -> a
<> Mod OptionFields String
forall (f :: * -> *) a. Mod f a
Opt.internal
        )

pReferenceTxIn :: String -> String -> Parser TxIn
pReferenceTxIn :: String -> String -> Parser TxIn
pReferenceTxIn String
prefix String
scriptType =
  ReadM TxIn -> Mod OptionFields TxIn -> Parser TxIn
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option (Parser TxIn -> ReadM TxIn
forall a. Parser a -> ReadM a
readerFromParsecParser Parser TxIn
parseTxIn)
    (  String -> Mod OptionFields TxIn
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long (String
prefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"tx-in-reference")
    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
Opt.metavar String
"TX-IN"
    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
Opt.help (String
"TxId#TxIx - Specify a reference input. The reference input must have\
                 \ a " String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
scriptType String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
" reference script attached.")
    )

pReadOnlyReferenceTxIn :: Parser TxIn
pReadOnlyReferenceTxIn :: Parser TxIn
pReadOnlyReferenceTxIn =
  ReadM TxIn -> Mod OptionFields TxIn -> Parser TxIn
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option (Parser TxIn -> ReadM TxIn
forall a. Parser a -> ReadM a
readerFromParsecParser Parser TxIn
parseTxIn)
    (  String -> Mod OptionFields TxIn
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"read-only-tx-in-reference"
    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
Opt.metavar String
"TX-IN"
    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
Opt.help String
"Specify a read only reference input. This reference input is not witnessing anything \
                \it is simply provided in the plutus script context."
    )


pScriptWitnessFiles :: forall witctx.
                       WitCtx witctx
                    -> BalanceTxExecUnits -- ^ Use the @execution-units@ flag.
                    -> String -- ^ Script flag prefix
                    -> Maybe String
                    -> String
                    -> Parser (ScriptWitnessFiles witctx)
pScriptWitnessFiles :: WitCtx witctx
-> BalanceTxExecUnits
-> String
-> Maybe String
-> String
-> Parser (ScriptWitnessFiles witctx)
pScriptWitnessFiles WitCtx witctx
witctx BalanceTxExecUnits
autoBalanceExecUnits String
scriptFlagPrefix Maybe String
scriptFlagPrefixDeprecated String
help =
    ScriptFile
-> Maybe
     (ScriptDatumOrFile witctx, ScriptRedeemerOrFile, ExecutionUnits)
-> ScriptWitnessFiles witctx
toScriptWitnessFiles
      (ScriptFile
 -> Maybe
      (ScriptDatumOrFile witctx, ScriptRedeemerOrFile, ExecutionUnits)
 -> ScriptWitnessFiles witctx)
-> Parser ScriptFile
-> Parser
     (Maybe
        (ScriptDatumOrFile witctx, ScriptRedeemerOrFile, ExecutionUnits)
      -> ScriptWitnessFiles witctx)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> Maybe String -> String -> Parser ScriptFile
pScriptFor (String
scriptFlagPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"-script-file")
                     ((String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"-script-file") (String -> String) -> Maybe String -> Maybe String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe String
scriptFlagPrefixDeprecated)
                     (String
"The file containing the script to witness " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
help)
      Parser
  (Maybe
     (ScriptDatumOrFile witctx, ScriptRedeemerOrFile, ExecutionUnits)
   -> ScriptWitnessFiles witctx)
-> Parser
     (Maybe
        (ScriptDatumOrFile witctx, ScriptRedeemerOrFile, ExecutionUnits))
-> Parser (ScriptWitnessFiles witctx)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser
  (ScriptDatumOrFile witctx, ScriptRedeemerOrFile, ExecutionUnits)
-> Parser
     (Maybe
        (ScriptDatumOrFile witctx, ScriptRedeemerOrFile, ExecutionUnits))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional ((,,) (ScriptDatumOrFile witctx
 -> ScriptRedeemerOrFile
 -> ExecutionUnits
 -> (ScriptDatumOrFile witctx, ScriptRedeemerOrFile,
     ExecutionUnits))
-> Parser (ScriptDatumOrFile witctx)
-> Parser
     (ScriptRedeemerOrFile
      -> ExecutionUnits
      -> (ScriptDatumOrFile witctx, ScriptRedeemerOrFile,
          ExecutionUnits))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> WitCtx witctx -> Parser (ScriptDatumOrFile witctx)
forall witctx.
String -> WitCtx witctx -> Parser (ScriptDatumOrFile witctx)
pScriptDatumOrFile String
scriptFlagPrefix WitCtx witctx
witctx
                         Parser
  (ScriptRedeemerOrFile
   -> ExecutionUnits
   -> (ScriptDatumOrFile witctx, ScriptRedeemerOrFile,
       ExecutionUnits))
-> Parser ScriptRedeemerOrFile
-> Parser
     (ExecutionUnits
      -> (ScriptDatumOrFile witctx, ScriptRedeemerOrFile,
          ExecutionUnits))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> Parser ScriptRedeemerOrFile
pScriptRedeemerOrFile String
scriptFlagPrefix
                         Parser
  (ExecutionUnits
   -> (ScriptDatumOrFile witctx, ScriptRedeemerOrFile,
       ExecutionUnits))
-> Parser ExecutionUnits
-> Parser
     (ScriptDatumOrFile witctx, ScriptRedeemerOrFile, ExecutionUnits)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (case BalanceTxExecUnits
autoBalanceExecUnits of
                               BalanceTxExecUnits
AutoBalance -> ExecutionUnits -> Parser ExecutionUnits
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Natural -> Natural -> ExecutionUnits
ExecutionUnits Natural
0 Natural
0)
                               BalanceTxExecUnits
ManualBalance -> String -> Parser ExecutionUnits
pExecutionUnits String
scriptFlagPrefix)
                   )
  where
    toScriptWitnessFiles :: ScriptFile
                         -> Maybe (ScriptDatumOrFile witctx,
                                   ScriptRedeemerOrFile,
                                   ExecutionUnits)
                         -> ScriptWitnessFiles witctx
    toScriptWitnessFiles :: ScriptFile
-> Maybe
     (ScriptDatumOrFile witctx, ScriptRedeemerOrFile, ExecutionUnits)
-> ScriptWitnessFiles witctx
toScriptWitnessFiles ScriptFile
sf Maybe
  (ScriptDatumOrFile witctx, ScriptRedeemerOrFile, ExecutionUnits)
Nothing        = ScriptFile -> ScriptWitnessFiles witctx
forall witctx. ScriptFile -> ScriptWitnessFiles witctx
SimpleScriptWitnessFile  ScriptFile
sf
    toScriptWitnessFiles ScriptFile
sf (Just (ScriptDatumOrFile witctx
d,ScriptRedeemerOrFile
r, ExecutionUnits
e)) = ScriptFile
-> ScriptDatumOrFile witctx
-> ScriptRedeemerOrFile
-> ExecutionUnits
-> ScriptWitnessFiles witctx
forall witctx.
ScriptFile
-> ScriptDatumOrFile witctx
-> ScriptRedeemerOrFile
-> ExecutionUnits
-> ScriptWitnessFiles witctx
PlutusScriptWitnessFiles ScriptFile
sf ScriptDatumOrFile witctx
d ScriptRedeemerOrFile
r ExecutionUnits
e


pExecutionUnits :: String -> Parser ExecutionUnits
pExecutionUnits :: String -> Parser ExecutionUnits
pExecutionUnits String
scriptFlagPrefix =
  (Natural -> Natural -> ExecutionUnits)
-> (Natural, Natural) -> ExecutionUnits
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Natural -> Natural -> ExecutionUnits
ExecutionUnits ((Natural, Natural) -> ExecutionUnits)
-> Parser (Natural, Natural) -> Parser ExecutionUnits
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
    ReadM (Natural, Natural)
-> Mod OptionFields (Natural, Natural) -> Parser (Natural, Natural)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM (Natural, Natural)
forall a. Read a => ReadM a
Opt.auto
      (  String -> Mod OptionFields (Natural, Natural)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long (String
scriptFlagPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"-execution-units")
      Mod OptionFields (Natural, Natural)
-> Mod OptionFields (Natural, Natural)
-> Mod OptionFields (Natural, Natural)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (Natural, Natural)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"(INT, INT)"
      Mod OptionFields (Natural, Natural)
-> Mod OptionFields (Natural, Natural)
-> Mod OptionFields (Natural, Natural)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (Natural, Natural)
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"The time and space units needed by the script."
      )

pScriptRedeemerOrFile :: String -> Parser ScriptDataOrFile
pScriptRedeemerOrFile :: String -> Parser ScriptRedeemerOrFile
pScriptRedeemerOrFile String
scriptFlagPrefix =
  String -> String -> String -> Parser ScriptRedeemerOrFile
pScriptDataOrFile (String
scriptFlagPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"-redeemer")
    String
"The script redeemer, in JSON syntax."
    String
"The script redeemer, in the given JSON file."


pScriptDatumOrFile :: String -> WitCtx witctx -> Parser (ScriptDatumOrFile witctx)
pScriptDatumOrFile :: String -> WitCtx witctx -> Parser (ScriptDatumOrFile witctx)
pScriptDatumOrFile String
scriptFlagPrefix WitCtx witctx
witctx =
  case WitCtx witctx
witctx of
    WitCtx witctx
WitCtxTxIn  -> (ScriptRedeemerOrFile -> ScriptDatumOrFile WitCtxTxIn
ScriptDatumOrFileForTxIn (ScriptRedeemerOrFile -> ScriptDatumOrFile WitCtxTxIn)
-> Parser ScriptRedeemerOrFile
-> Parser (ScriptDatumOrFile WitCtxTxIn)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
                     String -> String -> String -> Parser ScriptRedeemerOrFile
pScriptDataOrFile
                       (String
scriptFlagPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"-datum")
                       String
"The script datum, in JSON syntax."
                       String
"The script datum, in the given JSON file.") Parser (ScriptDatumOrFile WitCtxTxIn)
-> Parser (ScriptDatumOrFile WitCtxTxIn)
-> Parser (ScriptDatumOrFile WitCtxTxIn)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
                    Parser (ScriptDatumOrFile WitCtxTxIn)
pInlineDatumPresent
    WitCtx witctx
WitCtxMint  -> ScriptDatumOrFile WitCtxMint
-> Parser (ScriptDatumOrFile WitCtxMint)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ScriptDatumOrFile WitCtxMint
NoScriptDatumOrFileForMint
    WitCtx witctx
WitCtxStake -> ScriptDatumOrFile WitCtxStake
-> Parser (ScriptDatumOrFile WitCtxStake)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ScriptDatumOrFile WitCtxStake
NoScriptDatumOrFileForStake
 where
  pInlineDatumPresent :: Parser (ScriptDatumOrFile WitCtxTxIn)
  pInlineDatumPresent :: Parser (ScriptDatumOrFile WitCtxTxIn)
pInlineDatumPresent  =
    ScriptDatumOrFile WitCtxTxIn
-> Mod FlagFields (ScriptDatumOrFile WitCtxTxIn)
-> Parser (ScriptDatumOrFile WitCtxTxIn)
forall a. a -> Mod FlagFields a -> Parser a
flag' ScriptDatumOrFile WitCtxTxIn
InlineDatumPresentAtTxIn
      (  String -> Mod FlagFields (ScriptDatumOrFile WitCtxTxIn)
forall (f :: * -> *) a. HasName f => String -> Mod f a
long (String
scriptFlagPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"-inline-datum-present")
      Mod FlagFields (ScriptDatumOrFile WitCtxTxIn)
-> Mod FlagFields (ScriptDatumOrFile WitCtxTxIn)
-> Mod FlagFields (ScriptDatumOrFile WitCtxTxIn)
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields (ScriptDatumOrFile WitCtxTxIn)
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Inline datum present at transaction input."
      )

pScriptDataOrFile :: String -> String -> String -> Parser ScriptDataOrFile
pScriptDataOrFile :: String -> String -> String -> Parser ScriptRedeemerOrFile
pScriptDataOrFile String
dataFlagPrefix String
helpTextForValue String
helpTextForFile =
      Parser ScriptRedeemerOrFile
pScriptDataCborFile
  Parser ScriptRedeemerOrFile
-> Parser ScriptRedeemerOrFile -> Parser ScriptRedeemerOrFile
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser ScriptRedeemerOrFile
pScriptDataFile
  Parser ScriptRedeemerOrFile
-> Parser ScriptRedeemerOrFile -> Parser ScriptRedeemerOrFile
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser ScriptRedeemerOrFile
pScriptDataValue
  where
    pScriptDataCborFile :: Parser ScriptRedeemerOrFile
pScriptDataCborFile = String -> ScriptRedeemerOrFile
ScriptDataCborFile (String -> ScriptRedeemerOrFile)
-> Parser String -> Parser ScriptRedeemerOrFile
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
Opt.strOption
        (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long (String
dataFlagPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"-cbor-file")
        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
Opt.metavar String
"CBOR FILE"
        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
Opt.help (String
helpTextForFile String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" The file must follow the special \
                                         \JSON schema for script data.")
        )

    pScriptDataFile :: Parser ScriptRedeemerOrFile
pScriptDataFile = String -> ScriptRedeemerOrFile
ScriptDataJsonFile (String -> ScriptRedeemerOrFile)
-> Parser String -> Parser ScriptRedeemerOrFile
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
Opt.strOption
        (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long (String
dataFlagPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"-file")
        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
Opt.metavar String
"JSON FILE"
        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
Opt.help (String
helpTextForFile String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" The file must follow the special \
                                         \JSON schema for script data.")
        )

    pScriptDataValue :: Parser ScriptRedeemerOrFile
pScriptDataValue = ScriptData -> ScriptRedeemerOrFile
ScriptDataValue (ScriptData -> ScriptRedeemerOrFile)
-> Parser ScriptData -> Parser ScriptRedeemerOrFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
      ReadM ScriptData
-> Mod OptionFields ScriptData -> Parser ScriptData
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM ScriptData
readerScriptData
        (  String -> Mod OptionFields ScriptData
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long (String
dataFlagPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"-value")
        Mod OptionFields ScriptData
-> Mod OptionFields ScriptData -> Mod OptionFields ScriptData
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields ScriptData
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"JSON VALUE"
        Mod OptionFields ScriptData
-> Mod OptionFields ScriptData -> Mod OptionFields ScriptData
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields ScriptData
forall (f :: * -> *) a. String -> Mod f a
Opt.help (String
helpTextForValue String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" There is no schema: (almost) any \
                                         \JSON value is supported, including \
                                         \top-level strings and numbers.")
        )

    readerScriptData :: ReadM ScriptData
readerScriptData = do
      Value
v <- ReadM Value
readerJSON
      case ScriptDataJsonSchema
-> Value -> Either ScriptDataJsonError ScriptData
scriptDataFromJson ScriptDataJsonSchema
ScriptDataJsonNoSchema Value
v of
        Left ScriptDataJsonError
err -> String -> ReadM ScriptData
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (ScriptDataJsonError -> String
forall e. Error e => e -> String
displayError ScriptDataJsonError
err)
        Right ScriptData
sd -> ScriptData -> ReadM ScriptData
forall (m :: * -> *) a. Monad m => a -> m a
return ScriptData
sd

pStakeAddressCmd :: Parser StakeAddressCmd
pStakeAddressCmd :: Parser StakeAddressCmd
pStakeAddressCmd =
    [Parser StakeAddressCmd] -> Parser StakeAddressCmd
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
      [ String -> ParserInfo StakeAddressCmd -> Parser StakeAddressCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"key-gen"
          (Parser StakeAddressCmd
-> InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser StakeAddressCmd
pStakeAddressKeyGen (InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd)
-> InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod StakeAddressCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create a stake address key pair")
      , String -> ParserInfo StakeAddressCmd -> Parser StakeAddressCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"build"
          (Parser StakeAddressCmd
-> InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser StakeAddressCmd
pStakeAddressBuild (InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd)
-> InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod StakeAddressCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Build a stake address")
      , String -> ParserInfo StakeAddressCmd -> Parser StakeAddressCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"key-hash"
          (Parser StakeAddressCmd
-> InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser StakeAddressCmd
pStakeAddressKeyHash (InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd)
-> InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod StakeAddressCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Print the hash of a stake address key.")
      , String -> ParserInfo StakeAddressCmd -> Parser StakeAddressCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"registration-certificate"
          (Parser StakeAddressCmd
-> InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser StakeAddressCmd
pStakeAddressRegistrationCert (InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd)
-> InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod StakeAddressCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create a stake address registration certificate")
      , String -> ParserInfo StakeAddressCmd -> Parser StakeAddressCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"deregistration-certificate"
          (Parser StakeAddressCmd
-> InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser StakeAddressCmd
pStakeAddressDeregistrationCert (InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd)
-> InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod StakeAddressCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create a stake address deregistration certificate")
      , String -> ParserInfo StakeAddressCmd -> Parser StakeAddressCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"delegation-certificate"
          (Parser StakeAddressCmd
-> InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser StakeAddressCmd
pStakeAddressDelegationCert (InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd)
-> InfoMod StakeAddressCmd -> ParserInfo StakeAddressCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod StakeAddressCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create a stake address delegation certificate")
      ]
  where
    pStakeAddressKeyGen :: Parser StakeAddressCmd
    pStakeAddressKeyGen :: Parser StakeAddressCmd
pStakeAddressKeyGen = VerificationKeyFile -> SigningKeyFile -> StakeAddressCmd
StakeAddressKeyGen
                            (VerificationKeyFile -> SigningKeyFile -> StakeAddressCmd)
-> Parser VerificationKeyFile
-> Parser (SigningKeyFile -> StakeAddressCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile FileDirection
Output
                            Parser (SigningKeyFile -> StakeAddressCmd)
-> Parser SigningKeyFile -> Parser StakeAddressCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FileDirection -> Parser SigningKeyFile
pSigningKeyFile FileDirection
Output

    pStakeAddressKeyHash :: Parser StakeAddressCmd
    pStakeAddressKeyHash :: Parser StakeAddressCmd
pStakeAddressKeyHash = VerificationKeyOrFile StakeKey
-> Maybe OutputFile -> StakeAddressCmd
StakeAddressKeyHash (VerificationKeyOrFile StakeKey
 -> Maybe OutputFile -> StakeAddressCmd)
-> Parser (VerificationKeyOrFile StakeKey)
-> Parser (Maybe OutputFile -> StakeAddressCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (VerificationKeyOrFile StakeKey)
pStakeVerificationKeyOrFile Parser (Maybe OutputFile -> StakeAddressCmd)
-> Parser (Maybe OutputFile) -> Parser StakeAddressCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pStakeAddressBuild :: Parser StakeAddressCmd
    pStakeAddressBuild :: Parser StakeAddressCmd
pStakeAddressBuild = StakeVerifier -> NetworkId -> Maybe OutputFile -> StakeAddressCmd
StakeAddressBuild (StakeVerifier -> NetworkId -> Maybe OutputFile -> StakeAddressCmd)
-> Parser StakeVerifier
-> Parser (NetworkId -> Maybe OutputFile -> StakeAddressCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser StakeVerifier
pStakeVerifier
                                           Parser (NetworkId -> Maybe OutputFile -> StakeAddressCmd)
-> Parser NetworkId -> Parser (Maybe OutputFile -> StakeAddressCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
                                           Parser (Maybe OutputFile -> StakeAddressCmd)
-> Parser (Maybe OutputFile) -> Parser StakeAddressCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pStakeAddressRegistrationCert :: Parser StakeAddressCmd
    pStakeAddressRegistrationCert :: Parser StakeAddressCmd
pStakeAddressRegistrationCert = StakeVerifier -> OutputFile -> StakeAddressCmd
StakeRegistrationCert
                                      (StakeVerifier -> OutputFile -> StakeAddressCmd)
-> Parser StakeVerifier -> Parser (OutputFile -> StakeAddressCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser StakeVerifier
pStakeVerifier
                                      Parser (OutputFile -> StakeAddressCmd)
-> Parser OutputFile -> Parser StakeAddressCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile

    pStakeAddressDeregistrationCert :: Parser StakeAddressCmd
    pStakeAddressDeregistrationCert :: Parser StakeAddressCmd
pStakeAddressDeregistrationCert = StakeVerifier -> OutputFile -> StakeAddressCmd
StakeCredentialDeRegistrationCert
                                        (StakeVerifier -> OutputFile -> StakeAddressCmd)
-> Parser StakeVerifier -> Parser (OutputFile -> StakeAddressCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser StakeVerifier
pStakeVerifier
                                        Parser (OutputFile -> StakeAddressCmd)
-> Parser OutputFile -> Parser StakeAddressCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile

    pStakeAddressDelegationCert :: Parser StakeAddressCmd
    pStakeAddressDelegationCert :: Parser StakeAddressCmd
pStakeAddressDelegationCert = StakeVerifier
-> VerificationKeyOrHashOrFile StakePoolKey
-> OutputFile
-> StakeAddressCmd
StakeCredentialDelegationCert
                                    (StakeVerifier
 -> VerificationKeyOrHashOrFile StakePoolKey
 -> OutputFile
 -> StakeAddressCmd)
-> Parser StakeVerifier
-> Parser
     (VerificationKeyOrHashOrFile StakePoolKey
      -> OutputFile -> StakeAddressCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser StakeVerifier
pStakeVerifier
                                    Parser
  (VerificationKeyOrHashOrFile StakePoolKey
   -> OutputFile -> StakeAddressCmd)
-> Parser (VerificationKeyOrHashOrFile StakePoolKey)
-> Parser (OutputFile -> StakeAddressCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (VerificationKeyOrHashOrFile StakePoolKey)
pStakePoolVerificationKeyOrHashOrFile
                                    Parser (OutputFile -> StakeAddressCmd)
-> Parser OutputFile -> Parser StakeAddressCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile

pKeyCmd :: Parser KeyCmd
pKeyCmd :: Parser KeyCmd
pKeyCmd =
  [Parser KeyCmd] -> Parser KeyCmd
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
    [ String -> ParserInfo KeyCmd -> Parser KeyCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"verification-key" (ParserInfo KeyCmd -> Parser KeyCmd)
-> ParserInfo KeyCmd -> Parser KeyCmd
forall a b. (a -> b) -> a -> b
$
        Parser KeyCmd -> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser KeyCmd
pKeyGetVerificationKey (InfoMod KeyCmd -> ParserInfo KeyCmd)
-> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a b. (a -> b) -> a -> b
$
          String -> InfoMod KeyCmd
forall a. String -> InfoMod a
Opt.progDesc (String -> InfoMod KeyCmd) -> String -> InfoMod KeyCmd
forall a b. (a -> b) -> a -> b
$ String
"Get a verification key from a signing key. This "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" supports all key types."
    , String -> ParserInfo KeyCmd -> Parser KeyCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"non-extended-key" (ParserInfo KeyCmd -> Parser KeyCmd)
-> ParserInfo KeyCmd -> Parser KeyCmd
forall a b. (a -> b) -> a -> b
$
        Parser KeyCmd -> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser KeyCmd
pKeyNonExtendedKey (InfoMod KeyCmd -> ParserInfo KeyCmd)
-> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a b. (a -> b) -> a -> b
$
          String -> InfoMod KeyCmd
forall a. String -> InfoMod a
Opt.progDesc (String -> InfoMod KeyCmd) -> String -> InfoMod KeyCmd
forall a b. (a -> b) -> a -> b
$ String
"Get a non-extended verification key from an "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"extended verification key. This supports all "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"extended key types."
    , String -> ParserInfo KeyCmd -> Parser KeyCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"convert-byron-key" (ParserInfo KeyCmd -> Parser KeyCmd)
-> ParserInfo KeyCmd -> Parser KeyCmd
forall a b. (a -> b) -> a -> b
$
        Parser KeyCmd -> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser KeyCmd
pKeyConvertByronKey (InfoMod KeyCmd -> ParserInfo KeyCmd)
-> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a b. (a -> b) -> a -> b
$
          String -> InfoMod KeyCmd
forall a. String -> InfoMod a
Opt.progDesc (String -> InfoMod KeyCmd) -> String -> InfoMod KeyCmd
forall a b. (a -> b) -> a -> b
$ String
"Convert a Byron payment, genesis or genesis "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"delegate key (signing or verification) to a "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"corresponding Shelley-format key."
    , String -> ParserInfo KeyCmd -> Parser KeyCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"convert-byron-genesis-vkey" (ParserInfo KeyCmd -> Parser KeyCmd)
-> ParserInfo KeyCmd -> Parser KeyCmd
forall a b. (a -> b) -> a -> b
$
        Parser KeyCmd -> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser KeyCmd
pKeyConvertByronGenesisVKey (InfoMod KeyCmd -> ParserInfo KeyCmd)
-> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a b. (a -> b) -> a -> b
$
          String -> InfoMod KeyCmd
forall a. String -> InfoMod a
Opt.progDesc (String -> InfoMod KeyCmd) -> String -> InfoMod KeyCmd
forall a b. (a -> b) -> a -> b
$ String
"Convert a Base64-encoded Byron genesis "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"verification key to a Shelley genesis "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"verification key"
    , String -> ParserInfo KeyCmd -> Parser KeyCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"convert-itn-key" (ParserInfo KeyCmd -> Parser KeyCmd)
-> ParserInfo KeyCmd -> Parser KeyCmd
forall a b. (a -> b) -> a -> b
$
        Parser KeyCmd -> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser KeyCmd
pKeyConvertITNKey (InfoMod KeyCmd -> ParserInfo KeyCmd)
-> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a b. (a -> b) -> a -> b
$
          String -> InfoMod KeyCmd
forall a. String -> InfoMod a
Opt.progDesc (String -> InfoMod KeyCmd) -> String -> InfoMod KeyCmd
forall a b. (a -> b) -> a -> b
$ String
"Convert an Incentivized Testnet (ITN) non-extended "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"(Ed25519) signing or verification key to a "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"corresponding Shelley stake key"
    , String -> ParserInfo KeyCmd -> Parser KeyCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"convert-itn-extended-key" (ParserInfo KeyCmd -> Parser KeyCmd)
-> ParserInfo KeyCmd -> Parser KeyCmd
forall a b. (a -> b) -> a -> b
$
        Parser KeyCmd -> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser KeyCmd
pKeyConvertITNExtendedKey (InfoMod KeyCmd -> ParserInfo KeyCmd)
-> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a b. (a -> b) -> a -> b
$
          String -> InfoMod KeyCmd
forall a. String -> InfoMod a
Opt.progDesc (String -> InfoMod KeyCmd) -> String -> InfoMod KeyCmd
forall a b. (a -> b) -> a -> b
$ String
"Convert an Incentivized Testnet (ITN) extended "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"(Ed25519Extended) signing key to a corresponding "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"Shelley stake signing key"
    , String -> ParserInfo KeyCmd -> Parser KeyCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"convert-itn-bip32-key" (ParserInfo KeyCmd -> Parser KeyCmd)
-> ParserInfo KeyCmd -> Parser KeyCmd
forall a b. (a -> b) -> a -> b
$
        Parser KeyCmd -> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser KeyCmd
pKeyConvertITNBip32Key (InfoMod KeyCmd -> ParserInfo KeyCmd)
-> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a b. (a -> b) -> a -> b
$
          String -> InfoMod KeyCmd
forall a. String -> InfoMod a
Opt.progDesc (String -> InfoMod KeyCmd) -> String -> InfoMod KeyCmd
forall a b. (a -> b) -> a -> b
$ String
"Convert an Incentivized Testnet (ITN) BIP32 "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"(Ed25519Bip32) signing key to a corresponding "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"Shelley stake signing key"
    , String -> ParserInfo KeyCmd -> Parser KeyCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"convert-cardano-address-key" (ParserInfo KeyCmd -> Parser KeyCmd)
-> ParserInfo KeyCmd -> Parser KeyCmd
forall a b. (a -> b) -> a -> b
$
        Parser KeyCmd -> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser KeyCmd
pKeyConvertCardanoAddressSigningKey (InfoMod KeyCmd -> ParserInfo KeyCmd)
-> InfoMod KeyCmd -> ParserInfo KeyCmd
forall a b. (a -> b) -> a -> b
$
          String -> InfoMod KeyCmd
forall a. String -> InfoMod a
Opt.progDesc (String -> InfoMod KeyCmd) -> String -> InfoMod KeyCmd
forall a b. (a -> b) -> a -> b
$ String
"Convert a cardano-address extended signing key "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"to a corresponding Shelley-format key."
    ]
  where
    pKeyGetVerificationKey :: Parser KeyCmd
    pKeyGetVerificationKey :: Parser KeyCmd
pKeyGetVerificationKey =
      SigningKeyFile -> VerificationKeyFile -> KeyCmd
KeyGetVerificationKey
        (SigningKeyFile -> VerificationKeyFile -> KeyCmd)
-> Parser SigningKeyFile -> Parser (VerificationKeyFile -> KeyCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser SigningKeyFile
pSigningKeyFile      FileDirection
Input
        Parser (VerificationKeyFile -> KeyCmd)
-> Parser VerificationKeyFile -> Parser KeyCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile FileDirection
Output

    pKeyNonExtendedKey :: Parser KeyCmd
    pKeyNonExtendedKey :: Parser KeyCmd
pKeyNonExtendedKey =
      VerificationKeyFile -> VerificationKeyFile -> KeyCmd
KeyNonExtendedKey
        (VerificationKeyFile -> VerificationKeyFile -> KeyCmd)
-> Parser VerificationKeyFile
-> Parser (VerificationKeyFile -> KeyCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser VerificationKeyFile
pExtendedVerificationKeyFile FileDirection
Input
        Parser (VerificationKeyFile -> KeyCmd)
-> Parser VerificationKeyFile -> Parser KeyCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile FileDirection
Output

    pKeyConvertByronKey :: Parser KeyCmd
    pKeyConvertByronKey :: Parser KeyCmd
pKeyConvertByronKey =
      Maybe Text -> ByronKeyType -> SomeKeyFile -> OutputFile -> KeyCmd
KeyConvertByronKey
        (Maybe Text -> ByronKeyType -> SomeKeyFile -> OutputFile -> KeyCmd)
-> Parser (Maybe Text)
-> Parser (ByronKeyType -> SomeKeyFile -> OutputFile -> KeyCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text -> Parser (Maybe Text)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser Text
pPassword
        Parser (ByronKeyType -> SomeKeyFile -> OutputFile -> KeyCmd)
-> Parser ByronKeyType
-> Parser (SomeKeyFile -> OutputFile -> KeyCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ByronKeyType
pByronKeyType
        Parser (SomeKeyFile -> OutputFile -> KeyCmd)
-> Parser SomeKeyFile -> Parser (OutputFile -> KeyCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser SomeKeyFile
pByronKeyFile
        Parser (OutputFile -> KeyCmd) -> Parser OutputFile -> Parser KeyCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile

    pPassword :: Parser Text
    pPassword :: Parser Text
pPassword = Mod OptionFields Text -> Parser Text
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
                  (  String -> Mod OptionFields Text
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"password"
                  Mod OptionFields Text
-> Mod OptionFields Text -> Mod OptionFields Text
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Text
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"TEXT"
                  Mod OptionFields Text
-> Mod OptionFields Text -> Mod OptionFields Text
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Text
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Password for signing key (if applicable)."
                  )

    pByronKeyType :: Parser ByronKeyType
    pByronKeyType :: Parser ByronKeyType
pByronKeyType =
          ByronKeyType -> Mod FlagFields ByronKeyType -> Parser ByronKeyType
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' (ByronKeyFormat -> ByronKeyType
ByronPaymentKey ByronKeyFormat
NonLegacyByronKeyFormat)
            (  String -> Mod FlagFields ByronKeyType
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"byron-payment-key-type"
            Mod FlagFields ByronKeyType
-> Mod FlagFields ByronKeyType -> Mod FlagFields ByronKeyType
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields ByronKeyType
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use a Byron-era payment key."
            )
      Parser ByronKeyType -> Parser ByronKeyType -> Parser ByronKeyType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ByronKeyType -> Mod FlagFields ByronKeyType -> Parser ByronKeyType
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' (ByronKeyFormat -> ByronKeyType
ByronPaymentKey ByronKeyFormat
LegacyByronKeyFormat)
            (  String -> Mod FlagFields ByronKeyType
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"legacy-byron-payment-key-type"
            Mod FlagFields ByronKeyType
-> Mod FlagFields ByronKeyType -> Mod FlagFields ByronKeyType
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields ByronKeyType
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use a Byron-era payment key, in legacy SL format."
            )
      Parser ByronKeyType -> Parser ByronKeyType -> Parser ByronKeyType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ByronKeyType -> Mod FlagFields ByronKeyType -> Parser ByronKeyType
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' (ByronKeyFormat -> ByronKeyType
ByronGenesisKey ByronKeyFormat
NonLegacyByronKeyFormat)
            (  String -> Mod FlagFields ByronKeyType
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"byron-genesis-key-type"
            Mod FlagFields ByronKeyType
-> Mod FlagFields ByronKeyType -> Mod FlagFields ByronKeyType
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields ByronKeyType
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use a Byron-era genesis key."
            )
      Parser ByronKeyType -> Parser ByronKeyType -> Parser ByronKeyType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ByronKeyType -> Mod FlagFields ByronKeyType -> Parser ByronKeyType
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' (ByronKeyFormat -> ByronKeyType
ByronGenesisKey ByronKeyFormat
LegacyByronKeyFormat)
            (  String -> Mod FlagFields ByronKeyType
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"legacy-byron-genesis-key-type"
            Mod FlagFields ByronKeyType
-> Mod FlagFields ByronKeyType -> Mod FlagFields ByronKeyType
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields ByronKeyType
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use a Byron-era genesis key, in legacy SL format."
            )
      Parser ByronKeyType -> Parser ByronKeyType -> Parser ByronKeyType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ByronKeyType -> Mod FlagFields ByronKeyType -> Parser ByronKeyType
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' (ByronKeyFormat -> ByronKeyType
ByronDelegateKey ByronKeyFormat
NonLegacyByronKeyFormat)
            (  String -> Mod FlagFields ByronKeyType
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"byron-genesis-delegate-key-type"
            Mod FlagFields ByronKeyType
-> Mod FlagFields ByronKeyType -> Mod FlagFields ByronKeyType
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields ByronKeyType
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use a Byron-era genesis delegate key."
            )
      Parser ByronKeyType -> Parser ByronKeyType -> Parser ByronKeyType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ByronKeyType -> Mod FlagFields ByronKeyType -> Parser ByronKeyType
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' (ByronKeyFormat -> ByronKeyType
ByronDelegateKey ByronKeyFormat
LegacyByronKeyFormat)
            (  String -> Mod FlagFields ByronKeyType
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"legacy-byron-genesis-delegate-key-type"
            Mod FlagFields ByronKeyType
-> Mod FlagFields ByronKeyType -> Mod FlagFields ByronKeyType
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields ByronKeyType
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use a Byron-era genesis delegate key, in legacy SL format."
            )

    pByronKeyFile :: Parser SomeKeyFile
    pByronKeyFile :: Parser SomeKeyFile
pByronKeyFile =
          (SigningKeyFile -> SomeKeyFile
ASigningKeyFile      (SigningKeyFile -> SomeKeyFile)
-> Parser SigningKeyFile -> Parser SomeKeyFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser SigningKeyFile
pByronSigningKeyFile)
      Parser SomeKeyFile -> Parser SomeKeyFile -> Parser SomeKeyFile
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (VerificationKeyFile -> SomeKeyFile
AVerificationKeyFile (VerificationKeyFile -> SomeKeyFile)
-> Parser VerificationKeyFile -> Parser SomeKeyFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser VerificationKeyFile
pByronVerificationKeyFile)

    pByronSigningKeyFile :: Parser SigningKeyFile
    pByronSigningKeyFile :: Parser SigningKeyFile
pByronSigningKeyFile =
      String -> SigningKeyFile
SigningKeyFile (String -> SigningKeyFile)
-> Parser String -> Parser SigningKeyFile
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
Opt.strOption
          (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"byron-signing-key-file"
          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
Opt.metavar String
"FILE"
          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
Opt.help String
"Input filepath of the Byron-format signing key."
          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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
          )

    pByronVerificationKeyFile :: Parser VerificationKeyFile
    pByronVerificationKeyFile :: Parser VerificationKeyFile
pByronVerificationKeyFile =
      String -> VerificationKeyFile
VerificationKeyFile (String -> VerificationKeyFile)
-> Parser String -> Parser VerificationKeyFile
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
Opt.strOption
          (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"byron-verification-key-file"
          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
Opt.metavar String
"FILE"
          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
Opt.help String
"Input filepath of the Byron-format verification key."
          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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
          )

    pKeyConvertByronGenesisVKey :: Parser KeyCmd
    pKeyConvertByronGenesisVKey :: Parser KeyCmd
pKeyConvertByronGenesisVKey =
      VerificationKeyBase64 -> OutputFile -> KeyCmd
KeyConvertByronGenesisVKey
        (VerificationKeyBase64 -> OutputFile -> KeyCmd)
-> Parser VerificationKeyBase64 -> Parser (OutputFile -> KeyCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser VerificationKeyBase64
pByronGenesisVKeyBase64
        Parser (OutputFile -> KeyCmd) -> Parser OutputFile -> Parser KeyCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile

    pByronGenesisVKeyBase64 :: Parser VerificationKeyBase64
    pByronGenesisVKeyBase64 :: Parser VerificationKeyBase64
pByronGenesisVKeyBase64 =
      String -> VerificationKeyBase64
VerificationKeyBase64 (String -> VerificationKeyBase64)
-> Parser String -> Parser VerificationKeyBase64
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
Opt.strOption
          (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"byron-genesis-verification-key"
          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
Opt.metavar String
"BASE64"
          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
Opt.help String
"Base64 string for the Byron genesis verification key."
          )

    pKeyConvertITNKey :: Parser KeyCmd
    pKeyConvertITNKey :: Parser KeyCmd
pKeyConvertITNKey =
      SomeKeyFile -> OutputFile -> KeyCmd
KeyConvertITNStakeKey
        (SomeKeyFile -> OutputFile -> KeyCmd)
-> Parser SomeKeyFile -> Parser (OutputFile -> KeyCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser SomeKeyFile
pITNKeyFIle
        Parser (OutputFile -> KeyCmd) -> Parser OutputFile -> Parser KeyCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile

    pKeyConvertITNExtendedKey :: Parser KeyCmd
    pKeyConvertITNExtendedKey :: Parser KeyCmd
pKeyConvertITNExtendedKey =
      SomeKeyFile -> OutputFile -> KeyCmd
KeyConvertITNExtendedToStakeKey
        (SomeKeyFile -> OutputFile -> KeyCmd)
-> Parser SomeKeyFile -> Parser (OutputFile -> KeyCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser SomeKeyFile
pITNSigningKeyFile
        Parser (OutputFile -> KeyCmd) -> Parser OutputFile -> Parser KeyCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile

    pKeyConvertITNBip32Key :: Parser KeyCmd
    pKeyConvertITNBip32Key :: Parser KeyCmd
pKeyConvertITNBip32Key =
      SomeKeyFile -> OutputFile -> KeyCmd
KeyConvertITNBip32ToStakeKey
        (SomeKeyFile -> OutputFile -> KeyCmd)
-> Parser SomeKeyFile -> Parser (OutputFile -> KeyCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser SomeKeyFile
pITNSigningKeyFile
        Parser (OutputFile -> KeyCmd) -> Parser OutputFile -> Parser KeyCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile

    pITNKeyFIle :: Parser SomeKeyFile
    pITNKeyFIle :: Parser SomeKeyFile
pITNKeyFIle = Parser SomeKeyFile
pITNSigningKeyFile
              Parser SomeKeyFile -> Parser SomeKeyFile -> Parser SomeKeyFile
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser SomeKeyFile
pITNVerificationKeyFile

    pITNSigningKeyFile :: Parser SomeKeyFile
    pITNSigningKeyFile :: Parser SomeKeyFile
pITNSigningKeyFile =
      SigningKeyFile -> SomeKeyFile
ASigningKeyFile (SigningKeyFile -> SomeKeyFile)
-> (String -> SigningKeyFile) -> String -> SomeKeyFile
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> SigningKeyFile
SigningKeyFile (String -> SomeKeyFile) -> Parser String -> Parser SomeKeyFile
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
Opt.strOption
          (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"itn-signing-key-file"
          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
Opt.metavar String
"FILE"
          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
Opt.help String
"Filepath of the ITN signing key."
          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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
          )

    pITNVerificationKeyFile :: Parser SomeKeyFile
    pITNVerificationKeyFile :: Parser SomeKeyFile
pITNVerificationKeyFile =
      VerificationKeyFile -> SomeKeyFile
AVerificationKeyFile (VerificationKeyFile -> SomeKeyFile)
-> (String -> VerificationKeyFile) -> String -> SomeKeyFile
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> VerificationKeyFile
VerificationKeyFile (String -> SomeKeyFile) -> Parser String -> Parser SomeKeyFile
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
Opt.strOption
          (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"itn-verification-key-file"
          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
Opt.metavar String
"FILE"
          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
Opt.help String
"Filepath of the ITN verification key."
          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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
          )

    pKeyConvertCardanoAddressSigningKey :: Parser KeyCmd
    pKeyConvertCardanoAddressSigningKey :: Parser KeyCmd
pKeyConvertCardanoAddressSigningKey =
      CardanoAddressKeyType -> SigningKeyFile -> OutputFile -> KeyCmd
KeyConvertCardanoAddressSigningKey
        (CardanoAddressKeyType -> SigningKeyFile -> OutputFile -> KeyCmd)
-> Parser CardanoAddressKeyType
-> Parser (SigningKeyFile -> OutputFile -> KeyCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser CardanoAddressKeyType
pCardanoAddressKeyType
        Parser (SigningKeyFile -> OutputFile -> KeyCmd)
-> Parser SigningKeyFile -> Parser (OutputFile -> KeyCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FileDirection -> Parser SigningKeyFile
pSigningKeyFile FileDirection
Input
        Parser (OutputFile -> KeyCmd) -> Parser OutputFile -> Parser KeyCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile

    pCardanoAddressKeyType :: Parser CardanoAddressKeyType
    pCardanoAddressKeyType :: Parser CardanoAddressKeyType
pCardanoAddressKeyType =
          CardanoAddressKeyType
-> Mod FlagFields CardanoAddressKeyType
-> Parser CardanoAddressKeyType
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' CardanoAddressKeyType
CardanoAddressShelleyPaymentKey
            (  String -> Mod FlagFields CardanoAddressKeyType
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"shelley-payment-key"
            Mod FlagFields CardanoAddressKeyType
-> Mod FlagFields CardanoAddressKeyType
-> Mod FlagFields CardanoAddressKeyType
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields CardanoAddressKeyType
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use a Shelley-era extended payment key."
            )
      Parser CardanoAddressKeyType
-> Parser CardanoAddressKeyType -> Parser CardanoAddressKeyType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> CardanoAddressKeyType
-> Mod FlagFields CardanoAddressKeyType
-> Parser CardanoAddressKeyType
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' CardanoAddressKeyType
CardanoAddressShelleyStakeKey
            (  String -> Mod FlagFields CardanoAddressKeyType
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"shelley-stake-key"
            Mod FlagFields CardanoAddressKeyType
-> Mod FlagFields CardanoAddressKeyType
-> Mod FlagFields CardanoAddressKeyType
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields CardanoAddressKeyType
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use a Shelley-era extended stake key."
            )
      Parser CardanoAddressKeyType
-> Parser CardanoAddressKeyType -> Parser CardanoAddressKeyType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> CardanoAddressKeyType
-> Mod FlagFields CardanoAddressKeyType
-> Parser CardanoAddressKeyType
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' CardanoAddressKeyType
CardanoAddressIcarusPaymentKey
            (  String -> Mod FlagFields CardanoAddressKeyType
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"icarus-payment-key"
            Mod FlagFields CardanoAddressKeyType
-> Mod FlagFields CardanoAddressKeyType
-> Mod FlagFields CardanoAddressKeyType
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields CardanoAddressKeyType
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use a Byron-era extended payment key formatted in the Icarus style."
            )
      Parser CardanoAddressKeyType
-> Parser CardanoAddressKeyType -> Parser CardanoAddressKeyType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> CardanoAddressKeyType
-> Mod FlagFields CardanoAddressKeyType
-> Parser CardanoAddressKeyType
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' CardanoAddressKeyType
CardanoAddressByronPaymentKey
            (  String -> Mod FlagFields CardanoAddressKeyType
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"byron-payment-key"
            Mod FlagFields CardanoAddressKeyType
-> Mod FlagFields CardanoAddressKeyType
-> Mod FlagFields CardanoAddressKeyType
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields CardanoAddressKeyType
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use a Byron-era extended payment key formatted in the deprecated Byron style."
            )

pTransaction :: Parser TransactionCmd
pTransaction :: Parser TransactionCmd
pTransaction =
  [Parser TransactionCmd] -> Parser TransactionCmd
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
    [ String -> ParserInfo TransactionCmd -> Parser TransactionCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"build-raw"
        (ParserInfo TransactionCmd -> Parser TransactionCmd)
-> ParserInfo TransactionCmd -> Parser TransactionCmd
forall a b. (a -> b) -> a -> b
$ Parser TransactionCmd
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser TransactionCmd
pTransactionBuildRaw (InfoMod TransactionCmd -> ParserInfo TransactionCmd)
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a b. (a -> b) -> a -> b
$ Maybe Doc -> InfoMod TransactionCmd
forall a. Maybe Doc -> InfoMod a
Opt.progDescDoc (Maybe Doc -> InfoMod TransactionCmd)
-> Maybe Doc -> InfoMod TransactionCmd
forall a b. (a -> b) -> a -> b
$ Doc -> Maybe Doc
forall a. a -> Maybe a
Just (Doc -> Maybe Doc) -> Doc -> Maybe Doc
forall a b. (a -> b) -> a -> b
$ [Doc] -> Doc
forall a. Monoid a => [a] -> a
mconcat
          [ String -> Doc
forall a ann. Pretty a => a -> Doc ann
pretty @String String
"Build a transaction (low-level, inconvenient)"
          , Doc
forall ann. Doc ann
line
          , Doc
forall ann. Doc ann
line
          , Doc -> Doc
H.yellow (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ [Doc] -> Doc
forall a. Monoid a => [a] -> a
mconcat
            [ Doc
"Please note the order of some cmd options is crucial. If used incorrectly may produce "
            , Doc
"undesired tx body. See nested [] notation above for details."
            ]
          ]
    , String -> ParserInfo TransactionCmd -> Parser TransactionCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"build"
        (ParserInfo TransactionCmd -> Parser TransactionCmd)
-> ParserInfo TransactionCmd -> Parser TransactionCmd
forall a b. (a -> b) -> a -> b
$ Parser TransactionCmd
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser TransactionCmd
pTransactionBuild (InfoMod TransactionCmd -> ParserInfo TransactionCmd)
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a b. (a -> b) -> a -> b
$ Maybe Doc -> InfoMod TransactionCmd
forall a. Maybe Doc -> InfoMod a
Opt.progDescDoc (Maybe Doc -> InfoMod TransactionCmd)
-> Maybe Doc -> InfoMod TransactionCmd
forall a b. (a -> b) -> a -> b
$ Doc -> Maybe Doc
forall a. a -> Maybe a
Just (Doc -> Maybe Doc) -> Doc -> Maybe Doc
forall a b. (a -> b) -> a -> b
$ [Doc] -> Doc
forall a. Monoid a => [a] -> a
mconcat
          [ String -> Doc
forall a ann. Pretty a => a -> Doc ann
pretty @String String
"Build a balanced transaction (automatically calculates fees)"
          , Doc
forall ann. Doc ann
line
          , Doc
forall ann. Doc ann
line
          , Doc -> Doc
H.yellow (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ [Doc] -> Doc
forall a. Monoid a => [a] -> a
mconcat
            [ Doc
"Please note "
            , Doc -> Doc
H.underline Doc
"the order"
            , Doc
" of some cmd options is crucial. If used incorrectly may produce "
            , Doc
"undesired tx body. See nested [] notation above for details."
            ]
          ]
    , String -> ParserInfo TransactionCmd -> Parser TransactionCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"sign"
        (Parser TransactionCmd
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser TransactionCmd
pTransactionSign (InfoMod TransactionCmd -> ParserInfo TransactionCmd)
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod TransactionCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Sign a transaction")
    , String -> ParserInfo TransactionCmd -> Parser TransactionCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"witness"
        (Parser TransactionCmd
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser TransactionCmd
pTransactionCreateWitness (InfoMod TransactionCmd -> ParserInfo TransactionCmd)
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod TransactionCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create a transaction witness")
    , String -> ParserInfo TransactionCmd -> Parser TransactionCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"assemble"
        (Parser TransactionCmd
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser TransactionCmd
pTransactionAssembleTxBodyWit
          (InfoMod TransactionCmd -> ParserInfo TransactionCmd)
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod TransactionCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Assemble a tx body and witness(es) to form a transaction")
    , Parser TransactionCmd
pSignWitnessBackwardCompatible
    , String -> ParserInfo TransactionCmd -> Parser TransactionCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"submit"
        (Parser TransactionCmd
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser TransactionCmd
pTransactionSubmit (InfoMod TransactionCmd -> ParserInfo TransactionCmd)
-> (String -> InfoMod TransactionCmd)
-> String
-> ParserInfo TransactionCmd
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> InfoMod TransactionCmd
forall a. String -> InfoMod a
Opt.progDesc (String -> ParserInfo TransactionCmd)
-> String -> ParserInfo TransactionCmd
forall a b. (a -> b) -> a -> b
$
           [String] -> String
forall a. Monoid a => [a] -> a
mconcat
             [ String
"Submit a transaction to the local node whose Unix domain socket "
             , String
"is obtained from the CARDANO_NODE_SOCKET_PATH environment variable."
             ]
          )
    , String -> ParserInfo TransactionCmd -> Parser TransactionCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"policyid"
        (Parser TransactionCmd
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser TransactionCmd
pTransactionPolicyId (InfoMod TransactionCmd -> ParserInfo TransactionCmd)
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod TransactionCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Calculate the PolicyId from the monetary policy script.")
    , String -> ParserInfo TransactionCmd -> Parser TransactionCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"calculate-min-fee"
        (Parser TransactionCmd
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser TransactionCmd
pTransactionCalculateMinFee (InfoMod TransactionCmd -> ParserInfo TransactionCmd)
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod TransactionCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Calculate the minimum fee for a transaction.")
    , String -> ParserInfo TransactionCmd -> Parser TransactionCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"calculate-min-required-utxo"
        (Parser TransactionCmd
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser TransactionCmd
pTransactionCalculateMinReqUTxO (InfoMod TransactionCmd -> ParserInfo TransactionCmd)
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod TransactionCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Calculate the minimum required UTxO for a transaction output.")
    , Parser TransactionCmd
pCalculateMinRequiredUtxoBackwardCompatible
    , String -> ParserInfo TransactionCmd -> Parser TransactionCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"hash-script-data"
        (Parser TransactionCmd
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser TransactionCmd
pTxHashScriptData (InfoMod TransactionCmd -> ParserInfo TransactionCmd)
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod TransactionCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Calculate the hash of script data.")
    , String -> ParserInfo TransactionCmd -> Parser TransactionCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"txid"
        (Parser TransactionCmd
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser TransactionCmd
pTransactionId (InfoMod TransactionCmd -> ParserInfo TransactionCmd)
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod TransactionCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Print a transaction identifier.")
    , String -> ParserInfo TransactionCmd -> Parser TransactionCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"view" (ParserInfo TransactionCmd -> Parser TransactionCmd)
-> ParserInfo TransactionCmd -> Parser TransactionCmd
forall a b. (a -> b) -> a -> b
$
        Parser TransactionCmd
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser TransactionCmd
pTransactionView (InfoMod TransactionCmd -> ParserInfo TransactionCmd)
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod TransactionCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Print a transaction."
    ]
 where
  -- Backwards compatible parsers
  calcMinValueInfo :: ParserInfo TransactionCmd
  calcMinValueInfo :: ParserInfo TransactionCmd
calcMinValueInfo =
    Parser TransactionCmd
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser TransactionCmd
pTransactionCalculateMinReqUTxO
      (InfoMod TransactionCmd -> ParserInfo TransactionCmd)
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod TransactionCmd
forall a. String -> InfoMod a
Opt.progDesc String
"DEPRECATED: Use 'calculate-min-required-utxo' instead."

  pCalculateMinRequiredUtxoBackwardCompatible :: Parser TransactionCmd
  pCalculateMinRequiredUtxoBackwardCompatible :: Parser TransactionCmd
pCalculateMinRequiredUtxoBackwardCompatible =
    Mod CommandFields TransactionCmd -> Parser TransactionCmd
forall a. Mod CommandFields a -> Parser a
Opt.subparser
      (Mod CommandFields TransactionCmd -> Parser TransactionCmd)
-> Mod CommandFields TransactionCmd -> Parser TransactionCmd
forall a b. (a -> b) -> a -> b
$ String
-> ParserInfo TransactionCmd -> Mod CommandFields TransactionCmd
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"calculate-min-value" ParserInfo TransactionCmd
calcMinValueInfo Mod CommandFields TransactionCmd
-> Mod CommandFields TransactionCmd
-> Mod CommandFields TransactionCmd
forall a. Semigroup a => a -> a -> a
<> Mod CommandFields TransactionCmd
forall (f :: * -> *) a. Mod f a
Opt.internal

  assembleInfo :: ParserInfo TransactionCmd
  assembleInfo :: ParserInfo TransactionCmd
assembleInfo =
    Parser TransactionCmd
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser TransactionCmd
pTransactionAssembleTxBodyWit
      (InfoMod TransactionCmd -> ParserInfo TransactionCmd)
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod TransactionCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Assemble a tx body and witness(es) to form a transaction"

  pSignWitnessBackwardCompatible :: Parser TransactionCmd
  pSignWitnessBackwardCompatible :: Parser TransactionCmd
pSignWitnessBackwardCompatible =
    Mod CommandFields TransactionCmd -> Parser TransactionCmd
forall a. Mod CommandFields a -> Parser a
Opt.subparser
      (Mod CommandFields TransactionCmd -> Parser TransactionCmd)
-> Mod CommandFields TransactionCmd -> Parser TransactionCmd
forall a b. (a -> b) -> a -> b
$ String
-> ParserInfo TransactionCmd -> Mod CommandFields TransactionCmd
forall a. String -> ParserInfo a -> Mod CommandFields a
Opt.command String
"sign-witness" ParserInfo TransactionCmd
assembleInfo Mod CommandFields TransactionCmd
-> Mod CommandFields TransactionCmd
-> Mod CommandFields TransactionCmd
forall a. Semigroup a => a -> a -> a
<> Mod CommandFields TransactionCmd
forall (f :: * -> *) a. Mod f a
Opt.internal

  pScriptValidity :: Parser ScriptValidity
  pScriptValidity :: Parser ScriptValidity
pScriptValidity = [Parser ScriptValidity] -> Parser ScriptValidity
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
    [ ScriptValidity
-> Mod FlagFields ScriptValidity -> Parser ScriptValidity
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' ScriptValidity
ScriptValid (Mod FlagFields ScriptValidity -> Parser ScriptValidity)
-> Mod FlagFields ScriptValidity -> Parser ScriptValidity
forall a b. (a -> b) -> a -> b
$ [Mod FlagFields ScriptValidity] -> Mod FlagFields ScriptValidity
forall a. Monoid a => [a] -> a
mconcat
      [ String -> Mod FlagFields ScriptValidity
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"script-valid"
      , String -> Mod FlagFields ScriptValidity
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Assertion that the script is valid. (default)"
      ]
    , ScriptValidity
-> Mod FlagFields ScriptValidity -> Parser ScriptValidity
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' ScriptValidity
ScriptInvalid (Mod FlagFields ScriptValidity -> Parser ScriptValidity)
-> Mod FlagFields ScriptValidity -> Parser ScriptValidity
forall a b. (a -> b) -> a -> b
$ [Mod FlagFields ScriptValidity] -> Mod FlagFields ScriptValidity
forall a. Monoid a => [a] -> a
mconcat
      [ String -> Mod FlagFields ScriptValidity
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"script-invalid"
      , String -> Mod FlagFields ScriptValidity
forall (f :: * -> *) a. String -> Mod f a
Opt.help (String -> Mod FlagFields ScriptValidity)
-> String -> Mod FlagFields ScriptValidity
forall a b. (a -> b) -> a -> b
$ [String] -> String
forall a. Monoid a => [a] -> a
mconcat
        [ String
"Assertion that the script is invalid.  "
        , String
"If a transaction is submitted with such a script, "
        , String
"the script will fail and the collateral taken"
        ]
      ]
    ]

  pTransactionBuild :: Parser TransactionCmd
  pTransactionBuild :: Parser TransactionCmd
pTransactionBuild =
    AnyCardanoEra
-> AnyConsensusModeParams
-> NetworkId
-> Maybe ScriptValidity
-> Maybe Word
-> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
-> [TxIn]
-> [RequiredSigner]
-> [TxIn]
-> Maybe TxOutAnyEra
-> Maybe Lovelace
-> [TxOutAnyEra]
-> TxOutChangeAddress
-> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
-> Maybe SlotNo
-> Maybe SlotNo
-> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
-> [(StakeAddress, Lovelace,
     Maybe (ScriptWitnessFiles WitCtxStake))]
-> TxMetadataJsonSchema
-> [ScriptFile]
-> [MetadataFile]
-> Maybe ProtocolParamsSourceSpec
-> Maybe UpdateProposalFile
-> OutputSerialisation
-> TxBuildOutputOptions
-> TransactionCmd
TxBuild (AnyCardanoEra
 -> AnyConsensusModeParams
 -> NetworkId
 -> Maybe ScriptValidity
 -> Maybe Word
 -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
 -> [TxIn]
 -> [RequiredSigner]
 -> [TxIn]
 -> Maybe TxOutAnyEra
 -> Maybe Lovelace
 -> [TxOutAnyEra]
 -> TxOutChangeAddress
 -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
 -> Maybe SlotNo
 -> Maybe SlotNo
 -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
 -> [(StakeAddress, Lovelace,
      Maybe (ScriptWitnessFiles WitCtxStake))]
 -> TxMetadataJsonSchema
 -> [ScriptFile]
 -> [MetadataFile]
 -> Maybe ProtocolParamsSourceSpec
 -> Maybe UpdateProposalFile
 -> OutputSerialisation
 -> TxBuildOutputOptions
 -> TransactionCmd)
-> Parser AnyCardanoEra
-> Parser
     (AnyConsensusModeParams
      -> NetworkId
      -> Maybe ScriptValidity
      -> Maybe Word
      -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
      -> [TxIn]
      -> [RequiredSigner]
      -> [TxIn]
      -> Maybe TxOutAnyEra
      -> Maybe Lovelace
      -> [TxOutAnyEra]
      -> TxOutChangeAddress
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyCardanoEra
pCardanoEra
            Parser
  (AnyConsensusModeParams
   -> NetworkId
   -> Maybe ScriptValidity
   -> Maybe Word
   -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
   -> [TxIn]
   -> [RequiredSigner]
   -> [TxIn]
   -> Maybe TxOutAnyEra
   -> Maybe Lovelace
   -> [TxOutAnyEra]
   -> TxOutChangeAddress
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser AnyConsensusModeParams
-> Parser
     (NetworkId
      -> Maybe ScriptValidity
      -> Maybe Word
      -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
      -> [TxIn]
      -> [RequiredSigner]
      -> [TxIn]
      -> Maybe TxOutAnyEra
      -> Maybe Lovelace
      -> [TxOutAnyEra]
      -> TxOutChangeAddress
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser AnyConsensusModeParams
pConsensusModeParams
            Parser
  (NetworkId
   -> Maybe ScriptValidity
   -> Maybe Word
   -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
   -> [TxIn]
   -> [RequiredSigner]
   -> [TxIn]
   -> Maybe TxOutAnyEra
   -> Maybe Lovelace
   -> [TxOutAnyEra]
   -> TxOutChangeAddress
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser NetworkId
-> Parser
     (Maybe ScriptValidity
      -> Maybe Word
      -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
      -> [TxIn]
      -> [RequiredSigner]
      -> [TxIn]
      -> Maybe TxOutAnyEra
      -> Maybe Lovelace
      -> [TxOutAnyEra]
      -> TxOutChangeAddress
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
            Parser
  (Maybe ScriptValidity
   -> Maybe Word
   -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
   -> [TxIn]
   -> [RequiredSigner]
   -> [TxIn]
   -> Maybe TxOutAnyEra
   -> Maybe Lovelace
   -> [TxOutAnyEra]
   -> TxOutChangeAddress
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser (Maybe ScriptValidity)
-> Parser
     (Maybe Word
      -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
      -> [TxIn]
      -> [RequiredSigner]
      -> [TxIn]
      -> Maybe TxOutAnyEra
      -> Maybe Lovelace
      -> [TxOutAnyEra]
      -> TxOutChangeAddress
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ScriptValidity -> Parser (Maybe ScriptValidity)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser ScriptValidity
pScriptValidity
            Parser
  (Maybe Word
   -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
   -> [TxIn]
   -> [RequiredSigner]
   -> [TxIn]
   -> Maybe TxOutAnyEra
   -> Maybe Lovelace
   -> [TxOutAnyEra]
   -> TxOutChangeAddress
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser (Maybe Word)
-> Parser
     ([(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
      -> [TxIn]
      -> [RequiredSigner]
      -> [TxIn]
      -> Maybe TxOutAnyEra
      -> Maybe Lovelace
      -> [TxOutAnyEra]
      -> TxOutChangeAddress
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Word -> Parser (Maybe Word)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser Word
pWitnessOverride
            Parser
  ([(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
   -> [TxIn]
   -> [RequiredSigner]
   -> [TxIn]
   -> Maybe TxOutAnyEra
   -> Maybe Lovelace
   -> [TxOutAnyEra]
   -> TxOutChangeAddress
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
-> Parser
     ([TxIn]
      -> [RequiredSigner]
      -> [TxIn]
      -> Maybe TxOutAnyEra
      -> Maybe Lovelace
      -> [TxOutAnyEra]
      -> TxOutChangeAddress
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))
-> Parser [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some (BalanceTxExecUnits
-> Parser (TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))
pTxIn BalanceTxExecUnits
AutoBalance)
            Parser
  ([TxIn]
   -> [RequiredSigner]
   -> [TxIn]
   -> Maybe TxOutAnyEra
   -> Maybe Lovelace
   -> [TxOutAnyEra]
   -> TxOutChangeAddress
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser [TxIn]
-> Parser
     ([RequiredSigner]
      -> [TxIn]
      -> Maybe TxOutAnyEra
      -> Maybe Lovelace
      -> [TxOutAnyEra]
      -> TxOutChangeAddress
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxIn -> Parser [TxIn]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser TxIn
pReadOnlyReferenceTxIn
            Parser
  ([RequiredSigner]
   -> [TxIn]
   -> Maybe TxOutAnyEra
   -> Maybe Lovelace
   -> [TxOutAnyEra]
   -> TxOutChangeAddress
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser [RequiredSigner]
-> Parser
     ([TxIn]
      -> Maybe TxOutAnyEra
      -> Maybe Lovelace
      -> [TxOutAnyEra]
      -> TxOutChangeAddress
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser RequiredSigner -> Parser [RequiredSigner]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser RequiredSigner
pRequiredSigner
            Parser
  ([TxIn]
   -> Maybe TxOutAnyEra
   -> Maybe Lovelace
   -> [TxOutAnyEra]
   -> TxOutChangeAddress
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser [TxIn]
-> Parser
     (Maybe TxOutAnyEra
      -> Maybe Lovelace
      -> [TxOutAnyEra]
      -> TxOutChangeAddress
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxIn -> Parser [TxIn]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser TxIn
pTxInCollateral
            Parser
  (Maybe TxOutAnyEra
   -> Maybe Lovelace
   -> [TxOutAnyEra]
   -> TxOutChangeAddress
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser (Maybe TxOutAnyEra)
-> Parser
     (Maybe Lovelace
      -> [TxOutAnyEra]
      -> TxOutChangeAddress
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxOutAnyEra -> Parser (Maybe TxOutAnyEra)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser TxOutAnyEra
pReturnCollateral
            Parser
  (Maybe Lovelace
   -> [TxOutAnyEra]
   -> TxOutChangeAddress
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser (Maybe Lovelace)
-> Parser
     ([TxOutAnyEra]
      -> TxOutChangeAddress
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Lovelace -> Parser (Maybe Lovelace)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser Lovelace
pTotalCollateral
            Parser
  ([TxOutAnyEra]
   -> TxOutChangeAddress
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser [TxOutAnyEra]
-> Parser
     (TxOutChangeAddress
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxOutAnyEra -> Parser [TxOutAnyEra]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser TxOutAnyEra
pTxOut
            Parser
  (TxOutChangeAddress
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser TxOutChangeAddress
-> Parser
     (Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxOutChangeAddress
pChangeAddress
            Parser
  (Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser (Maybe (Value, [ScriptWitnessFiles WitCtxMint]))
-> Parser
     (Maybe SlotNo
      -> Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Value, [ScriptWitnessFiles WitCtxMint])
-> Parser (Maybe (Value, [ScriptWitnessFiles WitCtxMint]))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (BalanceTxExecUnits
-> Parser (Value, [ScriptWitnessFiles WitCtxMint])
pMintMultiAsset BalanceTxExecUnits
AutoBalance)
            Parser
  (Maybe SlotNo
   -> Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser (Maybe SlotNo)
-> Parser
     (Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser SlotNo -> Parser (Maybe SlotNo)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser SlotNo
pInvalidBefore
            Parser
  (Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser (Maybe SlotNo)
-> Parser
     ([(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser SlotNo -> Parser (Maybe SlotNo)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser SlotNo
pInvalidHereafter
            Parser
  ([(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser
     [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
-> Parser
     ([(StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))
-> Parser
     [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (BalanceTxExecUnits
-> Parser (CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))
pCertificateFile BalanceTxExecUnits
AutoBalance)
            Parser
  ([(StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser
     [(StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))]
-> Parser
     (TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser
  (StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))
-> Parser
     [(StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (BalanceTxExecUnits
-> Parser
     (StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))
pWithdrawal BalanceTxExecUnits
AutoBalance)
            Parser
  (TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser TxMetadataJsonSchema
-> Parser
     ([ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxMetadataJsonSchema
pTxMetadataJsonSchema
            Parser
  ([ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser [ScriptFile]
-> Parser
     ([MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ScriptFile -> Parser [ScriptFile]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (String -> Maybe String -> String -> Parser ScriptFile
pScriptFor
                        String
"auxiliary-script-file"
                        Maybe String
forall a. Maybe a
Nothing
                        String
"Filepath of auxiliary script(s)")
            Parser
  ([MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser [MetadataFile]
-> Parser
     (Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBuildOutputOptions
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser MetadataFile -> Parser [MetadataFile]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser MetadataFile
pMetadataFile
            Parser
  (Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBuildOutputOptions
   -> TransactionCmd)
-> Parser (Maybe ProtocolParamsSourceSpec)
-> Parser
     (Maybe UpdateProposalFile
      -> OutputSerialisation -> TxBuildOutputOptions -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ProtocolParamsSourceSpec
-> Parser (Maybe ProtocolParamsSourceSpec)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser ProtocolParamsSourceSpec
pProtocolParamsSourceSpec
            Parser
  (Maybe UpdateProposalFile
   -> OutputSerialisation -> TxBuildOutputOptions -> TransactionCmd)
-> Parser (Maybe UpdateProposalFile)
-> Parser
     (OutputSerialisation -> TxBuildOutputOptions -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser UpdateProposalFile -> Parser (Maybe UpdateProposalFile)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser UpdateProposalFile
pUpdateProposalFile
            Parser
  (OutputSerialisation -> TxBuildOutputOptions -> TransactionCmd)
-> Parser OutputSerialisation
-> Parser (TxBuildOutputOptions -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputSerialisation
pOutputSerialisation
            Parser (TxBuildOutputOptions -> TransactionCmd)
-> Parser TxBuildOutputOptions -> Parser TransactionCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (TxBodyFile -> TxBuildOutputOptions
OutputTxBodyOnly (TxBodyFile -> TxBuildOutputOptions)
-> Parser TxBodyFile -> Parser TxBuildOutputOptions
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser TxBodyFile
pTxBodyFile FileDirection
Output Parser TxBuildOutputOptions
-> Parser TxBuildOutputOptions -> Parser TxBuildOutputOptions
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser TxBuildOutputOptions
pCalculatePlutusScriptCost)

  pChangeAddress :: Parser TxOutChangeAddress
  pChangeAddress :: Parser TxOutChangeAddress
pChangeAddress =
    AddressAny -> TxOutChangeAddress
TxOutChangeAddress (AddressAny -> TxOutChangeAddress)
-> Parser AddressAny -> Parser TxOutChangeAddress
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
      ReadM AddressAny
-> Mod OptionFields AddressAny -> Parser AddressAny
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option (Parser AddressAny -> ReadM AddressAny
forall a. Parser a -> ReadM a
readerFromParsecParser Parser AddressAny
parseAddressAny)
        (  String -> Mod OptionFields AddressAny
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"change-address"
        Mod OptionFields AddressAny
-> Mod OptionFields AddressAny -> Mod OptionFields AddressAny
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields AddressAny
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"ADDRESS"
        Mod OptionFields AddressAny
-> Mod OptionFields AddressAny -> Mod OptionFields AddressAny
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields AddressAny
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Address where ADA in excess of the tx fee will go to."
        )

  pTransactionBuildRaw :: Parser TransactionCmd
  pTransactionBuildRaw :: Parser TransactionCmd
pTransactionBuildRaw =
    AnyCardanoEra
-> Maybe ScriptValidity
-> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
-> [TxIn]
-> [TxIn]
-> Maybe TxOutAnyEra
-> Maybe Lovelace
-> [RequiredSigner]
-> [TxOutAnyEra]
-> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
-> Maybe SlotNo
-> Maybe SlotNo
-> Maybe Lovelace
-> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
-> [(StakeAddress, Lovelace,
     Maybe (ScriptWitnessFiles WitCtxStake))]
-> TxMetadataJsonSchema
-> [ScriptFile]
-> [MetadataFile]
-> Maybe ProtocolParamsSourceSpec
-> Maybe UpdateProposalFile
-> OutputSerialisation
-> TxBodyFile
-> TransactionCmd
TxBuildRaw (AnyCardanoEra
 -> Maybe ScriptValidity
 -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
 -> [TxIn]
 -> [TxIn]
 -> Maybe TxOutAnyEra
 -> Maybe Lovelace
 -> [RequiredSigner]
 -> [TxOutAnyEra]
 -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
 -> Maybe SlotNo
 -> Maybe SlotNo
 -> Maybe Lovelace
 -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
 -> [(StakeAddress, Lovelace,
      Maybe (ScriptWitnessFiles WitCtxStake))]
 -> TxMetadataJsonSchema
 -> [ScriptFile]
 -> [MetadataFile]
 -> Maybe ProtocolParamsSourceSpec
 -> Maybe UpdateProposalFile
 -> OutputSerialisation
 -> TxBodyFile
 -> TransactionCmd)
-> Parser AnyCardanoEra
-> Parser
     (Maybe ScriptValidity
      -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
      -> [TxIn]
      -> [TxIn]
      -> Maybe TxOutAnyEra
      -> Maybe Lovelace
      -> [RequiredSigner]
      -> [TxOutAnyEra]
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> Maybe Lovelace
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyCardanoEra
pCardanoEra
               Parser
  (Maybe ScriptValidity
   -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
   -> [TxIn]
   -> [TxIn]
   -> Maybe TxOutAnyEra
   -> Maybe Lovelace
   -> [RequiredSigner]
   -> [TxOutAnyEra]
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> Maybe Lovelace
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser (Maybe ScriptValidity)
-> Parser
     ([(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
      -> [TxIn]
      -> [TxIn]
      -> Maybe TxOutAnyEra
      -> Maybe Lovelace
      -> [RequiredSigner]
      -> [TxOutAnyEra]
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> Maybe Lovelace
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ScriptValidity -> Parser (Maybe ScriptValidity)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser ScriptValidity
pScriptValidity
               Parser
  ([(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
   -> [TxIn]
   -> [TxIn]
   -> Maybe TxOutAnyEra
   -> Maybe Lovelace
   -> [RequiredSigner]
   -> [TxOutAnyEra]
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> Maybe Lovelace
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
-> Parser
     ([TxIn]
      -> [TxIn]
      -> Maybe TxOutAnyEra
      -> Maybe Lovelace
      -> [RequiredSigner]
      -> [TxOutAnyEra]
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> Maybe Lovelace
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))
-> Parser [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some (BalanceTxExecUnits
-> Parser (TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))
pTxIn BalanceTxExecUnits
ManualBalance)
               Parser
  ([TxIn]
   -> [TxIn]
   -> Maybe TxOutAnyEra
   -> Maybe Lovelace
   -> [RequiredSigner]
   -> [TxOutAnyEra]
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> Maybe Lovelace
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser [TxIn]
-> Parser
     ([TxIn]
      -> Maybe TxOutAnyEra
      -> Maybe Lovelace
      -> [RequiredSigner]
      -> [TxOutAnyEra]
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> Maybe Lovelace
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxIn -> Parser [TxIn]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser TxIn
pReadOnlyReferenceTxIn
               Parser
  ([TxIn]
   -> Maybe TxOutAnyEra
   -> Maybe Lovelace
   -> [RequiredSigner]
   -> [TxOutAnyEra]
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> Maybe Lovelace
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser [TxIn]
-> Parser
     (Maybe TxOutAnyEra
      -> Maybe Lovelace
      -> [RequiredSigner]
      -> [TxOutAnyEra]
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> Maybe Lovelace
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxIn -> Parser [TxIn]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser TxIn
pTxInCollateral
               Parser
  (Maybe TxOutAnyEra
   -> Maybe Lovelace
   -> [RequiredSigner]
   -> [TxOutAnyEra]
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> Maybe Lovelace
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser (Maybe TxOutAnyEra)
-> Parser
     (Maybe Lovelace
      -> [RequiredSigner]
      -> [TxOutAnyEra]
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> Maybe Lovelace
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxOutAnyEra -> Parser (Maybe TxOutAnyEra)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser TxOutAnyEra
pReturnCollateral
               Parser
  (Maybe Lovelace
   -> [RequiredSigner]
   -> [TxOutAnyEra]
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> Maybe Lovelace
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser (Maybe Lovelace)
-> Parser
     ([RequiredSigner]
      -> [TxOutAnyEra]
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> Maybe Lovelace
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Lovelace -> Parser (Maybe Lovelace)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser Lovelace
pTotalCollateral
               Parser
  ([RequiredSigner]
   -> [TxOutAnyEra]
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> Maybe Lovelace
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser [RequiredSigner]
-> Parser
     ([TxOutAnyEra]
      -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> Maybe Lovelace
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser RequiredSigner -> Parser [RequiredSigner]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser RequiredSigner
pRequiredSigner
               Parser
  ([TxOutAnyEra]
   -> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> Maybe Lovelace
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser [TxOutAnyEra]
-> Parser
     (Maybe (Value, [ScriptWitnessFiles WitCtxMint])
      -> Maybe SlotNo
      -> Maybe SlotNo
      -> Maybe Lovelace
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxOutAnyEra -> Parser [TxOutAnyEra]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser TxOutAnyEra
pTxOut
               Parser
  (Maybe (Value, [ScriptWitnessFiles WitCtxMint])
   -> Maybe SlotNo
   -> Maybe SlotNo
   -> Maybe Lovelace
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser (Maybe (Value, [ScriptWitnessFiles WitCtxMint]))
-> Parser
     (Maybe SlotNo
      -> Maybe SlotNo
      -> Maybe Lovelace
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Value, [ScriptWitnessFiles WitCtxMint])
-> Parser (Maybe (Value, [ScriptWitnessFiles WitCtxMint]))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (BalanceTxExecUnits
-> Parser (Value, [ScriptWitnessFiles WitCtxMint])
pMintMultiAsset BalanceTxExecUnits
ManualBalance)
               Parser
  (Maybe SlotNo
   -> Maybe SlotNo
   -> Maybe Lovelace
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser (Maybe SlotNo)
-> Parser
     (Maybe SlotNo
      -> Maybe Lovelace
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser SlotNo -> Parser (Maybe SlotNo)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser SlotNo
pInvalidBefore
               Parser
  (Maybe SlotNo
   -> Maybe Lovelace
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser (Maybe SlotNo)
-> Parser
     (Maybe Lovelace
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser SlotNo -> Parser (Maybe SlotNo)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser SlotNo
pInvalidHereafter
               Parser
  (Maybe Lovelace
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser (Maybe Lovelace)
-> Parser
     ([(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Lovelace -> Parser (Maybe Lovelace)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser Lovelace
pTxFee
               Parser
  ([(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser
     [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
-> Parser
     ([(StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))
-> Parser
     [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (BalanceTxExecUnits
-> Parser (CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))
pCertificateFile BalanceTxExecUnits
ManualBalance )
               Parser
  ([(StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser
     [(StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))]
-> Parser
     (TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser
  (StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))
-> Parser
     [(StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (BalanceTxExecUnits
-> Parser
     (StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))
pWithdrawal BalanceTxExecUnits
ManualBalance)
               Parser
  (TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser TxMetadataJsonSchema
-> Parser
     ([ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxMetadataJsonSchema
pTxMetadataJsonSchema
               Parser
  ([ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser [ScriptFile]
-> Parser
     ([MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ScriptFile -> Parser [ScriptFile]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (String -> Maybe String -> String -> Parser ScriptFile
pScriptFor
                           String
"auxiliary-script-file"
                           Maybe String
forall a. Maybe a
Nothing
                           String
"Filepath of auxiliary script(s)")
               Parser
  ([MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser [MetadataFile]
-> Parser
     (Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> OutputSerialisation
      -> TxBodyFile
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser MetadataFile -> Parser [MetadataFile]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser MetadataFile
pMetadataFile
               Parser
  (Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> OutputSerialisation
   -> TxBodyFile
   -> TransactionCmd)
-> Parser (Maybe ProtocolParamsSourceSpec)
-> Parser
     (Maybe UpdateProposalFile
      -> OutputSerialisation -> TxBodyFile -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ProtocolParamsSourceSpec
-> Parser (Maybe ProtocolParamsSourceSpec)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser ProtocolParamsSourceSpec
pProtocolParamsSourceSpec
               Parser
  (Maybe UpdateProposalFile
   -> OutputSerialisation -> TxBodyFile -> TransactionCmd)
-> Parser (Maybe UpdateProposalFile)
-> Parser (OutputSerialisation -> TxBodyFile -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser UpdateProposalFile -> Parser (Maybe UpdateProposalFile)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser UpdateProposalFile
pUpdateProposalFile
               Parser (OutputSerialisation -> TxBodyFile -> TransactionCmd)
-> Parser OutputSerialisation
-> Parser (TxBodyFile -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputSerialisation
pOutputSerialisation
               Parser (TxBodyFile -> TransactionCmd)
-> Parser TxBodyFile -> Parser TransactionCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FileDirection -> Parser TxBodyFile
pTxBodyFile FileDirection
Output

  pTransactionSign  :: Parser TransactionCmd
  pTransactionSign :: Parser TransactionCmd
pTransactionSign = InputTxBodyOrTxFile
-> [WitnessSigningData]
-> Maybe NetworkId
-> TxFile
-> TransactionCmd
TxSign (InputTxBodyOrTxFile
 -> [WitnessSigningData]
 -> Maybe NetworkId
 -> TxFile
 -> TransactionCmd)
-> Parser InputTxBodyOrTxFile
-> Parser
     ([WitnessSigningData]
      -> Maybe NetworkId -> TxFile -> TransactionCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser InputTxBodyOrTxFile
pInputTxOrTxBodyFile
                            Parser
  ([WitnessSigningData]
   -> Maybe NetworkId -> TxFile -> TransactionCmd)
-> Parser [WitnessSigningData]
-> Parser (Maybe NetworkId -> TxFile -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [WitnessSigningData]
pSomeWitnessSigningData
                            Parser (Maybe NetworkId -> TxFile -> TransactionCmd)
-> Parser (Maybe NetworkId) -> Parser (TxFile -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId -> Parser (Maybe NetworkId)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser NetworkId
pNetworkId
                            Parser (TxFile -> TransactionCmd)
-> Parser TxFile -> Parser TransactionCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FileDirection -> Parser TxFile
pTxFile FileDirection
Output

  pTransactionCreateWitness :: Parser TransactionCmd
  pTransactionCreateWitness :: Parser TransactionCmd
pTransactionCreateWitness = TxBodyFile
-> WitnessSigningData
-> Maybe NetworkId
-> OutputFile
-> TransactionCmd
TxCreateWitness
                                (TxBodyFile
 -> WitnessSigningData
 -> Maybe NetworkId
 -> OutputFile
 -> TransactionCmd)
-> Parser TxBodyFile
-> Parser
     (WitnessSigningData
      -> Maybe NetworkId -> OutputFile -> TransactionCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser TxBodyFile
pTxBodyFile FileDirection
Input
                                Parser
  (WitnessSigningData
   -> Maybe NetworkId -> OutputFile -> TransactionCmd)
-> Parser WitnessSigningData
-> Parser (Maybe NetworkId -> OutputFile -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser WitnessSigningData
pWitnessSigningData
                                Parser (Maybe NetworkId -> OutputFile -> TransactionCmd)
-> Parser (Maybe NetworkId)
-> Parser (OutputFile -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId -> Parser (Maybe NetworkId)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser NetworkId
pNetworkId
                                Parser (OutputFile -> TransactionCmd)
-> Parser OutputFile -> Parser TransactionCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile

  pTransactionAssembleTxBodyWit :: Parser TransactionCmd
  pTransactionAssembleTxBodyWit :: Parser TransactionCmd
pTransactionAssembleTxBodyWit = TxBodyFile -> [WitnessFile] -> OutputFile -> TransactionCmd
TxAssembleTxBodyWitness
                                    (TxBodyFile -> [WitnessFile] -> OutputFile -> TransactionCmd)
-> Parser TxBodyFile
-> Parser ([WitnessFile] -> OutputFile -> TransactionCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser TxBodyFile
pTxBodyFile FileDirection
Input
                                    Parser ([WitnessFile] -> OutputFile -> TransactionCmd)
-> Parser [WitnessFile] -> Parser (OutputFile -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser WitnessFile -> Parser [WitnessFile]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some Parser WitnessFile
pWitnessFile
                                    Parser (OutputFile -> TransactionCmd)
-> Parser OutputFile -> Parser TransactionCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile

  pTransactionSubmit :: Parser TransactionCmd
  pTransactionSubmit :: Parser TransactionCmd
pTransactionSubmit = AnyConsensusModeParams -> NetworkId -> String -> TransactionCmd
TxSubmit (AnyConsensusModeParams -> NetworkId -> String -> TransactionCmd)
-> Parser AnyConsensusModeParams
-> Parser (NetworkId -> String -> TransactionCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyConsensusModeParams
pConsensusModeParams
                                Parser (NetworkId -> String -> TransactionCmd)
-> Parser NetworkId -> Parser (String -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
                                Parser (String -> TransactionCmd)
-> Parser String -> Parser TransactionCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser String
pTxSubmitFile

  pTransactionPolicyId :: Parser TransactionCmd
  pTransactionPolicyId :: Parser TransactionCmd
pTransactionPolicyId = ScriptFile -> TransactionCmd
TxMintedPolicyId (ScriptFile -> TransactionCmd)
-> Parser ScriptFile -> Parser TransactionCmd
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser ScriptFile
pScript

  pTransactionCalculateMinFee :: Parser TransactionCmd
  pTransactionCalculateMinFee :: Parser TransactionCmd
pTransactionCalculateMinFee =
    TxBodyFile
-> Maybe NetworkId
-> ProtocolParamsSourceSpec
-> TxInCount
-> TxOutCount
-> TxShelleyWitnessCount
-> TxByronWitnessCount
-> TransactionCmd
TxCalculateMinFee
      (TxBodyFile
 -> Maybe NetworkId
 -> ProtocolParamsSourceSpec
 -> TxInCount
 -> TxOutCount
 -> TxShelleyWitnessCount
 -> TxByronWitnessCount
 -> TransactionCmd)
-> Parser TxBodyFile
-> Parser
     (Maybe NetworkId
      -> ProtocolParamsSourceSpec
      -> TxInCount
      -> TxOutCount
      -> TxShelleyWitnessCount
      -> TxByronWitnessCount
      -> TransactionCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser TxBodyFile
pTxBodyFile FileDirection
Input
      Parser
  (Maybe NetworkId
   -> ProtocolParamsSourceSpec
   -> TxInCount
   -> TxOutCount
   -> TxShelleyWitnessCount
   -> TxByronWitnessCount
   -> TransactionCmd)
-> Parser (Maybe NetworkId)
-> Parser
     (ProtocolParamsSourceSpec
      -> TxInCount
      -> TxOutCount
      -> TxShelleyWitnessCount
      -> TxByronWitnessCount
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId -> Parser (Maybe NetworkId)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser NetworkId
pNetworkId
      Parser
  (ProtocolParamsSourceSpec
   -> TxInCount
   -> TxOutCount
   -> TxShelleyWitnessCount
   -> TxByronWitnessCount
   -> TransactionCmd)
-> Parser ProtocolParamsSourceSpec
-> Parser
     (TxInCount
      -> TxOutCount
      -> TxShelleyWitnessCount
      -> TxByronWitnessCount
      -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ProtocolParamsSourceSpec
pProtocolParamsSourceSpec
      Parser
  (TxInCount
   -> TxOutCount
   -> TxShelleyWitnessCount
   -> TxByronWitnessCount
   -> TransactionCmd)
-> Parser TxInCount
-> Parser
     (TxOutCount
      -> TxShelleyWitnessCount -> TxByronWitnessCount -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxInCount
pTxInCount
      Parser
  (TxOutCount
   -> TxShelleyWitnessCount -> TxByronWitnessCount -> TransactionCmd)
-> Parser TxOutCount
-> Parser
     (TxShelleyWitnessCount -> TxByronWitnessCount -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxOutCount
pTxOutCount
      Parser
  (TxShelleyWitnessCount -> TxByronWitnessCount -> TransactionCmd)
-> Parser TxShelleyWitnessCount
-> Parser (TxByronWitnessCount -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxShelleyWitnessCount
pTxShelleyWitnessCount
      Parser (TxByronWitnessCount -> TransactionCmd)
-> Parser TxByronWitnessCount -> Parser TransactionCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxByronWitnessCount
pTxByronWitnessCount

  pTransactionCalculateMinReqUTxO :: Parser TransactionCmd
  pTransactionCalculateMinReqUTxO :: Parser TransactionCmd
pTransactionCalculateMinReqUTxO = AnyCardanoEra
-> ProtocolParamsSourceSpec -> TxOutAnyEra -> TransactionCmd
TxCalculateMinRequiredUTxO
    (AnyCardanoEra
 -> ProtocolParamsSourceSpec -> TxOutAnyEra -> TransactionCmd)
-> Parser AnyCardanoEra
-> Parser
     (ProtocolParamsSourceSpec -> TxOutAnyEra -> TransactionCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyCardanoEra
pCardanoEra
    Parser (ProtocolParamsSourceSpec -> TxOutAnyEra -> TransactionCmd)
-> Parser ProtocolParamsSourceSpec
-> Parser (TxOutAnyEra -> TransactionCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ProtocolParamsSourceSpec
pProtocolParamsSourceSpec
    Parser (TxOutAnyEra -> TransactionCmd)
-> Parser TxOutAnyEra -> Parser TransactionCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TxOutAnyEra
pTxOut

  pProtocolParamsSourceSpec :: Parser ProtocolParamsSourceSpec
  pProtocolParamsSourceSpec :: Parser ProtocolParamsSourceSpec
pProtocolParamsSourceSpec =
    GenesisFile -> ProtocolParamsSourceSpec
ParamsFromGenesis (GenesisFile -> ProtocolParamsSourceSpec)
-> Parser GenesisFile -> Parser ProtocolParamsSourceSpec
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
      String -> Parser GenesisFile
pGenesisFile
        String
"[TESTING] The genesis file to take initial protocol parameters from.  For test clusters only, since the parameters are going to be obsolete for production clusters."
    Parser ProtocolParamsSourceSpec
-> Parser ProtocolParamsSourceSpec
-> Parser ProtocolParamsSourceSpec
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
    ProtocolParamsFile -> ProtocolParamsSourceSpec
ParamsFromFile (ProtocolParamsFile -> ProtocolParamsSourceSpec)
-> Parser ProtocolParamsFile -> Parser ProtocolParamsSourceSpec
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser ProtocolParamsFile
pProtocolParamsFile

  pTxHashScriptData :: Parser TransactionCmd
  pTxHashScriptData :: Parser TransactionCmd
pTxHashScriptData = ScriptRedeemerOrFile -> TransactionCmd
TxHashScriptData (ScriptRedeemerOrFile -> TransactionCmd)
-> Parser ScriptRedeemerOrFile -> Parser TransactionCmd
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
                        String -> String -> String -> Parser ScriptRedeemerOrFile
pScriptDataOrFile
                          String
"script-data"
                          String
"The script data, in JSON syntax."
                          String
"The script data, in the given JSON file."

  pTransactionId  :: Parser TransactionCmd
  pTransactionId :: Parser TransactionCmd
pTransactionId = InputTxBodyOrTxFile -> TransactionCmd
TxGetTxId (InputTxBodyOrTxFile -> TransactionCmd)
-> Parser InputTxBodyOrTxFile -> Parser TransactionCmd
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser InputTxBodyOrTxFile
pInputTxOrTxBodyFile

  pTransactionView :: Parser TransactionCmd
  pTransactionView :: Parser TransactionCmd
pTransactionView = InputTxBodyOrTxFile -> TransactionCmd
TxView (InputTxBodyOrTxFile -> TransactionCmd)
-> Parser InputTxBodyOrTxFile -> Parser TransactionCmd
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser InputTxBodyOrTxFile
pInputTxOrTxBodyFile

pNodeCmd :: Parser NodeCmd
pNodeCmd :: Parser NodeCmd
pNodeCmd =
  [Parser NodeCmd] -> Parser NodeCmd
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
    [ String -> ParserInfo NodeCmd -> Parser NodeCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"key-gen"
        (Parser NodeCmd -> InfoMod NodeCmd -> ParserInfo NodeCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser NodeCmd
pKeyGenOperator (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 a key pair for a node operator's offline \
                       \ key and a new certificate issue counter")
    , String -> ParserInfo NodeCmd -> Parser NodeCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"key-gen-KES"
        (Parser NodeCmd -> InfoMod NodeCmd -> ParserInfo NodeCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser NodeCmd
pKeyGenKES (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 a key pair for a node KES operational key")
    , String -> ParserInfo NodeCmd -> Parser NodeCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"key-gen-VRF"
        (Parser NodeCmd -> InfoMod NodeCmd -> ParserInfo NodeCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser NodeCmd
pKeyGenVRF (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 a key pair for a node VRF operational key")
    , String -> ParserInfo NodeCmd -> Parser NodeCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"key-hash-VRF"
        (Parser NodeCmd -> InfoMod NodeCmd -> ParserInfo NodeCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser NodeCmd
pKeyHashVRF (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
"Print hash of a node's operational VRF key.")
    , String -> ParserInfo NodeCmd -> Parser NodeCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"new-counter"
        (Parser NodeCmd -> InfoMod NodeCmd -> ParserInfo NodeCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser NodeCmd
pNewCounter (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 a new certificate issue counter")
    , String -> ParserInfo NodeCmd -> Parser NodeCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"issue-op-cert"
        (Parser NodeCmd -> InfoMod NodeCmd -> ParserInfo NodeCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser NodeCmd
pIssueOpCert (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
"Issue a node operational certificate")
    ]
  where
    pKeyGenOperator :: Parser NodeCmd
    pKeyGenOperator :: Parser NodeCmd
pKeyGenOperator =
      VerificationKeyFile
-> SigningKeyFile -> OpCertCounterFile -> NodeCmd
NodeKeyGenCold (VerificationKeyFile
 -> SigningKeyFile -> OpCertCounterFile -> NodeCmd)
-> Parser VerificationKeyFile
-> Parser (SigningKeyFile -> OpCertCounterFile -> NodeCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser VerificationKeyFile
pColdVerificationKeyFile
                     Parser (SigningKeyFile -> OpCertCounterFile -> NodeCmd)
-> Parser SigningKeyFile -> Parser (OpCertCounterFile -> NodeCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser SigningKeyFile
pColdSigningKeyFile
                     Parser (OpCertCounterFile -> NodeCmd)
-> Parser OpCertCounterFile -> Parser NodeCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OpCertCounterFile
pOperatorCertIssueCounterFile

    pKeyGenKES :: Parser NodeCmd
    pKeyGenKES :: Parser NodeCmd
pKeyGenKES =
      VerificationKeyFile -> SigningKeyFile -> NodeCmd
NodeKeyGenKES (VerificationKeyFile -> SigningKeyFile -> NodeCmd)
-> Parser VerificationKeyFile -> Parser (SigningKeyFile -> NodeCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile FileDirection
Output Parser (SigningKeyFile -> NodeCmd)
-> Parser SigningKeyFile -> Parser NodeCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FileDirection -> Parser SigningKeyFile
pSigningKeyFile FileDirection
Output

    pKeyGenVRF :: Parser NodeCmd
    pKeyGenVRF :: Parser NodeCmd
pKeyGenVRF =
      VerificationKeyFile -> SigningKeyFile -> NodeCmd
NodeKeyGenVRF (VerificationKeyFile -> SigningKeyFile -> NodeCmd)
-> Parser VerificationKeyFile -> Parser (SigningKeyFile -> NodeCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile FileDirection
Output Parser (SigningKeyFile -> NodeCmd)
-> Parser SigningKeyFile -> Parser NodeCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FileDirection -> Parser SigningKeyFile
pSigningKeyFile FileDirection
Output

    pKeyHashVRF :: Parser NodeCmd
    pKeyHashVRF :: Parser NodeCmd
pKeyHashVRF =
      VerificationKeyOrFile VrfKey -> Maybe OutputFile -> NodeCmd
NodeKeyHashVRF (VerificationKeyOrFile VrfKey -> Maybe OutputFile -> NodeCmd)
-> Parser (VerificationKeyOrFile VrfKey)
-> Parser (Maybe OutputFile -> NodeCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AsType VrfKey -> Parser (VerificationKeyOrFile VrfKey)
forall keyrole.
SerialiseAsBech32 (VerificationKey keyrole) =>
AsType keyrole -> Parser (VerificationKeyOrFile keyrole)
pVerificationKeyOrFile AsType VrfKey
AsVrfKey Parser (Maybe OutputFile -> NodeCmd)
-> Parser (Maybe OutputFile) -> Parser NodeCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pNewCounter :: Parser NodeCmd
    pNewCounter :: Parser NodeCmd
pNewCounter =
      ColdVerificationKeyOrFile -> Word -> OpCertCounterFile -> NodeCmd
NodeNewCounter (ColdVerificationKeyOrFile -> Word -> OpCertCounterFile -> NodeCmd)
-> Parser ColdVerificationKeyOrFile
-> Parser (Word -> OpCertCounterFile -> NodeCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser ColdVerificationKeyOrFile
pColdVerificationKeyOrFile
                     Parser (Word -> OpCertCounterFile -> NodeCmd)
-> Parser Word -> Parser (OpCertCounterFile -> NodeCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Word
pCounterValue
                     Parser (OpCertCounterFile -> NodeCmd)
-> Parser OpCertCounterFile -> Parser NodeCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OpCertCounterFile
pOperatorCertIssueCounterFile

    pCounterValue :: Parser Word
    pCounterValue :: Parser Word
pCounterValue =
        ReadM Word -> Mod OptionFields Word -> Parser Word
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Word
forall a. Read a => ReadM a
Opt.auto
          (  String -> Mod OptionFields Word
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"counter-value"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"INT"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"The next certificate issue counter value to use."
          )

    pIssueOpCert :: Parser NodeCmd
    pIssueOpCert :: Parser NodeCmd
pIssueOpCert =
      VerificationKeyOrFile KesKey
-> SigningKeyFile
-> OpCertCounterFile
-> KESPeriod
-> OutputFile
-> NodeCmd
NodeIssueOpCert (VerificationKeyOrFile KesKey
 -> SigningKeyFile
 -> OpCertCounterFile
 -> KESPeriod
 -> OutputFile
 -> NodeCmd)
-> Parser (VerificationKeyOrFile KesKey)
-> Parser
     (SigningKeyFile
      -> OpCertCounterFile -> KESPeriod -> OutputFile -> NodeCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (VerificationKeyOrFile KesKey)
pKesVerificationKeyOrFile
                      Parser
  (SigningKeyFile
   -> OpCertCounterFile -> KESPeriod -> OutputFile -> NodeCmd)
-> Parser SigningKeyFile
-> Parser (OpCertCounterFile -> KESPeriod -> OutputFile -> NodeCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser SigningKeyFile
pColdSigningKeyFile
                      Parser (OpCertCounterFile -> KESPeriod -> OutputFile -> NodeCmd)
-> Parser OpCertCounterFile
-> Parser (KESPeriod -> OutputFile -> NodeCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OpCertCounterFile
pOperatorCertIssueCounterFile
                      Parser (KESPeriod -> OutputFile -> NodeCmd)
-> Parser KESPeriod -> Parser (OutputFile -> NodeCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser KESPeriod
pKesPeriod
                      Parser (OutputFile -> NodeCmd)
-> Parser OutputFile -> Parser NodeCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile


pPoolCmd :: Parser PoolCmd
pPoolCmd :: Parser PoolCmd
pPoolCmd =
  [Parser PoolCmd] -> Parser PoolCmd
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
      [ String -> ParserInfo PoolCmd -> Parser PoolCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"registration-certificate"
          (Parser PoolCmd -> InfoMod PoolCmd -> ParserInfo PoolCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser PoolCmd
pStakePoolRegistrationCert (InfoMod PoolCmd -> ParserInfo PoolCmd)
-> InfoMod PoolCmd -> ParserInfo PoolCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod PoolCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create a stake pool registration certificate")
      , String -> ParserInfo PoolCmd -> Parser PoolCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"deregistration-certificate"
          (Parser PoolCmd -> InfoMod PoolCmd -> ParserInfo PoolCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser PoolCmd
pStakePoolRetirementCert (InfoMod PoolCmd -> ParserInfo PoolCmd)
-> InfoMod PoolCmd -> ParserInfo PoolCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod PoolCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create a stake pool deregistration certificate")
      , String -> ParserInfo PoolCmd -> Parser PoolCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"id"
          (Parser PoolCmd -> InfoMod PoolCmd -> ParserInfo PoolCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser PoolCmd
pId (InfoMod PoolCmd -> ParserInfo PoolCmd)
-> InfoMod PoolCmd -> ParserInfo PoolCmd
forall a b. (a -> b) -> a -> b
$
             String -> InfoMod PoolCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Build pool id from the offline key")
      , String -> ParserInfo PoolCmd -> Parser PoolCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"metadata-hash"
          (Parser PoolCmd -> InfoMod PoolCmd -> ParserInfo PoolCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser PoolCmd
pPoolMetadataHashSubCmd (InfoMod PoolCmd -> ParserInfo PoolCmd)
-> InfoMod PoolCmd -> ParserInfo PoolCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod PoolCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Print the hash of pool metadata.")
      ]
  where
    pId :: Parser PoolCmd
    pId :: Parser PoolCmd
pId = VerificationKeyOrFile StakePoolKey -> OutputFormat -> PoolCmd
PoolGetId (VerificationKeyOrFile StakePoolKey -> OutputFormat -> PoolCmd)
-> Parser (VerificationKeyOrFile StakePoolKey)
-> Parser (OutputFormat -> PoolCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (VerificationKeyOrFile StakePoolKey)
pStakePoolVerificationKeyOrFile Parser (OutputFormat -> PoolCmd)
-> Parser OutputFormat -> Parser PoolCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFormat
pOutputFormat

    pPoolMetadataHashSubCmd :: Parser PoolCmd
    pPoolMetadataHashSubCmd :: Parser PoolCmd
pPoolMetadataHashSubCmd = PoolMetadataFile -> Maybe OutputFile -> PoolCmd
PoolMetadataHash (PoolMetadataFile -> Maybe OutputFile -> PoolCmd)
-> Parser PoolMetadataFile -> Parser (Maybe OutputFile -> PoolCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser PoolMetadataFile
pPoolMetadataFile Parser (Maybe OutputFile -> PoolCmd)
-> Parser (Maybe OutputFile) -> Parser PoolCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile


pQueryCmd :: Parser QueryCmd
pQueryCmd :: Parser QueryCmd
pQueryCmd =
  [Parser QueryCmd] -> Parser QueryCmd
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
    [ String -> ParserInfo QueryCmd -> Parser QueryCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"protocol-parameters"
        (Parser QueryCmd -> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser QueryCmd
pQueryProtocolParameters (InfoMod QueryCmd -> ParserInfo QueryCmd)
-> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod QueryCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Get the node's current protocol parameters")
    , String -> ParserInfo QueryCmd -> Parser QueryCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"tip"
        (Parser QueryCmd -> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser QueryCmd
pQueryTip (InfoMod QueryCmd -> ParserInfo QueryCmd)
-> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod QueryCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Get the node's current tip (slot no, hash, block no)")
    , String -> ParserInfo QueryCmd -> Parser QueryCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"stake-pools"
        (Parser QueryCmd -> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser QueryCmd
pQueryStakePools (InfoMod QueryCmd -> ParserInfo QueryCmd)
-> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod QueryCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Get the node's current set of stake pool ids")
    , String -> ParserInfo QueryCmd -> Parser QueryCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"stake-distribution"
        (Parser QueryCmd -> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser QueryCmd
pQueryStakeDistribution (InfoMod QueryCmd -> ParserInfo QueryCmd)
-> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod QueryCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Get the node's current aggregated stake distribution")
    , String -> ParserInfo QueryCmd -> Parser QueryCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"stake-address-info"
        (Parser QueryCmd -> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser QueryCmd
pQueryStakeAddressInfo (InfoMod QueryCmd -> ParserInfo QueryCmd)
-> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod QueryCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Get the current delegations and \
                                                        \reward accounts filtered by stake \
                                                        \address.")
    , String -> ParserInfo QueryCmd -> Parser QueryCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"utxo"
        (Parser QueryCmd -> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser QueryCmd
pQueryUTxO (InfoMod QueryCmd -> ParserInfo QueryCmd)
-> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod QueryCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Get a portion of the current UTxO: \
                                            \by tx in, by address or the whole.")
    , String -> ParserInfo QueryCmd -> Parser QueryCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"ledger-state"
        (Parser QueryCmd -> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser QueryCmd
pQueryLedgerState (InfoMod QueryCmd -> ParserInfo QueryCmd)
-> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod QueryCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command)")
    , String -> ParserInfo QueryCmd -> Parser QueryCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"protocol-state"
        (Parser QueryCmd -> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser QueryCmd
pQueryProtocolState (InfoMod QueryCmd -> ParserInfo QueryCmd)
-> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod QueryCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Dump the current protocol state of the node (Ledger.ChainDepState -- advanced command)")
    , String -> ParserInfo QueryCmd -> Parser QueryCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"stake-snapshot"
        (Parser QueryCmd -> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser QueryCmd
pQueryStakeSnapshot (InfoMod QueryCmd -> ParserInfo QueryCmd)
-> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod QueryCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Obtain the three stake snapshots for a pool, plus the total active stake (advanced command)")
    , String -> ParserInfo QueryCmd -> Parser QueryCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"pool-params"
        (Parser QueryCmd -> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser QueryCmd
pQueryPoolParams (InfoMod QueryCmd -> ParserInfo QueryCmd)
-> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod QueryCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Dump the pool parameters (Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced command)")
    , String -> ParserInfo QueryCmd -> Parser QueryCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"leadership-schedule"
        (Parser QueryCmd -> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser QueryCmd
pLeadershipSchedule (InfoMod QueryCmd -> ParserInfo QueryCmd)
-> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod QueryCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Get the slots the node is expected to mint a block in (advanced command)")
    , String -> ParserInfo QueryCmd -> Parser QueryCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"kes-period-info"
        (Parser QueryCmd -> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser QueryCmd
pKesPeriodInfo (InfoMod QueryCmd -> ParserInfo QueryCmd)
-> InfoMod QueryCmd -> ParserInfo QueryCmd
forall a b. (a -> b) -> a -> b
$ String -> InfoMod QueryCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Get information about the current KES period and your node's operational certificate.")
    ]
  where
    pQueryProtocolParameters :: Parser QueryCmd
    pQueryProtocolParameters :: Parser QueryCmd
pQueryProtocolParameters =
      AnyConsensusModeParams -> NetworkId -> Maybe OutputFile -> QueryCmd
QueryProtocolParameters'
        (AnyConsensusModeParams
 -> NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser AnyConsensusModeParams
-> Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyConsensusModeParams
pConsensusModeParams
        Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser NetworkId -> Parser (Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
        Parser (Maybe OutputFile -> QueryCmd)
-> Parser (Maybe OutputFile) -> Parser QueryCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pQueryTip :: Parser QueryCmd
    pQueryTip :: Parser QueryCmd
pQueryTip = AnyConsensusModeParams -> NetworkId -> Maybe OutputFile -> QueryCmd
QueryTip
                  (AnyConsensusModeParams
 -> NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser AnyConsensusModeParams
-> Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyConsensusModeParams
pConsensusModeParams
                  Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser NetworkId -> Parser (Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
                  Parser (Maybe OutputFile -> QueryCmd)
-> Parser (Maybe OutputFile) -> Parser QueryCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pQueryUTxO :: Parser QueryCmd
    pQueryUTxO :: Parser QueryCmd
pQueryUTxO =
      AnyConsensusModeParams
-> QueryUTxOFilter -> NetworkId -> Maybe OutputFile -> QueryCmd
QueryUTxO'
        (AnyConsensusModeParams
 -> QueryUTxOFilter -> NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser AnyConsensusModeParams
-> Parser
     (QueryUTxOFilter -> NetworkId -> Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyConsensusModeParams
pConsensusModeParams
        Parser
  (QueryUTxOFilter -> NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser QueryUTxOFilter
-> Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser QueryUTxOFilter
pQueryUTxOFilter
        Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser NetworkId -> Parser (Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
        Parser (Maybe OutputFile -> QueryCmd)
-> Parser (Maybe OutputFile) -> Parser QueryCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pQueryStakePools :: Parser QueryCmd
    pQueryStakePools :: Parser QueryCmd
pQueryStakePools =
      AnyConsensusModeParams -> NetworkId -> Maybe OutputFile -> QueryCmd
QueryStakePools'
        (AnyConsensusModeParams
 -> NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser AnyConsensusModeParams
-> Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyConsensusModeParams
pConsensusModeParams
        Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser NetworkId -> Parser (Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
        Parser (Maybe OutputFile -> QueryCmd)
-> Parser (Maybe OutputFile) -> Parser QueryCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pQueryStakeDistribution :: Parser QueryCmd
    pQueryStakeDistribution :: Parser QueryCmd
pQueryStakeDistribution =
      AnyConsensusModeParams -> NetworkId -> Maybe OutputFile -> QueryCmd
QueryStakeDistribution'
        (AnyConsensusModeParams
 -> NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser AnyConsensusModeParams
-> Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyConsensusModeParams
pConsensusModeParams
        Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser NetworkId -> Parser (Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
        Parser (Maybe OutputFile -> QueryCmd)
-> Parser (Maybe OutputFile) -> Parser QueryCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pQueryStakeAddressInfo :: Parser QueryCmd
    pQueryStakeAddressInfo :: Parser QueryCmd
pQueryStakeAddressInfo =
      AnyConsensusModeParams
-> StakeAddress -> NetworkId -> Maybe OutputFile -> QueryCmd
QueryStakeAddressInfo
        (AnyConsensusModeParams
 -> StakeAddress -> NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser AnyConsensusModeParams
-> Parser
     (StakeAddress -> NetworkId -> Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyConsensusModeParams
pConsensusModeParams
        Parser (StakeAddress -> NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser StakeAddress
-> Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser StakeAddress
pFilterByStakeAddress
        Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser NetworkId -> Parser (Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
        Parser (Maybe OutputFile -> QueryCmd)
-> Parser (Maybe OutputFile) -> Parser QueryCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pQueryLedgerState :: Parser QueryCmd
    pQueryLedgerState :: Parser QueryCmd
pQueryLedgerState = AnyConsensusModeParams -> NetworkId -> Maybe OutputFile -> QueryCmd
QueryDebugLedgerState'
                          (AnyConsensusModeParams
 -> NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser AnyConsensusModeParams
-> Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyConsensusModeParams
pConsensusModeParams
                          Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser NetworkId -> Parser (Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
                          Parser (Maybe OutputFile -> QueryCmd)
-> Parser (Maybe OutputFile) -> Parser QueryCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pQueryProtocolState :: Parser QueryCmd
    pQueryProtocolState :: Parser QueryCmd
pQueryProtocolState = AnyConsensusModeParams -> NetworkId -> Maybe OutputFile -> QueryCmd
QueryProtocolState'
                            (AnyConsensusModeParams
 -> NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser AnyConsensusModeParams
-> Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyConsensusModeParams
pConsensusModeParams
                            Parser (NetworkId -> Maybe OutputFile -> QueryCmd)
-> Parser NetworkId -> Parser (Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
                            Parser (Maybe OutputFile -> QueryCmd)
-> Parser (Maybe OutputFile) -> Parser QueryCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pQueryStakeSnapshot :: Parser QueryCmd
    pQueryStakeSnapshot :: Parser QueryCmd
pQueryStakeSnapshot = AnyConsensusModeParams
-> NetworkId -> Hash StakePoolKey -> QueryCmd
QueryStakeSnapshot'
      (AnyConsensusModeParams
 -> NetworkId -> Hash StakePoolKey -> QueryCmd)
-> Parser AnyConsensusModeParams
-> Parser (NetworkId -> Hash StakePoolKey -> QueryCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyConsensusModeParams
pConsensusModeParams
      Parser (NetworkId -> Hash StakePoolKey -> QueryCmd)
-> Parser NetworkId -> Parser (Hash StakePoolKey -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
      Parser (Hash StakePoolKey -> QueryCmd)
-> Parser (Hash StakePoolKey) -> Parser QueryCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Hash StakePoolKey)
pStakePoolVerificationKeyHash

    pQueryPoolParams :: Parser QueryCmd
    pQueryPoolParams :: Parser QueryCmd
pQueryPoolParams = AnyConsensusModeParams
-> NetworkId -> Hash StakePoolKey -> QueryCmd
QueryPoolParams'
      (AnyConsensusModeParams
 -> NetworkId -> Hash StakePoolKey -> QueryCmd)
-> Parser AnyConsensusModeParams
-> Parser (NetworkId -> Hash StakePoolKey -> QueryCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyConsensusModeParams
pConsensusModeParams
      Parser (NetworkId -> Hash StakePoolKey -> QueryCmd)
-> Parser NetworkId -> Parser (Hash StakePoolKey -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
      Parser (Hash StakePoolKey -> QueryCmd)
-> Parser (Hash StakePoolKey) -> Parser QueryCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Hash StakePoolKey)
pStakePoolVerificationKeyHash

    pLeadershipSchedule :: Parser QueryCmd
    pLeadershipSchedule :: Parser QueryCmd
pLeadershipSchedule = AnyConsensusModeParams
-> NetworkId
-> GenesisFile
-> VerificationKeyOrHashOrFile StakePoolKey
-> SigningKeyFile
-> EpochLeadershipSchedule
-> Maybe OutputFile
-> QueryCmd
QueryLeadershipSchedule
      (AnyConsensusModeParams
 -> NetworkId
 -> GenesisFile
 -> VerificationKeyOrHashOrFile StakePoolKey
 -> SigningKeyFile
 -> EpochLeadershipSchedule
 -> Maybe OutputFile
 -> QueryCmd)
-> Parser AnyConsensusModeParams
-> Parser
     (NetworkId
      -> GenesisFile
      -> VerificationKeyOrHashOrFile StakePoolKey
      -> SigningKeyFile
      -> EpochLeadershipSchedule
      -> Maybe OutputFile
      -> QueryCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyConsensusModeParams
pConsensusModeParams
      Parser
  (NetworkId
   -> GenesisFile
   -> VerificationKeyOrHashOrFile StakePoolKey
   -> SigningKeyFile
   -> EpochLeadershipSchedule
   -> Maybe OutputFile
   -> QueryCmd)
-> Parser NetworkId
-> Parser
     (GenesisFile
      -> VerificationKeyOrHashOrFile StakePoolKey
      -> SigningKeyFile
      -> EpochLeadershipSchedule
      -> Maybe OutputFile
      -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
      Parser
  (GenesisFile
   -> VerificationKeyOrHashOrFile StakePoolKey
   -> SigningKeyFile
   -> EpochLeadershipSchedule
   -> Maybe OutputFile
   -> QueryCmd)
-> Parser GenesisFile
-> Parser
     (VerificationKeyOrHashOrFile StakePoolKey
      -> SigningKeyFile
      -> EpochLeadershipSchedule
      -> Maybe OutputFile
      -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> Parser GenesisFile
pGenesisFile String
"Shelley genesis filepath"
      Parser
  (VerificationKeyOrHashOrFile StakePoolKey
   -> SigningKeyFile
   -> EpochLeadershipSchedule
   -> Maybe OutputFile
   -> QueryCmd)
-> Parser (VerificationKeyOrHashOrFile StakePoolKey)
-> Parser
     (SigningKeyFile
      -> EpochLeadershipSchedule -> Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (VerificationKeyOrHashOrFile StakePoolKey)
pStakePoolVerificationKeyOrHashOrFile
      Parser
  (SigningKeyFile
   -> EpochLeadershipSchedule -> Maybe OutputFile -> QueryCmd)
-> Parser SigningKeyFile
-> Parser (EpochLeadershipSchedule -> Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser SigningKeyFile
pVrfSigningKeyFile
      Parser (EpochLeadershipSchedule -> Maybe OutputFile -> QueryCmd)
-> Parser EpochLeadershipSchedule
-> Parser (Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser EpochLeadershipSchedule
pWhichLeadershipSchedule
      Parser (Maybe OutputFile -> QueryCmd)
-> Parser (Maybe OutputFile) -> Parser QueryCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pKesPeriodInfo :: Parser QueryCmd
    pKesPeriodInfo :: Parser QueryCmd
pKesPeriodInfo = AnyConsensusModeParams
-> NetworkId -> String -> Maybe OutputFile -> QueryCmd
QueryKesPeriodInfo
      (AnyConsensusModeParams
 -> NetworkId -> String -> Maybe OutputFile -> QueryCmd)
-> Parser AnyConsensusModeParams
-> Parser (NetworkId -> String -> Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser AnyConsensusModeParams
pConsensusModeParams
      Parser (NetworkId -> String -> Maybe OutputFile -> QueryCmd)
-> Parser NetworkId
-> Parser (String -> Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
      Parser (String -> Maybe OutputFile -> QueryCmd)
-> Parser String -> Parser (Maybe OutputFile -> QueryCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser String
pOperationalCertificateFile
      Parser (Maybe OutputFile -> QueryCmd)
-> Parser (Maybe OutputFile) -> Parser QueryCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

pGovernanceCmd :: Parser GovernanceCmd
pGovernanceCmd :: Parser GovernanceCmd
pGovernanceCmd =
 [Parser GovernanceCmd] -> Parser GovernanceCmd
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
   [ String -> ParserInfo GovernanceCmd -> Parser GovernanceCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"create-mir-certificate"
       (Parser GovernanceCmd
-> InfoMod GovernanceCmd -> ParserInfo GovernanceCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info (Parser GovernanceCmd
pMIRPayStakeAddresses Parser GovernanceCmd
-> Parser GovernanceCmd -> Parser GovernanceCmd
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser GovernanceCmd
mirCertParsers) (InfoMod GovernanceCmd -> ParserInfo GovernanceCmd)
-> InfoMod GovernanceCmd -> ParserInfo GovernanceCmd
forall a b. (a -> b) -> a -> b
$
         String -> InfoMod GovernanceCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create an MIR (Move Instantaneous Rewards) certificate")
   , String -> ParserInfo GovernanceCmd -> Parser GovernanceCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"create-genesis-key-delegation-certificate"
       (Parser GovernanceCmd
-> InfoMod GovernanceCmd -> ParserInfo GovernanceCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GovernanceCmd
pGovernanceGenesisKeyDelegationCertificate (InfoMod GovernanceCmd -> ParserInfo GovernanceCmd)
-> InfoMod GovernanceCmd -> ParserInfo GovernanceCmd
forall a b. (a -> b) -> a -> b
$
         String -> InfoMod GovernanceCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create a genesis key delegation certificate")
   , String -> ParserInfo GovernanceCmd -> Parser GovernanceCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"create-update-proposal"
       (Parser GovernanceCmd
-> InfoMod GovernanceCmd -> ParserInfo GovernanceCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GovernanceCmd
pUpdateProposal (InfoMod GovernanceCmd -> ParserInfo GovernanceCmd)
-> InfoMod GovernanceCmd -> ParserInfo GovernanceCmd
forall a b. (a -> b) -> a -> b
$
         String -> InfoMod GovernanceCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create an update proposal")
   ]
  where
    mirCertParsers :: Parser GovernanceCmd
    mirCertParsers :: Parser GovernanceCmd
mirCertParsers = [Parser GovernanceCmd] -> Parser GovernanceCmd
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
      [ String -> ParserInfo GovernanceCmd -> Parser GovernanceCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"stake-addresses" (Parser GovernanceCmd
-> InfoMod GovernanceCmd -> ParserInfo GovernanceCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GovernanceCmd
pMIRPayStakeAddresses (InfoMod GovernanceCmd -> ParserInfo GovernanceCmd)
-> InfoMod GovernanceCmd -> ParserInfo GovernanceCmd
forall a b. (a -> b) -> a -> b
$
          String -> InfoMod GovernanceCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create an MIR certificate to pay stake addresses")
      , String -> ParserInfo GovernanceCmd -> Parser GovernanceCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"transfer-to-treasury" (Parser GovernanceCmd
-> InfoMod GovernanceCmd -> ParserInfo GovernanceCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GovernanceCmd
pMIRTransferToTreasury (InfoMod GovernanceCmd -> ParserInfo GovernanceCmd)
-> InfoMod GovernanceCmd -> ParserInfo GovernanceCmd
forall a b. (a -> b) -> a -> b
$
          String -> InfoMod GovernanceCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create an MIR certificate to transfer from the reserves pot\
                       \ to the treasury pot")
      , String -> ParserInfo GovernanceCmd -> Parser GovernanceCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"transfer-to-rewards" (Parser GovernanceCmd
-> InfoMod GovernanceCmd -> ParserInfo GovernanceCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GovernanceCmd
pMIRTransferToReserves (InfoMod GovernanceCmd -> ParserInfo GovernanceCmd)
-> InfoMod GovernanceCmd -> ParserInfo GovernanceCmd
forall a b. (a -> b) -> a -> b
$
          String -> InfoMod GovernanceCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create an MIR certificate to transfer from the treasury pot\
                       \ to the reserves pot")
      ]

    pMIRPayStakeAddresses :: Parser GovernanceCmd
    pMIRPayStakeAddresses :: Parser GovernanceCmd
pMIRPayStakeAddresses = MIRPot
-> [StakeAddress] -> [Lovelace] -> OutputFile -> GovernanceCmd
GovernanceMIRPayStakeAddressesCertificate
                              (MIRPot
 -> [StakeAddress] -> [Lovelace] -> OutputFile -> GovernanceCmd)
-> Parser MIRPot
-> Parser
     ([StakeAddress] -> [Lovelace] -> OutputFile -> GovernanceCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser MIRPot
pMIRPot
                              Parser
  ([StakeAddress] -> [Lovelace] -> OutputFile -> GovernanceCmd)
-> Parser [StakeAddress]
-> Parser ([Lovelace] -> OutputFile -> GovernanceCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser StakeAddress -> Parser [StakeAddress]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some Parser StakeAddress
pStakeAddress
                              Parser ([Lovelace] -> OutputFile -> GovernanceCmd)
-> Parser [Lovelace] -> Parser (OutputFile -> GovernanceCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Lovelace -> Parser [Lovelace]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some Parser Lovelace
pRewardAmt
                              Parser (OutputFile -> GovernanceCmd)
-> Parser OutputFile -> Parser GovernanceCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile

    pMIRTransferToTreasury :: Parser GovernanceCmd
    pMIRTransferToTreasury :: Parser GovernanceCmd
pMIRTransferToTreasury = Lovelace -> OutputFile -> TransferDirection -> GovernanceCmd
GovernanceMIRTransfer
                               (Lovelace -> OutputFile -> TransferDirection -> GovernanceCmd)
-> Parser Lovelace
-> Parser (OutputFile -> TransferDirection -> GovernanceCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Lovelace
pTransferAmt
                               Parser (OutputFile -> TransferDirection -> GovernanceCmd)
-> Parser OutputFile -> Parser (TransferDirection -> GovernanceCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile
                               Parser (TransferDirection -> GovernanceCmd)
-> Parser TransferDirection -> Parser GovernanceCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TransferDirection -> Parser TransferDirection
forall (f :: * -> *) a. Applicative f => a -> f a
pure TransferDirection
TransferToTreasury

    pMIRTransferToReserves :: Parser GovernanceCmd
    pMIRTransferToReserves :: Parser GovernanceCmd
pMIRTransferToReserves = Lovelace -> OutputFile -> TransferDirection -> GovernanceCmd
GovernanceMIRTransfer
                               (Lovelace -> OutputFile -> TransferDirection -> GovernanceCmd)
-> Parser Lovelace
-> Parser (OutputFile -> TransferDirection -> GovernanceCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Lovelace
pTransferAmt
                               Parser (OutputFile -> TransferDirection -> GovernanceCmd)
-> Parser OutputFile -> Parser (TransferDirection -> GovernanceCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile
                               Parser (TransferDirection -> GovernanceCmd)
-> Parser TransferDirection -> Parser GovernanceCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TransferDirection -> Parser TransferDirection
forall (f :: * -> *) a. Applicative f => a -> f a
pure TransferDirection
TransferToReserves

    pGovernanceGenesisKeyDelegationCertificate :: Parser GovernanceCmd
    pGovernanceGenesisKeyDelegationCertificate :: Parser GovernanceCmd
pGovernanceGenesisKeyDelegationCertificate =
      VerificationKeyOrHashOrFile GenesisKey
-> VerificationKeyOrHashOrFile GenesisDelegateKey
-> VerificationKeyOrHashOrFile VrfKey
-> OutputFile
-> GovernanceCmd
GovernanceGenesisKeyDelegationCertificate
        (VerificationKeyOrHashOrFile GenesisKey
 -> VerificationKeyOrHashOrFile GenesisDelegateKey
 -> VerificationKeyOrHashOrFile VrfKey
 -> OutputFile
 -> GovernanceCmd)
-> Parser (VerificationKeyOrHashOrFile GenesisKey)
-> Parser
     (VerificationKeyOrHashOrFile GenesisDelegateKey
      -> VerificationKeyOrHashOrFile VrfKey
      -> OutputFile
      -> GovernanceCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (VerificationKeyOrHashOrFile GenesisKey)
pGenesisVerificationKeyOrHashOrFile
        Parser
  (VerificationKeyOrHashOrFile GenesisDelegateKey
   -> VerificationKeyOrHashOrFile VrfKey
   -> OutputFile
   -> GovernanceCmd)
-> Parser (VerificationKeyOrHashOrFile GenesisDelegateKey)
-> Parser
     (VerificationKeyOrHashOrFile VrfKey -> OutputFile -> GovernanceCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (VerificationKeyOrHashOrFile GenesisDelegateKey)
pGenesisDelegateVerificationKeyOrHashOrFile
        Parser
  (VerificationKeyOrHashOrFile VrfKey -> OutputFile -> GovernanceCmd)
-> Parser (VerificationKeyOrHashOrFile VrfKey)
-> Parser (OutputFile -> GovernanceCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (VerificationKeyOrHashOrFile VrfKey)
pVrfVerificationKeyOrHashOrFile
        Parser (OutputFile -> GovernanceCmd)
-> Parser OutputFile -> Parser GovernanceCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OutputFile
pOutputFile

    pMIRPot :: Parser Shelley.MIRPot
    pMIRPot :: Parser MIRPot
pMIRPot =
          MIRPot -> Mod FlagFields MIRPot -> Parser MIRPot
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' MIRPot
Shelley.ReservesMIR
            (  String -> Mod FlagFields MIRPot
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"reserves"
            Mod FlagFields MIRPot
-> Mod FlagFields MIRPot -> Mod FlagFields MIRPot
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields MIRPot
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use the reserves pot."
            )
      Parser MIRPot -> Parser MIRPot -> Parser MIRPot
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> MIRPot -> Mod FlagFields MIRPot -> Parser MIRPot
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' MIRPot
Shelley.TreasuryMIR
            (  String -> Mod FlagFields MIRPot
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"treasury"
            Mod FlagFields MIRPot
-> Mod FlagFields MIRPot -> Mod FlagFields MIRPot
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields MIRPot
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use the treasury pot."
            )

    pUpdateProposal :: Parser GovernanceCmd
    pUpdateProposal :: Parser GovernanceCmd
pUpdateProposal = OutputFile
-> EpochNo
-> [VerificationKeyFile]
-> ProtocolParametersUpdate
-> Maybe String
-> GovernanceCmd
GovernanceUpdateProposal
                        (OutputFile
 -> EpochNo
 -> [VerificationKeyFile]
 -> ProtocolParametersUpdate
 -> Maybe String
 -> GovernanceCmd)
-> Parser OutputFile
-> Parser
     (EpochNo
      -> [VerificationKeyFile]
      -> ProtocolParametersUpdate
      -> Maybe String
      -> GovernanceCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser OutputFile
pOutputFile
                        Parser
  (EpochNo
   -> [VerificationKeyFile]
   -> ProtocolParametersUpdate
   -> Maybe String
   -> GovernanceCmd)
-> Parser EpochNo
-> Parser
     ([VerificationKeyFile]
      -> ProtocolParametersUpdate -> Maybe String -> GovernanceCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser EpochNo
pEpochNoUpdateProp
                        Parser
  ([VerificationKeyFile]
   -> ProtocolParametersUpdate -> Maybe String -> GovernanceCmd)
-> Parser [VerificationKeyFile]
-> Parser
     (ProtocolParametersUpdate -> Maybe String -> GovernanceCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser VerificationKeyFile -> Parser [VerificationKeyFile]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some Parser VerificationKeyFile
pGenesisVerificationKeyFile
                        Parser (ProtocolParametersUpdate -> Maybe String -> GovernanceCmd)
-> Parser ProtocolParametersUpdate
-> Parser (Maybe String -> GovernanceCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ProtocolParametersUpdate
pProtocolParametersUpdate
                        Parser (Maybe String -> GovernanceCmd)
-> Parser (Maybe String) -> Parser GovernanceCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser String -> Parser (Maybe String)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser String
pCostModels

pTransferAmt :: Parser Lovelace
pTransferAmt :: Parser Lovelace
pTransferAmt =
    ReadM Lovelace -> Mod OptionFields Lovelace -> Parser Lovelace
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option (Parser Lovelace -> ReadM Lovelace
forall a. Parser a -> ReadM a
readerFromParsecParser Parser Lovelace
parseLovelace)
      (  String -> Mod OptionFields Lovelace
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"transfer"
      Mod OptionFields Lovelace
-> Mod OptionFields Lovelace -> Mod OptionFields Lovelace
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Lovelace
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"LOVELACE"
      Mod OptionFields Lovelace
-> Mod OptionFields Lovelace -> Mod OptionFields Lovelace
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Lovelace
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"The amount to transfer."
      )

pRewardAmt :: Parser Lovelace
pRewardAmt :: Parser Lovelace
pRewardAmt =
    ReadM Lovelace -> Mod OptionFields Lovelace -> Parser Lovelace
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option (Parser Lovelace -> ReadM Lovelace
forall a. Parser a -> ReadM a
readerFromParsecParser Parser Lovelace
parseLovelace)
      (  String -> Mod OptionFields Lovelace
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"reward"
      Mod OptionFields Lovelace
-> Mod OptionFields Lovelace -> Mod OptionFields Lovelace
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Lovelace
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"LOVELACE"
      Mod OptionFields Lovelace
-> Mod OptionFields Lovelace -> Mod OptionFields Lovelace
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Lovelace
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"The reward for the relevant reward account."
      )

pGenesisCmd :: Parser GenesisCmd
pGenesisCmd :: Parser GenesisCmd
pGenesisCmd =
  [Parser GenesisCmd] -> Parser GenesisCmd
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
    [ String -> ParserInfo GenesisCmd -> Parser GenesisCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"key-gen-genesis"
        (Parser GenesisCmd -> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GenesisCmd
pGenesisKeyGen (InfoMod GenesisCmd -> ParserInfo GenesisCmd)
-> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a b. (a -> b) -> a -> b
$
           String -> InfoMod GenesisCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create a Shelley genesis key pair")
    , String -> ParserInfo GenesisCmd -> Parser GenesisCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"key-gen-delegate"
        (Parser GenesisCmd -> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GenesisCmd
pGenesisDelegateKeyGen (InfoMod GenesisCmd -> ParserInfo GenesisCmd)
-> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a b. (a -> b) -> a -> b
$
           String -> InfoMod GenesisCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create a Shelley genesis delegate key pair")
    , String -> ParserInfo GenesisCmd -> Parser GenesisCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"key-gen-utxo"
        (Parser GenesisCmd -> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GenesisCmd
pGenesisUTxOKeyGen (InfoMod GenesisCmd -> ParserInfo GenesisCmd)
-> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a b. (a -> b) -> a -> b
$
           String -> InfoMod GenesisCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Create a Shelley genesis UTxO key pair")
    , String -> ParserInfo GenesisCmd -> Parser GenesisCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"key-hash"
        (Parser GenesisCmd -> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GenesisCmd
pGenesisKeyHash (InfoMod GenesisCmd -> ParserInfo GenesisCmd)
-> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a b. (a -> b) -> a -> b
$
           String -> InfoMod GenesisCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Print the identifier (hash) of a public key")
    , String -> ParserInfo GenesisCmd -> Parser GenesisCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"get-ver-key"
        (Parser GenesisCmd -> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GenesisCmd
pGenesisVerKey (InfoMod GenesisCmd -> ParserInfo GenesisCmd)
-> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a b. (a -> b) -> a -> b
$
           String -> InfoMod GenesisCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Derive the verification key from a signing key")
    , String -> ParserInfo GenesisCmd -> Parser GenesisCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"initial-addr"
        (Parser GenesisCmd -> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GenesisCmd
pGenesisAddr (InfoMod GenesisCmd -> ParserInfo GenesisCmd)
-> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a b. (a -> b) -> a -> b
$
           String -> InfoMod GenesisCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Get the address for an initial UTxO based on the verification key")
    , String -> ParserInfo GenesisCmd -> Parser GenesisCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"initial-txin"
        (Parser GenesisCmd -> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GenesisCmd
pGenesisTxIn (InfoMod GenesisCmd -> ParserInfo GenesisCmd)
-> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a b. (a -> b) -> a -> b
$
           String -> InfoMod GenesisCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Get the TxIn for an initial UTxO based on the verification key")
    , String -> ParserInfo GenesisCmd -> Parser GenesisCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"create-cardano"
        (Parser GenesisCmd -> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GenesisCmd
pGenesisCreateCardano (InfoMod GenesisCmd -> ParserInfo GenesisCmd)
-> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a b. (a -> b) -> a -> b
$
           String -> InfoMod GenesisCmd
forall a. String -> InfoMod a
Opt.progDesc (String
"Create a Byron and Shelley genesis file from a genesis "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"template and genesis/delegation/spending keys."))
    , String -> ParserInfo GenesisCmd -> Parser GenesisCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"create"
        (Parser GenesisCmd -> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GenesisCmd
pGenesisCreate (InfoMod GenesisCmd -> ParserInfo GenesisCmd)
-> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a b. (a -> b) -> a -> b
$
           String -> InfoMod GenesisCmd
forall a. String -> InfoMod a
Opt.progDesc (String
"Create a Shelley genesis file from a genesis "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"template and genesis/delegation/spending keys."))
    , String -> ParserInfo GenesisCmd -> Parser GenesisCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"create-staked"
        (Parser GenesisCmd -> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GenesisCmd
pGenesisCreateStaked (InfoMod GenesisCmd -> ParserInfo GenesisCmd)
-> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a b. (a -> b) -> a -> b
$
           String -> InfoMod GenesisCmd
forall a. String -> InfoMod a
Opt.progDesc (String
"Create a staked Shelley genesis file from a genesis "
                      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"template and genesis/delegation/spending keys."))
    , String -> ParserInfo GenesisCmd -> Parser GenesisCmd
forall a. String -> ParserInfo a -> Parser a
subParser String
"hash"
        (Parser GenesisCmd -> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser GenesisCmd
pGenesisHash (InfoMod GenesisCmd -> ParserInfo GenesisCmd)
-> InfoMod GenesisCmd -> ParserInfo GenesisCmd
forall a b. (a -> b) -> a -> b
$
           String -> InfoMod GenesisCmd
forall a. String -> InfoMod a
Opt.progDesc String
"Compute the hash of a genesis file")
    ]
  where
    pGenesisKeyGen :: Parser GenesisCmd
    pGenesisKeyGen :: Parser GenesisCmd
pGenesisKeyGen =
      VerificationKeyFile -> SigningKeyFile -> GenesisCmd
GenesisKeyGenGenesis (VerificationKeyFile -> SigningKeyFile -> GenesisCmd)
-> Parser VerificationKeyFile
-> Parser (SigningKeyFile -> GenesisCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile FileDirection
Output Parser (SigningKeyFile -> GenesisCmd)
-> Parser SigningKeyFile -> Parser GenesisCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FileDirection -> Parser SigningKeyFile
pSigningKeyFile FileDirection
Output

    pGenesisDelegateKeyGen :: Parser GenesisCmd
    pGenesisDelegateKeyGen :: Parser GenesisCmd
pGenesisDelegateKeyGen =
      VerificationKeyFile
-> SigningKeyFile -> OpCertCounterFile -> GenesisCmd
GenesisKeyGenDelegate (VerificationKeyFile
 -> SigningKeyFile -> OpCertCounterFile -> GenesisCmd)
-> Parser VerificationKeyFile
-> Parser (SigningKeyFile -> OpCertCounterFile -> GenesisCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile FileDirection
Output
                            Parser (SigningKeyFile -> OpCertCounterFile -> GenesisCmd)
-> Parser SigningKeyFile
-> Parser (OpCertCounterFile -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FileDirection -> Parser SigningKeyFile
pSigningKeyFile FileDirection
Output
                            Parser (OpCertCounterFile -> GenesisCmd)
-> Parser OpCertCounterFile -> Parser GenesisCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OpCertCounterFile
pOperatorCertIssueCounterFile

    pGenesisUTxOKeyGen :: Parser GenesisCmd
    pGenesisUTxOKeyGen :: Parser GenesisCmd
pGenesisUTxOKeyGen =
      VerificationKeyFile -> SigningKeyFile -> GenesisCmd
GenesisKeyGenUTxO (VerificationKeyFile -> SigningKeyFile -> GenesisCmd)
-> Parser VerificationKeyFile
-> Parser (SigningKeyFile -> GenesisCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile FileDirection
Output Parser (SigningKeyFile -> GenesisCmd)
-> Parser SigningKeyFile -> Parser GenesisCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FileDirection -> Parser SigningKeyFile
pSigningKeyFile FileDirection
Output

    pGenesisKeyHash :: Parser GenesisCmd
    pGenesisKeyHash :: Parser GenesisCmd
pGenesisKeyHash =
      VerificationKeyFile -> GenesisCmd
GenesisCmdKeyHash (VerificationKeyFile -> GenesisCmd)
-> Parser VerificationKeyFile -> Parser GenesisCmd
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile FileDirection
Input

    pGenesisVerKey :: Parser GenesisCmd
    pGenesisVerKey :: Parser GenesisCmd
pGenesisVerKey =
      VerificationKeyFile -> SigningKeyFile -> GenesisCmd
GenesisVerKey (VerificationKeyFile -> SigningKeyFile -> GenesisCmd)
-> Parser VerificationKeyFile
-> Parser (SigningKeyFile -> GenesisCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile FileDirection
Output Parser (SigningKeyFile -> GenesisCmd)
-> Parser SigningKeyFile -> Parser GenesisCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FileDirection -> Parser SigningKeyFile
pSigningKeyFile FileDirection
Output

    pGenesisAddr :: Parser GenesisCmd
    pGenesisAddr :: Parser GenesisCmd
pGenesisAddr =
      VerificationKeyFile -> NetworkId -> Maybe OutputFile -> GenesisCmd
GenesisAddr (VerificationKeyFile
 -> NetworkId -> Maybe OutputFile -> GenesisCmd)
-> Parser VerificationKeyFile
-> Parser (NetworkId -> Maybe OutputFile -> GenesisCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile FileDirection
Input Parser (NetworkId -> Maybe OutputFile -> GenesisCmd)
-> Parser NetworkId -> Parser (Maybe OutputFile -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId Parser (Maybe OutputFile -> GenesisCmd)
-> Parser (Maybe OutputFile) -> Parser GenesisCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pGenesisTxIn :: Parser GenesisCmd
    pGenesisTxIn :: Parser GenesisCmd
pGenesisTxIn =
      VerificationKeyFile -> NetworkId -> Maybe OutputFile -> GenesisCmd
GenesisTxIn (VerificationKeyFile
 -> NetworkId -> Maybe OutputFile -> GenesisCmd)
-> Parser VerificationKeyFile
-> Parser (NetworkId -> Maybe OutputFile -> GenesisCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile FileDirection
Input Parser (NetworkId -> Maybe OutputFile -> GenesisCmd)
-> Parser NetworkId -> Parser (Maybe OutputFile -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId Parser (Maybe OutputFile -> GenesisCmd)
-> Parser (Maybe OutputFile) -> Parser GenesisCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe OutputFile)
pMaybeOutputFile

    pGenesisCreateCardano :: Parser GenesisCmd
    pGenesisCreateCardano :: Parser GenesisCmd
pGenesisCreateCardano =
      GenesisDir
-> Word
-> Word
-> Maybe SystemStart
-> Maybe Lovelace
-> BlockCount
-> Word
-> Rational
-> NetworkId
-> String
-> String
-> String
-> Maybe String
-> GenesisCmd
GenesisCreateCardano (GenesisDir
 -> Word
 -> Word
 -> Maybe SystemStart
 -> Maybe Lovelace
 -> BlockCount
 -> Word
 -> Rational
 -> NetworkId
 -> String
 -> String
 -> String
 -> Maybe String
 -> GenesisCmd)
-> Parser GenesisDir
-> Parser
     (Word
      -> Word
      -> Maybe SystemStart
      -> Maybe Lovelace
      -> BlockCount
      -> Word
      -> Rational
      -> NetworkId
      -> String
      -> String
      -> String
      -> Maybe String
      -> GenesisCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser GenesisDir
pGenesisDir
                    Parser
  (Word
   -> Word
   -> Maybe SystemStart
   -> Maybe Lovelace
   -> BlockCount
   -> Word
   -> Rational
   -> NetworkId
   -> String
   -> String
   -> String
   -> Maybe String
   -> GenesisCmd)
-> Parser Word
-> Parser
     (Word
      -> Maybe SystemStart
      -> Maybe Lovelace
      -> BlockCount
      -> Word
      -> Rational
      -> NetworkId
      -> String
      -> String
      -> String
      -> Maybe String
      -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Word
pGenesisNumGenesisKeys
                    Parser
  (Word
   -> Maybe SystemStart
   -> Maybe Lovelace
   -> BlockCount
   -> Word
   -> Rational
   -> NetworkId
   -> String
   -> String
   -> String
   -> Maybe String
   -> GenesisCmd)
-> Parser Word
-> Parser
     (Maybe SystemStart
      -> Maybe Lovelace
      -> BlockCount
      -> Word
      -> Rational
      -> NetworkId
      -> String
      -> String
      -> String
      -> Maybe String
      -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Word
pGenesisNumUTxOKeys
                    Parser
  (Maybe SystemStart
   -> Maybe Lovelace
   -> BlockCount
   -> Word
   -> Rational
   -> NetworkId
   -> String
   -> String
   -> String
   -> Maybe String
   -> GenesisCmd)
-> Parser (Maybe SystemStart)
-> Parser
     (Maybe Lovelace
      -> BlockCount
      -> Word
      -> Rational
      -> NetworkId
      -> String
      -> String
      -> String
      -> Maybe String
      -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe SystemStart)
pMaybeSystemStart
                    Parser
  (Maybe Lovelace
   -> BlockCount
   -> Word
   -> Rational
   -> NetworkId
   -> String
   -> String
   -> String
   -> Maybe String
   -> GenesisCmd)
-> Parser (Maybe Lovelace)
-> Parser
     (BlockCount
      -> Word
      -> Rational
      -> NetworkId
      -> String
      -> String
      -> String
      -> Maybe String
      -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe Lovelace)
pInitialSupplyNonDelegated
                    Parser
  (BlockCount
   -> Word
   -> Rational
   -> NetworkId
   -> String
   -> String
   -> String
   -> Maybe String
   -> GenesisCmd)
-> Parser BlockCount
-> Parser
     (Word
      -> Rational
      -> NetworkId
      -> String
      -> String
      -> String
      -> Maybe String
      -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Word64 -> BlockCount
BlockCount (Word64 -> BlockCount) -> Parser Word64 -> Parser BlockCount
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Word64
pSecurityParam)
                    Parser
  (Word
   -> Rational
   -> NetworkId
   -> String
   -> String
   -> String
   -> Maybe String
   -> GenesisCmd)
-> Parser Word
-> Parser
     (Rational
      -> NetworkId
      -> String
      -> String
      -> String
      -> Maybe String
      -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Word
pSlotLength
                    Parser
  (Rational
   -> NetworkId
   -> String
   -> String
   -> String
   -> Maybe String
   -> GenesisCmd)
-> Parser Rational
-> Parser
     (NetworkId
      -> String -> String -> String -> Maybe String -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Rational
pSlotCoefficient
                    Parser
  (NetworkId
   -> String -> String -> String -> Maybe String -> GenesisCmd)
-> Parser NetworkId
-> Parser
     (String -> String -> String -> Maybe String -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
                    Parser (String -> String -> String -> Maybe String -> GenesisCmd)
-> Parser String
-> Parser (String -> String -> Maybe String -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser String
parseFilePath
                          String
"byron-template"
                          String
"JSON file with genesis defaults for each byron."
                    Parser (String -> String -> Maybe String -> GenesisCmd)
-> Parser String -> Parser (String -> Maybe String -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser String
parseFilePath
                          String
"shelley-template"
                          String
"JSON file with genesis defaults for each shelley."
                    Parser (String -> Maybe String -> GenesisCmd)
-> Parser String -> Parser (Maybe String -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> String -> Parser String
parseFilePath
                          String
"alonzo-template"
                          String
"JSON file with genesis defaults for each alonzo."
                    Parser (Maybe String -> GenesisCmd)
-> Parser (Maybe String) -> Parser GenesisCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe String)
pNodeConfigTemplate

    pGenesisCreate :: Parser GenesisCmd
    pGenesisCreate :: Parser GenesisCmd
pGenesisCreate =
      GenesisDir
-> Word
-> Word
-> Maybe SystemStart
-> Maybe Lovelace
-> NetworkId
-> GenesisCmd
GenesisCreate (GenesisDir
 -> Word
 -> Word
 -> Maybe SystemStart
 -> Maybe Lovelace
 -> NetworkId
 -> GenesisCmd)
-> Parser GenesisDir
-> Parser
     (Word
      -> Word
      -> Maybe SystemStart
      -> Maybe Lovelace
      -> NetworkId
      -> GenesisCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser GenesisDir
pGenesisDir
                    Parser
  (Word
   -> Word
   -> Maybe SystemStart
   -> Maybe Lovelace
   -> NetworkId
   -> GenesisCmd)
-> Parser Word
-> Parser
     (Word
      -> Maybe SystemStart -> Maybe Lovelace -> NetworkId -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Word
pGenesisNumGenesisKeys
                    Parser
  (Word
   -> Maybe SystemStart -> Maybe Lovelace -> NetworkId -> GenesisCmd)
-> Parser Word
-> Parser
     (Maybe SystemStart -> Maybe Lovelace -> NetworkId -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Word
pGenesisNumUTxOKeys
                    Parser
  (Maybe SystemStart -> Maybe Lovelace -> NetworkId -> GenesisCmd)
-> Parser (Maybe SystemStart)
-> Parser (Maybe Lovelace -> NetworkId -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe SystemStart)
pMaybeSystemStart
                    Parser (Maybe Lovelace -> NetworkId -> GenesisCmd)
-> Parser (Maybe Lovelace) -> Parser (NetworkId -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe Lovelace)
pInitialSupplyNonDelegated
                    Parser (NetworkId -> GenesisCmd)
-> Parser NetworkId -> Parser GenesisCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId

    pGenesisCreateStaked :: Parser GenesisCmd
    pGenesisCreateStaked :: Parser GenesisCmd
pGenesisCreateStaked =
      GenesisDir
-> Word
-> Word
-> Word
-> Word
-> Maybe SystemStart
-> Maybe Lovelace
-> Lovelace
-> NetworkId
-> Word
-> Word
-> Word
-> GenesisCmd
GenesisCreateStaked
        (GenesisDir
 -> Word
 -> Word
 -> Word
 -> Word
 -> Maybe SystemStart
 -> Maybe Lovelace
 -> Lovelace
 -> NetworkId
 -> Word
 -> Word
 -> Word
 -> GenesisCmd)
-> Parser GenesisDir
-> Parser
     (Word
      -> Word
      -> Word
      -> Word
      -> Maybe SystemStart
      -> Maybe Lovelace
      -> Lovelace
      -> NetworkId
      -> Word
      -> Word
      -> Word
      -> GenesisCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser GenesisDir
pGenesisDir
        Parser
  (Word
   -> Word
   -> Word
   -> Word
   -> Maybe SystemStart
   -> Maybe Lovelace
   -> Lovelace
   -> NetworkId
   -> Word
   -> Word
   -> Word
   -> GenesisCmd)
-> Parser Word
-> Parser
     (Word
      -> Word
      -> Word
      -> Maybe SystemStart
      -> Maybe Lovelace
      -> Lovelace
      -> NetworkId
      -> Word
      -> Word
      -> Word
      -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Word
pGenesisNumGenesisKeys
        Parser
  (Word
   -> Word
   -> Word
   -> Maybe SystemStart
   -> Maybe Lovelace
   -> Lovelace
   -> NetworkId
   -> Word
   -> Word
   -> Word
   -> GenesisCmd)
-> Parser Word
-> Parser
     (Word
      -> Word
      -> Maybe SystemStart
      -> Maybe Lovelace
      -> Lovelace
      -> NetworkId
      -> Word
      -> Word
      -> Word
      -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Word
pGenesisNumUTxOKeys
        Parser
  (Word
   -> Word
   -> Maybe SystemStart
   -> Maybe Lovelace
   -> Lovelace
   -> NetworkId
   -> Word
   -> Word
   -> Word
   -> GenesisCmd)
-> Parser Word
-> Parser
     (Word
      -> Maybe SystemStart
      -> Maybe Lovelace
      -> Lovelace
      -> NetworkId
      -> Word
      -> Word
      -> Word
      -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Word
pGenesisNumPools
        Parser
  (Word
   -> Maybe SystemStart
   -> Maybe Lovelace
   -> Lovelace
   -> NetworkId
   -> Word
   -> Word
   -> Word
   -> GenesisCmd)
-> Parser Word
-> Parser
     (Maybe SystemStart
      -> Maybe Lovelace
      -> Lovelace
      -> NetworkId
      -> Word
      -> Word
      -> Word
      -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Word
pGenesisNumStDelegs
        Parser
  (Maybe SystemStart
   -> Maybe Lovelace
   -> Lovelace
   -> NetworkId
   -> Word
   -> Word
   -> Word
   -> GenesisCmd)
-> Parser (Maybe SystemStart)
-> Parser
     (Maybe Lovelace
      -> Lovelace -> NetworkId -> Word -> Word -> Word -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe SystemStart)
pMaybeSystemStart
        Parser
  (Maybe Lovelace
   -> Lovelace -> NetworkId -> Word -> Word -> Word -> GenesisCmd)
-> Parser (Maybe Lovelace)
-> Parser
     (Lovelace -> NetworkId -> Word -> Word -> Word -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe Lovelace)
pInitialSupplyNonDelegated
        Parser
  (Lovelace -> NetworkId -> Word -> Word -> Word -> GenesisCmd)
-> Parser Lovelace
-> Parser (NetworkId -> Word -> Word -> Word -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Lovelace
pInitialSupplyDelegated
        Parser (NetworkId -> Word -> Word -> Word -> GenesisCmd)
-> Parser NetworkId -> Parser (Word -> Word -> Word -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NetworkId
pNetworkId
        Parser (Word -> Word -> Word -> GenesisCmd)
-> Parser Word -> Parser (Word -> Word -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Word
pBulkPoolCredFiles
        Parser (Word -> Word -> GenesisCmd)
-> Parser Word -> Parser (Word -> GenesisCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Word
pBulkPoolsPerFile
        Parser (Word -> GenesisCmd) -> Parser Word -> Parser GenesisCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Word
pStuffedUtxoCount

    pGenesisHash :: Parser GenesisCmd
    pGenesisHash :: Parser GenesisCmd
pGenesisHash =
      GenesisFile -> GenesisCmd
GenesisHashFile (GenesisFile -> GenesisCmd)
-> Parser GenesisFile -> Parser GenesisCmd
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> Parser GenesisFile
pGenesisFile String
"The genesis file."

    pGenesisDir :: Parser GenesisDir
    pGenesisDir :: Parser GenesisDir
pGenesisDir =
      String -> GenesisDir
GenesisDir (String -> GenesisDir) -> Parser String -> Parser GenesisDir
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
Opt.strOption
          (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"genesis-dir"
          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
Opt.metavar String
"DIR"
          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
Opt.help String
"The genesis directory containing the genesis template and required genesis/delegation/spending keys."
          )

    pMaybeSystemStart :: Parser (Maybe SystemStart)
    pMaybeSystemStart :: Parser (Maybe SystemStart)
pMaybeSystemStart =
      Parser SystemStart -> Parser (Maybe SystemStart)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser SystemStart -> Parser (Maybe SystemStart))
-> Parser SystemStart -> Parser (Maybe SystemStart)
forall a b. (a -> b) -> a -> b
$
        UTCTime -> SystemStart
SystemStart (UTCTime -> SystemStart)
-> (String -> UTCTime) -> String -> SystemStart
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> UTCTime
convertTime (String -> SystemStart) -> Parser String -> Parser SystemStart
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
Opt.strOption
            (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"start-time"
            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
Opt.metavar String
"UTC-TIME"
            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
Opt.help String
"The genesis start time in YYYY-MM-DDThh:mm:ssZ format. If unspecified, will be the current time +30 seconds."
            )

    pGenesisNumGenesisKeys :: Parser Word
    pGenesisNumGenesisKeys :: Parser Word
pGenesisNumGenesisKeys =
        ReadM Word -> Mod OptionFields Word -> Parser Word
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Word
forall a. Read a => ReadM a
Opt.auto
          (  String -> Mod OptionFields Word
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"gen-genesis-keys"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"INT"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"The number of genesis keys to make [default is 3]."
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> Word -> Mod OptionFields Word
forall (f :: * -> *) a. HasValue f => a -> Mod f a
Opt.value Word
3
          )

    pNodeConfigTemplate :: Parser (Maybe FilePath)
    pNodeConfigTemplate :: Parser (Maybe String)
pNodeConfigTemplate = Parser String -> Parser (Maybe String)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser String -> Parser (Maybe String))
-> Parser String -> Parser (Maybe String)
forall a b. (a -> b) -> a -> b
$ String -> String -> Parser String
parseFilePath String
"node-config-template" String
"the node config template"

    pGenesisNumUTxOKeys :: Parser Word
    pGenesisNumUTxOKeys :: Parser Word
pGenesisNumUTxOKeys =
        ReadM Word -> Mod OptionFields Word -> Parser Word
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Word
forall a. Read a => ReadM a
Opt.auto
          (  String -> Mod OptionFields Word
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"gen-utxo-keys"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"INT"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"The number of UTxO keys to make [default is 0]."
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> Word -> Mod OptionFields Word
forall (f :: * -> *) a. HasValue f => a -> Mod f a
Opt.value Word
0
          )

    pGenesisNumPools :: Parser Word
    pGenesisNumPools :: Parser Word
pGenesisNumPools =
        ReadM Word -> Mod OptionFields Word -> Parser Word
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Word
forall a. Read a => ReadM a
Opt.auto
          (  String -> Mod OptionFields Word
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"gen-pools"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"INT"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"The number of stake pool credential sets to make [default is 0]."
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> Word -> Mod OptionFields Word
forall (f :: * -> *) a. HasValue f => a -> Mod f a
Opt.value Word
0
          )

    pGenesisNumStDelegs :: Parser Word
    pGenesisNumStDelegs :: Parser Word
pGenesisNumStDelegs =
        ReadM Word -> Mod OptionFields Word -> Parser Word
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Word
forall a. Read a => ReadM a
Opt.auto
          (  String -> Mod OptionFields Word
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"gen-stake-delegs"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"INT"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"The number of stake delegator credential sets to make [default is 0]."
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> Word -> Mod OptionFields Word
forall (f :: * -> *) a. HasValue f => a -> Mod f a
Opt.value Word
0
          )

    pStuffedUtxoCount :: Parser Word
    pStuffedUtxoCount :: Parser Word
pStuffedUtxoCount =
        ReadM Word -> Mod OptionFields Word -> Parser Word
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Word
forall a. Read a => ReadM a
Opt.auto
          (  String -> Mod OptionFields Word
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"num-stuffed-utxo"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"INT"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"The number of fake UTxO entries to generate [default is 0]."
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> Word -> Mod OptionFields Word
forall (f :: * -> *) a. HasValue f => a -> Mod f a
Opt.value Word
0
          )

    convertTime :: String -> UTCTime
    convertTime :: String -> UTCTime
convertTime =
      Bool -> TimeLocale -> String -> String -> UTCTime
forall t.
ParseTime t =>
Bool -> TimeLocale -> String -> String -> t
parseTimeOrError Bool
False TimeLocale
defaultTimeLocale (Maybe String -> String
iso8601DateFormat (Maybe String -> String) -> Maybe String -> String
forall a b. (a -> b) -> a -> b
$ String -> Maybe String
forall a. a -> Maybe a
Just String
"%H:%M:%SZ")

    pInitialSupplyNonDelegated :: Parser (Maybe Lovelace)
    pInitialSupplyNonDelegated :: Parser (Maybe Lovelace)
pInitialSupplyNonDelegated =
      Parser Lovelace -> Parser (Maybe Lovelace)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser Lovelace -> Parser (Maybe Lovelace))
-> Parser Lovelace -> Parser (Maybe Lovelace)
forall a b. (a -> b) -> a -> b
$
      Integer -> Lovelace
Lovelace (Integer -> Lovelace) -> Parser Integer -> Parser Lovelace
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
        ReadM Integer -> Mod OptionFields Integer -> Parser Integer
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Integer
forall a. Read a => ReadM a
Opt.auto
          (  String -> Mod OptionFields Integer
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"supply"
          Mod OptionFields Integer
-> Mod OptionFields Integer -> Mod OptionFields Integer
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Integer
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"LOVELACE"
          Mod OptionFields Integer
-> Mod OptionFields Integer -> Mod OptionFields Integer
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Integer
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"The initial coin supply in Lovelace which will be evenly distributed across initial, non-delegating stake holders."
          )

    pInitialSupplyDelegated :: Parser Lovelace
    pInitialSupplyDelegated :: Parser Lovelace
pInitialSupplyDelegated =
      (Maybe Integer -> Lovelace)
-> Parser (Maybe Integer) -> Parser Lovelace
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Integer -> Lovelace
Lovelace (Integer -> Lovelace)
-> (Maybe Integer -> Integer) -> Maybe Integer -> Lovelace
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Integer -> Maybe Integer -> Integer
forall a. a -> Maybe a -> a
fromMaybe Integer
0) (Parser (Maybe Integer) -> Parser Lovelace)
-> Parser (Maybe Integer) -> Parser Lovelace
forall a b. (a -> b) -> a -> b
$ Parser Integer -> Parser (Maybe Integer)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
Opt.optional (Parser Integer -> Parser (Maybe Integer))
-> Parser Integer -> Parser (Maybe Integer)
forall a b. (a -> b) -> a -> b
$
        ReadM Integer -> Mod OptionFields Integer -> Parser Integer
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Integer
forall a. Read a => ReadM a
Opt.auto
          (  String -> Mod OptionFields Integer
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"supply-delegated"
          Mod OptionFields Integer
-> Mod OptionFields Integer -> Mod OptionFields Integer
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Integer
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"LOVELACE"
          Mod OptionFields Integer
-> Mod OptionFields Integer -> Mod OptionFields Integer
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Integer
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"The initial coin supply in Lovelace which will be evenly distributed across initial, delegating stake holders."
          Mod OptionFields Integer
-> Mod OptionFields Integer -> Mod OptionFields Integer
forall a. Semigroup a => a -> a -> a
<> Integer -> Mod OptionFields Integer
forall (f :: * -> *) a. HasValue f => a -> Mod f a
Opt.value Integer
0
          )

    pSecurityParam :: Parser Word64
    pSecurityParam :: Parser Word64
pSecurityParam =
        ReadM Word64 -> Mod OptionFields Word64 -> Parser Word64
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Word64
forall a. Read a => ReadM a
Opt.auto
          (  String -> Mod OptionFields Word64
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"security-param"
          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
Opt.metavar String
"INT"
          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
Opt.help String
"Security parameter for genesis file [default is 108]."
          Mod OptionFields Word64
-> Mod OptionFields Word64 -> Mod OptionFields Word64
forall a. Semigroup a => a -> a -> a
<> Word64 -> Mod OptionFields Word64
forall (f :: * -> *) a. HasValue f => a -> Mod f a
Opt.value Word64
108
          )

    pSlotLength :: Parser Word
    pSlotLength :: Parser Word
pSlotLength =
        ReadM Word -> Mod OptionFields Word -> Parser Word
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Word
forall a. Read a => ReadM a
Opt.auto
          (  String -> Mod OptionFields Word
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"slot-length"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"INT"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"slot length (ms) parameter for genesis file [default is 1000]."
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> Word -> Mod OptionFields Word
forall (f :: * -> *) a. HasValue f => a -> Mod f a
Opt.value Word
1000
          )


    pSlotCoefficient :: Parser Rational
    pSlotCoefficient :: Parser Rational
pSlotCoefficient =
        ReadM Rational -> Mod OptionFields Rational -> Parser Rational
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Rational
readRationalUnitInterval
          (  String -> Mod OptionFields Rational
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"slot-coefficient"
          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
Opt.metavar String
"RATIONAL"
          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
Opt.help String
"Slot Coefficient for genesis file [default is .05]."
          Mod OptionFields Rational
-> Mod OptionFields Rational -> Mod OptionFields Rational
forall a. Semigroup a => a -> a -> a
<> Rational -> Mod OptionFields Rational
forall (f :: * -> *) a. HasValue f => a -> Mod f a
Opt.value Rational
0.05
          )

    pBulkPoolCredFiles :: Parser Word
    pBulkPoolCredFiles :: Parser Word
pBulkPoolCredFiles =
        ReadM Word -> Mod OptionFields Word -> Parser Word
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Word
forall a. Read a => ReadM a
Opt.auto
          (  String -> Mod OptionFields Word
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"bulk-pool-cred-files"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"INT"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Generate bulk pool credential files [default is 0]."
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> Word -> Mod OptionFields Word
forall (f :: * -> *) a. HasValue f => a -> Mod f a
Opt.value Word
0
          )

    pBulkPoolsPerFile :: Parser Word
    pBulkPoolsPerFile :: Parser Word
pBulkPoolsPerFile =
        ReadM Word -> Mod OptionFields Word -> Parser Word
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Word
forall a. Read a => ReadM a
Opt.auto
          (  String -> Mod OptionFields Word
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"bulk-pools-per-file"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"INT"
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Each bulk pool to contain this many pool credential sets [default is 0]."
          Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> Word -> Mod OptionFields Word
forall (f :: * -> *) a. HasValue f => a -> Mod f a
Opt.value Word
0
          )


--
-- Shelley CLI flag parsers
--

data FileDirection
  = Input
  | Output
  deriving (FileDirection -> FileDirection -> Bool
(FileDirection -> FileDirection -> Bool)
-> (FileDirection -> FileDirection -> Bool) -> Eq FileDirection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileDirection -> FileDirection -> Bool
$c/= :: FileDirection -> FileDirection -> Bool
== :: FileDirection -> FileDirection -> Bool
$c== :: FileDirection -> FileDirection -> Bool
Eq, Int -> FileDirection -> String -> String
[FileDirection] -> String -> String
FileDirection -> String
(Int -> FileDirection -> String -> String)
-> (FileDirection -> String)
-> ([FileDirection] -> String -> String)
-> Show FileDirection
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [FileDirection] -> String -> String
$cshowList :: [FileDirection] -> String -> String
show :: FileDirection -> String
$cshow :: FileDirection -> String
showsPrec :: Int -> FileDirection -> String -> String
$cshowsPrec :: Int -> FileDirection -> String -> String
Show)

pAddressKeyType :: Parser AddressKeyType
pAddressKeyType :: Parser AddressKeyType
pAddressKeyType =
    AddressKeyType
-> Mod FlagFields AddressKeyType -> Parser AddressKeyType
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' AddressKeyType
AddressKeyShelley
      (  String -> Mod FlagFields AddressKeyType
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"normal-key"
      Mod FlagFields AddressKeyType
-> Mod FlagFields AddressKeyType -> Mod FlagFields AddressKeyType
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields AddressKeyType
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use a normal Shelley-era key (default)."
      )
  Parser AddressKeyType
-> Parser AddressKeyType -> Parser AddressKeyType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
    AddressKeyType
-> Mod FlagFields AddressKeyType -> Parser AddressKeyType
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' AddressKeyType
AddressKeyShelleyExtended
      (  String -> Mod FlagFields AddressKeyType
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"extended-key"
      Mod FlagFields AddressKeyType
-> Mod FlagFields AddressKeyType -> Mod FlagFields AddressKeyType
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields AddressKeyType
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use an extended ed25519 Shelley-era key."
      )
  Parser AddressKeyType
-> Parser AddressKeyType -> Parser AddressKeyType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
    AddressKeyType
-> Mod FlagFields AddressKeyType -> Parser AddressKeyType
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' AddressKeyType
AddressKeyByron
      (  String -> Mod FlagFields AddressKeyType
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"byron-key"
      Mod FlagFields AddressKeyType
-> Mod FlagFields AddressKeyType -> Mod FlagFields AddressKeyType
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields AddressKeyType
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use a Byron-era key."
      )
  Parser AddressKeyType
-> Parser AddressKeyType -> Parser AddressKeyType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
    AddressKeyType -> Parser AddressKeyType
forall (f :: * -> *) a. Applicative f => a -> f a
pure AddressKeyType
AddressKeyShelley


pProtocolParamsFile :: Parser ProtocolParamsFile
pProtocolParamsFile :: Parser ProtocolParamsFile
pProtocolParamsFile =
  String -> ProtocolParamsFile
ProtocolParamsFile (String -> ProtocolParamsFile)
-> Parser String -> Parser ProtocolParamsFile
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
Opt.strOption
      (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"protocol-params-file"
      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
Opt.metavar String
"FILE"
      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
Opt.help String
"Filepath of the JSON-encoded protocol parameters file"
      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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
      )

pCalculatePlutusScriptCost :: Parser TxBuildOutputOptions
pCalculatePlutusScriptCost :: Parser TxBuildOutputOptions
pCalculatePlutusScriptCost =
  String -> TxBuildOutputOptions
OutputScriptCostOnly (String -> TxBuildOutputOptions)
-> Parser String -> Parser TxBuildOutputOptions
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
Opt.strOption
   ( String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"calculate-plutus-script-cost" 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
Opt.metavar String
"FILE" 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
Opt.help String
"Output filepath of the script cost information." 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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
   )

pCertificateFile
  :: BalanceTxExecUnits
  -> Parser (CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))
pCertificateFile :: BalanceTxExecUnits
-> Parser (CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))
pCertificateFile BalanceTxExecUnits
balanceExecUnits =
  (,) (CertificateFile
 -> Maybe (ScriptWitnessFiles WitCtxStake)
 -> (CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake)))
-> Parser CertificateFile
-> Parser
     (Maybe (ScriptWitnessFiles WitCtxStake)
      -> (CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (String -> CertificateFile
CertificateFile
             (String -> CertificateFile)
-> Parser String -> Parser CertificateFile
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
Opt.strOption
                      (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"certificate-file"
                      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
Opt.metavar String
"CERTIFICATEFILE"
                      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
Opt.help String
helpText
                      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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
                      )
                  Parser String -> Parser String -> Parser String
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
                     Mod OptionFields String -> Parser String
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption (String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"certificate" Mod OptionFields String
-> Mod OptionFields String -> Mod OptionFields String
forall a. Semigroup a => a -> a -> a
<> Mod OptionFields String
forall (f :: * -> *) a. Mod f a
Opt.internal)
                  )
          )
      Parser
  (Maybe (ScriptWitnessFiles WitCtxStake)
   -> (CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake)))
-> Parser (Maybe (ScriptWitnessFiles WitCtxStake))
-> Parser (CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (ScriptWitnessFiles WitCtxStake)
-> Parser (Maybe (ScriptWitnessFiles WitCtxStake))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (BalanceTxExecUnits -> Parser (ScriptWitnessFiles WitCtxStake)
pCertifyingScriptOrReferenceScriptWit BalanceTxExecUnits
balanceExecUnits)
 where
  pCertifyingScriptOrReferenceScriptWit
    :: BalanceTxExecUnits -> Parser (ScriptWitnessFiles WitCtxStake)
  pCertifyingScriptOrReferenceScriptWit :: BalanceTxExecUnits -> Parser (ScriptWitnessFiles WitCtxStake)
pCertifyingScriptOrReferenceScriptWit BalanceTxExecUnits
bExecUnits =
    WitCtx WitCtxStake
-> BalanceTxExecUnits
-> String
-> Maybe String
-> String
-> Parser (ScriptWitnessFiles WitCtxStake)
forall witctx.
WitCtx witctx
-> BalanceTxExecUnits
-> String
-> Maybe String
-> String
-> Parser (ScriptWitnessFiles witctx)
pScriptWitnessFiles
     WitCtx WitCtxStake
WitCtxStake
     BalanceTxExecUnits
balanceExecUnits
     String
"certificate" Maybe String
forall a. Maybe a
Nothing
     String
"the use of the certificate." Parser (ScriptWitnessFiles WitCtxStake)
-> Parser (ScriptWitnessFiles WitCtxStake)
-> Parser (ScriptWitnessFiles WitCtxStake)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
    String
-> BalanceTxExecUnits -> Parser (ScriptWitnessFiles WitCtxStake)
pPlutusStakeReferenceScriptWitnessFiles String
"certificate-" BalanceTxExecUnits
bExecUnits

  helpText :: String
helpText = String
"Filepath of the certificate. This encompasses all \
             \types of certificates (stake pool certificates, \
             \stake key certificates etc). Optionally specify a script witness."

pPoolMetadataFile :: Parser PoolMetadataFile
pPoolMetadataFile :: Parser PoolMetadataFile
pPoolMetadataFile =
  String -> PoolMetadataFile
PoolMetadataFile (String -> PoolMetadataFile)
-> Parser String -> Parser PoolMetadataFile
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
Opt.strOption
      (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"pool-metadata-file"
      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
Opt.metavar String
"FILE"
      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
Opt.help String
"Filepath of the pool metadata."
      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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
      )

pTxMetadataJsonSchema :: Parser TxMetadataJsonSchema
pTxMetadataJsonSchema :: Parser TxMetadataJsonSchema
pTxMetadataJsonSchema =
    (  () -> Mod FlagFields () -> Parser ()
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' ()
        (  String -> Mod FlagFields ()
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"json-metadata-no-schema"
        Mod FlagFields () -> Mod FlagFields () -> Mod FlagFields ()
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields ()
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use the \"no schema\" conversion from JSON to tx metadata."
        )
    Parser ()
-> Parser TxMetadataJsonSchema -> Parser TxMetadataJsonSchema
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> TxMetadataJsonSchema -> Parser TxMetadataJsonSchema
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxMetadataJsonSchema
TxMetadataJsonNoSchema
    )
  Parser TxMetadataJsonSchema
-> Parser TxMetadataJsonSchema -> Parser TxMetadataJsonSchema
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
    (  () -> Mod FlagFields () -> Parser ()
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' ()
        (  String -> Mod FlagFields ()
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"json-metadata-detailed-schema"
        Mod FlagFields () -> Mod FlagFields () -> Mod FlagFields ()
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields ()
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use the \"detailed schema\" conversion from JSON to tx metadata."
        )
    Parser ()
-> Parser TxMetadataJsonSchema -> Parser TxMetadataJsonSchema
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> TxMetadataJsonSchema -> Parser TxMetadataJsonSchema
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxMetadataJsonSchema
TxMetadataJsonDetailedSchema
    )
  Parser TxMetadataJsonSchema
-> Parser TxMetadataJsonSchema -> Parser TxMetadataJsonSchema
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
    -- Default to the no-schema conversion.
    TxMetadataJsonSchema -> Parser TxMetadataJsonSchema
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxMetadataJsonSchema
TxMetadataJsonNoSchema

pMetadataFile :: Parser MetadataFile
pMetadataFile :: Parser MetadataFile
pMetadataFile =
      String -> MetadataFile
MetadataFileJSON (String -> MetadataFile) -> Parser String -> Parser MetadataFile
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
Opt.strOption
            (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"metadata-json-file"
            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
Opt.metavar String
"FILE"
            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
Opt.help String
"Filepath of the metadata file, in JSON format."
            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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
            )
        Parser String -> Parser String -> Parser String
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
          Mod OptionFields String -> Parser String
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
            (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"metadata-file" -- backward compat name
            Mod OptionFields String
-> Mod OptionFields String -> Mod OptionFields String
forall a. Semigroup a => a -> a -> a
<> Mod OptionFields String
forall (f :: * -> *) a. Mod f a
Opt.internal
            )
        )
  Parser MetadataFile -> Parser MetadataFile -> Parser MetadataFile
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
      String -> MetadataFile
MetadataFileCBOR (String -> MetadataFile) -> Parser String -> Parser MetadataFile
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
Opt.strOption
          (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"metadata-cbor-file"
          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
Opt.metavar String
"FILE"
          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
Opt.help String
"Filepath of the metadata, in raw CBOR format."
          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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
          )

pWithdrawal
  :: BalanceTxExecUnits
  -> Parser (StakeAddress,
            Lovelace,
            Maybe (ScriptWitnessFiles WitCtxStake))
pWithdrawal :: BalanceTxExecUnits
-> Parser
     (StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))
pWithdrawal BalanceTxExecUnits
balance =
    (\(StakeAddress
stakeAddr,Lovelace
lovelace) Maybe (ScriptWitnessFiles WitCtxStake)
maybeScriptFp -> (StakeAddress
stakeAddr, Lovelace
lovelace, Maybe (ScriptWitnessFiles WitCtxStake)
maybeScriptFp))
      ((StakeAddress, Lovelace)
 -> Maybe (ScriptWitnessFiles WitCtxStake)
 -> (StakeAddress, Lovelace,
     Maybe (ScriptWitnessFiles WitCtxStake)))
-> Parser (StakeAddress, Lovelace)
-> Parser
     (Maybe (ScriptWitnessFiles WitCtxStake)
      -> (StakeAddress, Lovelace,
          Maybe (ScriptWitnessFiles WitCtxStake)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM (StakeAddress, Lovelace)
-> Mod OptionFields (StakeAddress, Lovelace)
-> Parser (StakeAddress, Lovelace)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option (Parser (StakeAddress, Lovelace) -> ReadM (StakeAddress, Lovelace)
forall a. Parser a -> ReadM a
readerFromParsecParser Parser (StakeAddress, Lovelace)
parseWithdrawal)
            (  String -> Mod OptionFields (StakeAddress, Lovelace)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"withdrawal"
            Mod OptionFields (StakeAddress, Lovelace)
-> Mod OptionFields (StakeAddress, Lovelace)
-> Mod OptionFields (StakeAddress, Lovelace)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (StakeAddress, Lovelace)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"WITHDRAWAL"
            Mod OptionFields (StakeAddress, Lovelace)
-> Mod OptionFields (StakeAddress, Lovelace)
-> Mod OptionFields (StakeAddress, Lovelace)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (StakeAddress, Lovelace)
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
helpText
            )
      Parser
  (Maybe (ScriptWitnessFiles WitCtxStake)
   -> (StakeAddress, Lovelace,
       Maybe (ScriptWitnessFiles WitCtxStake)))
-> Parser (Maybe (ScriptWitnessFiles WitCtxStake))
-> Parser
     (StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (ScriptWitnessFiles WitCtxStake)
-> Parser (Maybe (ScriptWitnessFiles WitCtxStake))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser (ScriptWitnessFiles WitCtxStake)
pWithdrawalScriptOrReferenceScriptWit
 where
  pWithdrawalScriptOrReferenceScriptWit :: Parser (ScriptWitnessFiles WitCtxStake)
  pWithdrawalScriptOrReferenceScriptWit :: Parser (ScriptWitnessFiles WitCtxStake)
pWithdrawalScriptOrReferenceScriptWit =
   WitCtx WitCtxStake
-> BalanceTxExecUnits
-> String
-> Maybe String
-> String
-> Parser (ScriptWitnessFiles WitCtxStake)
forall witctx.
WitCtx witctx
-> BalanceTxExecUnits
-> String
-> Maybe String
-> String
-> Parser (ScriptWitnessFiles witctx)
pScriptWitnessFiles
     WitCtx WitCtxStake
WitCtxStake
     BalanceTxExecUnits
balance
     String
"withdrawal" Maybe String
forall a. Maybe a
Nothing
     String
"the withdrawal of rewards." Parser (ScriptWitnessFiles WitCtxStake)
-> Parser (ScriptWitnessFiles WitCtxStake)
-> Parser (ScriptWitnessFiles WitCtxStake)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
   String
-> BalanceTxExecUnits -> Parser (ScriptWitnessFiles WitCtxStake)
pPlutusStakeReferenceScriptWitnessFiles String
"withdrawal-" BalanceTxExecUnits
balance

  helpText :: String
helpText = String
"The reward withdrawal as StakeAddress+Lovelace where \
             \StakeAddress is the Bech32-encoded stake address \
             \followed by the amount in Lovelace. Optionally specify \
             \a script witness."

  parseWithdrawal :: Parsec.Parser (StakeAddress, Lovelace)
  parseWithdrawal :: Parser (StakeAddress, Lovelace)
parseWithdrawal =
    (,) (StakeAddress -> Lovelace -> (StakeAddress, Lovelace))
-> ParsecT String () Identity StakeAddress
-> ParsecT
     String () Identity (Lovelace -> (StakeAddress, Lovelace))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT String () Identity StakeAddress
parseStakeAddress ParsecT String () Identity (Lovelace -> (StakeAddress, Lovelace))
-> ParsecT String () Identity Char
-> ParsecT
     String () Identity (Lovelace -> (StakeAddress, Lovelace))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Char -> ParsecT String () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
Parsec.char Char
'+' ParsecT String () Identity (Lovelace -> (StakeAddress, Lovelace))
-> Parser Lovelace -> Parser (StakeAddress, Lovelace)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Lovelace
parseLovelace

pPlutusStakeReferenceScriptWitnessFiles
  :: String
  -> BalanceTxExecUnits -- ^ Use the @execution-units@ flag.
  -> Parser (ScriptWitnessFiles WitCtxStake)
pPlutusStakeReferenceScriptWitnessFiles :: String
-> BalanceTxExecUnits -> Parser (ScriptWitnessFiles WitCtxStake)
pPlutusStakeReferenceScriptWitnessFiles String
prefix BalanceTxExecUnits
autoBalanceExecUnits =
  TxIn
-> AnyScriptLanguage
-> ScriptDatumOrFile WitCtxStake
-> ScriptRedeemerOrFile
-> ExecutionUnits
-> Maybe PolicyId
-> ScriptWitnessFiles WitCtxStake
forall witctx.
TxIn
-> AnyScriptLanguage
-> ScriptDatumOrFile witctx
-> ScriptRedeemerOrFile
-> ExecutionUnits
-> Maybe PolicyId
-> ScriptWitnessFiles witctx
PlutusReferenceScriptWitnessFiles
    (TxIn
 -> AnyScriptLanguage
 -> ScriptDatumOrFile WitCtxStake
 -> ScriptRedeemerOrFile
 -> ExecutionUnits
 -> Maybe PolicyId
 -> ScriptWitnessFiles WitCtxStake)
-> Parser TxIn
-> Parser
     (AnyScriptLanguage
      -> ScriptDatumOrFile WitCtxStake
      -> ScriptRedeemerOrFile
      -> ExecutionUnits
      -> Maybe PolicyId
      -> ScriptWitnessFiles WitCtxStake)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> String -> Parser TxIn
pReferenceTxIn String
prefix String
"plutus"
    Parser
  (AnyScriptLanguage
   -> ScriptDatumOrFile WitCtxStake
   -> ScriptRedeemerOrFile
   -> ExecutionUnits
   -> Maybe PolicyId
   -> ScriptWitnessFiles WitCtxStake)
-> Parser AnyScriptLanguage
-> Parser
     (ScriptDatumOrFile WitCtxStake
      -> ScriptRedeemerOrFile
      -> ExecutionUnits
      -> Maybe PolicyId
      -> ScriptWitnessFiles WitCtxStake)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> Parser AnyScriptLanguage
pPlutusScriptLanguage String
prefix
    Parser
  (ScriptDatumOrFile WitCtxStake
   -> ScriptRedeemerOrFile
   -> ExecutionUnits
   -> Maybe PolicyId
   -> ScriptWitnessFiles WitCtxStake)
-> Parser (ScriptDatumOrFile WitCtxStake)
-> Parser
     (ScriptRedeemerOrFile
      -> ExecutionUnits
      -> Maybe PolicyId
      -> ScriptWitnessFiles WitCtxStake)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ScriptDatumOrFile WitCtxStake
-> Parser (ScriptDatumOrFile WitCtxStake)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ScriptDatumOrFile WitCtxStake
NoScriptDatumOrFileForStake
    Parser
  (ScriptRedeemerOrFile
   -> ExecutionUnits
   -> Maybe PolicyId
   -> ScriptWitnessFiles WitCtxStake)
-> Parser ScriptRedeemerOrFile
-> Parser
     (ExecutionUnits
      -> Maybe PolicyId -> ScriptWitnessFiles WitCtxStake)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> String -> Parser ScriptRedeemerOrFile
pScriptRedeemerOrFile (String
prefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"reference-tx-in")
    Parser
  (ExecutionUnits
   -> Maybe PolicyId -> ScriptWitnessFiles WitCtxStake)
-> Parser ExecutionUnits
-> Parser (Maybe PolicyId -> ScriptWitnessFiles WitCtxStake)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (case BalanceTxExecUnits
autoBalanceExecUnits of
          BalanceTxExecUnits
AutoBalance -> ExecutionUnits -> Parser ExecutionUnits
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Natural -> Natural -> ExecutionUnits
ExecutionUnits Natural
0 Natural
0)
          BalanceTxExecUnits
ManualBalance -> String -> Parser ExecutionUnits
pExecutionUnits (String -> Parser ExecutionUnits)
-> String -> Parser ExecutionUnits
forall a b. (a -> b) -> a -> b
$ String
prefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"reference-tx-in")
    Parser (Maybe PolicyId -> ScriptWitnessFiles WitCtxStake)
-> Parser (Maybe PolicyId)
-> Parser (ScriptWitnessFiles WitCtxStake)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Maybe PolicyId -> Parser (Maybe PolicyId)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe PolicyId
forall a. Maybe a
Nothing

pPlutusScriptLanguage :: String -> Parser AnyScriptLanguage
pPlutusScriptLanguage :: String -> Parser AnyScriptLanguage
pPlutusScriptLanguage String
prefix =
  AnyScriptLanguage
-> Mod FlagFields AnyScriptLanguage -> Parser AnyScriptLanguage
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' (ScriptLanguage PlutusScriptV2 -> AnyScriptLanguage
forall lang. ScriptLanguage lang -> AnyScriptLanguage
AnyScriptLanguage (ScriptLanguage PlutusScriptV2 -> AnyScriptLanguage)
-> ScriptLanguage PlutusScriptV2 -> AnyScriptLanguage
forall a b. (a -> b) -> a -> b
$ PlutusScriptVersion PlutusScriptV2 -> ScriptLanguage PlutusScriptV2
forall lang. PlutusScriptVersion lang -> ScriptLanguage lang
PlutusScriptLanguage PlutusScriptVersion PlutusScriptV2
PlutusScriptV2)
    (  String -> Mod FlagFields AnyScriptLanguage
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long (String
prefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"plutus-script-v2")
    Mod FlagFields AnyScriptLanguage
-> Mod FlagFields AnyScriptLanguage
-> Mod FlagFields AnyScriptLanguage
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields AnyScriptLanguage
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Specify a plutus script v2 reference script."
    )

pUpdateProposalFile :: Parser UpdateProposalFile
pUpdateProposalFile :: Parser UpdateProposalFile
pUpdateProposalFile =
  String -> UpdateProposalFile
UpdateProposalFile (String -> UpdateProposalFile)
-> Parser String -> Parser UpdateProposalFile
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
Opt.strOption
     (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"update-proposal-file"
     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
Opt.metavar String
"FILE"
     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
Opt.help String
"Filepath of the update proposal."
     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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
     )
  Parser String -> Parser String -> Parser String
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
    Mod OptionFields String -> Parser String
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
      (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"update-proposal"
      Mod OptionFields String
-> Mod OptionFields String -> Mod OptionFields String
forall a. Semigroup a => a -> a -> a
<> Mod OptionFields String
forall (f :: * -> *) a. Mod f a
Opt.internal
      )
  )


pColdSigningKeyFile :: Parser SigningKeyFile
pColdSigningKeyFile :: Parser SigningKeyFile
pColdSigningKeyFile =
  String -> SigningKeyFile
SigningKeyFile (String -> SigningKeyFile)
-> Parser String -> Parser SigningKeyFile
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
Opt.strOption
        (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"cold-signing-key-file"
        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
Opt.metavar String
"FILE"
        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
Opt.help String
"Filepath of the cold signing key."
        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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
        )
    Parser String -> Parser String -> Parser String
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
      Mod OptionFields String -> Parser String
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
      (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"signing-key-file"
      Mod OptionFields String
-> Mod OptionFields String -> Mod OptionFields String
forall a. Semigroup a => a -> a -> a
<> Mod OptionFields String
forall (f :: * -> *) a. Mod f a
Opt.internal
      )
    )

pRequiredSigner :: Parser RequiredSigner
pRequiredSigner :: Parser RequiredSigner
pRequiredSigner =
      SigningKeyFile -> RequiredSigner
RequiredSignerSkeyFile (SigningKeyFile -> RequiredSigner)
-> Parser SigningKeyFile -> Parser RequiredSigner
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser SigningKeyFile
sKeyFile
  Parser RequiredSigner
-> Parser RequiredSigner -> Parser RequiredSigner
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Hash PaymentKey -> RequiredSigner
RequiredSignerHash (Hash PaymentKey -> RequiredSigner)
-> Parser (Hash PaymentKey) -> Parser RequiredSigner
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (Hash PaymentKey)
sPayKeyHash
 where
  sKeyFile :: Parser SigningKeyFile
  sKeyFile :: Parser SigningKeyFile
sKeyFile = String -> SigningKeyFile
SigningKeyFile (String -> SigningKeyFile)
-> Parser String -> Parser SigningKeyFile
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
Opt.strOption
      (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"required-signer"
      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
Opt.metavar String
"FILE"
      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
Opt.help String
"Input filepath of the signing key (zero or more) whose \
                  \signature is required."
      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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
      )
  sPayKeyHash :: Parser (Hash PaymentKey)
  sPayKeyHash :: Parser (Hash PaymentKey)
sPayKeyHash =
    ReadM (Hash PaymentKey)
-> Mod OptionFields (Hash PaymentKey) -> Parser (Hash PaymentKey)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option (Parser (Hash PaymentKey) -> ReadM (Hash PaymentKey)
forall a. Parser a -> ReadM a
readerFromParsecParser (Parser (Hash PaymentKey) -> ReadM (Hash PaymentKey))
-> Parser (Hash PaymentKey) -> ReadM (Hash PaymentKey)
forall a b. (a -> b) -> a -> b
$ AsType (Hash PaymentKey) -> Parser (Hash PaymentKey)
forall a.
SerialiseAsRawBytes (Hash a) =>
AsType (Hash a) -> Parser (Hash a)
parseHash (AsType PaymentKey -> AsType (Hash PaymentKey)
forall a. AsType a -> AsType (Hash a)
AsHash AsType PaymentKey
AsPaymentKey))
      (  String -> Mod OptionFields (Hash PaymentKey)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"required-signer-hash"
      Mod OptionFields (Hash PaymentKey)
-> Mod OptionFields (Hash PaymentKey)
-> Mod OptionFields (Hash PaymentKey)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (Hash PaymentKey)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"HASH"
      Mod OptionFields (Hash PaymentKey)
-> Mod OptionFields (Hash PaymentKey)
-> Mod OptionFields (Hash PaymentKey)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (Hash PaymentKey)
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Hash of the verification key (zero or more) whose \
                  \signature is required."
      )

pVrfSigningKeyFile :: Parser SigningKeyFile
pVrfSigningKeyFile :: Parser SigningKeyFile
pVrfSigningKeyFile =
  String -> SigningKeyFile
SigningKeyFile (String -> SigningKeyFile)
-> Parser String -> Parser SigningKeyFile
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
Opt.strOption
      (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"vrf-signing-key-file"
      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
Opt.metavar String
"FILE"
      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
Opt.help String
"Input filepath of the VRF signing key."
      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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
      )

pWhichLeadershipSchedule :: Parser EpochLeadershipSchedule
pWhichLeadershipSchedule :: Parser EpochLeadershipSchedule
pWhichLeadershipSchedule = Parser EpochLeadershipSchedule
pCurrent Parser EpochLeadershipSchedule
-> Parser EpochLeadershipSchedule -> Parser EpochLeadershipSchedule
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser EpochLeadershipSchedule
pNext
 where
   pCurrent :: Parser EpochLeadershipSchedule
   pCurrent :: Parser EpochLeadershipSchedule
pCurrent =
     EpochLeadershipSchedule
-> Mod FlagFields EpochLeadershipSchedule
-> Parser EpochLeadershipSchedule
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' EpochLeadershipSchedule
CurrentEpoch
       (  String -> Mod FlagFields EpochLeadershipSchedule
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"current"
       Mod FlagFields EpochLeadershipSchedule
-> Mod FlagFields EpochLeadershipSchedule
-> Mod FlagFields EpochLeadershipSchedule
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields EpochLeadershipSchedule
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Get the leadership schedule for the current epoch."
       )

   pNext :: Parser EpochLeadershipSchedule
   pNext :: Parser EpochLeadershipSchedule
pNext =
     EpochLeadershipSchedule
-> Mod FlagFields EpochLeadershipSchedule
-> Parser EpochLeadershipSchedule
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' EpochLeadershipSchedule
NextEpoch
       (  String -> Mod FlagFields EpochLeadershipSchedule
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"next"
       Mod FlagFields EpochLeadershipSchedule
-> Mod FlagFields EpochLeadershipSchedule
-> Mod FlagFields EpochLeadershipSchedule
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields EpochLeadershipSchedule
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Get the leadership schedule for the following epoch."
       )

pSomeWitnessSigningData :: Parser [WitnessSigningData]
pSomeWitnessSigningData :: Parser [WitnessSigningData]
pSomeWitnessSigningData =
  Parser WitnessSigningData -> Parser [WitnessSigningData]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some (Parser WitnessSigningData -> Parser [WitnessSigningData])
-> Parser WitnessSigningData -> Parser [WitnessSigningData]
forall a b. (a -> b) -> a -> b
$
      SigningKeyFile -> Maybe (Address ByronAddr) -> WitnessSigningData
KeyWitnessSigningData
        (SigningKeyFile -> Maybe (Address ByronAddr) -> WitnessSigningData)
-> Parser SigningKeyFile
-> Parser (Maybe (Address ByronAddr) -> WitnessSigningData)
forall (f :: * -> *) a b. Functor 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
<$>
              Mod OptionFields String -> Parser String
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
                (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"signing-key-file"
                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
Opt.metavar String
"FILE"
                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
Opt.help String
"Input filepath of the signing key (one or more)."
                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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
                )
          )
        Parser (Maybe (Address ByronAddr) -> WitnessSigningData)
-> Parser (Maybe (Address ByronAddr)) -> Parser WitnessSigningData
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
          Parser (Address ByronAddr) -> Parser (Maybe (Address ByronAddr))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser (Address ByronAddr)
pByronAddress

pSigningKeyFile :: FileDirection -> Parser SigningKeyFile
pSigningKeyFile :: FileDirection -> Parser SigningKeyFile
pSigningKeyFile FileDirection
fdir =
  String -> SigningKeyFile
SigningKeyFile (String -> SigningKeyFile)
-> Parser String -> Parser SigningKeyFile
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
Opt.strOption
      (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"signing-key-file"
      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
Opt.metavar String
"FILE"
      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
Opt.help (FileDirection -> String
forall a b. (Show a, ConvertText String b) => a -> b
show FileDirection
fdir String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" filepath of the signing key.")
      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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
      )

pWitnessSigningData :: Parser WitnessSigningData
pWitnessSigningData :: Parser WitnessSigningData
pWitnessSigningData =
    SigningKeyFile -> Maybe (Address ByronAddr) -> WitnessSigningData
KeyWitnessSigningData
      (SigningKeyFile -> Maybe (Address ByronAddr) -> WitnessSigningData)
-> Parser SigningKeyFile
-> Parser (Maybe (Address ByronAddr) -> WitnessSigningData)
forall (f :: * -> *) a b. Functor 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
<$>
            Mod OptionFields String -> Parser String
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
              (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"signing-key-file"
              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
Opt.metavar String
"FILE"
              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
Opt.help String
"Filepath of the signing key to be used in witness construction."
              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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
              )
        )
      Parser (Maybe (Address ByronAddr) -> WitnessSigningData)
-> Parser (Maybe (Address ByronAddr)) -> Parser WitnessSigningData
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
        Parser (Address ByronAddr) -> Parser (Maybe (Address ByronAddr))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser (Address ByronAddr)
pByronAddress

pKesPeriod :: Parser KESPeriod
pKesPeriod :: Parser KESPeriod
pKesPeriod =
  Word -> KESPeriod
KESPeriod (Word -> KESPeriod) -> Parser Word -> Parser KESPeriod
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
    ReadM Word -> Mod OptionFields Word -> Parser Word
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Word
forall a. Read a => ReadM a
Opt.auto
      (  String -> Mod OptionFields Word
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"kes-period"
      Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"NATURAL"
      Mod OptionFields Word
-> Mod OptionFields Word -> Mod OptionFields Word
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"The start of the KES key validity period."
      )

pEpochNo :: Parser EpochNo
pEpochNo :: Parser EpochNo
pEpochNo =
  Word64 -> EpochNo
EpochNo (Word64 -> EpochNo) -> Parser Word64 -> Parser EpochNo
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
Opt.option ReadM Word64
forall a. Read a => ReadM a
Opt.auto
      (  String -> Mod OptionFields Word64
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"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
Opt.metavar String
"NATURAL"
      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
Opt.help String
"The epoch number."
      )


pEpochNoUpdateProp :: Parser EpochNo
pEpochNoUpdateProp :: Parser EpochNo
pEpochNoUpdateProp =
  Word64 -> EpochNo
EpochNo (Word64 -> EpochNo) -> Parser Word64 -> Parser EpochNo
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
Opt.option ReadM Word64
forall a. Read a => ReadM a
Opt.auto
      (  String -> Mod OptionFields Word64
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"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
Opt.metavar String
"NATURAL"
      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
Opt.help String
"The epoch number in which the update proposal is valid."
      )

pGenesisFile :: String -> Parser GenesisFile
pGenesisFile :: String -> Parser GenesisFile
pGenesisFile String
desc =
  String -> GenesisFile
GenesisFile (String -> GenesisFile) -> Parser String -> Parser GenesisFile
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
Opt.strOption
      (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"genesis"
      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
Opt.metavar String
"FILE"
      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
Opt.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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
      )

pOperatorCertIssueCounterFile :: Parser OpCertCounterFile
pOperatorCertIssueCounterFile :: Parser OpCertCounterFile
pOperatorCertIssueCounterFile =
  String -> OpCertCounterFile
OpCertCounterFile (String -> OpCertCounterFile)
-> Parser String -> Parser OpCertCounterFile
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
Opt.strOption
        (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"operational-certificate-issue-counter-file"
        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
Opt.metavar String
"FILE"
        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
Opt.help String
"The file with the issue counter for the operational certificate."
        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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
        )
    Parser String -> Parser String -> Parser String
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
      Mod OptionFields String -> Parser String
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
        (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"operational-certificate-issue-counter"
        Mod OptionFields String
-> Mod OptionFields String -> Mod OptionFields String
forall a. Semigroup a => a -> a -> a
<> Mod OptionFields String
forall (f :: * -> *) a. Mod f a
Opt.internal
        )
    )

pOperationalCertificateFile :: Parser FilePath
pOperationalCertificateFile :: Parser String
pOperationalCertificateFile =
  Mod OptionFields String -> Parser String
forall s. IsString s => Mod OptionFields s -> Parser s
Opt.strOption
    (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"op-cert-file"
    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
Opt.metavar String
"FILE"
    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
Opt.help String
"Filepath of the node's operational certificate."
    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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
    )

pOutputFormat :: Parser OutputFormat
pOutputFormat :: Parser OutputFormat
pOutputFormat =
  ReadM OutputFormat
-> Mod OptionFields OutputFormat -> Parser OutputFormat
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM OutputFormat
readOutputFormat
    (  String -> Mod OptionFields OutputFormat
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"output-format"
    Mod OptionFields OutputFormat
-> Mod OptionFields OutputFormat -> Mod OptionFields OutputFormat
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields OutputFormat
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"STRING"
    Mod OptionFields OutputFormat
-> Mod OptionFields OutputFormat -> Mod OptionFields OutputFormat
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields OutputFormat
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Optional output format. Accepted output formats are \"hex\" \
                \and \"bech32\" (default is \"bech32\")."
    Mod OptionFields OutputFormat
-> Mod OptionFields OutputFormat -> Mod OptionFields OutputFormat
forall a. Semigroup a => a -> a -> a
<> OutputFormat -> Mod OptionFields OutputFormat
forall (f :: * -> *) a. HasValue f => a -> Mod f a
Opt.value OutputFormat
OutputFormatBech32
    )

pOutputSerialisation :: Parser OutputSerialisation
pOutputSerialisation :: Parser OutputSerialisation
pOutputSerialisation =
  OutputSerialisation
-> Mod FlagFields OutputSerialisation -> Parser OutputSerialisation
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' OutputSerialisation
OutputLedgerCDDLSerialisation
    (  String -> Mod FlagFields OutputSerialisation
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"cddl-format"
    Mod FlagFields OutputSerialisation
-> Mod FlagFields OutputSerialisation
-> Mod FlagFields OutputSerialisation
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields OutputSerialisation
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Serialise in the ledger CDDL specified CBOR format."
    ) Parser OutputSerialisation
-> Parser OutputSerialisation -> Parser OutputSerialisation
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
  OutputSerialisation
-> OutputSerialisation
-> Mod FlagFields OutputSerialisation
-> Parser OutputSerialisation
forall a. a -> a -> Mod FlagFields a -> Parser a
Opt.flag OutputSerialisation
OutputCliSerialisation OutputSerialisation
OutputCliSerialisation
    (  String -> Mod FlagFields OutputSerialisation
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"cli-format"
    Mod FlagFields OutputSerialisation
-> Mod FlagFields OutputSerialisation
-> Mod FlagFields OutputSerialisation
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields OutputSerialisation
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Serialise in the cardano-cli CBOR format."
    )

pMaybeOutputFile :: Parser (Maybe OutputFile)
pMaybeOutputFile :: Parser (Maybe OutputFile)
pMaybeOutputFile =
  Parser OutputFile -> Parser (Maybe OutputFile)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Parser OutputFile -> Parser (Maybe OutputFile))
-> Parser OutputFile -> Parser (Maybe OutputFile)
forall a b. (a -> b) -> a -> b
$
    String -> OutputFile
OutputFile (String -> OutputFile) -> Parser String -> Parser OutputFile
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
Opt.strOption
        (  String -> Mod OptionFields String
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"out-file"
        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
Opt.metavar String
"FILE"
        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
Opt.help String
"Optional output file. Default is to write to stdout."
        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
Opt.completer (String -> Completer
Opt.bashCompleter String
"file")
        )

pOutputFile :: Parser OutputFile
pOutputFile :: Parser OutputFile
pOutputFile =
  String -> OutputFile
OutputFile (String -> OutputFile) -> Parser String -> Parser OutputFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b