{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} module Cardano.Api.Eon.ShelleyToAlonzoEra ( ShelleyToAlonzoEra (..) , shelleyToAlonzoEraConstraints , shelleyToAlonzoEraToShelleyBasedEra , ShelleyToAlonzoEraConstraints ) 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 Cardano.Ledger.Shelley.TxCert 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 ShelleyToAlonzoEra era where ShelleyToAlonzoEraShelley :: ShelleyToAlonzoEra ShelleyEra ShelleyToAlonzoEraAllegra :: ShelleyToAlonzoEra AllegraEra ShelleyToAlonzoEraMary :: ShelleyToAlonzoEra MaryEra ShelleyToAlonzoEraAlonzo :: ShelleyToAlonzoEra AlonzoEra deriving instance Show (ShelleyToAlonzoEra era) deriving instance Eq (ShelleyToAlonzoEra era) instance Eon ShelleyToAlonzoEra where inEonForEra :: forall a era. a -> (ShelleyToAlonzoEra era -> a) -> CardanoEra era -> a inEonForEra a no ShelleyToAlonzoEra era -> a yes = \case CardanoEra era ByronEra -> a no CardanoEra era ShelleyEra -> ShelleyToAlonzoEra era -> a yes ShelleyToAlonzoEra era ShelleyToAlonzoEra ShelleyEra ShelleyToAlonzoEraShelley CardanoEra era AllegraEra -> ShelleyToAlonzoEra era -> a yes ShelleyToAlonzoEra era ShelleyToAlonzoEra AllegraEra ShelleyToAlonzoEraAllegra CardanoEra era MaryEra -> ShelleyToAlonzoEra era -> a yes ShelleyToAlonzoEra era ShelleyToAlonzoEra MaryEra ShelleyToAlonzoEraMary CardanoEra era AlonzoEra -> ShelleyToAlonzoEra era -> a yes ShelleyToAlonzoEra era ShelleyToAlonzoEra AlonzoEra ShelleyToAlonzoEraAlonzo CardanoEra era BabbageEra -> a no CardanoEra era ConwayEra -> a no instance ToCardanoEra ShelleyToAlonzoEra where toCardanoEra :: forall era. ShelleyToAlonzoEra era -> CardanoEra era toCardanoEra = \case ShelleyToAlonzoEra era ShelleyToAlonzoEraShelley -> CardanoEra era CardanoEra ShelleyEra ShelleyEra ShelleyToAlonzoEra era ShelleyToAlonzoEraAllegra -> CardanoEra era CardanoEra AllegraEra AllegraEra ShelleyToAlonzoEra era ShelleyToAlonzoEraMary -> CardanoEra era CardanoEra MaryEra MaryEra ShelleyToAlonzoEra era ShelleyToAlonzoEraAlonzo -> CardanoEra era CardanoEra AlonzoEra AlonzoEra instance Convert ShelleyToAlonzoEra CardanoEra where convert :: forall era. ShelleyToAlonzoEra era -> CardanoEra era convert = ShelleyToAlonzoEra era -> CardanoEra era forall era. ShelleyToAlonzoEra era -> CardanoEra era forall (eon :: * -> *) era. ToCardanoEra eon => eon era -> CardanoEra era toCardanoEra instance Convert ShelleyToAlonzoEra ShelleyBasedEra where convert :: forall era. ShelleyToAlonzoEra era -> ShelleyBasedEra era convert = \case ShelleyToAlonzoEra era ShelleyToAlonzoEraShelley -> ShelleyBasedEra era ShelleyBasedEra ShelleyEra ShelleyBasedEraShelley ShelleyToAlonzoEra era ShelleyToAlonzoEraAllegra -> ShelleyBasedEra era ShelleyBasedEra AllegraEra ShelleyBasedEraAllegra ShelleyToAlonzoEra era ShelleyToAlonzoEraMary -> ShelleyBasedEra era ShelleyBasedEra MaryEra ShelleyBasedEraMary ShelleyToAlonzoEra era ShelleyToAlonzoEraAlonzo -> ShelleyBasedEra era ShelleyBasedEra AlonzoEra ShelleyBasedEraAlonzo type ShelleyToAlonzoEraConstraints 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.ProtVerAtMost (ShelleyLedgerEra era) 6 , L.ProtVerAtMost (ShelleyLedgerEra era) 8 , L.ShelleyEraTxBody (ShelleyLedgerEra era) , L.ShelleyEraTxCert (ShelleyLedgerEra era) , L.TxCert (ShelleyLedgerEra era) ~ L.ShelleyTxCert (ShelleyLedgerEra era) , FromCBOR (Consensus.ChainDepState (ConsensusProtocol era)) , FromCBOR (DebugLedgerState era) , IsCardanoEra era , IsShelleyBasedEra era , ToJSON (DebugLedgerState era) , Typeable era ) shelleyToAlonzoEraConstraints :: () => ShelleyToAlonzoEra era -> (ShelleyToAlonzoEraConstraints era => a) -> a shelleyToAlonzoEraConstraints :: forall era a. ShelleyToAlonzoEra era -> (ShelleyToAlonzoEraConstraints era => a) -> a shelleyToAlonzoEraConstraints = \case ShelleyToAlonzoEra era ShelleyToAlonzoEraShelley -> a -> a (ShelleyToAlonzoEraConstraints era => a) -> a forall a. a -> a id ShelleyToAlonzoEra era ShelleyToAlonzoEraAllegra -> a -> a (ShelleyToAlonzoEraConstraints era => a) -> a forall a. a -> a id ShelleyToAlonzoEra era ShelleyToAlonzoEraMary -> a -> a (ShelleyToAlonzoEraConstraints era => a) -> a forall a. a -> a id ShelleyToAlonzoEra era ShelleyToAlonzoEraAlonzo -> a -> a (ShelleyToAlonzoEraConstraints era => a) -> a forall a. a -> a id shelleyToAlonzoEraToShelleyBasedEra :: ShelleyToAlonzoEra era -> ShelleyBasedEra era shelleyToAlonzoEraToShelleyBasedEra :: forall era. ShelleyToAlonzoEra era -> ShelleyBasedEra era shelleyToAlonzoEraToShelleyBasedEra = ShelleyToAlonzoEra era -> ShelleyBasedEra era forall era. ShelleyToAlonzoEra era -> ShelleyBasedEra era forall a (f :: a -> *) (g :: a -> *) (era :: a). Convert f g => f era -> g era convert