{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} module Cardano.Api.Eon.AllegraEraOnwards ( AllegraEraOnwards (..) , allegraEraOnwardsConstraints , allegraEraOnwardsToShelleyBasedEra , AllegraEraOnwardsConstraints , IsAllegraBasedEra (..) ) where 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.SafeHash 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 AllegraEraOnwards era where AllegraEraOnwardsAllegra :: AllegraEraOnwards AllegraEra AllegraEraOnwardsMary :: AllegraEraOnwards MaryEra AllegraEraOnwardsAlonzo :: AllegraEraOnwards AlonzoEra AllegraEraOnwardsBabbage :: AllegraEraOnwards BabbageEra AllegraEraOnwardsConway :: AllegraEraOnwards ConwayEra deriving instance Show (AllegraEraOnwards era) deriving instance Eq (AllegraEraOnwards era) instance Eon AllegraEraOnwards where inEonForEra :: forall a era. a -> (AllegraEraOnwards era -> a) -> CardanoEra era -> a inEonForEra a no AllegraEraOnwards era -> a yes = \case CardanoEra era ByronEra -> a no CardanoEra era ShelleyEra -> a no CardanoEra era AllegraEra -> AllegraEraOnwards era -> a yes AllegraEraOnwards era AllegraEraOnwards AllegraEra AllegraEraOnwardsAllegra CardanoEra era MaryEra -> AllegraEraOnwards era -> a yes AllegraEraOnwards era AllegraEraOnwards MaryEra AllegraEraOnwardsMary CardanoEra era AlonzoEra -> AllegraEraOnwards era -> a yes AllegraEraOnwards era AllegraEraOnwards AlonzoEra AllegraEraOnwardsAlonzo CardanoEra era BabbageEra -> AllegraEraOnwards era -> a yes AllegraEraOnwards era AllegraEraOnwards BabbageEra AllegraEraOnwardsBabbage CardanoEra era ConwayEra -> AllegraEraOnwards era -> a yes AllegraEraOnwards era AllegraEraOnwards ConwayEra AllegraEraOnwardsConway instance ToCardanoEra AllegraEraOnwards where toCardanoEra :: forall era. AllegraEraOnwards era -> CardanoEra era toCardanoEra = \case AllegraEraOnwards era AllegraEraOnwardsAllegra -> CardanoEra era CardanoEra AllegraEra AllegraEra AllegraEraOnwards era AllegraEraOnwardsMary -> CardanoEra era CardanoEra MaryEra MaryEra AllegraEraOnwards era AllegraEraOnwardsAlonzo -> CardanoEra era CardanoEra AlonzoEra AlonzoEra AllegraEraOnwards era AllegraEraOnwardsBabbage -> CardanoEra era CardanoEra BabbageEra BabbageEra AllegraEraOnwards era AllegraEraOnwardsConway -> CardanoEra era CardanoEra ConwayEra ConwayEra instance Convert AllegraEraOnwards CardanoEra where convert :: forall era. AllegraEraOnwards era -> CardanoEra era convert = AllegraEraOnwards era -> CardanoEra era forall era. AllegraEraOnwards era -> CardanoEra era forall (eon :: * -> *) era. ToCardanoEra eon => eon era -> CardanoEra era toCardanoEra instance Convert AllegraEraOnwards ShelleyBasedEra where convert :: forall era. AllegraEraOnwards era -> ShelleyBasedEra era convert = \case AllegraEraOnwards era AllegraEraOnwardsAllegra -> ShelleyBasedEra era ShelleyBasedEra AllegraEra ShelleyBasedEraAllegra AllegraEraOnwards era AllegraEraOnwardsMary -> ShelleyBasedEra era ShelleyBasedEra MaryEra ShelleyBasedEraMary AllegraEraOnwards era AllegraEraOnwardsAlonzo -> ShelleyBasedEra era ShelleyBasedEra AlonzoEra ShelleyBasedEraAlonzo AllegraEraOnwards era AllegraEraOnwardsBabbage -> ShelleyBasedEra era ShelleyBasedEra BabbageEra ShelleyBasedEraBabbage AllegraEraOnwards era AllegraEraOnwardsConway -> ShelleyBasedEra era ShelleyBasedEra ConwayEra ShelleyBasedEraConway type AllegraEraOnwardsConstraints 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.HashAnnotated (L.TxBody (ShelleyLedgerEra era)) L.EraIndependentTxBody L.StandardCrypto , L.AllegraEraTxBody (ShelleyLedgerEra era) , L.ShelleyEraTxCert (ShelleyLedgerEra era) , FromCBOR (Consensus.ChainDepState (ConsensusProtocol era)) , FromCBOR (DebugLedgerState era) , IsCardanoEra era , IsShelleyBasedEra era , ToJSON (DebugLedgerState era) , Typeable era ) allegraEraOnwardsConstraints :: () => AllegraEraOnwards era -> (AllegraEraOnwardsConstraints era => a) -> a allegraEraOnwardsConstraints :: forall era a. AllegraEraOnwards era -> (AllegraEraOnwardsConstraints era => a) -> a allegraEraOnwardsConstraints = \case AllegraEraOnwards era AllegraEraOnwardsAllegra -> a -> a (AllegraEraOnwardsConstraints era => a) -> a forall a. a -> a id AllegraEraOnwards era AllegraEraOnwardsMary -> a -> a (AllegraEraOnwardsConstraints era => a) -> a forall a. a -> a id AllegraEraOnwards era AllegraEraOnwardsAlonzo -> a -> a (AllegraEraOnwardsConstraints era => a) -> a forall a. a -> a id AllegraEraOnwards era AllegraEraOnwardsBabbage -> a -> a (AllegraEraOnwardsConstraints era => a) -> a forall a. a -> a id AllegraEraOnwards era AllegraEraOnwardsConway -> a -> a (AllegraEraOnwardsConstraints era => a) -> a forall a. a -> a id {-# DEPRECATED allegraEraOnwardsToShelleyBasedEra "Use 'convert' instead." #-} allegraEraOnwardsToShelleyBasedEra :: AllegraEraOnwards era -> ShelleyBasedEra era allegraEraOnwardsToShelleyBasedEra :: forall era. AllegraEraOnwards era -> ShelleyBasedEra era allegraEraOnwardsToShelleyBasedEra = AllegraEraOnwards era -> ShelleyBasedEra era forall era. AllegraEraOnwards era -> ShelleyBasedEra era forall a (f :: a -> *) (g :: a -> *) (era :: a). Convert f g => f era -> g era convert class IsShelleyBasedEra era => IsAllegraBasedEra era where allegraBasedEra :: AllegraEraOnwards era instance IsAllegraBasedEra AllegraEra where allegraBasedEra :: AllegraEraOnwards AllegraEra allegraBasedEra = AllegraEraOnwards AllegraEra AllegraEraOnwardsAllegra instance IsAllegraBasedEra MaryEra where allegraBasedEra :: AllegraEraOnwards MaryEra allegraBasedEra = AllegraEraOnwards MaryEra AllegraEraOnwardsMary instance IsAllegraBasedEra AlonzoEra where allegraBasedEra :: AllegraEraOnwards AlonzoEra allegraBasedEra = AllegraEraOnwards AlonzoEra AllegraEraOnwardsAlonzo instance IsAllegraBasedEra BabbageEra where allegraBasedEra :: AllegraEraOnwards BabbageEra allegraBasedEra = AllegraEraOnwards BabbageEra AllegraEraOnwardsBabbage instance IsAllegraBasedEra ConwayEra where allegraBasedEra :: AllegraEraOnwards ConwayEra allegraBasedEra = AllegraEraOnwards ConwayEra AllegraEraOnwardsConway