{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
module Cardano.CLI.EraBased.Script.Type
( AnyPlutusScript (..)
, CliScriptWitnessError (..)
)
where
import Cardano.Api
import Cardano.CLI.Type.Error.PlutusScriptDecodeError
import Cardano.CLI.Type.Error.ScriptDataError
import Cardano.CLI.Type.Error.ScriptDecodeError
data AnyPlutusScript where
AnyPlutusScript
:: IsPlutusScriptLanguage lang => PlutusScriptVersion lang -> PlutusScript lang -> AnyPlutusScript
data CliScriptWitnessError
= SimpleScriptWitnessDecodeError ScriptDecodeError
| TextEnvelopeError TextEnvelopeError
| PlutusScriptWitnessDecodeError PlutusScriptDecodeError
| PlutusScriptWitnessLanguageNotSupportedInEra
AnyPlutusScriptVersion
AnyShelleyBasedEra
| PlutusScriptWitnessRedeemerError ScriptDataError
deriving Int -> CliScriptWitnessError -> ShowS
[CliScriptWitnessError] -> ShowS
CliScriptWitnessError -> String
(Int -> CliScriptWitnessError -> ShowS)
-> (CliScriptWitnessError -> String)
-> ([CliScriptWitnessError] -> ShowS)
-> Show CliScriptWitnessError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CliScriptWitnessError -> ShowS
showsPrec :: Int -> CliScriptWitnessError -> ShowS
$cshow :: CliScriptWitnessError -> String
show :: CliScriptWitnessError -> String
$cshowList :: [CliScriptWitnessError] -> ShowS
showList :: [CliScriptWitnessError] -> ShowS
Show
instance Error CliScriptWitnessError where
prettyError :: forall ann. CliScriptWitnessError -> Doc ann
prettyError = \case
SimpleScriptWitnessDecodeError ScriptDecodeError
err -> ScriptDecodeError -> Doc ann
forall e ann. Error e => e -> Doc ann
forall ann. ScriptDecodeError -> Doc ann
prettyError ScriptDecodeError
err
TextEnvelopeError TextEnvelopeError
err -> TextEnvelopeError -> Doc ann
forall e ann. Error e => e -> Doc ann
forall ann. TextEnvelopeError -> Doc ann
prettyError TextEnvelopeError
err
PlutusScriptWitnessDecodeError PlutusScriptDecodeError
err -> PlutusScriptDecodeError -> Doc ann
forall e ann. Error e => e -> Doc ann
forall ann. PlutusScriptDecodeError -> Doc ann
prettyError PlutusScriptDecodeError
err
PlutusScriptWitnessLanguageNotSupportedInEra AnyPlutusScriptVersion
version AnyShelleyBasedEra
era ->
Doc ann
"Plutus script version " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> AnyPlutusScriptVersion -> Doc ann
forall a ann. Show a => a -> Doc ann
pshow AnyPlutusScriptVersion
version Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" is not supported in era " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> AnyShelleyBasedEra -> Doc ann
forall a ann. Show a => a -> Doc ann
pshow AnyShelleyBasedEra
era
PlutusScriptWitnessRedeemerError ScriptDataError
err -> ScriptDataError -> Doc ann
forall ann. ScriptDataError -> Doc ann
renderScriptDataError ScriptDataError
err