{-# 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
  , renderTxIn
  ) where

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

import           Cardano.Api
import           Cardano.Api.Shelley

import           Cardano.CLI.Mary.ValueParser (parseValue)
import           Cardano.CLI.Shelley.Commands
import           Cardano.CLI.Shelley.Key (InputFormat (..), PaymentVerifier (..),
                   StakeVerifier (..), VerificationKeyOrFile (..), VerificationKeyOrHashOrFile (..),
                   VerificationKeyTextOrFile (..), deserialiseInput, renderInputDecodeError)
import           Cardano.CLI.Types
import qualified Cardano.Ledger.BaseTypes as Shelley
import           Control.Monad.Fail (fail)
import           Data.Time.Clock (UTCTime)
import           Data.Time.Format (defaultTimeLocale, iso8601DateFormat, parseTimeOrError)
import           Network.Socket (PortNumber)
import           Options.Applicative hiding (help, str)
import           Ouroboros.Consensus.BlockchainTime (SystemStart (..))
import           Prettyprinter (line, pretty)

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 qualified Data.Aeson as Aeson
import qualified Data.Aeson.Parser as Aeson.Parser
import qualified Data.Attoparsec.ByteString.Char8 as Atto
import qualified Options.Applicative as Opt
import qualified Options.Applicative.Help as H
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 Shelley.Spec.Ledger.TxBody as Shelley

{- 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 enviromnent 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
        )

pScriptWitnessFiles :: forall witctx.
                       WitCtx witctx
                    -> BalanceTxExecUnits -- ^ Use the @execution-units@ flag.
                    -> String
                    -> 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
<$> Parser (ScriptDatumOrFile witctx)
pScriptDatumOrFile
                         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
<*> Parser ScriptRedeemerOrFile
pScriptRedeemerOrFile
                         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 (Word64 -> Word64 -> ExecutionUnits
ExecutionUnits Word64
0 Word64
0)
                               BalanceTxExecUnits
ManualBalance -> Parser ExecutionUnits
pExecutionUnits)
                   )
  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

    pScriptDatumOrFile :: Parser (ScriptDatumOrFile witctx)
    pScriptDatumOrFile :: Parser (ScriptDatumOrFile witctx)
pScriptDatumOrFile =
      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 -> Parser ScriptRedeemerOrFile
pScriptDataOrFile (String
scriptFlagPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"-datum")
        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

    pScriptRedeemerOrFile :: Parser ScriptDataOrFile
    pScriptRedeemerOrFile :: Parser ScriptRedeemerOrFile
pScriptRedeemerOrFile = String -> Parser ScriptRedeemerOrFile
pScriptDataOrFile (String
scriptFlagPrefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"-redeemer")

    pExecutionUnits :: Parser ExecutionUnits
    pExecutionUnits :: Parser ExecutionUnits
pExecutionUnits =
      (Word64 -> Word64 -> ExecutionUnits)
-> (Word64, Word64) -> ExecutionUnits
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Word64 -> Word64 -> ExecutionUnits
ExecutionUnits ((Word64, Word64) -> ExecutionUnits)
-> Parser (Word64, Word64) -> Parser ExecutionUnits
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
        ReadM (Word64, Word64)
-> Mod OptionFields (Word64, Word64) -> Parser (Word64, Word64)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM (Word64, Word64)
forall a. Read a => ReadM a
Opt.auto
          (  String -> Mod OptionFields (Word64, Word64)
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 (Word64, Word64)
-> Mod OptionFields (Word64, Word64)
-> Mod OptionFields (Word64, Word64)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (Word64, Word64)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"(INT, INT)"
          Mod OptionFields (Word64, Word64)
-> Mod OptionFields (Word64, Word64)
-> Mod OptionFields (Word64, Word64)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (Word64, Word64)
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"The time and space units needed by the script."
          )


pScriptDataOrFile :: String -> Parser ScriptDataOrFile
pScriptDataOrFile :: String -> Parser ScriptRedeemerOrFile
pScriptDataOrFile String
dataFlagPrefix =
      String -> ScriptRedeemerOrFile
ScriptDataFile  (String -> ScriptRedeemerOrFile)
-> Parser String -> Parser ScriptRedeemerOrFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser String
pScriptDataFile
  Parser ScriptRedeemerOrFile
-> Parser ScriptRedeemerOrFile -> Parser ScriptRedeemerOrFile
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ScriptData -> ScriptRedeemerOrFile
ScriptDataValue (ScriptData -> ScriptRedeemerOrFile)
-> Parser ScriptData -> Parser ScriptRedeemerOrFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser ScriptData
pScriptDataValue
  where
    pScriptDataFile :: Parser String
pScriptDataFile =
      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
"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 JSON file containing the script data."
        )

    pScriptDataValue :: Parser ScriptData
pScriptDataValue =
      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
"The JSON value for the script data. Supported JSON data types: string, number, object & array."
        )

    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 = VerificationKeyOrFile StakeKey
-> NetworkId -> Maybe OutputFile -> StakeAddressCmd
StakeAddressBuild (VerificationKeyOrFile StakeKey
 -> NetworkId -> Maybe OutputFile -> StakeAddressCmd)
