{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}

-- | Shelley CLI command types
module Cardano.CLI.Shelley.Commands
  ( -- * CLI command types
    ShelleyCommand (..)
  , AddressCmd (..)
  , StakeAddressCmd (..)
  , KeyCmd (..)
  , TransactionCmd (..)
  , NodeCmd (..)
  , PoolCmd (..)
  , QueryCmd (..)
  , GovernanceCmd (..)
  , GenesisCmd (..)
  , TextViewCmd (..)
  , renderShelleyCommand

    -- * CLI flag types
  , AddressKeyType (..)
  , ByronKeyType (..)
  , ByronKeyFormat (..)
  , CardanoAddressKeyType (..)
  , GenesisDir (..)
  , TxInCount (..)
  , TxOutCount (..)
  , TxShelleyWitnessCount (..)
  , TxByronWitnessCount (..)
  , SomeKeyFile (..)
  , OpCertCounterFile (..)
  , OutputFile (..)
  , ProtocolParamsFile (..)
  , WitnessFile (..)
  , TxBodyFile (..)
  , TxFile (..)
  , VerificationKeyBase64 (..)
  , GenesisKeyFile (..)
  , MetaDataFile (..)
  , PoolId (..)
  , PoolMetaDataFile (..)
  , PrivKeyFile (..)
  , BlockId (..)
  , WitnessSigningData (..)
  , ColdVerificationKeyOrFile (..)
  ) where

import           Data.Text (Text)
import           Prelude

import           Cardano.Api.MetaData
import           Cardano.Api.Protocol (Protocol)
import           Cardano.Api.Typed hiding (PoolId)

import           Ouroboros.Consensus.BlockchainTime (SystemStart (..))

import           Cardano.CLI.Shelley.Key (VerificationKeyOrFile, VerificationKeyOrHashOrFile,
                     VerificationKeyTextOrFile)
import           Cardano.CLI.Types

import           Shelley.Spec.Ledger.TxBody (MIRPot)

--
-- Shelley CLI command data types
--

-- | All the CLI subcommands under \"shelley\".
--
data ShelleyCommand
  = AddressCmd      AddressCmd
  | StakeAddressCmd StakeAddressCmd
  | KeyCmd          KeyCmd
  | TransactionCmd  TransactionCmd
  | NodeCmd         NodeCmd
  | PoolCmd         PoolCmd
  | QueryCmd        QueryCmd
  | GovernanceCmd   GovernanceCmd
  | GenesisCmd      GenesisCmd
  | TextViewCmd     TextViewCmd
  deriving (ShelleyCommand -> ShelleyCommand -> Bool
(ShelleyCommand -> ShelleyCommand -> Bool)
-> (ShelleyCommand -> ShelleyCommand -> Bool) -> Eq ShelleyCommand
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShelleyCommand -> ShelleyCommand -> Bool
$c/= :: ShelleyCommand -> ShelleyCommand -> Bool
== :: ShelleyCommand -> ShelleyCommand -> Bool
$c== :: ShelleyCommand -> ShelleyCommand -> Bool
Eq, Int -> ShelleyCommand -> ShowS
[ShelleyCommand] -> ShowS
ShelleyCommand -> String
(Int -> ShelleyCommand -> ShowS)
-> (ShelleyCommand -> String)
-> ([ShelleyCommand] -> ShowS)
-> Show ShelleyCommand
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ShelleyCommand] -> ShowS
$cshowList :: [ShelleyCommand] -> ShowS
show :: ShelleyCommand -> String
$cshow :: ShelleyCommand -> String
showsPrec :: Int -> ShelleyCommand -> ShowS
$cshowsPrec :: Int -> ShelleyCommand -> ShowS
Show)

renderShelleyCommand :: ShelleyCommand -> Text
renderShelleyCommand :: ShelleyCommand -> Text
renderShelleyCommand ShelleyCommand
sc =
  case ShelleyCommand
sc of
    AddressCmd AddressCmd
cmd -> AddressCmd -> Text
renderAddressCmd AddressCmd
cmd
    StakeAddressCmd StakeAddressCmd
cmd -> StakeAddressCmd -> Text
renderStakeAddressCmd StakeAddressCmd
cmd
    KeyCmd KeyCmd
cmd -> KeyCmd -> Text
renderKeyCmd KeyCmd
cmd
    TransactionCmd TransactionCmd
cmd -> TransactionCmd -> Text
renderTransactionCmd TransactionCmd
cmd
    NodeCmd NodeCmd
cmd -> NodeCmd -> Text
renderNodeCmd NodeCmd
cmd
    PoolCmd PoolCmd
cmd -> PoolCmd -> Text
renderPoolCmd PoolCmd
cmd
    QueryCmd QueryCmd
cmd -> QueryCmd -> Text
renderQueryCmd QueryCmd
cmd
    GovernanceCmd GovernanceCmd
cmd -> GovernanceCmd -> Text
renderGovernanceCmd GovernanceCmd
cmd
    GenesisCmd GenesisCmd
cmd -> GenesisCmd -> Text
renderGenesisCmd GenesisCmd
cmd
    TextViewCmd TextViewCmd
cmd -> TextViewCmd -> Text
renderTextViewCmd TextViewCmd
cmd

data AddressCmd
  = AddressKeyGen AddressKeyType VerificationKeyFile SigningKeyFile
  | AddressKeyHash VerificationKeyTextOrFile (Maybe OutputFile)
  | AddressBuild
      VerificationKeyTextOrFile
      (Maybe (VerificationKeyOrFile StakeKey))
      NetworkId
      (Maybe OutputFile)
  | AddressBuildMultiSig ScriptFile NetworkId (Maybe OutputFile)
  | AddressInfo Text (Maybe OutputFile)
  deriving (AddressCmd -> AddressCmd -> Bool
(AddressCmd -> AddressCmd -> Bool)
-> (AddressCmd -> AddressCmd -> Bool) -> Eq AddressCmd
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddressCmd -> AddressCmd -> Bool
$c/= :: AddressCmd -> AddressCmd -> Bool
== :: AddressCmd -> AddressCmd -> Bool
$c== :: AddressCmd -> AddressCmd -> Bool
Eq, Int -> AddressCmd -> ShowS
[AddressCmd] -> ShowS
AddressCmd -> String
(Int -> AddressCmd -> ShowS)
-> (AddressCmd -> String)
-> ([AddressCmd] -> ShowS)
-> Show AddressCmd
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddressCmd] -> ShowS
$cshowList :: [AddressCmd] -> ShowS
show :: AddressCmd -> String
$cshow :: AddressCmd -> String
showsPrec :: Int -> AddressCmd -> ShowS
$cshowsPrec :: Int -> AddressCmd -> ShowS
Show)


renderAddressCmd :: AddressCmd -> Text
renderAddressCmd :: AddressCmd -> Text
renderAddressCmd AddressCmd
cmd =
  case AddressCmd
cmd of
    AddressKeyGen {} -> Text
"address key-gen"
    AddressKeyHash {} -> Text
"address key-hash"
    AddressBuild {} -> Text
"address build"
    AddressBuildMultiSig {} -> Text
"address build-script"
    AddressInfo {} -> Text
"address info"

