{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Cardano.CLI.Types.Errors.TxValidationError
( TxAuxScriptsValidationError (..)
, TxGovDuplicateVotes (..)
, TxNotSupportedInEraValidationError (..)
, validateScriptSupportedInEra
, validateTxAuxScripts
, validateRequiredSigners
, validateTxReturnCollateral
, validateTxScriptValidity
, validateTxTotalCollateral
, validateTxValidityLowerBound
, validateUpdateProposalFile
, validateTxCurrentTreasuryValue
, validateTxTreasuryDonation
)
where
import Cardano.Api
import Cardano.Api.Shelley
import Cardano.CLI.Types.Common
import Prelude
import Data.Bifunctor (first)
import qualified Data.Text as T
import Prettyprinter (viaShow)
data ScriptLanguageValidationError
= ScriptLanguageValidationError AnyScriptLanguage AnyCardanoEra
deriving Int -> ScriptLanguageValidationError -> ShowS
[ScriptLanguageValidationError] -> ShowS
ScriptLanguageValidationError -> String
(Int -> ScriptLanguageValidationError -> ShowS)
-> (ScriptLanguageValidationError -> String)
-> ([ScriptLanguageValidationError] -> ShowS)
-> Show ScriptLanguageValidationError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ScriptLanguageValidationError -> ShowS
showsPrec :: Int -> ScriptLanguageValidationError -> ShowS
$cshow :: ScriptLanguageValidationError -> String
show :: ScriptLanguageValidationError -> String
$cshowList :: [ScriptLanguageValidationError] -> ShowS
showList :: [ScriptLanguageValidationError] -> ShowS
Show
instance Error ScriptLanguageValidationError where
prettyError :: forall ann. ScriptLanguageValidationError -> Doc ann
prettyError = \case
ScriptLanguageValidationError AnyScriptLanguage
lang AnyCardanoEra
era ->
Doc ann
"The script language "
Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> AnyScriptLanguage -> Doc ann
forall a ann. Show a => a -> Doc ann
pshow AnyScriptLanguage
lang
Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" is not supported in the "
Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> AnyCardanoEra -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. AnyCardanoEra -> Doc ann
pretty AnyCardanoEra
era
Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" era."
validateScriptSupportedInEra
:: ShelleyBasedEra era
-> ScriptInAnyLang
-> Either ScriptLanguageValidationError (ScriptInEra era)
validateScriptSupportedInEra :: forall era.
ShelleyBasedEra era
-> ScriptInAnyLang
-> Either ScriptLanguageValidationError (ScriptInEra era)
validateScriptSupportedInEra ShelleyBasedEra era
era script :: ScriptInAnyLang
script@(ScriptInAnyLang ScriptLanguage lang
lang Script lang
_) =
case ShelleyBasedEra era -> ScriptInAnyLang -> Maybe (ScriptInEra era)
forall era.
ShelleyBasedEra era -> ScriptInAnyLang -> Maybe (ScriptInEra era)
toScriptInEra ShelleyBasedEra era
era ScriptInAnyLang
script of
Maybe (ScriptInEra era)
Nothing ->
ScriptLanguageValidationError
-> Either ScriptLanguageValidationError (ScriptInEra era)
forall a b. a -> Either a b
Left (ScriptLanguageValidationError
-> Either ScriptLanguageValidationError (ScriptInEra era))
-> ScriptLanguageValidationError
-> Either ScriptLanguageValidationError (ScriptInEra era)
forall a b. (a -> b) -> a -> b
$
AnyScriptLanguage -> AnyCardanoEra -> ScriptLanguageValidationError
ScriptLanguageValidationError
(ScriptLanguage lang -> AnyScriptLanguage
forall lang. ScriptLanguage lang -> AnyScriptLanguage
AnyScriptLanguage ScriptLanguage lang
lang)
(CardanoEra era -> AnyCardanoEra
forall era. CardanoEra era -> AnyCardanoEra
anyCardanoEra (CardanoEra era -> AnyCardanoEra)
-> CardanoEra era -> AnyCardanoEra
forall a b. (a -> b) -> a -> b
$ ShelleyBasedEra era -> CardanoEra era
forall era. ShelleyBasedEra era -> CardanoEra era
forall (eon :: * -> *) era.
ToCardanoEra eon =>
eon era -> CardanoEra era
toCardanoEra ShelleyBasedEra era
era)
Just ScriptInEra era
script' -> ScriptInEra era
-> Either ScriptLanguageValidationError (ScriptInEra era)
forall a. a -> Either ScriptLanguageValidationError a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ScriptInEra era
script'
data TxNotSupportedInEraValidationError era
=
TxNotSupportedInAnyCardanoEraValidationError T.Text AnyCardanoEra
|
TxNotSupportedInShelleyBasedEraValidationError T.Text (ShelleyBasedEra era)
instance Show (TxNotSupportedInEraValidationError era) where
show :: TxNotSupportedInEraValidationError era -> String
show =
\case
TxNotSupportedInAnyCardanoEraValidationError Text
a AnyCardanoEra
cEra -> Text -> AnyCardanoEra -> String
forall {a} {a}. (Pretty a, Show a) => a -> a -> String
go Text
a AnyCardanoEra
cEra
TxNotSupportedInShelleyBasedEraValidationError Text
a ShelleyBasedEra era
sbe -> Text -> ShelleyBasedEra era -> String
forall {a} {a}. (Pretty a, Show a) => a -> a -> String
go Text
a ShelleyBasedEra era
sbe
where
go :: a -> a -> String
go a
a a
era = Doc Any -> String
forall a. Show a => a -> String
show (a -> Doc Any
forall ann. a -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty a
a) String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
" not supported in " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> a -> String
forall a. Show a => a -> String
show a
era
instance Error (TxNotSupportedInEraValidationError era) where
prettyError :: forall ann. TxNotSupportedInEraValidationError era -> Doc ann
prettyError =
\case
TxNotSupportedInAnyCardanoEraValidationError Text
a AnyCardanoEra
cEra -> Text -> AnyCardanoEra -> Doc ann
forall {a} {a} {ann}. (Pretty a, Show a) => a -> a -> Doc ann
go Text
a AnyCardanoEra
cEra
TxNotSupportedInShelleyBasedEraValidationError Text
a ShelleyBasedEra era
sbe -> Text -> ShelleyBasedEra era -> Doc ann
forall {a} {a} {ann}. (Pretty a, Show a) => a -> a -> Doc ann
go Text
a ShelleyBasedEra era
sbe
where
go :: a -> a -> Doc ann
go a
a a
cEra = a -> Doc ann
forall ann. a -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty a
a Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> Doc ann
"not supported in" Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> a -> Doc ann
forall a ann. Show a => a -> Doc ann
viaShow a
cEra
validateTxTotalCollateral
:: ShelleyBasedEra era
-> Maybe Lovelace
-> Either (TxNotSupportedInEraValidationError era) (TxTotalCollateral era)
validateTxTotalCollateral :: forall era.
ShelleyBasedEra era
-> Maybe Lovelace
-> Either
(TxNotSupportedInEraValidationError era) (TxTotalCollateral era)
validateTxTotalCollateral ShelleyBasedEra era
_ Maybe Lovelace
Nothing = TxTotalCollateral era
-> Either
(TxNotSupportedInEraValidationError era) (TxTotalCollateral era)
forall a. a -> Either (TxNotSupportedInEraValidationError era) a
forall (m :: * -> *) a. Monad m => a -> m a
return TxTotalCollateral era
forall era. TxTotalCollateral era
TxTotalCollateralNone
validateTxTotalCollateral ShelleyBasedEra era
sbe (Just Lovelace
coll) = do
BabbageEraOnwards era
supported <-
CardanoEra era
-> (AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (BabbageEraOnwards era)
forall (eon :: * -> *) era e.
Eon eon =>
CardanoEra era -> (AnyCardanoEra -> e) -> Either e (eon era)
conjureWitness (ShelleyBasedEra era -> CardanoEra era
forall era. ShelleyBasedEra era -> CardanoEra era
forall (eon :: * -> *) era.
ToCardanoEra eon =>
eon era -> CardanoEra era
toCardanoEra ShelleyBasedEra era
sbe) ((AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (BabbageEraOnwards era))
-> (AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (BabbageEraOnwards era)
forall a b. (a -> b) -> a -> b
$
Text -> AnyCardanoEra -> TxNotSupportedInEraValidationError era
forall era.
Text -> AnyCardanoEra -> TxNotSupportedInEraValidationError era
TxNotSupportedInAnyCardanoEraValidationError Text
"Transaction collateral"
TxTotalCollateral era
-> Either
(TxNotSupportedInEraValidationError era) (TxTotalCollateral era)
forall a. a -> Either (TxNotSupportedInEraValidationError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxTotalCollateral era
-> Either
(TxNotSupportedInEraValidationError era) (TxTotalCollateral era))
-> TxTotalCollateral era
-> Either
(TxNotSupportedInEraValidationError era) (TxTotalCollateral era)
forall a b. (a -> b) -> a -> b
$ BabbageEraOnwards era -> Lovelace -> TxTotalCollateral era
forall era.
BabbageEraOnwards era -> Lovelace -> TxTotalCollateral era
TxTotalCollateral BabbageEraOnwards era
supported Lovelace
coll
validateTxCurrentTreasuryValue
:: ()
=> ShelleyBasedEra era
-> Maybe TxCurrentTreasuryValue
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
validateTxCurrentTreasuryValue :: forall era.
ShelleyBasedEra era
-> Maybe TxCurrentTreasuryValue
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
validateTxCurrentTreasuryValue ShelleyBasedEra era
sbe Maybe TxCurrentTreasuryValue
mCurrentTreasuryValue =
case Maybe TxCurrentTreasuryValue
mCurrentTreasuryValue of
Maybe TxCurrentTreasuryValue
Nothing -> Maybe (Featured ConwayEraOnwards era (Maybe Lovelace))
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
forall a b. b -> Either a b
Right Maybe (Featured ConwayEraOnwards era (Maybe Lovelace))
forall a. Maybe a
Nothing
Just (TxCurrentTreasuryValue{Lovelace
unTxCurrentTreasuryValue :: Lovelace
unTxCurrentTreasuryValue :: TxCurrentTreasuryValue -> Lovelace
unTxCurrentTreasuryValue}) ->
(ShelleyToBabbageEraConstraints era =>
ShelleyToBabbageEra era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace))))
-> (ConwayEraOnwardsConstraints era =>
ConwayEraOnwards era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace))))
-> ShelleyBasedEra era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
forall era a.
(ShelleyToBabbageEraConstraints era =>
ShelleyToBabbageEra era -> a)
-> (ConwayEraOnwardsConstraints era => ConwayEraOnwards era -> a)
-> ShelleyBasedEra era
-> a
caseShelleyToBabbageOrConwayEraOnwards
(Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
-> ShelleyToBabbageEra era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
forall a b. a -> b -> a
const (Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
-> ShelleyToBabbageEra era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace))))
-> (TxNotSupportedInEraValidationError era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace))))
-> TxNotSupportedInEraValidationError era
-> ShelleyToBabbageEra era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxNotSupportedInEraValidationError era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
forall a b. a -> Either a b
Left (TxNotSupportedInEraValidationError era
-> ShelleyToBabbageEra era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace))))
-> TxNotSupportedInEraValidationError era
-> ShelleyToBabbageEra era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
forall a b. (a -> b) -> a -> b
$ Text
-> ShelleyBasedEra era -> TxNotSupportedInEraValidationError era
forall era.
Text
-> ShelleyBasedEra era -> TxNotSupportedInEraValidationError era
TxNotSupportedInShelleyBasedEraValidationError Text
"Current treasury value" ShelleyBasedEra era
sbe)
(Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
-> ConwayEraOnwards era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
forall a b. a -> b -> a
const (Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
-> ConwayEraOnwards era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace))))
-> (Maybe Lovelace
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace))))
-> Maybe Lovelace
-> ConwayEraOnwards era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe (Featured ConwayEraOnwards era (Maybe Lovelace))
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
forall a. a -> Either (TxNotSupportedInEraValidationError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe (Featured ConwayEraOnwards era (Maybe Lovelace))
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace))))
-> (Maybe Lovelace
-> Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
-> Maybe Lovelace
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe Lovelace
-> Maybe (Featured ConwayEraOnwards era (Maybe Lovelace))
forall (eon :: * -> *) era a.
(IsCardanoEra era, Eon eon) =>
a -> Maybe (Featured eon era a)
mkFeatured (Maybe Lovelace
-> ConwayEraOnwards era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace))))
-> Maybe Lovelace
-> ConwayEraOnwards era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era (Maybe Lovelace)))
forall a b. (a -> b) -> a -> b
$ Lovelace -> Maybe Lovelace
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Lovelace
unTxCurrentTreasuryValue)
ShelleyBasedEra era
sbe
validateTxTreasuryDonation
:: ()
=> ShelleyBasedEra era
-> Maybe TxTreasuryDonation
-> Either (TxNotSupportedInEraValidationError era) (Maybe (Featured ConwayEraOnwards era Lovelace))
validateTxTreasuryDonation :: forall era.
ShelleyBasedEra era
-> Maybe TxTreasuryDonation
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace))
validateTxTreasuryDonation ShelleyBasedEra era
sbe Maybe TxTreasuryDonation
mTreasuryDonation =
case Maybe TxTreasuryDonation
mTreasuryDonation of
Maybe TxTreasuryDonation
Nothing -> Maybe (Featured ConwayEraOnwards era Lovelace)
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace))
forall a b. b -> Either a b
Right Maybe (Featured ConwayEraOnwards era Lovelace)
forall a. Maybe a
Nothing
Just (TxTreasuryDonation{Lovelace
unTxTreasuryDonation :: Lovelace
unTxTreasuryDonation :: TxTreasuryDonation -> Lovelace
unTxTreasuryDonation}) ->
(ShelleyToBabbageEraConstraints era =>
ShelleyToBabbageEra era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace)))
-> (ConwayEraOnwardsConstraints era =>
ConwayEraOnwards era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace)))
-> ShelleyBasedEra era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace))
forall era a.
(ShelleyToBabbageEraConstraints era =>
ShelleyToBabbageEra era -> a)
-> (ConwayEraOnwardsConstraints era => ConwayEraOnwards era -> a)
-> ShelleyBasedEra era
-> a
caseShelleyToBabbageOrConwayEraOnwards
(Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace))
-> ShelleyToBabbageEra era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace))
forall a b. a -> b -> a
const (Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace))
-> ShelleyToBabbageEra era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace)))
-> (TxNotSupportedInEraValidationError era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace)))
-> TxNotSupportedInEraValidationError era
-> ShelleyToBabbageEra era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxNotSupportedInEraValidationError era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace))
forall a b. a -> Either a b
Left (TxNotSupportedInEraValidationError era
-> ShelleyToBabbageEra era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace)))
-> TxNotSupportedInEraValidationError era
-> ShelleyToBabbageEra era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace))
forall a b. (a -> b) -> a -> b
$ Text
-> ShelleyBasedEra era -> TxNotSupportedInEraValidationError era
forall era.
Text
-> ShelleyBasedEra era -> TxNotSupportedInEraValidationError era
TxNotSupportedInShelleyBasedEraValidationError Text
"Treasury donation" ShelleyBasedEra era
sbe)
(Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace))
-> ConwayEraOnwards era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace))
forall a b. a -> b -> a
const (Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace))
-> ConwayEraOnwards era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace)))
-> (Maybe (Featured ConwayEraOnwards era Lovelace)
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace)))
-> Maybe (Featured ConwayEraOnwards era Lovelace)
-> ConwayEraOnwards era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe (Featured ConwayEraOnwards era Lovelace)
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace))
forall a. a -> Either (TxNotSupportedInEraValidationError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe (Featured ConwayEraOnwards era Lovelace)
-> ConwayEraOnwards era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace)))
-> Maybe (Featured ConwayEraOnwards era Lovelace)
-> ConwayEraOnwards era
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ConwayEraOnwards era Lovelace))
forall a b. (a -> b) -> a -> b
$ Lovelace -> Maybe (Featured ConwayEraOnwards era Lovelace)
forall (eon :: * -> *) era a.
(IsCardanoEra era, Eon eon) =>
a -> Maybe (Featured eon era a)
mkFeatured Lovelace
unTxTreasuryDonation)
ShelleyBasedEra era
sbe
validateTxReturnCollateral
:: ShelleyBasedEra era
-> Maybe (TxOut CtxTx era)
-> Either (TxNotSupportedInEraValidationError era) (TxReturnCollateral CtxTx era)
validateTxReturnCollateral :: forall era.
ShelleyBasedEra era
-> Maybe (TxOut CtxTx era)
-> Either
(TxNotSupportedInEraValidationError era)
(TxReturnCollateral CtxTx era)
validateTxReturnCollateral ShelleyBasedEra era
_ Maybe (TxOut CtxTx era)
Nothing = TxReturnCollateral CtxTx era
-> Either
(TxNotSupportedInEraValidationError era)
(TxReturnCollateral CtxTx era)
forall a. a -> Either (TxNotSupportedInEraValidationError era) a
forall (m :: * -> *) a. Monad m => a -> m a
return TxReturnCollateral CtxTx era
forall ctx era. TxReturnCollateral ctx era
TxReturnCollateralNone
validateTxReturnCollateral ShelleyBasedEra era
sbe (Just TxOut CtxTx era
retColTxOut) = do
BabbageEraOnwards era
supported <-
CardanoEra era
-> (AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (BabbageEraOnwards era)
forall (eon :: * -> *) era e.
Eon eon =>
CardanoEra era -> (AnyCardanoEra -> e) -> Either e (eon era)
conjureWitness (ShelleyBasedEra era -> CardanoEra era
forall era. ShelleyBasedEra era -> CardanoEra era
forall (eon :: * -> *) era.
ToCardanoEra eon =>
eon era -> CardanoEra era
toCardanoEra ShelleyBasedEra era
sbe) ((AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (BabbageEraOnwards era))
-> (AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (BabbageEraOnwards era)
forall a b. (a -> b) -> a -> b
$
Text -> AnyCardanoEra -> TxNotSupportedInEraValidationError era
forall era.
Text -> AnyCardanoEra -> TxNotSupportedInEraValidationError era
TxNotSupportedInAnyCardanoEraValidationError Text
"Transaction return collateral"
TxReturnCollateral CtxTx era
-> Either
(TxNotSupportedInEraValidationError era)
(TxReturnCollateral CtxTx era)
forall a. a -> Either (TxNotSupportedInEraValidationError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxReturnCollateral CtxTx era
-> Either
(TxNotSupportedInEraValidationError era)
(TxReturnCollateral CtxTx era))
-> TxReturnCollateral CtxTx era
-> Either
(TxNotSupportedInEraValidationError era)
(TxReturnCollateral CtxTx era)
forall a b. (a -> b) -> a -> b
$ BabbageEraOnwards era
-> TxOut CtxTx era -> TxReturnCollateral CtxTx era
forall era ctx.
BabbageEraOnwards era
-> TxOut ctx era -> TxReturnCollateral ctx era
TxReturnCollateral BabbageEraOnwards era
supported TxOut CtxTx era
retColTxOut
validateTxValidityLowerBound
:: ShelleyBasedEra era
-> Maybe SlotNo
-> Either (TxNotSupportedInEraValidationError era) (TxValidityLowerBound era)
validateTxValidityLowerBound :: forall era.
ShelleyBasedEra era
-> Maybe SlotNo
-> Either
(TxNotSupportedInEraValidationError era) (TxValidityLowerBound era)
validateTxValidityLowerBound ShelleyBasedEra era
_ Maybe SlotNo
Nothing = TxValidityLowerBound era
-> Either
(TxNotSupportedInEraValidationError era) (TxValidityLowerBound era)
forall a. a -> Either (TxNotSupportedInEraValidationError era) a
forall (m :: * -> *) a. Monad m => a -> m a
return TxValidityLowerBound era
forall era. TxValidityLowerBound era
TxValidityNoLowerBound
validateTxValidityLowerBound ShelleyBasedEra era
sbe (Just SlotNo
slot) = do
AllegraEraOnwards era
supported <-
CardanoEra era
-> (AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (AllegraEraOnwards era)
forall (eon :: * -> *) era e.
Eon eon =>
CardanoEra era -> (AnyCardanoEra -> e) -> Either e (eon era)
conjureWitness (ShelleyBasedEra era -> CardanoEra era
forall era. ShelleyBasedEra era -> CardanoEra era
forall (eon :: * -> *) era.
ToCardanoEra eon =>
eon era -> CardanoEra era
toCardanoEra ShelleyBasedEra era
sbe) ((AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (AllegraEraOnwards era))
-> (AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (AllegraEraOnwards era)
forall a b. (a -> b) -> a -> b
$
Text -> AnyCardanoEra -> TxNotSupportedInEraValidationError era
forall era.
Text -> AnyCardanoEra -> TxNotSupportedInEraValidationError era
TxNotSupportedInAnyCardanoEraValidationError Text
"Transaction validity lower bound"
TxValidityLowerBound era
-> Either
(TxNotSupportedInEraValidationError era) (TxValidityLowerBound era)
forall a. a -> Either (TxNotSupportedInEraValidationError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxValidityLowerBound era
-> Either
(TxNotSupportedInEraValidationError era)
(TxValidityLowerBound era))
-> TxValidityLowerBound era
-> Either
(TxNotSupportedInEraValidationError era) (TxValidityLowerBound era)
forall a b. (a -> b) -> a -> b
$ AllegraEraOnwards era -> SlotNo -> TxValidityLowerBound era
forall era.
AllegraEraOnwards era -> SlotNo -> TxValidityLowerBound era
TxValidityLowerBound AllegraEraOnwards era
supported SlotNo
slot
data TxAuxScriptsValidationError
= TxAuxScriptsNotSupportedInEra AnyCardanoEra
| TxAuxScriptsLanguageError ScriptLanguageValidationError
deriving Int -> TxAuxScriptsValidationError -> ShowS
[TxAuxScriptsValidationError] -> ShowS
TxAuxScriptsValidationError -> String
(Int -> TxAuxScriptsValidationError -> ShowS)
-> (TxAuxScriptsValidationError -> String)
-> ([TxAuxScriptsValidationError] -> ShowS)
-> Show TxAuxScriptsValidationError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxAuxScriptsValidationError -> ShowS
showsPrec :: Int -> TxAuxScriptsValidationError -> ShowS
$cshow :: TxAuxScriptsValidationError -> String
show :: TxAuxScriptsValidationError -> String
$cshowList :: [TxAuxScriptsValidationError] -> ShowS
showList :: [TxAuxScriptsValidationError] -> ShowS
Show
instance Error TxAuxScriptsValidationError where
prettyError :: forall ann. TxAuxScriptsValidationError -> Doc ann
prettyError (TxAuxScriptsNotSupportedInEra AnyCardanoEra
era) =
Doc ann
"Transaction auxiliary scripts are not supported in " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> AnyCardanoEra -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. AnyCardanoEra -> Doc ann
pretty AnyCardanoEra
era
prettyError (TxAuxScriptsLanguageError ScriptLanguageValidationError
e) =
Doc ann
"Transaction auxiliary scripts error: " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> ScriptLanguageValidationError -> Doc ann
forall e ann. Error e => e -> Doc ann
forall ann. ScriptLanguageValidationError -> Doc ann
prettyError ScriptLanguageValidationError
e
validateTxAuxScripts
:: ShelleyBasedEra era
-> [ScriptInAnyLang]
-> Either TxAuxScriptsValidationError (TxAuxScripts era)
validateTxAuxScripts :: forall era.
ShelleyBasedEra era
-> [ScriptInAnyLang]
-> Either TxAuxScriptsValidationError (TxAuxScripts era)
validateTxAuxScripts ShelleyBasedEra era
_ [] = TxAuxScripts era
-> Either TxAuxScriptsValidationError (TxAuxScripts era)
forall a. a -> Either TxAuxScriptsValidationError a
forall (m :: * -> *) a. Monad m => a -> m a
return TxAuxScripts era
forall era. TxAuxScripts era
TxAuxScriptsNone
validateTxAuxScripts ShelleyBasedEra era
era [ScriptInAnyLang]
scripts = do
AllegraEraOnwards era
supported <- CardanoEra era
-> (AnyCardanoEra -> TxAuxScriptsValidationError)
-> Either TxAuxScriptsValidationError (AllegraEraOnwards era)
forall (eon :: * -> *) era e.
Eon eon =>
CardanoEra era -> (AnyCardanoEra -> e) -> Either e (eon era)
conjureWitness (ShelleyBasedEra era -> CardanoEra era
forall era. ShelleyBasedEra era -> CardanoEra era
forall (eon :: * -> *) era.
ToCardanoEra eon =>
eon era -> CardanoEra era
toCardanoEra ShelleyBasedEra era
era) AnyCardanoEra -> TxAuxScriptsValidationError
TxAuxScriptsNotSupportedInEra
[ScriptInEra era]
scriptsInEra <- (ScriptInAnyLang
-> Either TxAuxScriptsValidationError (ScriptInEra era))
-> [ScriptInAnyLang]
-> Either TxAuxScriptsValidationError [ScriptInEra era]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM ((ScriptLanguageValidationError -> TxAuxScriptsValidationError)
-> Either ScriptLanguageValidationError (ScriptInEra era)
-> Either TxAuxScriptsValidationError (ScriptInEra era)
forall a b c. (a -> b) -> Either a c -> Either b c
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first ScriptLanguageValidationError -> TxAuxScriptsValidationError
TxAuxScriptsLanguageError (Either ScriptLanguageValidationError (ScriptInEra era)
-> Either TxAuxScriptsValidationError (ScriptInEra era))
-> (ScriptInAnyLang
-> Either ScriptLanguageValidationError (ScriptInEra era))
-> ScriptInAnyLang
-> Either TxAuxScriptsValidationError (ScriptInEra era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShelleyBasedEra era
-> ScriptInAnyLang
-> Either ScriptLanguageValidationError (ScriptInEra era)
forall era.
ShelleyBasedEra era
-> ScriptInAnyLang
-> Either ScriptLanguageValidationError (ScriptInEra era)
validateScriptSupportedInEra ShelleyBasedEra era
era) [ScriptInAnyLang]
scripts
TxAuxScripts era
-> Either TxAuxScriptsValidationError (TxAuxScripts era)
forall a. a -> Either TxAuxScriptsValidationError a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxAuxScripts era
-> Either TxAuxScriptsValidationError (TxAuxScripts era))
-> TxAuxScripts era
-> Either TxAuxScriptsValidationError (TxAuxScripts era)
forall a b. (a -> b) -> a -> b
$ AllegraEraOnwards era -> [ScriptInEra era] -> TxAuxScripts era
forall era.
AllegraEraOnwards era -> [ScriptInEra era] -> TxAuxScripts era
TxAuxScripts AllegraEraOnwards era
supported [ScriptInEra era]
scriptsInEra
validateRequiredSigners
:: ShelleyBasedEra era
-> [Hash PaymentKey]
-> Either (TxNotSupportedInEraValidationError era) (TxExtraKeyWitnesses era)
validateRequiredSigners :: forall era.
ShelleyBasedEra era
-> [Hash PaymentKey]
-> Either
(TxNotSupportedInEraValidationError era) (TxExtraKeyWitnesses era)
validateRequiredSigners ShelleyBasedEra era
_ [] = TxExtraKeyWitnesses era
-> Either
(TxNotSupportedInEraValidationError era) (TxExtraKeyWitnesses era)
forall a. a -> Either (TxNotSupportedInEraValidationError era) a
forall (m :: * -> *) a. Monad m => a -> m a
return TxExtraKeyWitnesses era
forall era. TxExtraKeyWitnesses era
TxExtraKeyWitnessesNone
validateRequiredSigners ShelleyBasedEra era
sbe [Hash PaymentKey]
reqSigs = do
AlonzoEraOnwards era
supported <-
CardanoEra era
-> (AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (AlonzoEraOnwards era)
forall (eon :: * -> *) era e.
Eon eon =>
CardanoEra era -> (AnyCardanoEra -> e) -> Either e (eon era)
conjureWitness (ShelleyBasedEra era -> CardanoEra era
forall era. ShelleyBasedEra era -> CardanoEra era
forall (eon :: * -> *) era.
ToCardanoEra eon =>
eon era -> CardanoEra era
toCardanoEra ShelleyBasedEra era
sbe) ((AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (AlonzoEraOnwards era))
-> (AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (AlonzoEraOnwards era)
forall a b. (a -> b) -> a -> b
$
Text -> AnyCardanoEra -> TxNotSupportedInEraValidationError era
forall era.
Text -> AnyCardanoEra -> TxNotSupportedInEraValidationError era
TxNotSupportedInAnyCardanoEraValidationError Text
"Transaction required signers"
TxExtraKeyWitnesses era
-> Either
(TxNotSupportedInEraValidationError era) (TxExtraKeyWitnesses era)
forall a. a -> Either (TxNotSupportedInEraValidationError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxExtraKeyWitnesses era
-> Either
(TxNotSupportedInEraValidationError era) (TxExtraKeyWitnesses era))
-> TxExtraKeyWitnesses era
-> Either
(TxNotSupportedInEraValidationError era) (TxExtraKeyWitnesses era)
forall a b. (a -> b) -> a -> b
$ AlonzoEraOnwards era
-> [Hash PaymentKey] -> TxExtraKeyWitnesses era
forall era.
AlonzoEraOnwards era
-> [Hash PaymentKey] -> TxExtraKeyWitnesses era
TxExtraKeyWitnesses AlonzoEraOnwards era
supported [Hash PaymentKey]
reqSigs
validateTxScriptValidity
:: ShelleyBasedEra era
-> Maybe ScriptValidity
-> Either (TxNotSupportedInEraValidationError era) (TxScriptValidity era)
validateTxScriptValidity :: forall era.
ShelleyBasedEra era
-> Maybe ScriptValidity
-> Either
(TxNotSupportedInEraValidationError era) (TxScriptValidity era)
validateTxScriptValidity ShelleyBasedEra era
_ Maybe ScriptValidity
Nothing = TxScriptValidity era
-> Either
(TxNotSupportedInEraValidationError era) (TxScriptValidity era)
forall a. a -> Either (TxNotSupportedInEraValidationError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxScriptValidity era
forall era. TxScriptValidity era
TxScriptValidityNone
validateTxScriptValidity ShelleyBasedEra era
sbe (Just ScriptValidity
scriptValidity) = do
AlonzoEraOnwards era
supported <-
CardanoEra era
-> (AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (AlonzoEraOnwards era)
forall (eon :: * -> *) era e.
Eon eon =>
CardanoEra era -> (AnyCardanoEra -> e) -> Either e (eon era)
conjureWitness (ShelleyBasedEra era -> CardanoEra era
forall era. ShelleyBasedEra era -> CardanoEra era
forall (eon :: * -> *) era.
ToCardanoEra eon =>
eon era -> CardanoEra era
toCardanoEra ShelleyBasedEra era
sbe) ((AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (AlonzoEraOnwards era))
-> (AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (AlonzoEraOnwards era)
forall a b. (a -> b) -> a -> b
$
Text -> AnyCardanoEra -> TxNotSupportedInEraValidationError era
forall era.
Text -> AnyCardanoEra -> TxNotSupportedInEraValidationError era
TxNotSupportedInAnyCardanoEraValidationError Text
"Transaction script validity"
TxScriptValidity era
-> Either
(TxNotSupportedInEraValidationError era) (TxScriptValidity era)
forall a. a -> Either (TxNotSupportedInEraValidationError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxScriptValidity era
-> Either
(TxNotSupportedInEraValidationError era) (TxScriptValidity era))
-> TxScriptValidity era
-> Either
(TxNotSupportedInEraValidationError era) (TxScriptValidity era)
forall a b. (a -> b) -> a -> b
$ AlonzoEraOnwards era -> ScriptValidity -> TxScriptValidity era
forall era.
AlonzoEraOnwards era -> ScriptValidity -> TxScriptValidity era
TxScriptValidity AlonzoEraOnwards era
supported ScriptValidity
scriptValidity
validateUpdateProposalFile
:: CardanoEra era
-> Maybe UpdateProposalFile
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)))
validateUpdateProposalFile :: forall era.
CardanoEra era
-> Maybe UpdateProposalFile
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe
(Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)))
validateUpdateProposalFile CardanoEra era
era = \case
Maybe UpdateProposalFile
Nothing -> Maybe (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe
(Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)))
forall a. a -> Either (TxNotSupportedInEraValidationError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))
forall a. Maybe a
Nothing
Just UpdateProposalFile
updateProposal -> do
ShelleyToBabbageEra era
supported <-
CardanoEra era
-> (AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (ShelleyToBabbageEra era)
forall (eon :: * -> *) era e.
Eon eon =>
CardanoEra era -> (AnyCardanoEra -> e) -> Either e (eon era)
conjureWitness CardanoEra era
era ((AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (ShelleyToBabbageEra era))
-> (AnyCardanoEra -> TxNotSupportedInEraValidationError era)
-> Either
(TxNotSupportedInEraValidationError era) (ShelleyToBabbageEra era)
forall a b. (a -> b) -> a -> b
$ Text -> AnyCardanoEra -> TxNotSupportedInEraValidationError era
forall era.
Text -> AnyCardanoEra -> TxNotSupportedInEraValidationError era
TxNotSupportedInAnyCardanoEraValidationError Text
"Transaction update proposal"
Maybe (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe
(Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)))
forall a. a -> Either (TxNotSupportedInEraValidationError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe
(Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe
(Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))))
-> Maybe
(Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))
-> Either
(TxNotSupportedInEraValidationError era)
(Maybe
(Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)))
forall a b. (a -> b) -> a -> b
$ Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)
-> Maybe
(Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))
forall a. a -> Maybe a
Just (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)
-> Maybe
(Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)))
-> Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)
-> Maybe
(Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))
forall a b. (a -> b) -> a -> b
$ ShelleyToBabbageEra era
-> Maybe UpdateProposalFile
-> Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)
forall (eon :: * -> *) era a. eon era -> a -> Featured eon era a
Featured ShelleyToBabbageEra era
supported (Maybe UpdateProposalFile
-> Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))
-> Maybe UpdateProposalFile
-> Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)
forall a b. (a -> b) -> a -> b
$ UpdateProposalFile -> Maybe UpdateProposalFile
forall a. a -> Maybe a
Just UpdateProposalFile
updateProposal
conjureWitness
:: Eon eon
=> CardanoEra era
-> (AnyCardanoEra -> e)
-> Either e (eon era)
conjureWitness :: forall (eon :: * -> *) era e.
Eon eon =>
CardanoEra era -> (AnyCardanoEra -> e) -> Either e (eon era)
conjureWitness CardanoEra era
era AnyCardanoEra -> e
errF =
Either e (eon era)
-> (eon era -> Either e (eon era))
-> Maybe (eon era)
-> Either e (eon era)
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (CardanoEra era
-> (CardanoEraConstraints era => Either e (eon era))
-> Either e (eon era)
forall era a.
CardanoEra era -> (CardanoEraConstraints era => a) -> a
cardanoEraConstraints CardanoEra era
era ((CardanoEraConstraints era => Either e (eon era))
-> Either e (eon era))
-> (CardanoEraConstraints era => Either e (eon era))
-> Either e (eon era)
forall a b. (a -> b) -> a -> b
$ e -> Either e (eon era)
forall a b. a -> Either a b
Left (e -> Either e (eon era))
-> (AnyCardanoEra -> e) -> AnyCardanoEra -> Either e (eon era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AnyCardanoEra -> e
errF (AnyCardanoEra -> Either e (eon era))
-> AnyCardanoEra -> Either e (eon era)
forall a b. (a -> b) -> a -> b
$ CardanoEra era -> AnyCardanoEra
forall era. Typeable era => CardanoEra era -> AnyCardanoEra
AnyCardanoEra CardanoEra era
era) eon era -> Either e (eon era)
forall a b. b -> Either a b
Right (Maybe (eon era) -> Either e (eon era))
-> Maybe (eon era) -> Either e (eon era)
forall a b. (a -> b) -> a -> b
$
CardanoEra era -> Maybe (eon era)
forall (eon :: * -> *) era.
Eon eon =>
CardanoEra era -> Maybe (eon era)
forEraMaybeEon CardanoEra era
era
newtype TxGovDuplicateVotes era
= TxGovDuplicateVotes (VotesMergingConflict era)
instance Error (TxGovDuplicateVotes era) where
prettyError :: forall ann. TxGovDuplicateVotes era -> Doc ann
prettyError (TxGovDuplicateVotes (VotesMergingConflict (Voter (EraCrypto (ShelleyLedgerEra era))
_voter, [GovActionId (EraCrypto (ShelleyLedgerEra era))]
actionIds))) =
Doc ann
"Trying to merge votes with similar action identifiers: "
Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> [GovActionId (EraCrypto (ShelleyLedgerEra era))] -> Doc ann
forall a ann. Show a => a -> Doc ann
viaShow [GovActionId (EraCrypto (ShelleyLedgerEra era))]
actionIds
Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
". This would cause ignoring some of the votes, so not proceeding."