-> Parser (VerificationKeyOrFile StakeKey)
-> Parser (NetworkId -> Maybe OutputFile -> StakeAddressCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (VerificationKeyOrFile StakeKey)
pStakeVerificationKeyOrFile
                                           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 enviromnent 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-value"
        (Parser TransactionCmd
-> InfoMod TransactionCmd -> ParserInfo TransactionCmd
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser TransactionCmd
pTransactionCalculateMinValue (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 value for a transaction")

    , 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
  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]
-> [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
-> TxBodyFile
-> TransactionCmd
TxBuild (AnyCardanoEra
 -> AnyConsensusModeParams
 -> NetworkId
 -> Maybe ScriptValidity
 -> Maybe Word
 -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
 -> [TxIn]
 -> [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
 -> TxBodyFile
 -> TransactionCmd)
-> Parser AnyCardanoEra
-> Parser
     (AnyConsensusModeParams
      -> NetworkId
      -> Maybe ScriptValidity
      -> Maybe Word
      -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
      -> [TxIn]
      -> [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
      -> TxBodyFile
      -> 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]
   -> [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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser AnyConsensusModeParams
-> Parser
     (NetworkId
      -> Maybe ScriptValidity
      -> Maybe Word
      -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
      -> [TxIn]
      -> [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
      -> TxBodyFile
      -> 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]
   -> [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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser NetworkId
-> Parser
     (Maybe ScriptValidity
      -> Maybe Word
      -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
      -> [TxIn]
      -> [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
      -> TxBodyFile
      -> 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]
   -> [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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser (Maybe ScriptValidity)
-> Parser
     (Maybe Word
      -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
      -> [TxIn]
      -> [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
      -> 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
  (Maybe Word
   -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
   -> [TxIn]
   -> [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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser (Maybe Word)
-> Parser
     ([(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
      -> [TxIn]
      -> [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
      -> TxBodyFile
      -> 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]
   -> [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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
-> Parser
     ([TxIn]
      -> [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
      -> 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
AutoBalance)
            Parser
  ([TxIn]
   -> [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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser [TxIn]
-> 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
      -> 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
  ([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
   -> TxBodyFile
   -> 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
      -> 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
  (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
   -> TxBodyFile
   -> 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
      -> TxBodyFile
      -> 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
   -> TxBodyFile
   -> 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
      -> 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
AutoBalance)
            Parser
  (Maybe SlotNo
   -> Maybe SlotNo
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> TxBodyFile
   -> TransactionCmd)
-> Parser (Maybe SlotNo)
-> Parser
     (Maybe SlotNo
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> 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
   -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> TxBodyFile
   -> TransactionCmd)
-> Parser (Maybe SlotNo)
-> Parser
     ([(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> 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
  ([(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> [(StakeAddress, Lovelace,
        Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> TxBodyFile
   -> TransactionCmd)
-> Parser
     [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
-> Parser
     ([(StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> 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
AutoBalance)
            Parser
  ([(StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))]
   -> TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> TxBodyFile
   -> TransactionCmd)
-> Parser
     [(StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))]
-> Parser
     (TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> 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
AutoBalance)
            Parser
  (TxMetadataJsonSchema
   -> [ScriptFile]
   -> [MetadataFile]
   -> Maybe ProtocolParamsSourceSpec
   -> Maybe UpdateProposalFile
   -> TxBodyFile
   -> TransactionCmd)
-> Parser TxMetadataJsonSchema
-> Parser
     ([ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> 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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser [ScriptFile]
-> Parser
     ([MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> 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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser [MetadataFile]
-> Parser
     (Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile -> 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 -> TxBodyFile -> TransactionCmd)
-> Parser (Maybe ProtocolParamsSourceSpec)
-> Parser
     (Maybe UpdateProposalFile -> 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 -> TxBodyFile -> TransactionCmd)
-> Parser (Maybe UpdateProposalFile)
-> Parser (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 (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

  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]
-> [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
-> TxBodyFile
-> TransactionCmd
TxBuildRaw (AnyCardanoEra
 -> Maybe ScriptValidity
 -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
 -> [TxIn]
 -> [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
 -> TxBodyFile
 -> TransactionCmd)
-> Parser AnyCardanoEra
-> Parser
     (Maybe ScriptValidity
      -> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
      -> [TxIn]
      -> [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
      -> 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]
   -> [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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser (Maybe ScriptValidity)
-> Parser
     ([(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
      -> [TxIn]
      -> [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
      -> 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]
   -> [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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
-> Parser
     ([TxIn]
      -> [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
      -> 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]
   -> [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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser [TxIn]
-> 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
      -> 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
  ([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
   -> 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
      -> 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
   -> 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
      -> 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
   -> 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
      -> 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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser (Maybe SlotNo)
-> Parser
     (Maybe Lovelace
      -> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> 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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser (Maybe Lovelace)
-> Parser
     ([(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> [(StakeAddress, Lovelace,
           Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> 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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser
     [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
-> Parser
     ([(StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))]
      -> TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> 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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser
     [(StakeAddress, Lovelace, Maybe (ScriptWitnessFiles WitCtxStake))]
-> Parser
     (TxMetadataJsonSchema
      -> [ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> 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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser TxMetadataJsonSchema
-> Parser
     ([ScriptFile]
      -> [MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> 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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser [ScriptFile]
-> Parser
     ([MetadataFile]
      -> Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile
      -> 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
   -> TxBodyFile
   -> TransactionCmd)
-> Parser [MetadataFile]
-> Parser
     (Maybe ProtocolParamsSourceSpec
      -> Maybe UpdateProposalFile -> 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 -> TxBodyFile -> TransactionCmd)
-> Parser (Maybe ProtocolParamsSourceSpec)
-> Parser
     (Maybe UpdateProposalFile -> 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 -> TxBodyFile -> TransactionCmd)
-> Parser (Maybe UpdateProposalFile)
-> Parser (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 (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 = TxBodyFile
-> [WitnessSigningData]
-> Maybe NetworkId
-> TxFile
-> TransactionCmd
TxSign (TxBodyFile
 -> [WitnessSigningData]
 -> Maybe NetworkId
 -> TxFile
 -> TransactionCmd)
-> Parser TxBodyFile
-> Parser
     ([WitnessSigningData]
      -> Maybe NetworkId -> TxFile -> TransactionCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser TxBodyFile
pTxBodyFile FileDirection
Input
                            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

  pTransactionCalculateMinValue :: Parser TransactionCmd
  pTransactionCalculateMinValue :: Parser TransactionCmd
pTransactionCalculateMinValue = ProtocolParamsSourceSpec -> Value -> TransactionCmd
TxCalculateMinValue
    (ProtocolParamsSourceSpec -> Value -> TransactionCmd)
-> Parser ProtocolParamsSourceSpec
-> Parser (Value -> TransactionCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser ProtocolParamsSourceSpec
pProtocolParamsSourceSpec
    Parser (Value -> TransactionCmd)
-> Parser Value -> Parser TransactionCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Value
pMultiAsset

  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 -> Parser ScriptRedeemerOrFile
pScriptDataOrFile String
"script-data"

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

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

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-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)")
    ]
  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

    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


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
-> GovernanceCmd
GovernanceUpdateProposal
                        (OutputFile
 -> EpochNo
 -> [VerificationKeyFile]
 -> ProtocolParametersUpdate
 -> GovernanceCmd)
-> Parser OutputFile
-> Parser
     (EpochNo
      -> [VerificationKeyFile]
      -> ProtocolParametersUpdate
      -> GovernanceCmd)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser OutputFile
pOutputFile
                        Parser
  (EpochNo
   -> [VerificationKeyFile]
   -> ProtocolParametersUpdate
   -> GovernanceCmd)
-> Parser EpochNo
-> Parser
     ([VerificationKeyFile]
      -> ProtocolParametersUpdate -> GovernanceCmd)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser EpochNo
pEpochNoUpdateProp
                        Parser
  ([VerificationKeyFile]
   -> ProtocolParametersUpdate -> GovernanceCmd)
-> Parser [VerificationKeyFile]
-> Parser (ProtocolParametersUpdate -> 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 -> GovernanceCmd)
-> Parser ProtocolParametersUpdate -> Parser GovernanceCmd
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ProtocolParametersUpdate
pProtocolParametersUpdate

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"
        (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

    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 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
          )

    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
          )

    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")
      )

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 (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.")
 where
   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 (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.")
 where
   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


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
      )
    )

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
        )
    )


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
    )


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
<$>
    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
"The output 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")
      )

pColdVerificationKeyOrFile :: Parser ColdVerificationKeyOrFile
pColdVerificationKeyOrFile :: Parser ColdVerificationKeyOrFile
pColdVerificationKeyOrFile =
  VerificationKey StakePoolKey -> ColdVerificationKeyOrFile
ColdStakePoolVerificationKey (VerificationKey StakePoolKey -> ColdVerificationKeyOrFile)
-> Parser (VerificationKey StakePoolKey)
-> Parser ColdVerificationKeyOrFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (VerificationKey StakePoolKey)
pStakePoolVerificationKey
    Parser ColdVerificationKeyOrFile
-> Parser ColdVerificationKeyOrFile
-> Parser ColdVerificationKeyOrFile
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> VerificationKey GenesisDelegateKey -> ColdVerificationKeyOrFile
ColdGenesisDelegateVerificationKey (VerificationKey GenesisDelegateKey -> ColdVerificationKeyOrFile)
-> Parser (VerificationKey GenesisDelegateKey)
-> Parser ColdVerificationKeyOrFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (VerificationKey GenesisDelegateKey)
pGenesisDelegateVerificationKey
    Parser ColdVerificationKeyOrFile
-> Parser ColdVerificationKeyOrFile
-> Parser ColdVerificationKeyOrFile
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> VerificationKeyFile -> ColdVerificationKeyOrFile
ColdVerificationKeyFile (VerificationKeyFile -> ColdVerificationKeyOrFile)
-> Parser VerificationKeyFile -> Parser ColdVerificationKeyOrFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser VerificationKeyFile
pColdVerificationKeyFile

pColdVerificationKeyFile :: Parser VerificationKeyFile
pColdVerificationKeyFile :: Parser VerificationKeyFile
pColdVerificationKeyFile =
  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
"cold-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 cold 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
        )
    )

pVerificationKey
  :: forall keyrole. SerialiseAsBech32 (VerificationKey keyrole)
  => AsType keyrole
  -> Parser (VerificationKey keyrole)
pVerificationKey :: AsType keyrole -> Parser (VerificationKey keyrole)
pVerificationKey AsType keyrole
asType =
  ReadM (VerificationKey keyrole)
-> Mod OptionFields (VerificationKey keyrole)
-> Parser (VerificationKey keyrole)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
    (AsType keyrole -> ReadM (VerificationKey keyrole)
forall keyrole.
SerialiseAsBech32 (VerificationKey keyrole) =>
AsType keyrole -> ReadM (VerificationKey keyrole)
readVerificationKey AsType keyrole
asType)
      (  String -> Mod OptionFields (VerificationKey keyrole)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"verification-key"
      Mod OptionFields (VerificationKey keyrole)
-> Mod OptionFields (VerificationKey keyrole)
-> Mod OptionFields (VerificationKey keyrole)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (VerificationKey keyrole)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"STRING"
      Mod OptionFields (VerificationKey keyrole)
-> Mod OptionFields (VerificationKey keyrole)
-> Mod OptionFields (VerificationKey keyrole)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (VerificationKey keyrole)
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Verification key (Bech32 or hex-encoded)."
      )

pVerificationKeyOrFile
  :: SerialiseAsBech32 (VerificationKey keyrole)
  => AsType keyrole
  -> Parser (VerificationKeyOrFile keyrole)
pVerificationKeyOrFile :: AsType keyrole -> Parser (VerificationKeyOrFile keyrole)
pVerificationKeyOrFile AsType keyrole
asType =
  VerificationKey keyrole -> VerificationKeyOrFile keyrole
forall keyrole.
VerificationKey keyrole -> VerificationKeyOrFile keyrole
VerificationKeyValue (VerificationKey keyrole -> VerificationKeyOrFile keyrole)
-> Parser (VerificationKey keyrole)
-> Parser (VerificationKeyOrFile keyrole)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AsType keyrole -> Parser (VerificationKey keyrole)
forall keyrole.
SerialiseAsBech32 (VerificationKey keyrole) =>
AsType keyrole -> Parser (VerificationKey keyrole)
pVerificationKey AsType keyrole
asType
    Parser (VerificationKeyOrFile keyrole)
-> Parser (VerificationKeyOrFile keyrole)
-> Parser (VerificationKeyOrFile keyrole)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> VerificationKeyFile -> VerificationKeyOrFile keyrole
forall keyrole.
VerificationKeyFile -> VerificationKeyOrFile keyrole
VerificationKeyFilePath (VerificationKeyFile -> VerificationKeyOrFile keyrole)
-> Parser VerificationKeyFile
-> Parser (VerificationKeyOrFile keyrole)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile FileDirection
Input

pVerificationKeyFile :: FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile :: FileDirection -> Parser VerificationKeyFile
pVerificationKeyFile FileDirection
fdir =
  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
"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 (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 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")
      )

pExtendedVerificationKeyFile :: FileDirection -> Parser VerificationKeyFile
pExtendedVerificationKeyFile :: FileDirection -> Parser VerificationKeyFile
pExtendedVerificationKeyFile FileDirection
fdir =
  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
"extended-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 (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 ed25519-bip32 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")
      )

pGenesisVerificationKeyFile :: Parser VerificationKeyFile
pGenesisVerificationKeyFile :: Parser VerificationKeyFile
pGenesisVerificationKeyFile =
  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
"genesis-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 genesis 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")
      )

pGenesisVerificationKeyHash :: Parser (Hash GenesisKey)
pGenesisVerificationKeyHash :: Parser (Hash GenesisKey)
pGenesisVerificationKeyHash =
    ReadM (Hash GenesisKey)
-> Mod OptionFields (Hash GenesisKey) -> Parser (Hash GenesisKey)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String (Hash GenesisKey))
-> ReadM (Hash GenesisKey)
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String (Hash GenesisKey)
deserialiseFromHex)
        (  String -> Mod OptionFields (Hash GenesisKey)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"genesis-verification-key-hash"
        Mod OptionFields (Hash GenesisKey)
-> Mod OptionFields (Hash GenesisKey)
-> Mod OptionFields (Hash GenesisKey)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (Hash GenesisKey)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"STRING"
        Mod OptionFields (Hash GenesisKey)
-> Mod OptionFields (Hash GenesisKey)
-> Mod OptionFields (Hash GenesisKey)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (Hash GenesisKey)
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Genesis verification key hash (hex-encoded)."
        )
  where
    deserialiseFromHex :: String -> Either String (Hash GenesisKey)
    deserialiseFromHex :: String -> Either String (Hash GenesisKey)
deserialiseFromHex =
      Either String (Hash GenesisKey)
-> (Hash GenesisKey -> Either String (Hash GenesisKey))
-> Maybe (Hash GenesisKey)
-> Either String (Hash GenesisKey)
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> Either String (Hash GenesisKey)
forall a b. a -> Either a b
Left String
"Invalid genesis verification key hash.") Hash GenesisKey -> Either String (Hash GenesisKey)
forall a b. b -> Either a b
Right
        (Maybe (Hash GenesisKey) -> Either String (Hash GenesisKey))
-> (String -> Maybe (Hash GenesisKey))
-> String
-> Either String (Hash GenesisKey)
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. AsType (Hash GenesisKey) -> ByteString -> Maybe (Hash GenesisKey)
forall a.
SerialiseAsRawBytes a =>
AsType a -> ByteString -> Maybe a
deserialiseFromRawBytesHex (AsType GenesisKey -> AsType (Hash GenesisKey)
forall a. AsType a -> AsType (Hash a)
AsHash AsType GenesisKey
AsGenesisKey)
        (ByteString -> Maybe (Hash GenesisKey))
-> (String -> ByteString) -> String -> Maybe (Hash GenesisKey)
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> ByteString
BSC.pack

pGenesisVerificationKey :: Parser (VerificationKey GenesisKey)
pGenesisVerificationKey :: Parser (VerificationKey GenesisKey)
pGenesisVerificationKey =
    ReadM (VerificationKey GenesisKey)
-> Mod OptionFields (VerificationKey GenesisKey)
-> Parser (VerificationKey GenesisKey)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String (VerificationKey GenesisKey))
-> ReadM (VerificationKey GenesisKey)
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String (VerificationKey GenesisKey)
deserialiseFromHex)
        (  String -> Mod OptionFields (VerificationKey GenesisKey)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"genesis-verification-key"
        Mod OptionFields (VerificationKey GenesisKey)
-> Mod OptionFields (VerificationKey GenesisKey)
-> Mod OptionFields (VerificationKey GenesisKey)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (VerificationKey GenesisKey)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"STRING"
        Mod OptionFields (VerificationKey GenesisKey)
-> Mod OptionFields (VerificationKey GenesisKey)
-> Mod OptionFields (VerificationKey GenesisKey)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (VerificationKey GenesisKey)
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Genesis verification key (hex-encoded)."
        )
  where
    deserialiseFromHex :: String -> Either String (VerificationKey GenesisKey)
    deserialiseFromHex :: String -> Either String (VerificationKey GenesisKey)
deserialiseFromHex =
      Either String (VerificationKey GenesisKey)
-> (VerificationKey GenesisKey
    -> Either String (VerificationKey GenesisKey))
-> Maybe (VerificationKey GenesisKey)
-> Either String (VerificationKey GenesisKey)
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> Either String (VerificationKey GenesisKey)
forall a b. a -> Either a b
Left String
"Invalid genesis verification key.") VerificationKey GenesisKey
-> Either String (VerificationKey GenesisKey)
forall a b. b -> Either a b
Right
        (Maybe (VerificationKey GenesisKey)
 -> Either String (VerificationKey GenesisKey))
-> (String -> Maybe (VerificationKey GenesisKey))
-> String
-> Either String (VerificationKey GenesisKey)
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. AsType (VerificationKey GenesisKey)
-> ByteString -> Maybe (VerificationKey GenesisKey)
forall a.
SerialiseAsRawBytes a =>
AsType a -> ByteString -> Maybe a
deserialiseFromRawBytesHex (AsType GenesisKey -> AsType (VerificationKey GenesisKey)
forall a. AsType a -> AsType (VerificationKey a)
AsVerificationKey AsType GenesisKey
AsGenesisKey)
        (ByteString -> Maybe (VerificationKey GenesisKey))
-> (String -> ByteString)
-> String
-> Maybe (VerificationKey GenesisKey)
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> ByteString
BSC.pack

pGenesisVerificationKeyOrFile :: Parser (VerificationKeyOrFile GenesisKey)
pGenesisVerificationKeyOrFile :: Parser (VerificationKeyOrFile GenesisKey)
pGenesisVerificationKeyOrFile =
  VerificationKey GenesisKey -> VerificationKeyOrFile GenesisKey
forall keyrole.
VerificationKey keyrole -> VerificationKeyOrFile keyrole
VerificationKeyValue (VerificationKey GenesisKey -> VerificationKeyOrFile GenesisKey)
-> Parser (VerificationKey GenesisKey)
-> Parser (VerificationKeyOrFile GenesisKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (VerificationKey GenesisKey)
pGenesisVerificationKey
    Parser (VerificationKeyOrFile GenesisKey)
-> Parser (VerificationKeyOrFile GenesisKey)
-> Parser (VerificationKeyOrFile GenesisKey)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> VerificationKeyFile -> VerificationKeyOrFile GenesisKey
forall keyrole.
VerificationKeyFile -> VerificationKeyOrFile keyrole
VerificationKeyFilePath (VerificationKeyFile -> VerificationKeyOrFile GenesisKey)
-> Parser VerificationKeyFile
-> Parser (VerificationKeyOrFile GenesisKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser VerificationKeyFile
pGenesisVerificationKeyFile

pGenesisVerificationKeyOrHashOrFile :: Parser (VerificationKeyOrHashOrFile GenesisKey)
pGenesisVerificationKeyOrHashOrFile :: Parser (VerificationKeyOrHashOrFile GenesisKey)
pGenesisVerificationKeyOrHashOrFile =
  VerificationKeyOrFile GenesisKey
-> VerificationKeyOrHashOrFile GenesisKey
forall keyrole.
VerificationKeyOrFile keyrole
-> VerificationKeyOrHashOrFile keyrole
VerificationKeyOrFile (VerificationKeyOrFile GenesisKey
 -> VerificationKeyOrHashOrFile GenesisKey)
-> Parser (VerificationKeyOrFile GenesisKey)
-> Parser (VerificationKeyOrHashOrFile GenesisKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (VerificationKeyOrFile GenesisKey)
pGenesisVerificationKeyOrFile
    Parser (VerificationKeyOrHashOrFile GenesisKey)
-> Parser (VerificationKeyOrHashOrFile GenesisKey)
-> Parser (VerificationKeyOrHashOrFile GenesisKey)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Hash GenesisKey -> VerificationKeyOrHashOrFile GenesisKey
forall keyrole. Hash keyrole -> VerificationKeyOrHashOrFile keyrole
VerificationKeyHash (Hash GenesisKey -> VerificationKeyOrHashOrFile GenesisKey)
-> Parser (Hash GenesisKey)
-> Parser (VerificationKeyOrHashOrFile GenesisKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (Hash GenesisKey)
pGenesisVerificationKeyHash

pGenesisDelegateVerificationKeyFile :: Parser VerificationKeyFile
pGenesisDelegateVerificationKeyFile :: Parser VerificationKeyFile
pGenesisDelegateVerificationKeyFile =
  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
"genesis-delegate-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 genesis delegate 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")
      )

pGenesisDelegateVerificationKeyHash :: Parser (Hash GenesisDelegateKey)
pGenesisDelegateVerificationKeyHash :: Parser (Hash GenesisDelegateKey)
pGenesisDelegateVerificationKeyHash =
    ReadM (Hash GenesisDelegateKey)
-> Mod OptionFields (Hash GenesisDelegateKey)
-> Parser (Hash GenesisDelegateKey)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String (Hash GenesisDelegateKey))
-> ReadM (Hash GenesisDelegateKey)
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String (Hash GenesisDelegateKey)
deserialiseFromHex)
        (  String -> Mod OptionFields (Hash GenesisDelegateKey)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"genesis-delegate-verification-key-hash"
        Mod OptionFields (Hash GenesisDelegateKey)
-> Mod OptionFields (Hash GenesisDelegateKey)
-> Mod OptionFields (Hash GenesisDelegateKey)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (Hash GenesisDelegateKey)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"STRING"
        Mod OptionFields (Hash GenesisDelegateKey)
-> Mod OptionFields (Hash GenesisDelegateKey)
-> Mod OptionFields (Hash GenesisDelegateKey)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (Hash GenesisDelegateKey)
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Genesis delegate verification key hash (hex-encoded)."
        )
  where
    deserialiseFromHex :: String -> Either String (Hash GenesisDelegateKey)
    deserialiseFromHex :: String -> Either String (Hash GenesisDelegateKey)
deserialiseFromHex =
      Either String (Hash GenesisDelegateKey)
-> (Hash GenesisDelegateKey
    -> Either String (Hash GenesisDelegateKey))
-> Maybe (Hash GenesisDelegateKey)
-> Either String (Hash GenesisDelegateKey)
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> Either String (Hash GenesisDelegateKey)
forall a b. a -> Either a b
Left String
"Invalid genesis delegate verification key hash.") Hash GenesisDelegateKey -> Either String (Hash GenesisDelegateKey)
forall a b. b -> Either a b
Right
        (Maybe (Hash GenesisDelegateKey)
 -> Either String (Hash GenesisDelegateKey))
-> (String -> Maybe (Hash GenesisDelegateKey))
-> String
-> Either String (Hash GenesisDelegateKey)
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. AsType (Hash GenesisDelegateKey)
-> ByteString -> Maybe (Hash GenesisDelegateKey)
forall a.
SerialiseAsRawBytes a =>
AsType a -> ByteString -> Maybe a
deserialiseFromRawBytesHex (AsType GenesisDelegateKey -> AsType (Hash GenesisDelegateKey)
forall a. AsType a -> AsType (Hash a)
AsHash AsType GenesisDelegateKey
AsGenesisDelegateKey)
        (ByteString -> Maybe (Hash GenesisDelegateKey))
-> (String -> ByteString)
-> String
-> Maybe (Hash GenesisDelegateKey)
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> ByteString
BSC.pack

pGenesisDelegateVerificationKey :: Parser (VerificationKey GenesisDelegateKey)
pGenesisDelegateVerificationKey :: Parser (VerificationKey GenesisDelegateKey)
pGenesisDelegateVerificationKey =
    ReadM (VerificationKey GenesisDelegateKey)
-> Mod OptionFields (VerificationKey GenesisDelegateKey)
-> Parser (VerificationKey GenesisDelegateKey)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String (VerificationKey GenesisDelegateKey))
-> ReadM (VerificationKey GenesisDelegateKey)
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String (VerificationKey GenesisDelegateKey)
deserialiseFromHex)
        (  String -> Mod OptionFields (VerificationKey GenesisDelegateKey)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"genesis-delegate-verification-key"
        Mod OptionFields (VerificationKey GenesisDelegateKey)
-> Mod OptionFields (VerificationKey GenesisDelegateKey)
-> Mod OptionFields (VerificationKey GenesisDelegateKey)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (VerificationKey GenesisDelegateKey)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"STRING"
        Mod OptionFields (VerificationKey GenesisDelegateKey)
-> Mod OptionFields (VerificationKey GenesisDelegateKey)
-> Mod OptionFields (VerificationKey GenesisDelegateKey)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (VerificationKey GenesisDelegateKey)
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Genesis delegate verification key (hex-encoded)."
        )
  where
    deserialiseFromHex
      :: String
      -> Either String (VerificationKey GenesisDelegateKey)
    deserialiseFromHex :: String -> Either String (VerificationKey GenesisDelegateKey)
deserialiseFromHex =
      Either String (VerificationKey GenesisDelegateKey)
-> (VerificationKey GenesisDelegateKey
    -> Either String (VerificationKey GenesisDelegateKey))
-> Maybe (VerificationKey GenesisDelegateKey)
-> Either String (VerificationKey GenesisDelegateKey)
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> Either String (VerificationKey GenesisDelegateKey)
forall a b. a -> Either a b
Left String
"Invalid genesis delegate verification key.") VerificationKey GenesisDelegateKey
-> Either String (VerificationKey GenesisDelegateKey)
forall a b. b -> Either a b
Right
        (Maybe (VerificationKey GenesisDelegateKey)
 -> Either String (VerificationKey GenesisDelegateKey))
-> (String -> Maybe (VerificationKey GenesisDelegateKey))
-> String
-> Either String (VerificationKey GenesisDelegateKey)
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. AsType (VerificationKey GenesisDelegateKey)
-> ByteString -> Maybe (VerificationKey GenesisDelegateKey)
forall a.
SerialiseAsRawBytes a =>
AsType a -> ByteString -> Maybe a
deserialiseFromRawBytesHex (AsType GenesisDelegateKey
-> AsType (VerificationKey GenesisDelegateKey)
forall a. AsType a -> AsType (VerificationKey a)
AsVerificationKey AsType GenesisDelegateKey
AsGenesisDelegateKey)
        (ByteString -> Maybe (VerificationKey GenesisDelegateKey))
-> (String -> ByteString)
-> String
-> Maybe (VerificationKey GenesisDelegateKey)
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> ByteString
BSC.pack

pGenesisDelegateVerificationKeyOrFile
  :: Parser (VerificationKeyOrFile GenesisDelegateKey)
pGenesisDelegateVerificationKeyOrFile :: Parser (VerificationKeyOrFile GenesisDelegateKey)
pGenesisDelegateVerificationKeyOrFile =
  VerificationKey GenesisDelegateKey
-> VerificationKeyOrFile GenesisDelegateKey
forall keyrole.
VerificationKey keyrole -> VerificationKeyOrFile keyrole
VerificationKeyValue (VerificationKey GenesisDelegateKey
 -> VerificationKeyOrFile GenesisDelegateKey)
-> Parser (VerificationKey GenesisDelegateKey)
-> Parser (VerificationKeyOrFile GenesisDelegateKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (VerificationKey GenesisDelegateKey)
pGenesisDelegateVerificationKey
    Parser (VerificationKeyOrFile GenesisDelegateKey)
-> Parser (VerificationKeyOrFile GenesisDelegateKey)
-> Parser (VerificationKeyOrFile GenesisDelegateKey)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> VerificationKeyFile -> VerificationKeyOrFile GenesisDelegateKey
forall keyrole.
VerificationKeyFile -> VerificationKeyOrFile keyrole
VerificationKeyFilePath (VerificationKeyFile -> VerificationKeyOrFile GenesisDelegateKey)
-> Parser VerificationKeyFile
-> Parser (VerificationKeyOrFile GenesisDelegateKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser VerificationKeyFile
pGenesisDelegateVerificationKeyFile

pGenesisDelegateVerificationKeyOrHashOrFile
  :: Parser (VerificationKeyOrHashOrFile GenesisDelegateKey)
pGenesisDelegateVerificationKeyOrHashOrFile :: Parser (VerificationKeyOrHashOrFile GenesisDelegateKey)
pGenesisDelegateVerificationKeyOrHashOrFile =
  VerificationKeyOrFile GenesisDelegateKey
-> VerificationKeyOrHashOrFile GenesisDelegateKey
forall keyrole.
VerificationKeyOrFile keyrole
-> VerificationKeyOrHashOrFile keyrole
VerificationKeyOrFile (VerificationKeyOrFile GenesisDelegateKey
 -> VerificationKeyOrHashOrFile GenesisDelegateKey)
-> Parser (VerificationKeyOrFile GenesisDelegateKey)
-> Parser (VerificationKeyOrHashOrFile GenesisDelegateKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (VerificationKeyOrFile GenesisDelegateKey)
pGenesisDelegateVerificationKeyOrFile
    Parser (VerificationKeyOrHashOrFile GenesisDelegateKey)
-> Parser (VerificationKeyOrHashOrFile GenesisDelegateKey)
-> Parser (VerificationKeyOrHashOrFile GenesisDelegateKey)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Hash GenesisDelegateKey
-> VerificationKeyOrHashOrFile GenesisDelegateKey
forall keyrole. Hash keyrole -> VerificationKeyOrHashOrFile keyrole
VerificationKeyHash (Hash GenesisDelegateKey
 -> VerificationKeyOrHashOrFile GenesisDelegateKey)
-> Parser (Hash GenesisDelegateKey)
-> Parser (VerificationKeyOrHashOrFile GenesisDelegateKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (Hash GenesisDelegateKey)
pGenesisDelegateVerificationKeyHash

pKesVerificationKeyOrFile :: Parser (VerificationKeyOrFile KesKey)
pKesVerificationKeyOrFile :: Parser (VerificationKeyOrFile KesKey)
pKesVerificationKeyOrFile =
  VerificationKey KesKey -> VerificationKeyOrFile KesKey
forall keyrole.
VerificationKey keyrole -> VerificationKeyOrFile keyrole
VerificationKeyValue (VerificationKey KesKey -> VerificationKeyOrFile KesKey)
-> Parser (VerificationKey KesKey)
-> Parser (VerificationKeyOrFile KesKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (VerificationKey KesKey)
pKesVerificationKey
    Parser (VerificationKeyOrFile KesKey)
-> Parser (VerificationKeyOrFile KesKey)
-> Parser (VerificationKeyOrFile KesKey)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> VerificationKeyFile -> VerificationKeyOrFile KesKey
forall keyrole.
VerificationKeyFile -> VerificationKeyOrFile keyrole
VerificationKeyFilePath (VerificationKeyFile -> VerificationKeyOrFile KesKey)
-> Parser VerificationKeyFile
-> Parser (VerificationKeyOrFile KesKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser VerificationKeyFile
pKesVerificationKeyFile

pKesVerificationKey :: Parser (VerificationKey KesKey)
pKesVerificationKey :: Parser (VerificationKey KesKey)
pKesVerificationKey =
    ReadM (VerificationKey KesKey)
-> Mod OptionFields (VerificationKey KesKey)
-> Parser (VerificationKey KesKey)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
      ((String -> Either String (VerificationKey KesKey))
-> ReadM (VerificationKey KesKey)
forall a. (String -> Either String a) -> ReadM a
Opt.eitherReader String -> Either String (VerificationKey KesKey)
deserialiseVerKey)
        (  String -> Mod OptionFields (VerificationKey KesKey)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"kes-verification-key"
        Mod OptionFields (VerificationKey KesKey)
-> Mod OptionFields (VerificationKey KesKey)
-> Mod OptionFields (VerificationKey KesKey)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (VerificationKey KesKey)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"STRING"
        Mod OptionFields (VerificationKey KesKey)
-> Mod OptionFields (VerificationKey KesKey)
-> Mod OptionFields (VerificationKey KesKey)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (VerificationKey KesKey)
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"A Bech32 or hex-encoded hot KES verification key."
        )
  where
    asType :: AsType (VerificationKey KesKey)
    asType :: AsType (VerificationKey KesKey)
asType = AsType KesKey -> AsType (VerificationKey KesKey)
forall a. AsType a -> AsType (VerificationKey a)
AsVerificationKey AsType KesKey
AsKesKey

    deserialiseVerKey :: String -> Either String (VerificationKey KesKey)
    deserialiseVerKey :: String -> Either String (VerificationKey KesKey)
deserialiseVerKey String
str =
      case AsType (VerificationKey KesKey)
-> Text -> Either Bech32DecodeError (VerificationKey KesKey)
forall a.
SerialiseAsBech32 a =>
AsType a -> Text -> Either Bech32DecodeError a
deserialiseFromBech32 AsType (VerificationKey KesKey)
asType (String -> Text
Text.pack String
str) of
        Right VerificationKey KesKey
res -> VerificationKey KesKey -> Either String (VerificationKey KesKey)
forall a b. b -> Either a b
Right VerificationKey KesKey
res

        -- The input was valid Bech32, but some other error occurred.
        Left err :: Bech32DecodeError
err@(Bech32UnexpectedPrefix Text
_ Set Text
_) -> String -> Either String (VerificationKey KesKey)
forall a b. a -> Either a b
Left (Bech32DecodeError -> String
forall e. Error e => e -> String
displayError Bech32DecodeError
err)
        Left err :: Bech32DecodeError
err@(Bech32DataPartToBytesError Text
_) -> String -> Either String (VerificationKey KesKey)
forall a b. a -> Either a b
Left (Bech32DecodeError -> String
forall e. Error e => e -> String
displayError Bech32DecodeError
err)
        Left err :: Bech32DecodeError
err@(Bech32DeserialiseFromBytesError ByteString
_) -> String -> Either String (VerificationKey KesKey)
forall a b. a -> Either a b
Left (Bech32DecodeError -> String
forall e. Error e => e -> String
displayError Bech32DecodeError
err)
        Left err :: Bech32DecodeError
err@(Bech32WrongPrefix Text
_ Text
_) -> String -> Either String (VerificationKey KesKey)
forall a b. a -> Either a b
Left (Bech32DecodeError -> String
forall e. Error e => e -> String
displayError Bech32DecodeError
err)

        -- The input was not valid Bech32. Attempt to deserialise it as hex.
        Left (Bech32DecodingError DecodingError
_) ->
          case AsType (VerificationKey KesKey)
-> ByteString -> Maybe (VerificationKey KesKey)
forall a.
SerialiseAsRawBytes a =>
AsType a -> ByteString -> Maybe a
deserialiseFromRawBytesHex AsType (VerificationKey KesKey)
asType (String -> ByteString
BSC.pack String
str) of
            Just VerificationKey KesKey
res' -> VerificationKey KesKey -> Either String (VerificationKey KesKey)
forall a b. b -> Either a b
Right VerificationKey KesKey
res'
            Maybe (VerificationKey KesKey)
Nothing -> String -> Either String (VerificationKey KesKey)
forall a b. a -> Either a b
Left String
"Invalid stake pool verification key."

pKesVerificationKeyFile :: Parser VerificationKeyFile
pKesVerificationKeyFile :: Parser VerificationKeyFile
pKesVerificationKeyFile =
  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
"kes-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 hot KES 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
"hot-kes-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
        )
    )

pNetworkId :: Parser NetworkId
pNetworkId :: Parser NetworkId
pNetworkId =
  Parser NetworkId
pMainnet Parser NetworkId -> Parser NetworkId -> Parser NetworkId
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (NetworkMagic -> NetworkId)
-> Parser NetworkMagic -> Parser NetworkId
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap NetworkMagic -> NetworkId
Testnet Parser NetworkMagic
pTestnetMagic
 where
   pMainnet :: Parser NetworkId
   pMainnet :: Parser NetworkId
pMainnet =
    NetworkId -> Mod FlagFields NetworkId -> Parser NetworkId
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' NetworkId
Mainnet
      (  String -> Mod FlagFields NetworkId
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"mainnet"
      Mod FlagFields NetworkId
-> Mod FlagFields NetworkId -> Mod FlagFields NetworkId
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields NetworkId
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Use the mainnet magic id."
      )

pTestnetMagic :: Parser NetworkMagic
pTestnetMagic :: Parser NetworkMagic
pTestnetMagic =
  Word32 -> NetworkMagic
NetworkMagic (Word32 -> NetworkMagic) -> Parser Word32 -> Parser NetworkMagic
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
    ReadM Word32 -> Mod OptionFields Word32 -> Parser Word32
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Word32
forall a. Read a => ReadM a
Opt.auto
      (  String -> Mod OptionFields Word32
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"testnet-magic"
      Mod OptionFields Word32
-> Mod OptionFields Word32 -> Mod OptionFields Word32
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word32
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"NATURAL"
      Mod OptionFields Word32
-> Mod OptionFields Word32 -> Mod OptionFields Word32
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Word32
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Specify a testnet magic id."
      )

pTxSubmitFile :: Parser FilePath
pTxSubmitFile :: Parser String
pTxSubmitFile =
  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
"tx-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 transaction you intend to submit."
    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")
    )

pCardanoEra :: Parser AnyCardanoEra
pCardanoEra :: Parser AnyCardanoEra
pCardanoEra = [Parser AnyCardanoEra] -> Parser AnyCardanoEra
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
  [ AnyCardanoEra
-> Mod FlagFields AnyCardanoEra -> Parser AnyCardanoEra
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' (CardanoEra ByronEra -> AnyCardanoEra
forall era. IsCardanoEra era => CardanoEra era -> AnyCardanoEra
AnyCardanoEra CardanoEra ByronEra
ByronEra)
      (  String -> Mod FlagFields AnyCardanoEra
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"byron-era"
      Mod FlagFields AnyCardanoEra
-> Mod FlagFields AnyCardanoEra -> Mod FlagFields AnyCardanoEra
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields AnyCardanoEra
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Specify the Byron era"
      )
  , AnyCardanoEra
-> Mod FlagFields AnyCardanoEra -> Parser AnyCardanoEra
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' (CardanoEra ShelleyEra -> AnyCardanoEra
forall era. IsCardanoEra era => CardanoEra era -> AnyCardanoEra
AnyCardanoEra CardanoEra ShelleyEra
ShelleyEra)
      (  String -> Mod FlagFields AnyCardanoEra
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"shelley-era"
      Mod FlagFields AnyCardanoEra
-> Mod FlagFields AnyCardanoEra -> Mod FlagFields AnyCardanoEra
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields AnyCardanoEra
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Specify the Shelley era"
      )
  , AnyCardanoEra
-> Mod FlagFields AnyCardanoEra -> Parser AnyCardanoEra
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' (CardanoEra AllegraEra -> AnyCardanoEra
forall era. IsCardanoEra era => CardanoEra era -> AnyCardanoEra
AnyCardanoEra CardanoEra AllegraEra
AllegraEra)
      (  String -> Mod FlagFields AnyCardanoEra
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"allegra-era"
      Mod FlagFields AnyCardanoEra
-> Mod FlagFields AnyCardanoEra -> Mod FlagFields AnyCardanoEra
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields AnyCardanoEra
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Specify the Allegra era"
      )
  , AnyCardanoEra
-> Mod FlagFields AnyCardanoEra -> Parser AnyCardanoEra
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' (CardanoEra MaryEra -> AnyCardanoEra
forall era. IsCardanoEra era => CardanoEra era -> AnyCardanoEra
AnyCardanoEra CardanoEra MaryEra
MaryEra)
      (  String -> Mod FlagFields AnyCardanoEra
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"mary-era"
      Mod FlagFields AnyCardanoEra
-> Mod FlagFields AnyCardanoEra -> Mod FlagFields AnyCardanoEra
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields AnyCardanoEra
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Specify the Mary era (default)"
      )
  , AnyCardanoEra
-> Mod FlagFields AnyCardanoEra -> Parser AnyCardanoEra
forall a. a -> Mod FlagFields a -> Parser a
Opt.flag' (CardanoEra AlonzoEra -> AnyCardanoEra
forall era. IsCardanoEra era => CardanoEra era -> AnyCardanoEra
AnyCardanoEra CardanoEra AlonzoEra
AlonzoEra)
      (  String -> Mod FlagFields AnyCardanoEra
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"alonzo-era"
      Mod FlagFields AnyCardanoEra
-> Mod FlagFields AnyCardanoEra -> Mod FlagFields AnyCardanoEra
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields AnyCardanoEra
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Specify the Alonzo era"
      )

    -- Default for now:
  , AnyCardanoEra -> Parser AnyCardanoEra
forall (f :: * -> *) a. Applicative f => a -> f a
pure (CardanoEra MaryEra -> AnyCardanoEra
forall era. IsCardanoEra era => CardanoEra era -> AnyCardanoEra
AnyCardanoEra CardanoEra MaryEra
MaryEra)
  ]

pTxIn :: BalanceTxExecUnits
      -> Parser (TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))
pTxIn :: BalanceTxExecUnits
-> Parser (TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))
pTxIn BalanceTxExecUnits
balance =
     (,) (TxIn
 -> Maybe (ScriptWitnessFiles WitCtxTxIn)
 -> (TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn)))
-> Parser TxIn
-> Parser
     (Maybe (ScriptWitnessFiles WitCtxTxIn)
      -> (TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> 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
"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. 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"
               )
         Parser
  (Maybe (ScriptWitnessFiles WitCtxTxIn)
   -> (TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn)))
-> Parser (Maybe (ScriptWitnessFiles WitCtxTxIn))
-> Parser (TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (ScriptWitnessFiles WitCtxTxIn)
-> Parser (Maybe (ScriptWitnessFiles WitCtxTxIn))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (WitCtx WitCtxTxIn
-> BalanceTxExecUnits
-> String
-> Maybe String
-> String
-> Parser (ScriptWitnessFiles WitCtxTxIn)
forall witctx.
WitCtx witctx
-> BalanceTxExecUnits
-> String
-> Maybe String
-> String
-> Parser (ScriptWitnessFiles witctx)
pScriptWitnessFiles
                         WitCtx WitCtxTxIn
WitCtxTxIn
                         BalanceTxExecUnits
balance
                         String
"tx-in" (String -> Maybe String
forall a. a -> Maybe a
Just String
"txin")
                         String
"the spending of the transaction input.")

pTxInCollateral :: Parser TxIn
pTxInCollateral :: Parser TxIn
pTxInCollateral =
    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
"tx-in-collateral"
      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"
      )

pWitnessOverride :: Parser Word
pWitnessOverride :: Parser Word
pWitnessOverride = 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
"witness-override"
  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
"WORD"
  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
"Specify and override the number of \
              \witnesses the transaction requires."
  )

parseTxIn :: Parsec.Parser TxIn
parseTxIn :: Parser TxIn
parseTxIn = TxId -> TxIx -> TxIn
TxIn (TxId -> TxIx -> TxIn)
-> ParsecT String () Identity TxId
-> ParsecT String () Identity (TxIx -> TxIn)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT String () Identity TxId
parseTxId ParsecT String () Identity (TxIx -> TxIn)
-> ParsecT String () Identity TxIx -> Parser TxIn
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (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 Char
-> ParsecT String () Identity TxIx
-> ParsecT String () Identity TxIx
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ParsecT String () Identity TxIx
parseTxIx)

renderTxIn :: TxIn -> Text
renderTxIn :: TxIn -> Text
renderTxIn (TxIn TxId
txid (TxIx Word
txix)) =
  [Text] -> Text
forall a. Monoid a => [a] -> a
mconcat
    [ TxId -> Text
forall a. SerialiseAsRawBytes a => a -> Text
serialiseToRawBytesHexText TxId
txid
    , Text
"#"
    , String -> Text
Text.pack (Word -> String
forall a b. (Show a, ConvertText String b) => a -> b
show Word
txix)
    ]

parseTxId :: Parsec.Parser TxId
parseTxId :: ParsecT String () Identity TxId
parseTxId = do
  String
str <- ParsecT String () Identity Char
-> ParsecT String () Identity String
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
Parsec.many1 ParsecT String () Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
Parsec.hexDigit ParsecT String () Identity String
-> String -> ParsecT String () Identity String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
Parsec.<?> String
"transaction id (hexadecimal)"
  case AsType TxId -> ByteString -> Maybe TxId
forall a.
SerialiseAsRawBytes a =>
AsType a -> ByteString -> Maybe a
deserialiseFromRawBytesHex AsType TxId
AsTxId (String -> ByteString
BSC.pack String
str) of
    Just TxId
addr -> TxId -> ParsecT String () Identity TxId
forall (m :: * -> *) a. Monad m => a -> m a
return TxId
addr
    Maybe TxId
Nothing -> String -> ParsecT String () Identity TxId
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> ParsecT String () Identity TxId)
-> String -> ParsecT String () Identity TxId
forall a b. (a -> b) -> a -> b
$ String
"Incorrect transaction id format:: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> String
forall a b. (Show a, ConvertText String b) => a -> b
show String
str

parseTxIx :: Parsec.Parser TxIx
parseTxIx :: ParsecT String () Identity TxIx
parseTxIx = Word -> TxIx
TxIx (Word -> TxIx) -> (Integer -> Word) -> Integer -> TxIx
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Integer -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Integer -> TxIx)
-> ParsecT String () Identity Integer
-> ParsecT String () Identity TxIx
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT String () Identity Integer
decimal


pTxOut :: Parser TxOutAnyEra
pTxOut :: Parser TxOutAnyEra
pTxOut =
        ReadM (Maybe (Hash ScriptData) -> TxOutAnyEra)
-> Mod OptionFields (Maybe (Hash ScriptData) -> TxOutAnyEra)
-> Parser (Maybe (Hash ScriptData) -> TxOutAnyEra)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option (Parser (Maybe (Hash ScriptData) -> TxOutAnyEra)
-> ReadM (Maybe (Hash ScriptData) -> TxOutAnyEra)
forall a. Parser a -> ReadM a
readerFromParsecParser Parser (Maybe (Hash ScriptData) -> TxOutAnyEra)
parseTxOutAnyEra)
          (  String -> Mod OptionFields (Maybe (Hash ScriptData) -> TxOutAnyEra)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"tx-out"
          Mod OptionFields (Maybe (Hash ScriptData) -> TxOutAnyEra)
-> Mod OptionFields (Maybe (Hash ScriptData) -> TxOutAnyEra)
-> Mod OptionFields (Maybe (Hash ScriptData) -> TxOutAnyEra)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (Maybe (Hash ScriptData) -> TxOutAnyEra)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"ADDRESS VALUE"
          -- TODO alonzo: Update the help text to describe the new syntax as well.
          Mod OptionFields (Maybe (Hash ScriptData) -> TxOutAnyEra)
-> Mod OptionFields (Maybe (Hash ScriptData) -> TxOutAnyEra)
-> Mod OptionFields (Maybe (Hash ScriptData) -> TxOutAnyEra)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (Maybe (Hash ScriptData) -> TxOutAnyEra)
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"The transaction output as Address+Lovelace where Address is \
                      \the Bech32-encoded address followed by the amount in \
                      \Lovelace."
          )
    Parser (Maybe (Hash ScriptData) -> TxOutAnyEra)
-> Parser (Maybe (Hash ScriptData)) -> Parser TxOutAnyEra
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Hash ScriptData) -> Parser (Maybe (Hash ScriptData))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser (Hash ScriptData)
pDatumHash


pDatumHash :: Parser (Hash ScriptData)
pDatumHash :: Parser (Hash ScriptData)
pDatumHash  =
  ReadM (Hash ScriptData)
-> Mod OptionFields (Hash ScriptData) -> Parser (Hash ScriptData)
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option (Parser (Hash ScriptData) -> ReadM (Hash ScriptData)
forall a. Parser a -> ReadM a
readerFromParsecParser Parser (Hash ScriptData)
parseHashScriptData)
    (  String -> Mod OptionFields (Hash ScriptData)
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"tx-out-datum-hash"
    Mod OptionFields (Hash ScriptData)
-> Mod OptionFields (Hash ScriptData)
-> Mod OptionFields (Hash ScriptData)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (Hash ScriptData)
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"HASH"
    Mod OptionFields (Hash ScriptData)
-> Mod OptionFields (Hash ScriptData)
-> Mod OptionFields (Hash ScriptData)
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields (Hash ScriptData)
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Required datum hash for tx inputs intended \
               \to be utilizied by a Plutus script."
    )
  where
    parseHashScriptData :: Parsec.Parser (Hash ScriptData)
    parseHashScriptData :: Parser (Hash ScriptData)
parseHashScriptData = do
      String
str <- ParsecT String () Identity Char
-> ParsecT String () Identity String
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
Parsec.many1 ParsecT String () Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
Parsec.hexDigit ParsecT String () Identity String
-> String -> ParsecT String () Identity String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
Parsec.<?> String
"script data hash"
      case AsType (Hash ScriptData) -> ByteString -> Maybe (Hash ScriptData)
forall a.
SerialiseAsRawBytes a =>
AsType a -> ByteString -> Maybe a
deserialiseFromRawBytesHex (AsType ScriptData -> AsType (Hash ScriptData)
forall a. AsType a -> AsType (Hash a)
AsHash AsType ScriptData
AsScriptData) (String -> ByteString
BSC.pack String
str) of
        Just Hash ScriptData
sdh -> Hash ScriptData -> Parser (Hash ScriptData)
forall (m :: * -> *) a. Monad m => a -> m a
return Hash ScriptData
sdh
        Maybe (Hash ScriptData)
Nothing  -> String -> Parser (Hash ScriptData)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Parser (Hash ScriptData))
-> String -> Parser (Hash ScriptData)
forall a b. (a -> b) -> a -> b
$ String
"Invalid datum hash: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> String
forall a b. (Show a, ConvertText String b) => a -> b
show String
str


pMultiAsset :: Parser Value
pMultiAsset :: Parser Value
pMultiAsset =
  ReadM Value -> Mod OptionFields Value -> Parser Value
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
    (Parser Value -> ReadM Value
forall a. Parser a -> ReadM a
readerFromParsecParser Parser Value
parseValue)
      (  String -> Mod OptionFields Value
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"multi-asset"
      Mod OptionFields Value
-> Mod OptionFields Value -> Mod OptionFields Value
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Value
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"VALUE"
      Mod OptionFields Value
-> Mod OptionFields Value -> Mod OptionFields Value
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Value
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"Multi-asset value(s) with the multi-asset cli syntax"
      )

pMintMultiAsset
  :: BalanceTxExecUnits
  -> Parser (Value, [ScriptWitnessFiles WitCtxMint])
pMintMultiAsset :: BalanceTxExecUnits
-> Parser (Value, [ScriptWitnessFiles WitCtxMint])
pMintMultiAsset BalanceTxExecUnits
balanceExecUnits =
  (,) (Value
 -> [ScriptWitnessFiles WitCtxMint]
 -> (Value, [ScriptWitnessFiles WitCtxMint]))
-> Parser Value
-> Parser
     ([ScriptWitnessFiles WitCtxMint]
      -> (Value, [ScriptWitnessFiles WitCtxMint]))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Value -> Mod OptionFields Value -> Parser Value
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option
            (Parser Value -> ReadM Value
forall a. Parser a -> ReadM a
readerFromParsecParser Parser Value
parseValue)
              (  String -> Mod OptionFields Value
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"mint"
              Mod OptionFields Value
-> Mod OptionFields Value -> Mod OptionFields Value
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Value
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"VALUE"
              Mod OptionFields Value
-> Mod OptionFields Value -> Mod OptionFields Value
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Value
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
helpText
              )
      Parser
  ([ScriptWitnessFiles WitCtxMint]
   -> (Value, [ScriptWitnessFiles WitCtxMint]))
-> Parser [ScriptWitnessFiles WitCtxMint]
-> Parser (Value, [ScriptWitnessFiles WitCtxMint])
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (ScriptWitnessFiles WitCtxMint)
-> Parser [ScriptWitnessFiles WitCtxMint]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some (WitCtx WitCtxMint
-> BalanceTxExecUnits
-> String
-> Maybe String
-> String
-> Parser (ScriptWitnessFiles WitCtxMint)
forall witctx.
WitCtx witctx
-> BalanceTxExecUnits
-> String
-> Maybe String
-> String
-> Parser (ScriptWitnessFiles witctx)
pScriptWitnessFiles
                  WitCtx WitCtxMint
WitCtxMint
                  BalanceTxExecUnits
balanceExecUnits
                  String
"mint" (String -> Maybe String
forall a. a -> Maybe a
Just String
"minting")
                  String
"the minting of assets for a particular policy Id."
               )
 where
   helpText :: String
helpText = String
"Mint multi-asset value(s) with the multi-asset cli syntax. \
               \You must specifiy a script witness."

pInvalidBefore :: Parser SlotNo
pInvalidBefore :: Parser SlotNo
pInvalidBefore =
  Word64 -> SlotNo
SlotNo (Word64 -> SlotNo) -> Parser Word64 -> Parser SlotNo
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
"invalid-before"
       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
"SLOT"
       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
"Time that transaction is valid from (in slots)."
       )
    Parser Word64 -> Parser Word64 -> Parser Word64
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
      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
"lower-bound"
        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
"SLOT"
        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
"Time that transaction is valid from (in slots) \
                    \(deprecated; use --invalid-before instead)."
        Mod OptionFields Word64
-> Mod OptionFields Word64 -> Mod OptionFields Word64
forall a. Semigroup a => a -> a -> a
<> Mod OptionFields Word64
forall (f :: * -> *) a. Mod f a
Opt.internal
        )
    )

pInvalidHereafter :: Parser SlotNo
pInvalidHereafter :: Parser SlotNo
pInvalidHereafter =
  Word64 -> SlotNo
SlotNo (Word64 -> SlotNo) -> Parser Word64 -> Parser SlotNo
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
"invalid-hereafter"
        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
"SLOT"
        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
"Time that transaction is valid until (in slots)."
        )
    Parser Word64 -> Parser Word64 -> Parser Word64
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
      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
"upper-bound"
        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
"SLOT"
        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
"Time that transaction is valid until (in slots) \
                    \(deprecated; use --invalid-hereafter instead)."
       Mod OptionFields Word64
-> Mod OptionFields Word64 -> Mod OptionFields Word64
forall a. Semigroup a => a -> a -> a
<> Mod OptionFields Word64
forall (f :: * -> *) a. Mod f a
Opt.internal
        )
    Parser Word64 -> Parser Word64 -> Parser Word64
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
      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
"ttl"
        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
"SLOT"
        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
"Time to live (in slots) (deprecated; use --invalid-hereafter instead)."
        Mod OptionFields Word64
-> Mod OptionFields Word64 -> Mod OptionFields Word64
forall a. Semigroup a => a -> a -> a
<> Mod OptionFields Word64
forall (f :: * -> *) a. Mod f a
Opt.internal
        )
    )

pTxFee :: Parser Lovelace
pTxFee :: Parser Lovelace
pTxFee =
  Integer -> Lovelace
Lovelace (Integer -> Lovelace)
-> (Natural -> Integer) -> Natural -> Lovelace
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Natural -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral :: Natural -> Integer) (Natural -> Lovelace) -> Parser Natural -> Parser Lovelace
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
    ReadM Natural -> Mod OptionFields Natural -> Parser Natural
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Natural
forall a. Read a => ReadM a
Opt.auto
      (  String -> Mod OptionFields Natural
forall (f :: * -> *) a. HasName f => String -> Mod f a
Opt.long String
"fee"
      Mod OptionFields Natural
-> Mod OptionFields Natural -> Mod OptionFields Natural
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Natural
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
Opt.metavar String
"LOVELACE"
      Mod OptionFields Natural
-> Mod OptionFields Natural -> Mod OptionFields Natural
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields Natural
forall (f :: * -> *) a. String -> Mod f a
Opt.help String
"The fee amount in Lovelace."
      )

pWitnessFile :: Parser WitnessFile
pWitnessFile :: Parser WitnessFile
pWitnessFile =
  String -> WitnessFile
WitnessFile (String -> WitnessFile) -> Parser String -> Parser WitnessFile
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
"witness-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 witness"
      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")
      )

pTxBodyFile :: FileDirection -> Parser TxBodyFile
pTxBodyFile :: FileDirection -> Parser TxBodyFile
pTxBodyFile FileDirection
fdir =
    String -> TxBodyFile
TxBodyFile (String -> TxBodyFile) -> Parser String -> Parser TxBodyFile
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
optName
           Mod OptionFields String
-> Mod OptionFields String -> Mod OptionFields String
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields String
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
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 JSON TxBody.")
           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
"tx-body-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
           )
      )
  where
    optName :: String
optName =
      case FileDirection
fdir of
        FileDirection
Input -> String
"tx-body-file"
        FileDirection
Output -> String
"out-file"


pTxFile :: FileDirection -> Parser TxFile
pTxFile :: FileDirection -> Parser TxFile
pTxFile FileDirection
fdir =
    String -> TxFile
TxFile (String -> TxFile) -> Parser String -> Parser TxFile
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
optName
           Mod OptionFields String
-> Mod OptionFields String -> Mod OptionFields String
forall a. Semigroup a => a -> a -> a
<> String -> Mod OptionFields String
forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
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 JSON Tx.")
           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
"tx-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
           )
      )
  where
    optName :: String
optName =
      case FileDirection
fdir of
        FileDirection
Input -> String
"tx-file"
        FileDirection
Output -> String
"out-file"

pInputTxFile :: Parser InputTxFile
pInputTxFile :: Parser InputTxFile
pInputTxFile =
  TxBodyFile -> InputTxFile
InputTxBodyFile (TxBodyFile -> InputTxFile)
-> Parser TxBodyFile -> Parser InputTxFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser TxBodyFile
pTxBodyFile FileDirection
Input Parser InputTxFile -> Parser InputTxFile -> Parser InputTxFile
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> TxFile -> InputTxFile
InputTxFile (TxFile -> InputTxFile) -> Parser TxFile -> Parser InputTxFile
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FileDirection -> Parser TxFile
pTxFile FileDirection
Input

pTxInCount :: Parser TxInCount
pTxInCount :: Parser TxInCount
pTxInCount =
  Int -> TxInCount
TxInCount (Int -> TxInCount) -> Parser Int -> Parser TxInCount
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
    ReadM Int -> Mod OptionFields Int -> Parser Int
forall a. ReadM a -> Mod OptionFields a -> Parser a
Opt.option ReadM Int
forall a. Read a => ReadM a
Opt.auto
      (  String -> Mod OptionFields Int
forall (f :: * -> *) a. HasName f => String -> Mod f a