data StakeAddressCmd
  = StakeAddressKeyGen VerificationKeyFile SigningKeyFile
  | StakeAddressKeyHash (VerificationKeyOrFile StakeKey) (Maybe OutputFile)
  | StakeAddressBuild (VerificationKeyOrFile StakeKey) NetworkId (Maybe OutputFile)
  | StakeKeyRegistrationCert (VerificationKeyOrFile StakeKey) OutputFile
  | StakeKeyDelegationCert
      (VerificationKeyOrFile StakeKey)
      (VerificationKeyOrHashOrFile StakePoolKey)
      OutputFile
  | StakeKeyDeRegistrationCert (VerificationKeyOrFile StakeKey) OutputFile
  deriving (StakeAddressCmd -> StakeAddressCmd -> Bool
(StakeAddressCmd -> StakeAddressCmd -> Bool)
-> (StakeAddressCmd -> StakeAddressCmd -> Bool)
-> Eq StakeAddressCmd
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StakeAddressCmd -> StakeAddressCmd -> Bool
$c/= :: StakeAddressCmd -> StakeAddressCmd -> Bool
== :: StakeAddressCmd -> StakeAddressCmd -> Bool
$c== :: StakeAddressCmd -> StakeAddressCmd -> Bool
Eq, Int -> StakeAddressCmd -> ShowS
[StakeAddressCmd] -> ShowS
StakeAddressCmd -> String
(Int -> StakeAddressCmd -> ShowS)
-> (StakeAddressCmd -> String)
-> ([StakeAddressCmd] -> ShowS)
-> Show StakeAddressCmd
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StakeAddressCmd] -> ShowS
$cshowList :: [StakeAddressCmd] -> ShowS
show :: StakeAddressCmd -> String
$cshow :: StakeAddressCmd -> String
showsPrec :: Int -> StakeAddressCmd -> ShowS
$cshowsPrec :: Int -> StakeAddressCmd -> ShowS
Show)

renderStakeAddressCmd :: StakeAddressCmd -> Text
renderStakeAddressCmd :: StakeAddressCmd -> Text
renderStakeAddressCmd StakeAddressCmd
cmd =
  case StakeAddressCmd
cmd of
    StakeAddressKeyGen {} -> Text
"stake-address key-gen"
    StakeAddressKeyHash {} -> Text
"stake-address key-hash"
    StakeAddressBuild {} -> Text
"stake-address build"
    StakeKeyRegistrationCert {} -> Text
"stake-address registration-certificate"
    StakeKeyDelegationCert {} -> Text
"stake-address delegation-certificate"
    StakeKeyDeRegistrationCert {} -> Text
"stake-address deregistration-certificate"

data KeyCmd
  = KeyGetVerificationKey SigningKeyFile VerificationKeyFile
  | KeyNonExtendedKey  VerificationKeyFile VerificationKeyFile
  | KeyConvertByronKey (Maybe Text) ByronKeyType SomeKeyFile OutputFile
  | KeyConvertByronGenesisVKey VerificationKeyBase64 OutputFile
  | KeyConvertITNStakeKey SomeKeyFile OutputFile
  | KeyConvertITNExtendedToStakeKey SomeKeyFile OutputFile
  | KeyConvertITNBip32ToStakeKey SomeKeyFile OutputFile
  | KeyConvertCardanoAddressSigningKey CardanoAddressKeyType SigningKeyFile OutputFile
  deriving (KeyCmd -> KeyCmd -> Bool
(KeyCmd -> KeyCmd -> Bool)
-> (KeyCmd -> KeyCmd -> Bool) -> Eq KeyCmd
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KeyCmd -> KeyCmd -> Bool
$c/= :: KeyCmd -> KeyCmd -> Bool
== :: KeyCmd -> KeyCmd -> Bool
$c== :: KeyCmd -> KeyCmd -> Bool
Eq, Int -> KeyCmd -> ShowS
[KeyCmd] -> ShowS
KeyCmd -> String
(Int -> KeyCmd -> ShowS)
-> (KeyCmd -> String) -> ([KeyCmd] -> ShowS) -> Show KeyCmd
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeyCmd] -> ShowS
$cshowList :: [KeyCmd] -> ShowS
show :: KeyCmd -> String
$cshow :: KeyCmd -> String
showsPrec :: Int -> KeyCmd -> ShowS
$cshowsPrec :: Int -> KeyCmd -> ShowS
Show)

renderKeyCmd :: KeyCmd -> Text
renderKeyCmd :: KeyCmd -> Text
renderKeyCmd KeyCmd
cmd =
  case KeyCmd
cmd of
    KeyGetVerificationKey {} -> Text
"key verification-key"
    KeyNonExtendedKey {} -> Text
"key non-extended-key"
    KeyConvertByronKey {} -> Text
"key convert-byron-key"
    KeyConvertByronGenesisVKey {} -> Text
"key convert-byron-genesis-key"
    KeyConvertITNStakeKey {} -> Text
"key convert-itn-key"
    KeyConvertITNExtendedToStakeKey {} -> Text
"key convert-itn-extended-key"
    KeyConvertITNBip32ToStakeKey {} -> Text
"key convert-itn-bip32-key"
    KeyConvertCardanoAddressSigningKey {} -> Text
"key convert-cardano-address-signing-key"

data TransactionCmd
  = TxBuildRaw
      [TxIn]
      [TxOut Shelley]
      SlotNo
      Lovelace
      [CertificateFile]
      [(StakeAddress, Lovelace)]
      TxMetadataJsonSchema
      [MetaDataFile]
      (Maybe UpdateProposalFile)
      TxBodyFile
  | TxSign TxBodyFile [WitnessSigningData] (Maybe NetworkId) TxFile
  | TxCreateWitness TxBodyFile WitnessSigningData (Maybe NetworkId) OutputFile
  | TxAssembleTxBodyWitness TxBodyFile [WitnessFile] OutputFile
  | TxSubmit Protocol NetworkId FilePath
  | TxCalculateMinFee
      TxBodyFile
      (Maybe NetworkId)
      ProtocolParamsFile
      TxInCount
      TxOutCount
      TxShelleyWitnessCount
      TxByronWitnessCount
  | TxGetTxId TxBodyFile
  deriving (TransactionCmd -> TransactionCmd -> Bool
(TransactionCmd -> TransactionCmd -> Bool)
-> (TransactionCmd -> TransactionCmd -> Bool) -> Eq TransactionCmd
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransactionCmd -> TransactionCmd -> Bool
$c/= :: TransactionCmd -> TransactionCmd -> Bool
== :: TransactionCmd -> TransactionCmd -> Bool
$c== :: TransactionCmd -> TransactionCmd -> Bool
Eq, Int -> TransactionCmd -> ShowS
[TransactionCmd] -> ShowS
TransactionCmd -> String
(Int -> TransactionCmd -> ShowS)
-> (TransactionCmd -> String)
-> ([TransactionCmd] -> ShowS)
-> Show TransactionCmd
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransactionCmd] -> ShowS
$cshowList :: [TransactionCmd] -> ShowS
show :: TransactionCmd -> String
$cshow :: TransactionCmd -> String
showsPrec :: Int -> TransactionCmd -> ShowS
$cshowsPrec :: Int -> TransactionCmd -> ShowS
Show)

renderTransactionCmd :: TransactionCmd -> Text
renderTransactionCmd :: TransactionCmd -> Text
renderTransactionCmd TransactionCmd
cmd =
  case TransactionCmd
cmd of
    TxBuildRaw {} -> Text
