{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE LambdaCase #-}

module Cardano.CLI.EraBased.Commands.Transaction
  ( TransactionCmds (..)
  , TransactionBuildRawCmdArgs (..)
  , TransactionBuildCmdArgs (..)
  , TransactionBuildEstimateCmdArgs (..)
  , TransactionSignCmdArgs (..)
  , TransactionWitnessCmdArgs (..)
  , TransactionSignWitnessCmdArgs (..)
  , TransactionSubmitCmdArgs (..)
  , TransactionPolicyIdCmdArgs (..)
  , TransactionCalculateMinFeeCmdArgs (..)
  , TransactionCalculateMinValueCmdArgs (..)
  , TransactionHashScriptDataCmdArgs (..)
  , TransactionTxIdCmdArgs (..)
  , TransactionViewCmdArgs (..)
  , renderTransactionCmds
  )
where

import qualified Cardano.Api.Experimental as Exp
import           Cardano.Api.Ledger (Coin)
import           Cardano.Api.Shelley

import           Cardano.CLI.Types.Common
import           Cardano.CLI.Types.Governance

import           Data.Text (Text)

data TransactionCmds era
  = TransactionBuildRawCmd !(TransactionBuildRawCmdArgs era)
  | TransactionBuildCmd !(TransactionBuildCmdArgs era)
  | TransactionBuildEstimateCmd !(TransactionBuildEstimateCmdArgs era)
  | TransactionSignCmd !TransactionSignCmdArgs
  | TransactionWitnessCmd !TransactionWitnessCmdArgs
  | TransactionSignWitnessCmd !TransactionSignWitnessCmdArgs
  | TransactionSubmitCmd !TransactionSubmitCmdArgs
  | TransactionPolicyIdCmd !TransactionPolicyIdCmdArgs
  | TransactionCalculateMinFeeCmd !TransactionCalculateMinFeeCmdArgs
  | TransactionCalculateMinValueCmd !(TransactionCalculateMinValueCmdArgs era)
  | TransactionHashScriptDataCmd !TransactionHashScriptDataCmdArgs
  | TransactionTxIdCmd !TransactionTxIdCmdArgs

data TransactionBuildRawCmdArgs era = TransactionBuildRawCmdArgs
  { forall era. TransactionBuildRawCmdArgs era -> ShelleyBasedEra era
eon :: !(ShelleyBasedEra era)
  , forall era. TransactionBuildRawCmdArgs era -> Maybe ScriptValidity
mScriptValidity :: !(Maybe ScriptValidity)
  -- ^ Mark script as expected to pass or fail validation
  , forall era.
TransactionBuildRawCmdArgs era
-> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
txIns :: ![(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
  -- ^ Transaction inputs with optional spending scripts
  , forall era. TransactionBuildRawCmdArgs era -> [TxIn]
readOnlyRefIns :: ![TxIn]
  -- ^ Read only reference inputs
  , forall era. TransactionBuildRawCmdArgs era -> [TxIn]
txInsCollateral :: ![TxIn]
  -- ^ Transaction inputs for collateral, only key witnesses, no scripts.
  , forall era.
TransactionBuildRawCmdArgs era -> Maybe TxOutShelleyBasedEra
mReturnCollateral :: !(Maybe TxOutShelleyBasedEra)
  -- ^ Return collateral
  , forall era. TransactionBuildRawCmdArgs era -> Maybe Coin
mTotalCollateral :: !(Maybe Coin)
  -- ^ Total collateral
  , forall era. TransactionBuildRawCmdArgs era -> [RequiredSigner]
requiredSigners :: ![RequiredSigner]
  -- ^ Required signers
  , forall era. TransactionBuildRawCmdArgs era -> [TxOutAnyEra]
txouts :: ![TxOutAnyEra]
  , forall era.
TransactionBuildRawCmdArgs era
-> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
mValue :: !(Maybe (Value, [ScriptWitnessFiles WitCtxMint]))
  -- ^ Multi-Asset value with script witness
  , forall era. TransactionBuildRawCmdArgs era -> Maybe SlotNo
mValidityLowerBound :: !(Maybe SlotNo)
  -- ^ Transaction validity lower bound
  , forall era.
TransactionBuildRawCmdArgs era -> TxValidityUpperBound era
mValidityUpperBound :: !(TxValidityUpperBound era)
  -- ^ Transaction validity upper bound
  , forall era. TransactionBuildRawCmdArgs era -> Coin
fee :: !Coin
  -- ^ Transaction fee
  , forall era.
TransactionBuildRawCmdArgs era
-> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
certificates :: ![(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
  -- ^ Certificates with potential script witness
  , forall era.
TransactionBuildRawCmdArgs era
-> [(StakeAddress, Coin, Maybe (ScriptWitnessFiles WitCtxStake))]
withdrawals :: ![(StakeAddress, Coin, Maybe (ScriptWitnessFiles WitCtxStake))]
  , forall era. TransactionBuildRawCmdArgs era -> TxMetadataJsonSchema
metadataSchema :: !TxMetadataJsonSchema
  , forall era. TransactionBuildRawCmdArgs era -> [ScriptFile]
scriptFiles :: ![ScriptFile]
  -- ^ Auxiliary scripts
  , forall era. TransactionBuildRawCmdArgs era -> [MetadataFile]
metadataFiles :: ![MetadataFile]
  , forall era.
TransactionBuildRawCmdArgs era -> Maybe ProtocolParamsFile
mProtocolParamsFile :: !(Maybe ProtocolParamsFile)
  , forall era.
TransactionBuildRawCmdArgs era
-> Maybe
     (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))
mUpdateProprosalFile :: !(Maybe (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)))
  , forall era.
TransactionBuildRawCmdArgs era
-> [(VoteFile 'In, Maybe (ScriptWitnessFiles WitCtxStake))]
voteFiles :: ![(VoteFile In, Maybe (ScriptWitnessFiles WitCtxStake))]
  , forall era.
TransactionBuildRawCmdArgs era
-> [(ProposalFile 'In, Maybe (ScriptWitnessFiles WitCtxStake))]
proposalFiles :: ![(ProposalFile In, Maybe (ScriptWitnessFiles WitCtxStake))]
  , forall era.
TransactionBuildRawCmdArgs era
-> Maybe (TxCurrentTreasuryValue, TxTreasuryDonation)
currentTreasuryValueAndDonation :: !(Maybe (TxCurrentTreasuryValue, TxTreasuryDonation))
  , forall era. TransactionBuildRawCmdArgs era -> TxBodyFile 'Out
txBodyOutFile :: !(TxBodyFile Out)
  }
  deriving Int -> TransactionBuildRawCmdArgs era -> ShowS
[TransactionBuildRawCmdArgs era] -> ShowS
TransactionBuildRawCmdArgs era -> String
(Int -> TransactionBuildRawCmdArgs era -> ShowS)
-> (TransactionBuildRawCmdArgs era -> String)
-> ([TransactionBuildRawCmdArgs era] -> ShowS)
-> Show (TransactionBuildRawCmdArgs era)
forall era. Int -> TransactionBuildRawCmdArgs era -> ShowS
forall era. [TransactionBuildRawCmdArgs era] -> ShowS
forall era. TransactionBuildRawCmdArgs era -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall era. Int -> TransactionBuildRawCmdArgs era -> ShowS
showsPrec :: Int -> TransactionBuildRawCmdArgs era -> ShowS
$cshow :: forall era. TransactionBuildRawCmdArgs era -> String
show :: TransactionBuildRawCmdArgs era -> String
$cshowList :: forall era. [TransactionBuildRawCmdArgs era] -> ShowS
showList :: [TransactionBuildRawCmdArgs era] -> ShowS
Show

-- | Like 'TransactionBuildRaw' but without the fee, and with a change output.
data TransactionBuildCmdArgs era = TransactionBuildCmdArgs
  { forall era. TransactionBuildCmdArgs era -> Era era
currentEra :: !(Exp.Era era)
  , forall era. TransactionBuildCmdArgs era -> SocketPath
nodeSocketPath :: !SocketPath
  , forall era. TransactionBuildCmdArgs era -> ConsensusModeParams
consensusModeParams :: !ConsensusModeParams
  , forall era. TransactionBuildCmdArgs era -> NetworkId
networkId :: !NetworkId
  , forall era. TransactionBuildCmdArgs era -> Maybe ScriptValidity
mScriptValidity :: !(Maybe ScriptValidity)
  -- ^ Mark script as expected to pass or fail validation
  , forall era. TransactionBuildCmdArgs era -> Maybe Word
mOverrideWitnesses :: !(Maybe Word)
  -- ^ Override the required number of tx witnesses
  , forall era.
TransactionBuildCmdArgs era
-> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
txins :: ![(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
  -- ^ Transaction inputs with optional spending scripts
  , forall era. TransactionBuildCmdArgs era -> [TxIn]
readOnlyReferenceInputs :: ![TxIn]
  -- ^ Read only reference inputs
  , forall era. TransactionBuildCmdArgs era -> [RequiredSigner]
requiredSigners :: ![RequiredSigner]
  -- ^ Required signers
  , forall era. TransactionBuildCmdArgs era -> [TxIn]
txinsc :: ![TxIn]
  -- ^ Transaction inputs for collateral, only key witnesses, no scripts.
  , forall era.
TransactionBuildCmdArgs era -> Maybe TxOutShelleyBasedEra
mReturnCollateral :: !(Maybe TxOutShelleyBasedEra)
  -- ^ Return collateral
  , forall era. TransactionBuildCmdArgs era -> Maybe Coin
mTotalCollateral :: !(Maybe Coin)
  -- ^ Total collateral
  , forall era. TransactionBuildCmdArgs era -> [TxOutAnyEra]
txouts :: ![TxOutAnyEra]
  -- ^ Normal outputs
  , forall era. TransactionBuildCmdArgs era -> TxOutChangeAddress
changeAddresses :: !TxOutChangeAddress
  -- ^ A change output
  , forall era.
TransactionBuildCmdArgs era
-> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
mValue :: !(Maybe (Value, [ScriptWitnessFiles WitCtxMint]))
  -- ^ Multi-Asset value with script witness
  , forall era. TransactionBuildCmdArgs era -> Maybe SlotNo
mValidityLowerBound :: !(Maybe SlotNo)
  -- ^ Transaction validity lower bound
  , forall era. TransactionBuildCmdArgs era -> TxValidityUpperBound era
mValidityUpperBound :: !(TxValidityUpperBound era)
  -- ^ Transaction validity upper bound
  , forall era.
TransactionBuildCmdArgs era
-> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
certificates :: ![(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
  -- ^ Certificates with potential script witness
  , forall era.
TransactionBuildCmdArgs era
-> [(StakeAddress, Coin, Maybe (ScriptWitnessFiles WitCtxStake))]
withdrawals :: ![(StakeAddress, Coin, Maybe (ScriptWitnessFiles WitCtxStake))]
  -- ^ Withdrawals with potential script witness
  , forall era. TransactionBuildCmdArgs era -> TxMetadataJsonSchema
metadataSchema :: !TxMetadataJsonSchema
  , forall era. TransactionBuildCmdArgs era -> [ScriptFile]
scriptFiles :: ![ScriptFile]
  -- ^ Auxiliary scripts
  , forall era. TransactionBuildCmdArgs era -> [MetadataFile]
metadataFiles :: ![MetadataFile]
  , forall era.
TransactionBuildCmdArgs era
-> Maybe
     (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))
mUpdateProposalFile :: !(Maybe (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)))
  , forall era.
TransactionBuildCmdArgs era
-> [(VoteFile 'In, Maybe (ScriptWitnessFiles WitCtxStake))]
voteFiles :: ![(VoteFile In, Maybe (ScriptWitnessFiles WitCtxStake))]
  , forall era.
TransactionBuildCmdArgs era
-> [(ProposalFile 'In, Maybe (ScriptWitnessFiles WitCtxStake))]
proposalFiles :: ![(ProposalFile In, Maybe (ScriptWitnessFiles WitCtxStake))]
  , forall era. TransactionBuildCmdArgs era -> Maybe TxTreasuryDonation
treasuryDonation :: !(Maybe TxTreasuryDonation)
  , forall era. TransactionBuildCmdArgs era -> TxBuildOutputOptions
buildOutputOptions :: !TxBuildOutputOptions
  }
  deriving Int -> TransactionBuildCmdArgs era -> ShowS
[TransactionBuildCmdArgs era] -> ShowS
TransactionBuildCmdArgs era -> String
(Int -> TransactionBuildCmdArgs era -> ShowS)
-> (TransactionBuildCmdArgs era -> String)
-> ([TransactionBuildCmdArgs era] -> ShowS)
-> Show (TransactionBuildCmdArgs era)
forall era. Int -> TransactionBuildCmdArgs era -> ShowS
forall era. [TransactionBuildCmdArgs era] -> ShowS
forall era. TransactionBuildCmdArgs era -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall era. Int -> TransactionBuildCmdArgs era -> ShowS
showsPrec :: Int -> TransactionBuildCmdArgs era -> ShowS
$cshow :: forall era. TransactionBuildCmdArgs era -> String
show :: TransactionBuildCmdArgs era -> String
$cshowList :: forall era. [TransactionBuildCmdArgs era] -> ShowS
showList :: [TransactionBuildCmdArgs era] -> ShowS
Show

-- | Like 'TransactionBuildCmd' but does not require explicit access to a running node
data TransactionBuildEstimateCmdArgs era = TransactionBuildEstimateCmdArgs
  { forall era. TransactionBuildEstimateCmdArgs era -> Era era
currentEra :: !(Exp.Era era)
  , forall era.
TransactionBuildEstimateCmdArgs era -> Maybe ScriptValidity
mScriptValidity :: !(Maybe ScriptValidity)
  -- ^ Mark script as expected to pass or fail validation
  , forall era. TransactionBuildEstimateCmdArgs era -> Int
shelleyWitnesses :: !Int
  -- ^ Number of shelley witnesses to be added
  , forall era. TransactionBuildEstimateCmdArgs era -> Maybe Int
mByronWitnesses :: !(Maybe Int)
  , forall era.
TransactionBuildEstimateCmdArgs era -> ProtocolParamsFile
protocolParamsFile :: !ProtocolParamsFile
  , forall era. TransactionBuildEstimateCmdArgs era -> Value
totalUTxOValue :: !Value
  , forall era.
TransactionBuildEstimateCmdArgs era
-> [(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
txins :: ![(TxIn, Maybe (ScriptWitnessFiles WitCtxTxIn))]
  -- ^ Transaction inputs with optional spending scripts
  , forall era. TransactionBuildEstimateCmdArgs era -> [TxIn]
readOnlyReferenceInputs :: ![TxIn]
  -- ^ Read only reference inputs
  , forall era. TransactionBuildEstimateCmdArgs era -> [RequiredSigner]
requiredSigners :: ![RequiredSigner]
  -- ^ Required signers
  , forall era. TransactionBuildEstimateCmdArgs era -> [TxIn]
txinsc :: ![TxIn]
  -- ^ Transaction inputs for collateral, only key witnesses, no scripts.
  , forall era.
TransactionBuildEstimateCmdArgs era -> Maybe TxOutShelleyBasedEra
mReturnCollateral :: !(Maybe TxOutShelleyBasedEra)
  -- ^ Return collateral
  , forall era. TransactionBuildEstimateCmdArgs era -> [TxOutAnyEra]
txouts :: ![TxOutAnyEra]
  -- ^ Normal outputs
  , forall era.
TransactionBuildEstimateCmdArgs era -> TxOutChangeAddress
changeAddress :: !TxOutChangeAddress
  -- ^ A change output
  , forall era.
TransactionBuildEstimateCmdArgs era
-> Maybe (Value, [ScriptWitnessFiles WitCtxMint])
mValue :: !(Maybe (Value, [ScriptWitnessFiles WitCtxMint]))
  -- ^ Multi-Asset value with script witness
  , forall era. TransactionBuildEstimateCmdArgs era -> Maybe SlotNo
mValidityLowerBound :: !(Maybe SlotNo)
  -- ^ Transaction validity lower bound
  , forall era.
TransactionBuildEstimateCmdArgs era -> TxValidityUpperBound era
mValidityUpperBound :: !(TxValidityUpperBound era)
  -- ^ Transaction validity upper bound
  , forall era.
TransactionBuildEstimateCmdArgs era
-> [(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
certificates :: ![(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
  -- ^ Certificates with potential script witness
  , forall era.
TransactionBuildEstimateCmdArgs era
-> [(StakeAddress, Coin, Maybe (ScriptWitnessFiles WitCtxStake))]
withdrawals :: ![(StakeAddress, Coin, Maybe (ScriptWitnessFiles WitCtxStake))]
  -- ^ Withdrawals with potential script witness
  , forall era. TransactionBuildEstimateCmdArgs era -> Maybe Coin
plutusCollateral :: !(Maybe Coin)
  -- ^ Total collateral
  , forall era.
TransactionBuildEstimateCmdArgs era -> Maybe ReferenceScriptSize
totalReferenceScriptSize :: !(Maybe ReferenceScriptSize)
  -- ^ Size of all reference scripts in bytes
  , forall era.
TransactionBuildEstimateCmdArgs era -> TxMetadataJsonSchema
metadataSchema :: !TxMetadataJsonSchema
  , forall era. TransactionBuildEstimateCmdArgs era -> [ScriptFile]
scriptFiles :: ![ScriptFile]
  -- ^ Auxiliary scripts
  , forall era. TransactionBuildEstimateCmdArgs era -> [MetadataFile]
metadataFiles :: ![MetadataFile]
  , forall era.
TransactionBuildEstimateCmdArgs era
-> Maybe
     (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))
mUpdateProposalFile :: !(Maybe (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)))
  , forall era.
TransactionBuildEstimateCmdArgs era
-> [(VoteFile 'In, Maybe (ScriptWitnessFiles WitCtxStake))]
voteFiles :: ![(VoteFile In, Maybe (ScriptWitnessFiles WitCtxStake))]
  , forall era.
TransactionBuildEstimateCmdArgs era
-> [(ProposalFile 'In, Maybe (ScriptWitnessFiles WitCtxStake))]
proposalFiles :: ![(ProposalFile In, Maybe (ScriptWitnessFiles WitCtxStake))]
  , forall era.
TransactionBuildEstimateCmdArgs era
-> Maybe (TxCurrentTreasuryValue, TxTreasuryDonation)
currentTreasuryValueAndDonation :: !(Maybe (TxCurrentTreasuryValue, TxTreasuryDonation))
  , forall era. TransactionBuildEstimateCmdArgs era -> TxBodyFile 'Out
txBodyOutFile :: !(TxBodyFile Out)
  }

data TransactionSignCmdArgs = TransactionSignCmdArgs
  { TransactionSignCmdArgs -> InputTxBodyOrTxFile
txOrTxBodyFile :: !InputTxBodyOrTxFile
  , TransactionSignCmdArgs -> [WitnessSigningData]
witnessSigningData :: ![WitnessSigningData]
  , TransactionSignCmdArgs -> Maybe NetworkId
mNetworkId :: !(Maybe NetworkId)
  , TransactionSignCmdArgs -> TxFile 'Out
outTxFile :: !(TxFile Out)
  }
  deriving Int -> TransactionSignCmdArgs -> ShowS
[TransactionSignCmdArgs] -> ShowS
TransactionSignCmdArgs -> String
(Int -> TransactionSignCmdArgs -> ShowS)
-> (TransactionSignCmdArgs -> String)
-> ([TransactionSignCmdArgs] -> ShowS)
-> Show TransactionSignCmdArgs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TransactionSignCmdArgs -> ShowS
showsPrec :: Int -> TransactionSignCmdArgs -> ShowS
$cshow :: TransactionSignCmdArgs -> String
show :: TransactionSignCmdArgs -> String
$cshowList :: [TransactionSignCmdArgs] -> ShowS
showList :: [TransactionSignCmdArgs] -> ShowS
Show

data TransactionWitnessCmdArgs = TransactionWitnessCmdArgs
  { TransactionWitnessCmdArgs -> TxBodyFile 'In
txBodyFile :: !(TxBodyFile In)
  , TransactionWitnessCmdArgs -> WitnessSigningData
witnessSigningData :: !WitnessSigningData
  , TransactionWitnessCmdArgs -> Maybe NetworkId
mNetworkId :: !(Maybe NetworkId)
  , TransactionWitnessCmdArgs -> File () 'Out
outFile :: !(File () Out)
  }
  deriving Int -> TransactionWitnessCmdArgs -> ShowS
[TransactionWitnessCmdArgs] -> ShowS
TransactionWitnessCmdArgs -> String
(Int -> TransactionWitnessCmdArgs -> ShowS)
-> (TransactionWitnessCmdArgs -> String)
-> ([TransactionWitnessCmdArgs] -> ShowS)
-> Show TransactionWitnessCmdArgs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TransactionWitnessCmdArgs -> ShowS
showsPrec :: Int -> TransactionWitnessCmdArgs -> ShowS
$cshow :: TransactionWitnessCmdArgs -> String
show :: TransactionWitnessCmdArgs -> String
$cshowList :: [TransactionWitnessCmdArgs] -> ShowS
showList :: [TransactionWitnessCmdArgs] -> ShowS
Show

data TransactionSignWitnessCmdArgs = TransactionSignWitnessCmdArgs
  { TransactionSignWitnessCmdArgs -> TxBodyFile 'In
txBodyFile :: !(TxBodyFile In)
  , TransactionSignWitnessCmdArgs -> [WitnessFile]
witnessFiles :: ![WitnessFile]
  , TransactionSignWitnessCmdArgs -> File () 'Out
outFile :: !(File () Out)
  }
  deriving Int -> TransactionSignWitnessCmdArgs -> ShowS
[TransactionSignWitnessCmdArgs] -> ShowS
TransactionSignWitnessCmdArgs -> String
(Int -> TransactionSignWitnessCmdArgs -> ShowS)
-> (TransactionSignWitnessCmdArgs -> String)
-> ([TransactionSignWitnessCmdArgs] -> ShowS)
-> Show TransactionSignWitnessCmdArgs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TransactionSignWitnessCmdArgs -> ShowS
showsPrec :: Int -> TransactionSignWitnessCmdArgs -> ShowS
$cshow :: TransactionSignWitnessCmdArgs -> String
show :: TransactionSignWitnessCmdArgs -> String
$cshowList :: [TransactionSignWitnessCmdArgs] -> ShowS
showList :: [TransactionSignWitnessCmdArgs] -> ShowS
Show

data TransactionSubmitCmdArgs = TransactionSubmitCmdArgs
  { TransactionSubmitCmdArgs -> SocketPath
nodeSocketPath :: !SocketPath
  , TransactionSubmitCmdArgs -> ConsensusModeParams
consensusModeParams :: !ConsensusModeParams
  , TransactionSubmitCmdArgs -> NetworkId
networkId :: !NetworkId
  , TransactionSubmitCmdArgs -> String
txFile :: !FilePath
  }
  deriving Int -> TransactionSubmitCmdArgs -> ShowS
[TransactionSubmitCmdArgs] -> ShowS
TransactionSubmitCmdArgs -> String
(Int -> TransactionSubmitCmdArgs -> ShowS)
-> (TransactionSubmitCmdArgs -> String)
-> ([TransactionSubmitCmdArgs] -> ShowS)
-> Show TransactionSubmitCmdArgs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TransactionSubmitCmdArgs -> ShowS
showsPrec :: Int -> TransactionSubmitCmdArgs -> ShowS
$cshow :: TransactionSubmitCmdArgs -> String
show :: TransactionSubmitCmdArgs -> String
$cshowList :: [TransactionSubmitCmdArgs] -> ShowS
showList :: [TransactionSubmitCmdArgs] -> ShowS
Show

newtype TransactionPolicyIdCmdArgs = TransactionPolicyIdCmdArgs
  { TransactionPolicyIdCmdArgs -> ScriptFile
scriptFile :: ScriptFile
  }
  deriving Int -> TransactionPolicyIdCmdArgs -> ShowS
[TransactionPolicyIdCmdArgs] -> ShowS
TransactionPolicyIdCmdArgs -> String
(Int -> TransactionPolicyIdCmdArgs -> ShowS)
-> (TransactionPolicyIdCmdArgs -> String)
-> ([TransactionPolicyIdCmdArgs] -> ShowS)
-> Show TransactionPolicyIdCmdArgs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TransactionPolicyIdCmdArgs -> ShowS
showsPrec :: Int -> TransactionPolicyIdCmdArgs -> ShowS
$cshow :: TransactionPolicyIdCmdArgs -> String
show :: TransactionPolicyIdCmdArgs -> String
$cshowList :: [TransactionPolicyIdCmdArgs] -> ShowS
showList :: [TransactionPolicyIdCmdArgs] -> ShowS
Show

data TransactionCalculateMinFeeCmdArgs = TransactionCalculateMinFeeCmdArgs
  { TransactionCalculateMinFeeCmdArgs -> TxBodyFile 'In
txBodyFile :: !(TxBodyFile In)
  , TransactionCalculateMinFeeCmdArgs -> ProtocolParamsFile
protocolParamsFile :: !ProtocolParamsFile
  , TransactionCalculateMinFeeCmdArgs -> TxShelleyWitnessCount
txShelleyWitnessCount :: !TxShelleyWitnessCount
  , TransactionCalculateMinFeeCmdArgs -> TxByronWitnessCount
txByronWitnessCount :: !TxByronWitnessCount
  , TransactionCalculateMinFeeCmdArgs -> ReferenceScriptSize
referenceScriptSize :: !ReferenceScriptSize
  -- ^ The total size in bytes of the transaction reference scripts.
  , TransactionCalculateMinFeeCmdArgs -> Maybe OutputFormatJsonOrText
outputFormat :: !(Maybe OutputFormatJsonOrText)
  , TransactionCalculateMinFeeCmdArgs -> Maybe (File () 'Out)
outFile :: !(Maybe (File () Out))
  }
  deriving Int -> TransactionCalculateMinFeeCmdArgs -> ShowS
[TransactionCalculateMinFeeCmdArgs] -> ShowS
TransactionCalculateMinFeeCmdArgs -> String
(Int -> TransactionCalculateMinFeeCmdArgs -> ShowS)
-> (TransactionCalculateMinFeeCmdArgs -> String)
-> ([TransactionCalculateMinFeeCmdArgs] -> ShowS)
-> Show TransactionCalculateMinFeeCmdArgs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TransactionCalculateMinFeeCmdArgs -> ShowS
showsPrec :: Int -> TransactionCalculateMinFeeCmdArgs -> ShowS
$cshow :: TransactionCalculateMinFeeCmdArgs -> String
show :: TransactionCalculateMinFeeCmdArgs -> String
$cshowList :: [TransactionCalculateMinFeeCmdArgs] -> ShowS
showList :: [TransactionCalculateMinFeeCmdArgs] -> ShowS
Show

data TransactionCalculateMinValueCmdArgs era = TransactionCalculateMinValueCmdArgs
  { forall era.
TransactionCalculateMinValueCmdArgs era -> ShelleyBasedEra era
eon :: !(ShelleyBasedEra era)
  , forall era.
TransactionCalculateMinValueCmdArgs era -> ProtocolParamsFile
protocolParamsFile :: !ProtocolParamsFile
  , forall era.
TransactionCalculateMinValueCmdArgs era -> TxOutShelleyBasedEra
txOut :: !TxOutShelleyBasedEra
  }
  deriving Int -> TransactionCalculateMinValueCmdArgs era -> ShowS
[TransactionCalculateMinValueCmdArgs era] -> ShowS
TransactionCalculateMinValueCmdArgs era -> String
(Int -> TransactionCalculateMinValueCmdArgs era -> ShowS)
-> (TransactionCalculateMinValueCmdArgs era -> String)
-> ([TransactionCalculateMinValueCmdArgs era] -> ShowS)
-> Show (TransactionCalculateMinValueCmdArgs era)
forall era. Int -> TransactionCalculateMinValueCmdArgs era -> ShowS
forall era. [TransactionCalculateMinValueCmdArgs era] -> ShowS
forall era. TransactionCalculateMinValueCmdArgs era -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall era. Int -> TransactionCalculateMinValueCmdArgs era -> ShowS
showsPrec :: Int -> TransactionCalculateMinValueCmdArgs era -> ShowS
$cshow :: forall era. TransactionCalculateMinValueCmdArgs era -> String
show :: TransactionCalculateMinValueCmdArgs era -> String
$cshowList :: forall era. [TransactionCalculateMinValueCmdArgs era] -> ShowS
showList :: [TransactionCalculateMinValueCmdArgs era] -> ShowS
Show

newtype TransactionHashScriptDataCmdArgs = TransactionHashScriptDataCmdArgs
  { TransactionHashScriptDataCmdArgs -> ScriptDataOrFile
scriptDataOrFile :: ScriptDataOrFile
  }
  deriving Int -> TransactionHashScriptDataCmdArgs -> ShowS
[TransactionHashScriptDataCmdArgs] -> ShowS
TransactionHashScriptDataCmdArgs -> String
(Int -> TransactionHashScriptDataCmdArgs -> ShowS)
-> (TransactionHashScriptDataCmdArgs -> String)
-> ([TransactionHashScriptDataCmdArgs] -> ShowS)
-> Show TransactionHashScriptDataCmdArgs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TransactionHashScriptDataCmdArgs -> ShowS
showsPrec :: Int -> TransactionHashScriptDataCmdArgs -> ShowS
$cshow :: TransactionHashScriptDataCmdArgs -> String
show :: TransactionHashScriptDataCmdArgs -> String
$cshowList :: [TransactionHashScriptDataCmdArgs] -> ShowS
showList :: [TransactionHashScriptDataCmdArgs] -> ShowS
Show

newtype TransactionTxIdCmdArgs = TransactionTxIdCmdArgs
  { TransactionTxIdCmdArgs -> InputTxBodyOrTxFile
inputTxBodyOrTxFile :: InputTxBodyOrTxFile
  }
  deriving Int -> TransactionTxIdCmdArgs -> ShowS
[TransactionTxIdCmdArgs] -> ShowS
TransactionTxIdCmdArgs -> String
(Int -> TransactionTxIdCmdArgs -> ShowS)
-> (TransactionTxIdCmdArgs -> String)
-> ([TransactionTxIdCmdArgs] -> ShowS)
-> Show TransactionTxIdCmdArgs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TransactionTxIdCmdArgs -> ShowS
showsPrec :: Int -> TransactionTxIdCmdArgs -> ShowS
$cshow :: TransactionTxIdCmdArgs -> String
show :: TransactionTxIdCmdArgs -> String
$cshowList :: [TransactionTxIdCmdArgs] -> ShowS
showList :: [TransactionTxIdCmdArgs] -> ShowS
Show

data TransactionViewCmdArgs = TransactionViewCmdArgs
  deriving Int -> TransactionViewCmdArgs -> ShowS
[TransactionViewCmdArgs] -> ShowS
TransactionViewCmdArgs -> String
(Int -> TransactionViewCmdArgs -> ShowS)
-> (TransactionViewCmdArgs -> String)
-> ([TransactionViewCmdArgs] -> ShowS)
-> Show TransactionViewCmdArgs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TransactionViewCmdArgs -> ShowS
showsPrec :: Int -> TransactionViewCmdArgs -> ShowS
$cshow :: TransactionViewCmdArgs -> String
show :: TransactionViewCmdArgs -> String
$cshowList :: [TransactionViewCmdArgs] -> ShowS
showList :: [TransactionViewCmdArgs] -> ShowS
Show

renderTransactionCmds :: TransactionCmds era -> Text
renderTransactionCmds :: forall era. TransactionCmds era -> Text
renderTransactionCmds = \case
  TransactionBuildCmd{} -> Text
"transaction build"
  TransactionBuildEstimateCmd{} -> Text
"transaction build-estimate"
  TransactionBuildRawCmd{} -> Text
"transaction build-raw"
  TransactionSignCmd{} -> Text
"transaction sign"
  TransactionWitnessCmd{} -> Text
"transaction witness"
  TransactionSignWitnessCmd{} -> Text
"transaction sign-witness"
  TransactionSubmitCmd{} -> Text
"transaction submit"
  TransactionPolicyIdCmd{} -> Text
"transaction policyid"
  TransactionCalculateMinFeeCmd{} -> Text
"transaction calculate-min-fee"
  TransactionCalculateMinValueCmd{} -> Text
"transaction calculate-min-value"
  TransactionHashScriptDataCmd{} -> Text
"transaction hash-script-data"
  TransactionTxIdCmd{} -> Text
"transaction txid"