{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} module Cardano.Api.Eon.MaryEraOnwards ( MaryEraOnwards (..) , maryEraOnwardsConstraints , maryEraOnwardsToShelleyBasedEra , MaryEraOnwardsConstraints , IsMaryBasedEra (..) ) where import Cardano.Api.Eon.AllegraEraOnwards import Cardano.Api.Eon.Convert import Cardano.Api.Eon.ShelleyBasedEra import Cardano.Api.Eras.Core import Cardano.Api.Modes import Cardano.Api.Query.Types import Cardano.Binary import qualified Cardano.Crypto.Hash.Blake2b as Blake2b import qualified Cardano.Crypto.Hash.Class as C import qualified Cardano.Crypto.VRF as C import qualified Cardano.Ledger.Api as L import qualified Cardano.Ledger.BaseTypes as L import qualified Cardano.Ledger.Core as L import qualified Cardano.Ledger.Mary.Value as L import qualified Cardano.Ledger.SafeHash as L import qualified Cardano.Ledger.UTxO as L import qualified Ouroboros.Consensus.Protocol.Abstract as Consensus import qualified Ouroboros.Consensus.Protocol.Praos.Common as Consensus import qualified Ouroboros.Consensus.Shelley.Ledger as Consensus import Data.Aeson import Data.Typeable (Typeable) data MaryEraOnwards era where MaryEraOnwardsMary :: MaryEraOnwards MaryEra MaryEraOnwardsAlonzo :: MaryEraOnwards AlonzoEra MaryEraOnwardsBabbage :: MaryEraOnwards BabbageEra MaryEraOnwardsConway :: MaryEraOnwards ConwayEra deriving instance Show (MaryEraOnwards era) deriving instance Eq (MaryEraOnwards era) instance Eon MaryEraOnwards where inEonForEra :: forall a era. a -> (MaryEraOnwards era -> a) -> CardanoEra era -> a inEonForEra a no MaryEraOnwards era -> a yes = \case CardanoEra era ByronEra -> a no CardanoEra era ShelleyEra -> a no CardanoEra era AllegraEra -> a no CardanoEra era MaryEra -> MaryEraOnwards era -> a yes MaryEraOnwards era MaryEraOnwards MaryEra MaryEraOnwardsMary CardanoEra era AlonzoEra -> MaryEraOnwards era -> a yes MaryEraOnwards era MaryEraOnwards AlonzoEra MaryEraOnwardsAlonzo CardanoEra era BabbageEra -> MaryEraOnwards era -> a yes MaryEraOnwards era MaryEraOnwards BabbageEra MaryEraOnwardsBabbage CardanoEra era ConwayEra -> MaryEraOnwards era -> a yes MaryEraOnwards era MaryEraOnwards ConwayEra MaryEraOnwardsConway instance ToCardanoEra MaryEraOnwards where toCardanoEra :: forall era. MaryEraOnwards era -> CardanoEra era toCardanoEra = \case MaryEraOnwards era MaryEraOnwardsMary -> CardanoEra era CardanoEra MaryEra MaryEra MaryEraOnwards era MaryEraOnwardsAlonzo -> CardanoEra era CardanoEra AlonzoEra AlonzoEra MaryEraOnwards era MaryEraOnwardsBabbage -> CardanoEra era CardanoEra BabbageEra BabbageEra MaryEraOnwards era MaryEraOnwardsConway -> CardanoEra era CardanoEra ConwayEra ConwayEra instance Convert MaryEraOnwards CardanoEra where convert :: forall era. MaryEraOnwards era -> CardanoEra era convert = MaryEraOnwards era -> CardanoEra era forall era. MaryEraOnwards era -> CardanoEra era forall (eon :: * -> *) era. ToCardanoEra eon => eon era -> CardanoEra era toCardanoEra instance Convert MaryEraOnwards ShelleyBasedEra where convert :: forall era. MaryEraOnwards era -> ShelleyBasedEra era convert = \case MaryEraOnwards era MaryEraOnwardsMary -> ShelleyBasedEra era ShelleyBasedEra MaryEra ShelleyBasedEraMary MaryEraOnwards era MaryEraOnwardsAlonzo -> ShelleyBasedEra era ShelleyBasedEra AlonzoEra ShelleyBasedEraAlonzo MaryEraOnwards era MaryEraOnwardsBabbage -> ShelleyBasedEra era ShelleyBasedEra BabbageEra ShelleyBasedEraBabbage MaryEraOnwards era MaryEraOnwardsConway -> ShelleyBasedEra era ShelleyBasedEra ConwayEra ShelleyBasedEraConway type MaryEraOnwardsConstraints era = ( C.HashAlgorithm (L.HASH (L.EraCrypto (ShelleyLedgerEra era))) , C.Signable (L.VRF (L.EraCrypto (ShelleyLedgerEra era))) L.Seed , Consensus.PraosProtocolSupportsNode (ConsensusProtocol era) , Consensus.ShelleyBlock (ConsensusProtocol era) (ShelleyLedgerEra era) ~ ConsensusBlockForEra era , Consensus.ShelleyCompatible (ConsensusProtocol era) (ShelleyLedgerEra era) , L.ADDRHASH (Consensus.PraosProtocolSupportsNodeCrypto (ConsensusProtocol era)) ~ Blake2b.Blake2b_224 , L.Crypto (L.EraCrypto (ShelleyLedgerEra era)) , L.Era (ShelleyLedgerEra era) , L.EraCrypto (ShelleyLedgerEra era) ~ L.StandardCrypto , L.EraPParams (ShelleyLedgerEra era) , L.EraTx (ShelleyLedgerEra era) , L.EraTxBody (ShelleyLedgerEra era) , L.EraTxOut (ShelleyLedgerEra era) , L.EraUTxO (ShelleyLedgerEra era) , L.HashAnnotated (L.TxBody (ShelleyLedgerEra era)) L.EraIndependentTxBody L.StandardCrypto , L.MaryEraTxBody (ShelleyLedgerEra era) , L.ShelleyEraTxCert (ShelleyLedgerEra era) , L.Value (ShelleyLedgerEra era) ~ L.MaryValue L.StandardCrypto , FromCBOR (Consensus.ChainDepState (ConsensusProtocol era)) , FromCBOR (DebugLedgerState era) , IsCardanoEra era , IsShelleyBasedEra era , ToJSON (DebugLedgerState era) , Typeable era ) maryEraOnwardsConstraints :: () => MaryEraOnwards era -> (MaryEraOnwardsConstraints era => a) -> a maryEraOnwardsConstraints :: forall era a. MaryEraOnwards era -> (MaryEraOnwardsConstraints era => a) -> a maryEraOnwardsConstraints = \case MaryEraOnwards era MaryEraOnwardsMary -> a -> a (MaryEraOnwardsConstraints era => a) -> a forall a. a -> a id MaryEraOnwards era MaryEraOnwardsAlonzo -> a -> a (MaryEraOnwardsConstraints era => a) -> a forall a. a -> a id MaryEraOnwards era MaryEraOnwardsBabbage -> a -> a (MaryEraOnwardsConstraints era => a) -> a forall a. a -> a id MaryEraOnwards era MaryEraOnwardsConway -> a -> a (MaryEraOnwardsConstraints era => a) -> a forall a. a -> a id {-# DEPRECATED maryEraOnwardsToShelleyBasedEra "Use 'convert' instead." #-} maryEraOnwardsToShelleyBasedEra :: MaryEraOnwards era -> ShelleyBasedEra era maryEraOnwardsToShelleyBasedEra :: forall era. MaryEraOnwards era -> ShelleyBasedEra era maryEraOnwardsToShelleyBasedEra = MaryEraOnwards era -> ShelleyBasedEra era forall era. MaryEraOnwards era -> ShelleyBasedEra era forall a (f :: a -> *) (g :: a -> *) (era :: a). Convert f g => f era -> g era convert class IsAllegraBasedEra era => IsMaryBasedEra era where maryBasedEra :: MaryEraOnwards era instance IsMaryBasedEra MaryEra where maryBasedEra :: MaryEraOnwards MaryEra maryBasedEra = MaryEraOnwards MaryEra MaryEraOnwardsMary instance IsMaryBasedEra AlonzoEra where maryBasedEra :: MaryEraOnwards AlonzoEra maryBasedEra = MaryEraOnwards AlonzoEra MaryEraOnwardsAlonzo instance IsMaryBasedEra BabbageEra where maryBasedEra :: MaryEraOnwards BabbageEra maryBasedEra = MaryEraOnwards BabbageEra MaryEraOnwardsBabbage instance IsMaryBasedEra ConwayEra where maryBasedEra :: MaryEraOnwards ConwayEra maryBasedEra = MaryEraOnwards ConwayEra MaryEraOnwardsConway