"transaction build-raw"
    TxSign {} -> Text
"transaction sign"
    TxCreateWitness {} -> Text
"transaction witness"
    TxAssembleTxBodyWitness {} -> Text
"transaction sign-witness"
    TxSubmit {} -> Text
"transaction submit"
    TxCalculateMinFee {} -> Text
"transaction calculate-min-fee"
    TxGetTxId {} -> Text
"transaction txid"

data NodeCmd
  = NodeKeyGenCold VerificationKeyFile SigningKeyFile OpCertCounterFile
  | NodeKeyGenKES  VerificationKeyFile SigningKeyFile
  | NodeKeyGenVRF  VerificationKeyFile SigningKeyFile
  | NodeKeyHashVRF  (VerificationKeyOrFile VrfKey) (Maybe OutputFile)
  | NodeNewCounter ColdVerificationKeyOrFile Word OpCertCounterFile
  | NodeIssueOpCert (VerificationKeyOrFile KesKey) SigningKeyFile OpCertCounterFile
                    KESPeriod OutputFile
  deriving (NodeCmd -> NodeCmd -> Bool
(NodeCmd -> NodeCmd -> Bool)
-> (NodeCmd -> NodeCmd -> Bool) -> Eq NodeCmd
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeCmd -> NodeCmd -> Bool
$c/= :: NodeCmd -> NodeCmd -> Bool
== :: NodeCmd -> NodeCmd -> Bool
$c== :: NodeCmd -> NodeCmd -> Bool
Eq, Int -> NodeCmd -> ShowS
[NodeCmd] -> ShowS
NodeCmd -> String
(Int -> NodeCmd -> ShowS)
-> (NodeCmd -> String) -> ([NodeCmd] -> ShowS) -> Show NodeCmd
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeCmd] -> ShowS
$cshowList :: [NodeCmd] -> ShowS
show :: NodeCmd -> String
$cshow :: NodeCmd -> String
showsPrec :: Int -> NodeCmd -> ShowS
$cshowsPrec :: Int -> NodeCmd -> ShowS
Show)

renderNodeCmd :: NodeCmd -> Text
renderNodeCmd :: NodeCmd -> Text
renderNodeCmd NodeCmd
cmd = do
  case NodeCmd
cmd of
    NodeKeyGenCold {} -> Text
"node key-gen"
    NodeKeyGenKES {} -> Text
"node key-gen-KES"
    NodeKeyGenVRF {} -> Text
"node key-gen-VRF"
    NodeKeyHashVRF {} -> Text
"node key-hash-VRF"
    NodeNewCounter {} -> Text
"node new-counter"
    NodeIssueOpCert{} -> Text
"node issue-op-cert"


data PoolCmd
  = PoolRegistrationCert
      (VerificationKeyOrFile StakePoolKey)
      -- ^ Stake pool verification key.
      (VerificationKeyOrFile VrfKey)
      -- ^ VRF Verification key.
      Lovelace
      -- ^ Pool pledge.
      Lovelace
      -- ^ Pool cost.
      Rational
      -- ^ Pool margin.
      (VerificationKeyOrFile StakeKey)
      -- ^ Reward account verification staking key.
      [VerificationKeyOrFile StakeKey]
      -- ^ Pool owner verification staking key(s).
      [StakePoolRelay]
      -- ^ Stake pool relays.
      (Maybe StakePoolMetadataReference)
      -- ^ Stake pool metadata.
      NetworkId
      OutputFile
  | PoolRetirementCert
      (VerificationKeyOrFile StakePoolKey)
      -- ^ Stake pool verification key.
      EpochNo
      -- ^ Epoch in which to retire the stake pool.
      OutputFile
  | PoolGetId (VerificationKeyOrFile StakePoolKey) OutputFormat
  | PoolMetaDataHash PoolMetaDataFile (Maybe OutputFile)
  deriving (PoolCmd -> PoolCmd -> Bool
(PoolCmd -> PoolCmd -> Bool)
-> (PoolCmd -> PoolCmd -> Bool) -> Eq PoolCmd
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PoolCmd -> PoolCmd -> Bool
$c/= :: PoolCmd -> PoolCmd -> Bool
== :: PoolCmd -> PoolCmd -> Bool
$c== :: PoolCmd -> PoolCmd -> Bool
Eq, Int -> PoolCmd -> ShowS
[PoolCmd] -> ShowS
PoolCmd -> String
(Int -> PoolCmd -> ShowS)
-> (PoolCmd -> String) -> ([PoolCmd] -> ShowS) -> Show PoolCmd
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PoolCmd] -> ShowS
$cshowList :: [PoolCmd] -> ShowS
show :: PoolCmd -> String
$cshow :: PoolCmd -> String
showsPrec :: Int -> PoolCmd -> ShowS
$cshowsPrec :: Int -> PoolCmd -> ShowS
Show)

renderPoolCmd :: PoolCmd -> Text
renderPoolCmd :: PoolCmd -> Text
renderPoolCmd PoolCmd
cmd =
  case PoolCmd
cmd of
    PoolRegistrationCert {} -> Text
"stake-pool registration-certificate"
    PoolRetirementCert {} -> Text
"stake-pool deregistration-certificate"
    PoolGetId {} -> Text
"stake-pool id"
    PoolMetaDataHash {} -> Text
"stake-pool metadata-hash"

data QueryCmd =
    QueryProtocolParameters Protocol NetworkId (Maybe OutputFile)
  | QueryTip Protocol NetworkId (Maybe OutputFile)
  | QueryStakeDistribution Protocol NetworkId (Maybe OutputFile)
  | QueryStakeAddressInfo Protocol StakeAddress NetworkId (Maybe OutputFile)
  | QueryUTxO Protocol QueryFilter NetworkId (Maybe OutputFile)
  | QueryLedgerState Protocol NetworkId (Maybe OutputFile)
  deriving (QueryCmd -> QueryCmd -> Bool
(QueryCmd -> QueryCmd -> Bool)
-> (QueryCmd -> QueryCmd -> Bool) -> Eq QueryCmd
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryCmd -> QueryCmd -> Bool
$c/= :: QueryCmd -> QueryCmd -> Bool
== :: QueryCmd -> QueryCmd -> Bool
$c== :: QueryCmd -> QueryCmd -> Bool
Eq, Int -> QueryCmd -> ShowS
[QueryCmd] -> ShowS
QueryCmd -> String
(Int -> QueryCmd -> ShowS)
-> (QueryCmd -> String) -> ([QueryCmd] -> ShowS) -> Show QueryCmd
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryCmd] -> ShowS
$cshowList :: [QueryCmd] -> ShowS
show :: QueryCmd -> String
$cshow :: QueryCmd -> String
showsPrec :: Int -> QueryCmd -> ShowS
$cshowsPrec :: Int -> QueryCmd -> ShowS
Show)

renderQueryCmd :: QueryCmd -> Text
renderQueryCmd :: QueryCmd -> Text
renderQueryCmd QueryCmd
cmd =
  case QueryCmd
cmd of
    QueryProtocolParameters {} -> Text
"query protocol-parameters "
    QueryTip {} -> Text
"query tip"
    QueryStakeDistribution {} -> Text
"query stake-distribution"
    QueryStakeAddressInfo {} -> Text
"query stake-address-info"
    QueryUTxO {} -> Text
