{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
module Cardano.Api.Modes (
ByronMode,
ShelleyMode,
CardanoMode,
ConsensusMode(..),
AnyConsensusMode(..),
renderMode,
ConsensusModeIsMultiEra(..),
EraInMode(..),
eraInModeToEra,
anyEraInModeToAnyEra,
AnyEraInMode(..),
toEraInMode,
ConsensusProtocol,
ChainDepStateProtocol,
ConsensusModeParams(..),
AnyConsensusModeParams(..),
Byron.EpochSlots(..),
ConsensusCryptoForBlock,
ConsensusBlockForMode,
ConsensusBlockForEra,
toConsensusEraIndex,
fromConsensusEraIndex,
) where
import Prelude
import Cardano.Api.Eras
import Cardano.Ledger.Crypto (StandardCrypto)
import Data.Aeson (FromJSON (parseJSON), ToJSON (toJSON), Value)
import Data.Aeson.Types (Parser, prependFailure, typeMismatch)
import Data.SOP.Strict (K (K), NS (S, Z))
import Data.Text (Text)
import qualified Ouroboros.Consensus.Byron.Ledger as Consensus
import qualified Ouroboros.Consensus.Cardano.Block as Consensus
import qualified Ouroboros.Consensus.Cardano.ByronHFC as Consensus (ByronBlockHFC)
import Ouroboros.Consensus.HardFork.Combinator as Consensus (EraIndex (..), eraIndexSucc,
eraIndexZero)
import qualified Ouroboros.Consensus.Protocol.Praos as Consensus
import qualified Ouroboros.Consensus.Protocol.TPraos as Consensus
import qualified Ouroboros.Consensus.Shelley.HFEras as Consensus
import qualified Ouroboros.Consensus.Shelley.ShelleyHFC as Consensus
import qualified Cardano.Chain.Slotting as Byron (EpochSlots (..))
data ByronMode
data ShelleyMode
data CardanoMode
data AnyConsensusModeParams where
AnyConsensusModeParams :: ConsensusModeParams mode -> AnyConsensusModeParams
deriving instance Show AnyConsensusModeParams
data ConsensusMode mode where
ByronMode :: ConsensusMode ByronMode
ShelleyMode :: ConsensusMode ShelleyMode
CardanoMode :: ConsensusMode CardanoMode
deriving instance Show (ConsensusMode mode)
data AnyConsensusMode where
AnyConsensusMode :: ConsensusMode mode -> AnyConsensusMode
deriving instance Show AnyConsensusMode
renderMode :: AnyConsensusMode -> Text
renderMode :: AnyConsensusMode -> Text
renderMode (AnyConsensusMode ConsensusMode mode
ByronMode) = Text
"ByronMode"
renderMode (AnyConsensusMode ConsensusMode mode
ShelleyMode) = Text
"ShelleyMode"
renderMode (AnyConsensusMode ConsensusMode mode
CardanoMode) = Text
"CardanoMode"
data ConsensusModeIsMultiEra mode where
CardanoModeIsMultiEra :: ConsensusModeIsMultiEra CardanoMode
deriving instance Show (ConsensusModeIsMultiEra mode)
toEraInMode :: CardanoEra era -> ConsensusMode mode -> Maybe (EraInMode era mode)
toEraInMode :: CardanoEra era -> ConsensusMode mode -> Maybe (EraInMode era mode)
toEraInMode CardanoEra era
ByronEra ConsensusMode mode
ByronMode = EraInMode ByronEra ByronMode
-> Maybe (EraInMode ByronEra ByronMode)
forall a. a -> Maybe a
Just EraInMode ByronEra ByronMode
ByronEraInByronMode
toEraInMode CardanoEra era
ShelleyEra ConsensusMode mode
ShelleyMode = EraInMode ShelleyEra ShelleyMode
-> Maybe (EraInMode ShelleyEra ShelleyMode)
forall a. a -> Maybe a
Just EraInMode ShelleyEra ShelleyMode
ShelleyEraInShelleyMode
toEraInMode CardanoEra era
ByronEra ConsensusMode mode
CardanoMode = EraInMode ByronEra CardanoMode
-> Maybe (EraInMode ByronEra CardanoMode)
forall a. a -> Maybe a
Just EraInMode ByronEra CardanoMode
ByronEraInCardanoMode
toEraInMode CardanoEra era
ShelleyEra ConsensusMode mode
CardanoMode = EraInMode ShelleyEra CardanoMode
-> Maybe (EraInMode ShelleyEra CardanoMode)
forall a. a -> Maybe a
Just EraInMode ShelleyEra CardanoMode
ShelleyEraInCardanoMode
toEraInMode CardanoEra era
AllegraEra ConsensusMode mode
CardanoMode = EraInMode AllegraEra CardanoMode
-> Maybe (EraInMode AllegraEra CardanoMode)
forall a. a -> Maybe a
Just EraInMode AllegraEra CardanoMode
AllegraEraInCardanoMode
toEraInMode CardanoEra era
MaryEra ConsensusMode mode
CardanoMode = EraInMode MaryEra CardanoMode
-> Maybe (EraInMode MaryEra CardanoMode)
forall a. a -> Maybe a
Just EraInMode MaryEra CardanoMode
MaryEraInCardanoMode
toEraInMode CardanoEra era
AlonzoEra ConsensusMode mode
CardanoMode = EraInMode AlonzoEra CardanoMode
-> Maybe (EraInMode AlonzoEra CardanoMode)
forall a. a -> Maybe a
Just EraInMode AlonzoEra CardanoMode
AlonzoEraInCardanoMode
toEraInMode CardanoEra era
BabbageEra ConsensusMode mode
CardanoMode = EraInMode BabbageEra CardanoMode
-> Maybe (EraInMode BabbageEra CardanoMode)
forall a. a -> Maybe a
Just EraInMode BabbageEra CardanoMode
BabbageEraInCardanoMode
toEraInMode CardanoEra era
_ ConsensusMode mode
_ = Maybe (EraInMode era mode)
forall a. Maybe a
Nothing
data EraInMode era mode where
ByronEraInByronMode :: EraInMode ByronEra ByronMode
ShelleyEraInShelleyMode :: EraInMode ShelleyEra ShelleyMode
ByronEraInCardanoMode :: EraInMode ByronEra CardanoMode
ShelleyEraInCardanoMode :: EraInMode ShelleyEra CardanoMode
AllegraEraInCardanoMode :: EraInMode AllegraEra CardanoMode
MaryEraInCardanoMode :: EraInMode MaryEra CardanoMode
AlonzoEraInCardanoMode :: EraInMode AlonzoEra CardanoMode
BabbageEraInCardanoMode :: EraInMode BabbageEra CardanoMode
deriving instance Show (EraInMode era mode)
deriving instance Eq (EraInMode era mode)
instance FromJSON (EraInMode ByronEra ByronMode) where
parseJSON :: Value -> Parser (EraInMode ByronEra ByronMode)
parseJSON Value
"ByronEraInByronMode" = EraInMode ByronEra ByronMode
-> Parser (EraInMode ByronEra ByronMode)
forall (f :: * -> *) a. Applicative f => a -> f a
pure EraInMode ByronEra ByronMode
ByronEraInByronMode
parseJSON Value
invalid =
String -> String -> Value -> Parser (EraInMode ByronEra ByronMode)
forall a. String -> String -> Value -> Parser a
invalidJSONFailure String
"ByronEraInByronMode"
String
"parsing 'EraInMode ByronEra ByronMode' failed, "
Value
invalid
instance FromJSON (EraInMode ShelleyEra ShelleyMode) where
parseJSON :: Value -> Parser (EraInMode ShelleyEra ShelleyMode)
parseJSON Value
"ShelleyEraInShelleyMode" = EraInMode ShelleyEra ShelleyMode
-> Parser (EraInMode ShelleyEra ShelleyMode)
forall (f :: * -> *) a. Applicative f => a -> f a
pure EraInMode ShelleyEra ShelleyMode
ShelleyEraInShelleyMode
parseJSON Value
invalid =
String
-> String -> Value -> Parser (EraInMode ShelleyEra ShelleyMode)
forall a. String -> String -> Value -> Parser a
invalidJSONFailure String
"ShelleyEraInShelleyMode"
String
"parsing 'EraInMode ShelleyEra ShelleyMode' failed, "
Value
invalid
instance FromJSON (EraInMode ByronEra CardanoMode) where
parseJSON :: Value -> Parser (EraInMode ByronEra CardanoMode)
parseJSON Value
"ByronEraInCardanoMode" = EraInMode ByronEra CardanoMode
-> Parser (EraInMode ByronEra CardanoMode)
forall (f :: * -> *) a. Applicative f => a -> f a
pure EraInMode ByronEra CardanoMode
ByronEraInCardanoMode
parseJSON Value
invalid =
String
-> String -> Value -> Parser (EraInMode ByronEra CardanoMode)
forall a. String -> String -> Value -> Parser a
invalidJSONFailure String
"ByronEraInCardanoMode"
String
"parsing 'EraInMode ByronEra CardanoMode' failed, "
Value
invalid
instance FromJSON (EraInMode ShelleyEra CardanoMode) where
parseJSON :: Value -> Parser (EraInMode ShelleyEra CardanoMode)
parseJSON Value
"ShelleyEraInCardanoMode" = EraInMode ShelleyEra CardanoMode
-> Parser (EraInMode ShelleyEra CardanoMode)
forall (f :: * -> *) a. Applicative f => a -> f a
pure EraInMode ShelleyEra CardanoMode
ShelleyEraInCardanoMode
parseJSON Value
invalid =
String
-> String -> Value -> Parser (EraInMode ShelleyEra CardanoMode)
forall a. String -> String -> Value -> Parser a
invalidJSONFailure String
"ShelleyEraInCardanoMode"
String
"parsing 'EraInMode ShelleyEra CardanoMode' failed, "
Value
invalid
instance FromJSON (EraInMode AllegraEra CardanoMode) where
parseJSON :: Value -> Parser (EraInMode AllegraEra CardanoMode)
parseJSON Value
"AllegraEraInCardanoMode" = EraInMode AllegraEra CardanoMode
-> Parser (EraInMode AllegraEra CardanoMode)
forall (f :: * -> *) a. Applicative f => a -> f a
pure EraInMode AllegraEra CardanoMode
AllegraEraInCardanoMode
parseJSON Value
invalid =
String
-> String -> Value -> Parser (EraInMode AllegraEra CardanoMode)
forall a. String -> String -> Value -> Parser a
invalidJSONFailure String
"AllegraEraInCardanoMode"
String
"parsing 'EraInMode AllegraEra CardanoMode' failed, "
Value
invalid
instance FromJSON (EraInMode MaryEra CardanoMode) where
parseJSON :: Value -> Parser (EraInMode MaryEra CardanoMode)
parseJSON Value
"MaryEraInCardanoMode" = EraInMode MaryEra CardanoMode
-> Parser (EraInMode MaryEra CardanoMode)
forall (f :: * -> *) a. Applicative f => a -> f a
pure EraInMode MaryEra CardanoMode
MaryEraInCardanoMode
parseJSON Value
invalid =
String -> String -> Value -> Parser (EraInMode MaryEra CardanoMode)
forall a. String -> String -> Value -> Parser a
invalidJSONFailure String
"MaryEraInCardanoMode"
String
"parsing 'EraInMode MaryEra CardanoMode' failed, "
Value
invalid
instance FromJSON (EraInMode AlonzoEra CardanoMode) where
parseJSON :: Value -> Parser (EraInMode AlonzoEra CardanoMode)
parseJSON Value
"AlonzoEraInCardanoMode" = EraInMode AlonzoEra CardanoMode
-> Parser (EraInMode AlonzoEra CardanoMode)
forall (f :: * -> *) a. Applicative f => a -> f a
pure EraInMode AlonzoEra CardanoMode
AlonzoEraInCardanoMode
parseJSON Value
invalid =
String
-> String -> Value -> Parser (EraInMode AlonzoEra CardanoMode)
forall a. String -> String -> Value -> Parser a
invalidJSONFailure String
"AlonzoEraInCardanoMode"
String
"parsing 'EraInMode AlonzoEra CardanoMode' failed, "
Value
invalid
invalidJSONFailure :: String -> String -> Value -> Parser a
invalidJSONFailure :: String -> String -> Value -> Parser a
invalidJSONFailure String
expectedType String
errorMsg Value
invalidValue =
String -> Parser a -> Parser a
forall a. String -> Parser a -> Parser a
prependFailure String
errorMsg
(String -> Value -> Parser a
forall a. String -> Value -> Parser a
typeMismatch String
expectedType Value
invalidValue)
instance ToJSON (EraInMode era mode) where
toJSON :: EraInMode era mode -> Value
toJSON EraInMode era mode
ByronEraInByronMode = Value
"ByronEraInByronMode"
toJSON EraInMode era mode
ShelleyEraInShelleyMode = Value
"ShelleyEraInShelleyMode"
toJSON EraInMode era mode
ByronEraInCardanoMode = Value
"ByronEraInCardanoMode"
toJSON EraInMode era mode
ShelleyEraInCardanoMode = Value
"ShelleyEraInCardanoMode"
toJSON EraInMode era mode
AllegraEraInCardanoMode = Value
"AllegraEraInCardanoMode"
toJSON EraInMode era mode
MaryEraInCardanoMode = Value
"MaryEraInCardanoMode"
toJSON EraInMode era mode
AlonzoEraInCardanoMode = Value
"AlonzoEraInCardanoMode"
toJSON EraInMode era mode
BabbageEraInCardanoMode = Value
"BabbageEraInCardanoMode"
eraInModeToEra :: EraInMode era mode -> CardanoEra era
eraInModeToEra :: EraInMode era mode -> CardanoEra era
eraInModeToEra EraInMode era mode
ByronEraInByronMode = CardanoEra era
CardanoEra ByronEra
ByronEra
eraInModeToEra EraInMode era mode
ShelleyEraInShelleyMode = CardanoEra era
CardanoEra ShelleyEra
ShelleyEra
eraInModeToEra EraInMode era mode
ByronEraInCardanoMode = CardanoEra era
CardanoEra ByronEra
ByronEra
eraInModeToEra EraInMode era mode
ShelleyEraInCardanoMode = CardanoEra era
CardanoEra ShelleyEra
ShelleyEra
eraInModeToEra EraInMode era mode
AllegraEraInCardanoMode = CardanoEra era
CardanoEra AllegraEra
AllegraEra
eraInModeToEra EraInMode era mode
MaryEraInCardanoMode = CardanoEra era
CardanoEra MaryEra
MaryEra
eraInModeToEra EraInMode era mode
AlonzoEraInCardanoMode = CardanoEra era
CardanoEra AlonzoEra
AlonzoEra
eraInModeToEra EraInMode era mode
BabbageEraInCardanoMode = CardanoEra era
CardanoEra BabbageEra
BabbageEra
data AnyEraInMode mode where
AnyEraInMode :: EraInMode era mode -> AnyEraInMode mode
deriving instance Show (AnyEraInMode mode)
anyEraInModeToAnyEra :: AnyEraInMode mode -> AnyCardanoEra
anyEraInModeToAnyEra :: AnyEraInMode mode -> AnyCardanoEra
anyEraInModeToAnyEra (AnyEraInMode EraInMode era mode
erainmode) =
case EraInMode era mode
erainmode of
EraInMode era mode
ByronEraInByronMode -> CardanoEra ByronEra -> AnyCardanoEra
forall era. IsCardanoEra era => CardanoEra era -> AnyCardanoEra
AnyCardanoEra CardanoEra ByronEra
ByronEra
EraInMode era mode
ShelleyEraInShelleyMode -> CardanoEra ShelleyEra -> AnyCardanoEra
forall era. IsCardanoEra era => CardanoEra era -> AnyCardanoEra
AnyCardanoEra CardanoEra ShelleyEra
ShelleyEra
EraInMode era mode
ByronEraInCardanoMode -> CardanoEra ByronEra -> AnyCardanoEra
forall era. IsCardanoEra era => CardanoEra era -> AnyCardanoEra
AnyCardanoEra CardanoEra ByronEra
ByronEra
EraInMode era mode
ShelleyEraInCardanoMode -> CardanoEra ShelleyEra -> AnyCardanoEra
forall era. IsCardanoEra era => CardanoEra era -> AnyCardanoEra
AnyCardanoEra CardanoEra ShelleyEra
ShelleyEra
EraInMode era mode
AllegraEraInCardanoMode -> CardanoEra AllegraEra -> AnyCardanoEra
forall era. IsCardanoEra era => CardanoEra era -> AnyCardanoEra
AnyCardanoEra CardanoEra AllegraEra
AllegraEra
EraInMode era mode
MaryEraInCardanoMode -> CardanoEra MaryEra -> AnyCardanoEra
forall era. IsCardanoEra era => CardanoEra era -> AnyCardanoEra
AnyCardanoEra CardanoEra MaryEra
MaryEra
EraInMode era mode
AlonzoEraInCardanoMode -> CardanoEra AlonzoEra -> AnyCardanoEra
forall era. IsCardanoEra era => CardanoEra era -> AnyCardanoEra
AnyCardanoEra CardanoEra AlonzoEra
AlonzoEra
EraInMode era mode
BabbageEraInCardanoMode -> CardanoEra BabbageEra -> AnyCardanoEra
forall era. IsCardanoEra era => CardanoEra era -> AnyCardanoEra
AnyCardanoEra CardanoEra BabbageEra
BabbageEra
data ConsensusModeParams mode where
ByronModeParams
:: Byron.EpochSlots
-> ConsensusModeParams ByronMode
ShelleyModeParams
:: ConsensusModeParams ShelleyMode
CardanoModeParams
:: Byron.EpochSlots
-> ConsensusModeParams CardanoMode
deriving instance Show (ConsensusModeParams mode)
type family ConsensusBlockForMode mode where
ConsensusBlockForMode ByronMode = Consensus.ByronBlockHFC
ConsensusBlockForMode ShelleyMode = Consensus.ShelleyBlockHFC (Consensus.TPraos StandardCrypto) Consensus.StandardShelley
ConsensusBlockForMode CardanoMode = Consensus.CardanoBlock StandardCrypto
type family ConsensusBlockForEra era where
ConsensusBlockForEra ByronEra = Consensus.ByronBlock
ConsensusBlockForEra ShelleyEra = Consensus.StandardShelleyBlock
ConsensusBlockForEra AllegraEra = Consensus.StandardAllegraBlock
ConsensusBlockForEra MaryEra = Consensus.StandardMaryBlock
ConsensusBlockForEra AlonzoEra = Consensus.StandardAlonzoBlock
ConsensusBlockForEra BabbageEra = Consensus.StandardBabbageBlock
type family ConsensusCryptoForBlock block where
ConsensusCryptoForBlock Consensus.ByronBlockHFC = StandardCrypto
ConsensusCryptoForBlock (Consensus.ShelleyBlockHFC (Consensus.TPraos StandardCrypto) Consensus.StandardShelley) = Consensus.StandardShelley
ConsensusCryptoForBlock (Consensus.CardanoBlock StandardCrypto) = StandardCrypto
type family ConsensusProtocol era where
ConsensusProtocol ShelleyEra = Consensus.TPraos StandardCrypto
ConsensusProtocol AllegraEra = Consensus.TPraos StandardCrypto
ConsensusProtocol MaryEra = Consensus.TPraos StandardCrypto
ConsensusProtocol AlonzoEra = Consensus.TPraos StandardCrypto
ConsensusProtocol BabbageEra = Consensus.Praos StandardCrypto
type family ChainDepStateProtocol era where
ChainDepStateProtocol ShelleyEra = Consensus.TPraosState StandardCrypto
ChainDepStateProtocol AllegraEra = Consensus.TPraosState StandardCrypto
ChainDepStateProtocol MaryEra = Consensus.TPraosState StandardCrypto
ChainDepStateProtocol AlonzoEra = Consensus.TPraosState StandardCrypto
ChainDepStateProtocol BabbageEra = Consensus.PraosState StandardCrypto
eraIndex0 :: Consensus.EraIndex (x0 : xs)
eraIndex0 :: EraIndex (x0 : xs)
eraIndex0 = EraIndex (x0 : xs)
forall x (xs :: [*]). EraIndex (x : xs)
Consensus.eraIndexZero
eraIndex1 :: Consensus.EraIndex (x1 : x0 : xs)
eraIndex1 :: EraIndex (x1 : x0 : xs)
eraIndex1 = EraIndex (x0 : xs) -> EraIndex (x1 : x0 : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex (x0 : xs)
forall x (xs :: [*]). EraIndex (x : xs)
eraIndex0
eraIndex2 :: Consensus.EraIndex (x2 : x1 : x0 : xs)
eraIndex2 :: EraIndex (x2 : x1 : x0 : xs)
eraIndex2 = EraIndex (x1 : x0 : xs) -> EraIndex (x2 : x1 : x0 : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex (x1 : x0 : xs)
forall x1 x0 (xs :: [*]). EraIndex (x1 : x0 : xs)
eraIndex1
eraIndex3 :: Consensus.EraIndex (x3 : x2 : x1 : x0 : xs)
eraIndex3 :: EraIndex (x3 : x2 : x1 : x0 : xs)
eraIndex3 = EraIndex (x2 : x1 : x0 : xs) -> EraIndex (x3 : x2 : x1 : x0 : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex (x2 : x1 : x0 : xs)
forall x2 x1 x0 (xs :: [*]). EraIndex (x2 : x1 : x0 : xs)
eraIndex2
eraIndex4 :: Consensus.EraIndex (x4 : x3 : x2 : x1 : x0 : xs)
eraIndex4 :: EraIndex (x4 : x3 : x2 : x1 : x0 : xs)
eraIndex4 = EraIndex (x3 : x2 : x1 : x0 : xs)
-> EraIndex (x4 : x3 : x2 : x1 : x0 : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex (x3 : x2 : x1 : x0 : xs)
forall x3 x2 x1 x0 (xs :: [*]). EraIndex (x3 : x2 : x1 : x0 : xs)
eraIndex3
eraIndex5 :: Consensus.EraIndex (x5 : x4 : x3 : x2 : x1 : x0 : xs)
eraIndex5 :: EraIndex (x5 : x4 : x3 : x2 : x1 : x0 : xs)
eraIndex5 = EraIndex (x4 : x3 : x2 : x1 : x0 : xs)
-> EraIndex (x5 : x4 : x3 : x2 : x1 : x0 : xs)
forall (xs :: [*]) x. EraIndex xs -> EraIndex (x : xs)
eraIndexSucc EraIndex (x4 : x3 : x2 : x1 : x0 : xs)
forall x4 x3 x2 x1 x0 (xs :: [*]).
EraIndex (x4 : x3 : x2 : x1 : x0 : xs)
eraIndex4
toConsensusEraIndex :: ConsensusBlockForMode mode ~ Consensus.HardForkBlock xs
=> EraInMode era mode
-> Consensus.EraIndex xs
toConsensusEraIndex :: EraInMode era mode -> EraIndex xs
toConsensusEraIndex EraInMode era mode
ByronEraInByronMode = EraIndex xs
forall x (xs :: [*]). EraIndex (x : xs)
eraIndex0
toConsensusEraIndex EraInMode era mode
ShelleyEraInShelleyMode = EraIndex xs
forall x (xs :: [*]). EraIndex (x : xs)
eraIndex0
toConsensusEraIndex EraInMode era mode
ByronEraInCardanoMode = EraIndex xs
forall x (xs :: [*]). EraIndex (x : xs)
eraIndex0
toConsensusEraIndex EraInMode era mode
ShelleyEraInCardanoMode = EraIndex xs
forall x1 x0 (xs :: [*]). EraIndex (x1 : x0 : xs)
eraIndex1
toConsensusEraIndex EraInMode era mode
AllegraEraInCardanoMode = EraIndex xs
forall x2 x1 x0 (xs :: [*]). EraIndex (x2 : x1 : x0 : xs)
eraIndex2
toConsensusEraIndex EraInMode era mode
MaryEraInCardanoMode = EraIndex xs
forall x3 x2 x1 x0 (xs :: [*]). EraIndex (x3 : x2 : x1 : x0 : xs)
eraIndex3
toConsensusEraIndex EraInMode era mode
AlonzoEraInCardanoMode = EraIndex xs
forall x4 x3 x2 x1 x0 (xs :: [*]).
EraIndex (x4 : x3 : x2 : x1 : x0 : xs)
eraIndex4
toConsensusEraIndex EraInMode era mode
BabbageEraInCardanoMode = EraIndex xs
forall x5 x4 x3 x2 x1 x0 (xs :: [*]).
EraIndex (x5 : x4 : x3 : x2 : x1 : x0 : xs)
eraIndex5
fromConsensusEraIndex :: ConsensusBlockForMode mode ~ Consensus.HardForkBlock xs
=> ConsensusMode mode
-> Consensus.EraIndex xs
-> AnyEraInMode mode
fromConsensusEraIndex :: ConsensusMode mode -> EraIndex xs -> AnyEraInMode mode
fromConsensusEraIndex ConsensusMode mode
ByronMode = EraIndex xs -> AnyEraInMode mode
EraIndex '[ByronBlock] -> AnyEraInMode ByronMode
fromByronEraIndex
where
fromByronEraIndex :: Consensus.EraIndex
'[Consensus.ByronBlock]
-> AnyEraInMode ByronMode
fromByronEraIndex :: EraIndex '[ByronBlock] -> AnyEraInMode ByronMode
fromByronEraIndex (Consensus.EraIndex (Z (K ()))) =
EraInMode ByronEra ByronMode -> AnyEraInMode ByronMode
forall era mode. EraInMode era mode -> AnyEraInMode mode
AnyEraInMode EraInMode ByronEra ByronMode
ByronEraInByronMode
fromConsensusEraIndex ConsensusMode mode
ShelleyMode = EraIndex xs -> AnyEraInMode mode
EraIndex '[StandardShelleyBlock] -> AnyEraInMode ShelleyMode
fromShelleyEraIndex
where
fromShelleyEraIndex :: Consensus.EraIndex
'[Consensus.StandardShelleyBlock]
-> AnyEraInMode ShelleyMode
fromShelleyEraIndex :: EraIndex '[StandardShelleyBlock] -> AnyEraInMode ShelleyMode
fromShelleyEraIndex (Consensus.EraIndex (Z (K ()))) =
EraInMode ShelleyEra ShelleyMode -> AnyEraInMode ShelleyMode
forall era mode. EraInMode era mode -> AnyEraInMode mode
AnyEraInMode EraInMode ShelleyEra ShelleyMode
ShelleyEraInShelleyMode
fromConsensusEraIndex ConsensusMode mode
CardanoMode = EraIndex xs -> AnyEraInMode mode
EraIndex (CardanoEras StandardCrypto) -> AnyEraInMode CardanoMode
fromShelleyEraIndex
where
fromShelleyEraIndex :: Consensus.EraIndex
(Consensus.CardanoEras StandardCrypto)
-> AnyEraInMode CardanoMode
fromShelleyEraIndex :: EraIndex (CardanoEras StandardCrypto) -> AnyEraInMode CardanoMode
fromShelleyEraIndex (Consensus.EraIndex (Z (K ()))) =
EraInMode ByronEra CardanoMode -> AnyEraInMode CardanoMode
forall era mode. EraInMode era mode -> AnyEraInMode mode
AnyEraInMode EraInMode ByronEra CardanoMode
ByronEraInCardanoMode
fromShelleyEraIndex (Consensus.EraIndex (S (Z (K ())))) =
EraInMode ShelleyEra CardanoMode -> AnyEraInMode CardanoMode
forall era mode. EraInMode era mode -> AnyEraInMode mode
AnyEraInMode EraInMode ShelleyEra CardanoMode
ShelleyEraInCardanoMode
fromShelleyEraIndex (Consensus.EraIndex (S (S (Z (K ()))))) =
EraInMode AllegraEra CardanoMode -> AnyEraInMode CardanoMode
forall era mode. EraInMode era mode -> AnyEraInMode mode
AnyEraInMode EraInMode AllegraEra CardanoMode
AllegraEraInCardanoMode
fromShelleyEraIndex (Consensus.EraIndex (S (S (S (Z (K ())))))) =
EraInMode MaryEra CardanoMode -> AnyEraInMode CardanoMode
forall era mode. EraInMode era mode -> AnyEraInMode mode
AnyEraInMode EraInMode MaryEra CardanoMode
MaryEraInCardanoMode
fromShelleyEraIndex (Consensus.EraIndex (S (S (S (S (Z (K ()))))))) =
EraInMode AlonzoEra CardanoMode -> AnyEraInMode CardanoMode
forall era mode. EraInMode era mode -> AnyEraInMode mode
AnyEraInMode EraInMode AlonzoEra CardanoMode
AlonzoEraInCardanoMode
fromShelleyEraIndex (Consensus.EraIndex (S (S (S (S (S (Z (K ())))))))) =
EraInMode BabbageEra CardanoMode -> AnyEraInMode CardanoMode
forall era mode. EraInMode era mode -> AnyEraInMode mode
AnyEraInMode EraInMode BabbageEra CardanoMode
BabbageEraInCardanoMode