"query utxo"
    QueryLedgerState {} -> Text
"query ledger-state"

data GovernanceCmd
  = GovernanceMIRCertificate MIRPot [VerificationKeyFile] [Lovelace] OutputFile
  | GovernanceGenesisKeyDelegationCertificate
      (VerificationKeyOrHashOrFile GenesisKey)
      (VerificationKeyOrHashOrFile GenesisDelegateKey)
      (VerificationKeyOrHashOrFile VrfKey)
      OutputFile
  | GovernanceUpdateProposal OutputFile EpochNo
                             [VerificationKeyFile]
                             ProtocolParametersUpdate
  deriving (GovernanceCmd -> GovernanceCmd -> Bool
(GovernanceCmd -> GovernanceCmd -> Bool)
-> (GovernanceCmd -> GovernanceCmd -> Bool) -> Eq GovernanceCmd
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GovernanceCmd -> GovernanceCmd -> Bool
$c/= :: GovernanceCmd -> GovernanceCmd -> Bool
== :: GovernanceCmd -> GovernanceCmd -> Bool
$c== :: GovernanceCmd -> GovernanceCmd -> Bool
Eq, Int -> GovernanceCmd -> ShowS
[GovernanceCmd] -> ShowS
GovernanceCmd -> String
(Int -> GovernanceCmd -> ShowS)
-> (GovernanceCmd -> String)
-> ([GovernanceCmd] -> ShowS)
-> Show GovernanceCmd
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GovernanceCmd] -> ShowS
$cshowList :: [GovernanceCmd] -> ShowS
show :: GovernanceCmd -> String
$cshow :: GovernanceCmd -> String
showsPrec :: Int -> GovernanceCmd -> ShowS
$cshowsPrec :: Int -> GovernanceCmd -> ShowS
Show)

renderGovernanceCmd :: GovernanceCmd -> Text
renderGovernanceCmd :: GovernanceCmd -> Text
renderGovernanceCmd GovernanceCmd
cmd =
  case GovernanceCmd
cmd of
    GovernanceGenesisKeyDelegationCertificate {} -> Text
"governance create-genesis-key-delegation-certificate"
    GovernanceMIRCertificate {} -> Text
"governance create-mir-certificate"
    GovernanceUpdateProposal {} -> Text
"governance create-update-proposal"

data TextViewCmd
  = TextViewInfo !FilePath (Maybe OutputFile)
  deriving (TextViewCmd -> TextViewCmd -> Bool
(TextViewCmd -> TextViewCmd -> Bool)
-> (TextViewCmd -> TextViewCmd -> Bool) -> Eq TextViewCmd
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextViewCmd -> TextViewCmd -> Bool
$c/= :: TextViewCmd -> TextViewCmd -> Bool
== :: TextViewCmd -> TextViewCmd -> Bool
$c== :: TextViewCmd -> TextViewCmd -> Bool
Eq, Int -> TextViewCmd -> ShowS
[TextViewCmd] -> ShowS
TextViewCmd -> String
(Int -> TextViewCmd -> ShowS)
-> (TextViewCmd -> String)
-> ([TextViewCmd] -> ShowS)
-> Show TextViewCmd
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextViewCmd] -> ShowS
$cshowList :: [TextViewCmd] -> ShowS
show :: TextViewCmd -> String
$cshow :: TextViewCmd -> String
showsPrec :: Int -> TextViewCmd -> ShowS
$cshowsPrec :: Int -> TextViewCmd -> ShowS
Show)


renderTextViewCmd :: TextViewCmd -> Text
renderTextViewCmd :: TextViewCmd -> Text
renderTextViewCmd (TextViewInfo String
_ Maybe OutputFile
_) = Text
"text-view decode-cbor"

data GenesisCmd
  = GenesisCreate GenesisDir Word Word (Maybe SystemStart) (Maybe Lovelace) NetworkId
  | GenesisKeyGenGenesis VerificationKeyFile SigningKeyFile
  | GenesisKeyGenDelegate VerificationKeyFile SigningKeyFile OpCertCounterFile
  | GenesisKeyGenUTxO VerificationKeyFile SigningKeyFile
  | GenesisCmdKeyHash VerificationKeyFile
  | GenesisVerKey VerificationKeyFile SigningKeyFile
  | GenesisTxIn VerificationKeyFile NetworkId (Maybe OutputFile)
  | GenesisAddr VerificationKeyFile NetworkId (Maybe OutputFile)
  | GenesisHashFile GenesisFile
  deriving (GenesisCmd -> GenesisCmd -> Bool
(GenesisCmd -> GenesisCmd -> Bool)
-> (GenesisCmd -> GenesisCmd -> Bool) -> Eq GenesisCmd
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GenesisCmd -> GenesisCmd -> Bool
$c/= :: GenesisCmd -> GenesisCmd -> Bool
== :: GenesisCmd -> GenesisCmd -> Bool
$c== :: GenesisCmd -> GenesisCmd -> Bool
Eq, Int -> GenesisCmd -> ShowS
[GenesisCmd] -> ShowS
GenesisCmd -> String
(Int -> GenesisCmd -> ShowS)
-> (GenesisCmd -> String)
-> ([GenesisCmd] -> ShowS)
-> Show GenesisCmd
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GenesisCmd] -> ShowS
$cshowList :: [GenesisCmd] -> ShowS
show :: GenesisCmd -> String
$cshow :: GenesisCmd -> String
showsPrec :: Int -> GenesisCmd -> ShowS
$cshowsPrec :: Int -> GenesisCmd -> ShowS
Show)

renderGenesisCmd :: GenesisCmd -> Text
renderGenesisCmd :: GenesisCmd -> Text
renderGenesisCmd GenesisCmd
cmd =
  case GenesisCmd
cmd of
    GenesisCreate {} -> Text
"genesis create"
    GenesisKeyGenGenesis {} -> Text
"genesis key-gen-genesis"
    GenesisKeyGenDelegate {} -> Text
"genesis key-gen-delegate"
    GenesisKeyGenUTxO {} -> Text
"genesis key-gen-utxo"
    GenesisCmdKeyHash {} -> Text
"genesis key-hash"
    GenesisVerKey {} -> Text
"genesis get-ver-key"
    GenesisTxIn {} -> Text
"genesis initial-txin"
    GenesisAddr {} -> Text
"genesis initial-addr"
    GenesisHashFile {} -> Text
"genesis hash"

--
-- Shelley CLI flag/option data types
--

newtype ProtocolParamsFile
  = ProtocolParamsFile FilePath
  deriving (Int -> ProtocolParamsFile -> ShowS
[ProtocolParamsFile] -> ShowS
ProtocolParamsFile -> String
(Int -> ProtocolParamsFile -> ShowS)
-> (ProtocolParamsFile -> String)
-> ([ProtocolParamsFile] -> ShowS)
-> Show ProtocolParamsFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProtocolParamsFile] -> ShowS
$cshowList :: [ProtocolParamsFile] -> ShowS
show :: ProtocolParamsFile -> String
$cshow :: ProtocolParamsFile -> String
showsPrec :: Int -> ProtocolParamsFile -> ShowS
$cshowsPrec :: Int -> ProtocolParamsFile -> ShowS
Show, ProtocolParamsFile -> ProtocolParamsFile -> Bool
(ProtocolParamsFile -> ProtocolParamsFile -> Bool)
-> (ProtocolParamsFile -> ProtocolParamsFile -> Bool)
-> Eq ProtocolParamsFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProtocolParamsFile -> ProtocolParamsFile -> Bool
$c/= :: ProtocolParamsFile -> ProtocolParamsFile -> Bool
== :: ProtocolParamsFile -> ProtocolParamsFile -> Bool
$c== :: ProtocolParamsFile -> ProtocolParamsFile -> Bool
Eq)

newtype TxInCount
  = TxInCount Int
  deriving (TxInCount -> TxInCount -> Bool
(TxInCount -> TxInCount -> Bool)
-> (TxInCount -> TxInCount -> Bool) -> Eq TxInCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TxInCount -> TxInCount -> Bool
$c/= :: TxInCount -> TxInCount -> Bool
== :: TxInCount -> TxInCount -> Bool
$c== :: TxInCount -> TxInCount -> Bool
Eq, Int -> TxInCount -> ShowS
[TxInCount] -> ShowS
TxInCount -> String
(Int -> TxInCount -> ShowS)
-> (TxInCount -> String)
-> ([TxInCount] -> ShowS)
-> Show TxInCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TxInCount] -> ShowS
$cshowList :: [TxInCount] -> ShowS
show :: TxInCount -> String
$cshow :: TxInCount -> String
showsPrec :: Int -> TxInCount -> ShowS
$cshowsPrec :: Int -> TxInCount -> ShowS
Show)

newtype TxOutCount
  = TxOutCount Int
  deriving (TxOutCount -> TxOutCount -> Bool
(TxOutCount -> TxOutCount -> Bool)
-> (TxOutCount -> TxOutCount -> Bool) -> Eq TxOutCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TxOutCount -> TxOutCount -> Bool
$c/= :: TxOutCount -> TxOutCount -> Bool
== :: TxOutCount -> TxOutCount -> Bool
$c== :: TxOutCount -> TxOutCount -> Bool
Eq, Int -> TxOutCount -> ShowS
[TxOutCount] -> ShowS
TxOutCount -> String
(Int -> TxOutCount -> ShowS)
-> (TxOutCount -> String)
-> ([TxOutCount] -> ShowS)
-> Show TxOutCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TxOutCount] -> ShowS
$cshowList :: [TxOutCount] -> ShowS
show :: TxOutCount -> String
$cshow :: TxOutCount -> String
showsPrec :: Int -> TxOutCount -> ShowS
$cshowsPrec :: Int -> TxOutCount -> ShowS
Show)

newtype TxShelleyWitnessCount
  = TxShelleyWitnessCount Int
  deriving (TxShelleyWitnessCount -> TxShelleyWitnessCount -> Bool
(TxShelleyWitnessCount -> TxShelleyWitnessCount -> Bool)
-> (TxShelleyWitnessCount -> TxShelleyWitnessCount -> Bool)
-> Eq TxShelleyWitnessCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TxShelleyWitnessCount -> TxShelleyWitnessCount -> Bool
$c/= :: TxShelleyWitnessCount -> TxShelleyWitnessCount -> Bool
== :: TxShelleyWitnessCount -> TxShelleyWitnessCount -> Bool
$c== :: TxShelleyWitnessCount -> TxShelleyWitnessCount -> Bool
Eq, Int -> TxShelleyWitnessCount -> ShowS
[TxShelleyWitnessCount] -> ShowS
TxShelleyWitnessCount -> String
(Int -> TxShelleyWitnessCount -> ShowS)
-> (TxShelleyWitnessCount -> String)
-> ([TxShelleyWitnessCount] -> ShowS)
-> Show TxShelleyWitnessCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TxShelleyWitnessCount] -> ShowS
$cshowList :: [TxShelleyWitnessCount] -> ShowS
show :: TxShelleyWitnessCount -> String
$cshow :: TxShelleyWitnessCount -> String
showsPrec :: Int -> TxShelleyWitnessCount -> ShowS
$cshowsPrec :: Int -> TxShelleyWitnessCount -> ShowS
Show)

newtype TxByronWitnessCount
  = TxByronWitnessCount Int
  deriving (TxByronWitnessCount -> TxByronWitnessCount -> Bool
(TxByronWitnessCount -> TxByronWitnessCount -> Bool)
-> (TxByronWitnessCount -> TxByronWitnessCount -> Bool)
-> Eq TxByronWitnessCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TxByronWitnessCount -> TxByronWitnessCount -> Bool
$c/= :: TxByronWitnessCount -> TxByronWitnessCount -> Bool
== :: TxByronWitnessCount -> TxByronWitnessCount -> Bool
$c== :: TxByronWitnessCount -> TxByronWitnessCount -> Bool
Eq, Int -> TxByronWitnessCount -> ShowS
[TxByronWitnessCount] -> ShowS
TxByronWitnessCount -> String
(Int -> TxByronWitnessCount -> ShowS)
-> (TxByronWitnessCount -> String)
-> ([TxByronWitnessCount] -> ShowS)
-> Show TxByronWitnessCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TxByronWitnessCount] -> ShowS
$cshowList :: [TxByronWitnessCount] -> ShowS
show :: TxByronWitnessCount -> String
$cshow :: TxByronWitnessCount -> String
showsPrec :: Int -> TxByronWitnessCount -> ShowS
$cshowsPrec :: Int -> TxByronWitnessCount -> ShowS
Show)

newtype BlockId
  = BlockId String -- Probably not a String
  deriving (BlockId -> BlockId -> Bool
(BlockId -> BlockId -> Bool)
-> (BlockId -> BlockId -> Bool) -> Eq BlockId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BlockId -> BlockId -> Bool
$c/= :: BlockId -> BlockId -> Bool
== :: BlockId -> BlockId -> Bool
$c== :: BlockId -> BlockId -> Bool
Eq, Int -> BlockId -> ShowS
[BlockId] -> ShowS
BlockId -> String
(Int -> BlockId -> ShowS)
-> (BlockId -> String) -> ([BlockId] -> ShowS) -> Show BlockId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BlockId] -> ShowS
$cshowList :: [BlockId] -> ShowS
show :: BlockId -> String
$cshow :: BlockId -> String
showsPrec :: Int -> BlockId -> ShowS
$cshowsPrec :: Int -> BlockId -> ShowS
Show)

newtype GenesisKeyFile
  = GenesisKeyFile FilePath
  deriving (GenesisKeyFile -> GenesisKeyFile -> Bool
(GenesisKeyFile -> GenesisKeyFile -> Bool)
-> (GenesisKeyFile -> GenesisKeyFile -> Bool) -> Eq GenesisKeyFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GenesisKeyFile -> GenesisKeyFile -> Bool
$c/= :: GenesisKeyFile -> GenesisKeyFile -> Bool
== :: GenesisKeyFile -> GenesisKeyFile -> Bool
$c== :: GenesisKeyFile -> GenesisKeyFile -> Bool
Eq, Int -> GenesisKeyFile -> ShowS
[GenesisKeyFile] -> ShowS
GenesisKeyFile -> String
(Int -> GenesisKeyFile -> ShowS)
-> (GenesisKeyFile -> String)
-> ([GenesisKeyFile] -> ShowS)
-> Show GenesisKeyFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GenesisKeyFile] -> ShowS
$cshowList :: [GenesisKeyFile] -> ShowS
show :: GenesisKeyFile -> String
$cshow :: GenesisKeyFile -> String
showsPrec :: Int -> GenesisKeyFile -> ShowS
$cshowsPrec :: Int -> GenesisKeyFile -> ShowS
Show)

data MetaDataFile = MetaDataFileJSON FilePath
                  | MetaDataFileCBOR FilePath

  deriving (MetaDataFile -> MetaDataFile -> Bool
(MetaDataFile -> MetaDataFile -> Bool)
-> (MetaDataFile -> MetaDataFile -> Bool) -> Eq MetaDataFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetaDataFile -> MetaDataFile -> Bool
$c/= :: MetaDataFile -> MetaDataFile -> Bool
== :: MetaDataFile -> MetaDataFile -> Bool
$c== :: MetaDataFile -> MetaDataFile -> Bool
Eq, Int -> MetaDataFile -> ShowS
[MetaDataFile] -> ShowS
MetaDataFile -> String
(Int -> MetaDataFile -> ShowS)
-> (MetaDataFile -> String)
-> ([MetaDataFile] -> ShowS)
-> Show MetaDataFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MetaDataFile] -> ShowS
$cshowList :: [MetaDataFile] -> ShowS
show :: MetaDataFile -> String
$cshow :: MetaDataFile -> String
showsPrec :: Int -> MetaDataFile -> ShowS
$cshowsPrec :: Int -> MetaDataFile -> ShowS
Show)

newtype OutputFile
  = OutputFile FilePath
  deriving (OutputFile -> OutputFile -> Bool
(OutputFile -> OutputFile -> Bool)
-> (OutputFile -> OutputFile -> Bool) -> Eq OutputFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputFile -> OutputFile -> Bool
$c/= :: OutputFile -> OutputFile -> Bool
== :: OutputFile -> OutputFile -> Bool
$c== :: OutputFile -> OutputFile -> Bool
Eq, Int -> OutputFile -> ShowS
[OutputFile] -> ShowS
OutputFile -> String
(Int -> OutputFile -> ShowS)
-> (OutputFile -> String)
-> ([OutputFile] -> ShowS)
-> Show OutputFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputFile] -> ShowS
$cshowList :: [OutputFile] -> ShowS
show :: OutputFile -> String
$cshow :: OutputFile -> String
showsPrec :: Int -> OutputFile -> ShowS
$cshowsPrec :: Int -> OutputFile -> ShowS
Show)

newtype PoolId
  = PoolId String -- Probably not a String
  deriving (PoolId -> PoolId -> Bool
(PoolId -> PoolId -> Bool)
-> (PoolId -> PoolId -> Bool) -> Eq PoolId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PoolId -> PoolId -> Bool
$c/= :: PoolId -> PoolId -> Bool
== :: PoolId -> PoolId -> Bool
$c== :: PoolId -> PoolId -> Bool
Eq, Int -> PoolId -> ShowS
[PoolId] -> ShowS
PoolId -> String
(Int -> PoolId -> ShowS)
-> (PoolId -> String) -> ([PoolId] -> ShowS) -> Show PoolId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PoolId] -> ShowS
$cshowList :: [PoolId] -> ShowS
show :: PoolId -> String
$cshow :: PoolId -> String
showsPrec :: Int -> PoolId -> ShowS
$cshowsPrec :: Int -> PoolId -> ShowS
Show)

newtype PoolMetaDataFile = PoolMetaDataFile
  { PoolMetaDataFile -> String
unPoolMetaDataFile :: FilePath }
  deriving (PoolMetaDataFile -> PoolMetaDataFile -> Bool
(PoolMetaDataFile -> PoolMetaDataFile -> Bool)
-> (PoolMetaDataFile -> PoolMetaDataFile -> Bool)
-> Eq PoolMetaDataFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PoolMetaDataFile -> PoolMetaDataFile -> Bool
$c/= :: PoolMetaDataFile -> PoolMetaDataFile -> Bool
== :: PoolMetaDataFile -> PoolMetaDataFile -> Bool
$c== :: PoolMetaDataFile -> PoolMetaDataFile -> Bool
Eq, Int -> PoolMetaDataFile -> ShowS
[PoolMetaDataFile] -> ShowS
PoolMetaDataFile -> String
(Int -> PoolMetaDataFile -> ShowS)
-> (PoolMetaDataFile -> String)
-> ([PoolMetaDataFile] -> ShowS)
-> Show PoolMetaDataFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PoolMetaDataFile] -> ShowS
$cshowList :: [PoolMetaDataFile] -> ShowS
show :: PoolMetaDataFile -> String
$cshow :: PoolMetaDataFile -> String
showsPrec :: Int -> PoolMetaDataFile -> ShowS
$cshowsPrec :: Int -> PoolMetaDataFile -> ShowS
Show)

newtype GenesisDir
  = GenesisDir FilePath
  deriving (GenesisDir -> GenesisDir -> Bool
(GenesisDir -> GenesisDir -> Bool)
-> (GenesisDir -> GenesisDir -> Bool) -> Eq GenesisDir
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GenesisDir -> GenesisDir -> Bool
$c/= :: GenesisDir -> GenesisDir -> Bool
== :: GenesisDir -> GenesisDir -> Bool
$c== :: GenesisDir -> GenesisDir -> Bool
Eq, Int -> GenesisDir -> ShowS
[GenesisDir] -> ShowS
GenesisDir -> String
(Int -> GenesisDir -> ShowS)
-> (GenesisDir -> String)
-> ([GenesisDir] -> ShowS)
-> Show GenesisDir
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GenesisDir] -> ShowS
$cshowList :: [GenesisDir] -> ShowS
show :: GenesisDir -> String
$cshow :: GenesisDir -> String
showsPrec :: Int -> GenesisDir -> ShowS
$cshowsPrec :: Int -> GenesisDir -> ShowS
Show)

-- | Either a verification or signing key, used for conversions and other
-- commands that make sense for both.
--
data SomeKeyFile
  = AVerificationKeyFile VerificationKeyFile
  | ASigningKeyFile SigningKeyFile
  deriving (SomeKeyFile -> SomeKeyFile -> Bool
(SomeKeyFile -> SomeKeyFile -> Bool)
-> (SomeKeyFile -> SomeKeyFile -> Bool) -> Eq SomeKeyFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SomeKeyFile -> SomeKeyFile -> Bool
$c/= :: SomeKeyFile -> SomeKeyFile -> Bool
== :: SomeKeyFile -> SomeKeyFile -> Bool
$c== :: SomeKeyFile -> SomeKeyFile -> Bool
Eq, Int -> SomeKeyFile -> ShowS
[SomeKeyFile] -> ShowS
SomeKeyFile -> String
(Int -> SomeKeyFile -> ShowS)
-> (SomeKeyFile -> String)
-> ([SomeKeyFile] -> ShowS)
-> Show SomeKeyFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SomeKeyFile] -> ShowS
$cshowList :: [SomeKeyFile] -> ShowS
show :: SomeKeyFile -> String
$cshow :: SomeKeyFile -> String
showsPrec :: Int -> SomeKeyFile -> ShowS
$cshowsPrec :: Int -> SomeKeyFile -> ShowS
Show)

data AddressKeyType
  = AddressKeyShelley
  | AddressKeyShelleyExtended
  | AddressKeyByron
  deriving (AddressKeyType -> AddressKeyType -> Bool
(AddressKeyType -> AddressKeyType -> Bool)
-> (AddressKeyType -> AddressKeyType -> Bool) -> Eq AddressKeyType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddressKeyType -> AddressKeyType -> Bool
$c/= :: AddressKeyType -> AddressKeyType -> Bool
== :: AddressKeyType -> AddressKeyType -> Bool
$c== :: AddressKeyType -> AddressKeyType -> Bool
Eq, Int -> AddressKeyType -> ShowS
[AddressKeyType] -> ShowS
AddressKeyType -> String
(Int -> AddressKeyType -> ShowS)
-> (AddressKeyType -> String)
-> ([AddressKeyType] -> ShowS)
-> Show AddressKeyType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddressKeyType] -> ShowS
$cshowList :: [AddressKeyType] -> ShowS
show :: AddressKeyType -> String
$cshow :: AddressKeyType -> String
showsPrec :: Int -> AddressKeyType -> ShowS
$cshowsPrec :: Int -> AddressKeyType -> ShowS
Show)

data ByronKeyType
  = ByronPaymentKey  ByronKeyFormat
  | ByronGenesisKey  ByronKeyFormat
  | ByronDelegateKey ByronKeyFormat
  deriving (ByronKeyType -> ByronKeyType -> Bool
(ByronKeyType -> ByronKeyType -> Bool)
-> (ByronKeyType -> ByronKeyType -> Bool) -> Eq ByronKeyType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ByronKeyType -> ByronKeyType -> Bool
$c/= :: ByronKeyType -> ByronKeyType -> Bool
== :: ByronKeyType -> ByronKeyType -> Bool
$c== :: ByronKeyType -> ByronKeyType -> Bool
Eq, Int -> ByronKeyType -> ShowS
[ByronKeyType] -> ShowS
ByronKeyType -> String
(Int -> ByronKeyType -> ShowS)
-> (ByronKeyType -> String)
-> ([ByronKeyType] -> ShowS)
-> Show ByronKeyType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ByronKeyType] -> ShowS
$cshowList :: [ByronKeyType] -> ShowS
show :: ByronKeyType -> String
$cshow :: ByronKeyType -> String
showsPrec :: Int -> ByronKeyType -> ShowS
$cshowsPrec :: Int -> ByronKeyType -> ShowS
Show)

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

-- | The type of @cardano-address@ key.
data CardanoAddressKeyType
  = CardanoAddressShelleyPaymentKey
  | CardanoAddressShelleyStakeKey
  | CardanoAddressIcarusPaymentKey
  | CardanoAddressByronPaymentKey
  deriving (CardanoAddressKeyType -> CardanoAddressKeyType -> Bool
(CardanoAddressKeyType -> CardanoAddressKeyType -> Bool)
-> (CardanoAddressKeyType -> CardanoAddressKeyType -> Bool)
-> Eq CardanoAddressKeyType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CardanoAddressKeyType -> CardanoAddressKeyType -> Bool
$c/= :: CardanoAddressKeyType -> CardanoAddressKeyType -> Bool
== :: CardanoAddressKeyType -> CardanoAddressKeyType -> Bool
$c== :: CardanoAddressKeyType -> CardanoAddressKeyType -> Bool
Eq, Int -> CardanoAddressKeyType -> ShowS
[CardanoAddressKeyType] -> ShowS
CardanoAddressKeyType -> String
(Int -> CardanoAddressKeyType -> ShowS)
-> (CardanoAddressKeyType -> String)
-> ([CardanoAddressKeyType] -> ShowS)
-> Show CardanoAddressKeyType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CardanoAddressKeyType] -> ShowS
$cshowList :: [CardanoAddressKeyType] -> ShowS
show :: CardanoAddressKeyType -> String
$cshow :: CardanoAddressKeyType -> String
showsPrec :: Int -> CardanoAddressKeyType -> ShowS
$cshowsPrec :: Int -> CardanoAddressKeyType -> ShowS
Show)

newtype OpCertCounterFile
  = OpCertCounterFile FilePath
  deriving (OpCertCounterFile -> OpCertCounterFile -> Bool
(OpCertCounterFile -> OpCertCounterFile -> Bool)
-> (OpCertCounterFile -> OpCertCounterFile -> Bool)
-> Eq OpCertCounterFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OpCertCounterFile -> OpCertCounterFile -> Bool
$c/= :: OpCertCounterFile -> OpCertCounterFile -> Bool
== :: OpCertCounterFile -> OpCertCounterFile -> Bool
$c== :: OpCertCounterFile -> OpCertCounterFile -> Bool
Eq, Int -> OpCertCounterFile -> ShowS
[OpCertCounterFile] -> ShowS
OpCertCounterFile -> String
(Int -> OpCertCounterFile -> ShowS)
-> (OpCertCounterFile -> String)
-> ([OpCertCounterFile] -> ShowS)
-> Show OpCertCounterFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OpCertCounterFile] -> ShowS
$cshowList :: [OpCertCounterFile] -> ShowS
show :: OpCertCounterFile -> String
$cshow :: OpCertCounterFile -> String
showsPrec :: Int -> OpCertCounterFile -> ShowS
$cshowsPrec :: Int -> OpCertCounterFile -> ShowS
Show)

newtype PrivKeyFile
  = PrivKeyFile FilePath
  deriving (PrivKeyFile -> PrivKeyFile -> Bool
(PrivKeyFile -> PrivKeyFile -> Bool)
-> (PrivKeyFile -> PrivKeyFile -> Bool) -> Eq PrivKeyFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PrivKeyFile -> PrivKeyFile -> Bool
$c/= :: PrivKeyFile -> PrivKeyFile -> Bool
== :: PrivKeyFile -> PrivKeyFile -> Bool
$c== :: PrivKeyFile -> PrivKeyFile -> Bool
Eq, Int -> PrivKeyFile -> ShowS
[PrivKeyFile] -> ShowS
PrivKeyFile -> String
(Int -> PrivKeyFile -> ShowS)
-> (PrivKeyFile -> String)
-> ([PrivKeyFile] -> ShowS)
-> Show PrivKeyFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PrivKeyFile] -> ShowS
$cshowList :: [PrivKeyFile] -> ShowS
show :: PrivKeyFile -> String
$cshow :: PrivKeyFile -> String
showsPrec :: Int -> PrivKeyFile -> ShowS
$cshowsPrec :: Int -> PrivKeyFile -> ShowS
Show)

newtype WitnessFile
  = WitnessFile FilePath
  deriving (WitnessFile -> WitnessFile -> Bool
(WitnessFile -> WitnessFile -> Bool)
-> (WitnessFile -> WitnessFile -> Bool) -> Eq WitnessFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WitnessFile -> WitnessFile -> Bool
$c/= :: WitnessFile -> WitnessFile -> Bool
== :: WitnessFile -> WitnessFile -> Bool
$c== :: WitnessFile -> WitnessFile -> Bool
Eq, Int -> WitnessFile -> ShowS
[WitnessFile] -> ShowS
WitnessFile -> String
(Int -> WitnessFile -> ShowS)
-> (WitnessFile -> String)
-> ([WitnessFile] -> ShowS)
-> Show WitnessFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WitnessFile] -> ShowS
$cshowList :: [WitnessFile] -> ShowS
show :: WitnessFile -> String
$cshow :: WitnessFile -> String
showsPrec :: Int -> WitnessFile -> ShowS
$cshowsPrec :: Int -> WitnessFile -> ShowS
Show)

newtype TxBodyFile
  = TxBodyFile FilePath
  deriving (TxBodyFile -> TxBodyFile -> Bool
(TxBodyFile -> TxBodyFile -> Bool)
-> (TxBodyFile -> TxBodyFile -> Bool) -> Eq TxBodyFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TxBodyFile -> TxBodyFile -> Bool
$c/= :: TxBodyFile -> TxBodyFile -> Bool
== :: TxBodyFile -> TxBodyFile -> Bool
$c== :: TxBodyFile -> TxBodyFile -> Bool
Eq, Int -> TxBodyFile -> ShowS
[TxBodyFile] -> ShowS
TxBodyFile -> String
(Int -> TxBodyFile -> ShowS)
-> (TxBodyFile -> String)
-> ([TxBodyFile] -> ShowS)
-> Show TxBodyFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TxBodyFile] -> ShowS
$cshowList :: [TxBodyFile] -> ShowS
show :: TxBodyFile -> String
$cshow :: TxBodyFile -> String
showsPrec :: Int -> TxBodyFile -> ShowS
$cshowsPrec :: Int -> TxBodyFile -> ShowS
Show)

newtype TxFile
  = TxFile FilePath
  deriving (TxFile -> TxFile -> Bool
(TxFile -> TxFile -> Bool)
-> (TxFile -> TxFile -> Bool) -> Eq TxFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TxFile -> TxFile -> Bool
$c/= :: TxFile -> TxFile -> Bool
== :: TxFile -> TxFile -> Bool
$c== :: TxFile -> TxFile -> Bool
Eq, Int -> TxFile -> ShowS
[TxFile] -> ShowS
TxFile -> String
(Int -> TxFile -> ShowS)
-> (TxFile -> String) -> ([TxFile] -> ShowS) -> Show TxFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TxFile] -> ShowS
$cshowList :: [TxFile] -> ShowS
show :: TxFile -> String
$cshow :: TxFile -> String
showsPrec :: Int -> TxFile -> ShowS
$cshowsPrec :: Int -> TxFile -> ShowS
Show)

-- | A raw verification key given in Base64, and decoded into a ByteString.
newtype VerificationKeyBase64
  = VerificationKeyBase64 String
  deriving (VerificationKeyBase64 -> VerificationKeyBase64 -> Bool
(VerificationKeyBase64 -> VerificationKeyBase64 -> Bool)
-> (VerificationKeyBase64 -> VerificationKeyBase64 -> Bool)
-> Eq VerificationKeyBase64
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VerificationKeyBase64 -> VerificationKeyBase64 -> Bool
$c/= :: VerificationKeyBase64 -> VerificationKeyBase64 -> Bool
== :: VerificationKeyBase64 -> VerificationKeyBase64 -> Bool
$c== :: VerificationKeyBase64 -> VerificationKeyBase64 -> Bool
Eq, Int -> VerificationKeyBase64 -> ShowS
[VerificationKeyBase64] -> ShowS
VerificationKeyBase64 -> String
(Int -> VerificationKeyBase64 -> ShowS)
-> (VerificationKeyBase64 -> String)
-> ([VerificationKeyBase64] -> ShowS)
-> Show VerificationKeyBase64
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VerificationKeyBase64] -> ShowS
$cshowList :: [VerificationKeyBase64] -> ShowS
show :: VerificationKeyBase64 -> String
$cshow :: VerificationKeyBase64 -> String
showsPrec :: Int -> VerificationKeyBase64 -> ShowS
$cshowsPrec :: Int -> VerificationKeyBase64 -> ShowS
Show)

-- | Data required to construct a witness.
data WitnessSigningData
  = KeyWitnessSigningData
      !SigningKeyFile
      -- ^ Path to a file that should contain a signing key.
      !(Maybe (Address Byron))
      -- ^ An optionally specified Byron address.
      --
      -- If specified, both the network ID and derivation path are extracted
      -- from the address and used in the construction of the Byron witness.
  | ScriptWitnessSigningData !ScriptFile
  deriving (WitnessSigningData -> WitnessSigningData -> Bool
(WitnessSigningData -> WitnessSigningData -> Bool)
-> (WitnessSigningData -> WitnessSigningData -> Bool)
-> Eq WitnessSigningData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WitnessSigningData -> WitnessSigningData -> Bool
$c/= :: WitnessSigningData -> WitnessSigningData -> Bool
== :: WitnessSigningData -> WitnessSigningData -> Bool
$c== :: WitnessSigningData -> WitnessSigningData -> Bool
Eq, Int -> WitnessSigningData -> ShowS
[WitnessSigningData] -> ShowS
WitnessSigningData -> String
(Int -> WitnessSigningData -> ShowS)
-> (WitnessSigningData -> String)
-> ([WitnessSigningData] -> ShowS)
-> Show WitnessSigningData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WitnessSigningData] -> ShowS
$cshowList :: [WitnessSigningData] -> ShowS
show :: WitnessSigningData -> String
$cshow :: WitnessSigningData -> String
showsPrec :: Int -> WitnessSigningData -> ShowS
$cshowsPrec :: Int -> WitnessSigningData -> ShowS
Show)

-- | Either a stake pool verification key, genesis delegate verification key,
-- or a path to a cold verification key file.
--
-- Note that a "cold verification key" refers to either a stake pool or
-- genesis delegate verification key.
--
-- TODO: A genesis delegate extended key should also be valid here.
data ColdVerificationKeyOrFile
  = ColdStakePoolVerificationKey !(VerificationKey StakePoolKey)
  | ColdGenesisDelegateVerificationKey !(VerificationKey GenesisDelegateKey)
  | ColdVerificationKeyFile !VerificationKeyFile
  deriving (ColdVerificationKeyOrFile -> ColdVerificationKeyOrFile -> Bool
(ColdVerificationKeyOrFile -> ColdVerificationKeyOrFile -> Bool)
-> (ColdVerificationKeyOrFile -> ColdVerificationKeyOrFile -> Bool)
-> Eq ColdVerificationKeyOrFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ColdVerificationKeyOrFile -> ColdVerificationKeyOrFile -> Bool
$c/= :: ColdVerificationKeyOrFile -> ColdVerificationKeyOrFile -> Bool
== :: ColdVerificationKeyOrFile -> ColdVerificationKeyOrFile -> Bool
$c== :: ColdVerificationKeyOrFile -> ColdVerificationKeyOrFile -> Bool
Eq, Int -> ColdVerificationKeyOrFile -> ShowS
[ColdVerificationKeyOrFile] -> ShowS
ColdVerificationKeyOrFile -> String
(Int -> ColdVerificationKeyOrFile -> ShowS)
-> (ColdVerificationKeyOrFile -> String)
-> ([ColdVerificationKeyOrFile] -> ShowS)
-> Show ColdVerificationKeyOrFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ColdVerificationKeyOrFile] -> ShowS
$cshowList :: [ColdVerificationKeyOrFile] -> ShowS
show :: ColdVerificationKeyOrFile -> String
$cshow :: ColdVerificationKeyOrFile -> String
showsPrec :: Int -> ColdVerificationKeyOrFile -> ShowS
$cshowsPrec :: Int -> ColdVerificationKeyOrFile -> ShowS
Show)