{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} module Cardano.Api.Eon.ShelleyToBabbageEra ( ShelleyToBabbageEra (..) , shelleyToBabbageEraConstraints , shelleyToBabbageEraToShelleyBasedEra , ShelleyToBabbageEraConstraints ) 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 ShelleyToBabbageEra era where ShelleyToBabbageEraShelley :: ShelleyToBabbageEra ShelleyEra ShelleyToBabbageEraAllegra :: ShelleyToBabbageEra AllegraEra ShelleyToBabbageEraMary :: ShelleyToBabbageEra MaryEra ShelleyToBabbageEraAlonzo :: ShelleyToBabbageEra AlonzoEra ShelleyToBabbageEraBabbage :: ShelleyToBabbageEra BabbageEra deriving instance Show (ShelleyToBabbageEra era) deriving instance Eq (ShelleyToBabbageEra era) instance Eon ShelleyToBabbageEra where inEonForEra :: forall a era. a -> (ShelleyToBabbageEra era -> a) -> CardanoEra era -> a inEonForEra a no ShelleyToBabbageEra era -> a yes = \case CardanoEra era ByronEra -> a no CardanoEra era ShelleyEra -> ShelleyToBabbageEra era -> a yes ShelleyToBabbageEra era ShelleyToBabbageEra ShelleyEra ShelleyToBabbageEraShelley CardanoEra era AllegraEra -> ShelleyToBabbageEra era -> a yes ShelleyToBabbageEra era ShelleyToBabbageEra AllegraEra ShelleyToBabbageEraAllegra CardanoEra era MaryEra -> ShelleyToBabbageEra era -> a yes ShelleyToBabbageEra era ShelleyToBabbageEra MaryEra ShelleyToBabbageEraMary CardanoEra era AlonzoEra -> ShelleyToBabbageEra era -> a yes ShelleyToBabbageEra era ShelleyToBabbageEra AlonzoEra ShelleyToBabbageEraAlonzo CardanoEra era BabbageEra -> ShelleyToBabbageEra era -> a yes ShelleyToBabbageEra era ShelleyToBabbageEra BabbageEra ShelleyToBabbageEraBabbage CardanoEra era ConwayEra -> a no instance ToCardanoEra ShelleyToBabbageEra where toCardanoEra :: forall era. ShelleyToBabbageEra era -> CardanoEra era toCardanoEra = \case ShelleyToBabbageEra era ShelleyToBabbageEraShelley -> CardanoEra era CardanoEra ShelleyEra ShelleyEra ShelleyToBabbageEra era ShelleyToBabbageEraAllegra -> CardanoEra era CardanoEra AllegraEra AllegraEra ShelleyToBabbageEra era ShelleyToBabbageEraMary -> CardanoEra era CardanoEra MaryEra MaryEra ShelleyToBabbageEra era ShelleyToBabbageEraAlonzo -> CardanoEra era CardanoEra AlonzoEra AlonzoEra ShelleyToBabbageEra era ShelleyToBabbageEraBabbage -> CardanoEra era CardanoEra BabbageEra BabbageEra instance Convert ShelleyToBabbageEra CardanoEra where convert :: forall era. ShelleyToBabbageEra era -> CardanoEra era convert = ShelleyToBabbageEra era -> CardanoEra era forall era. ShelleyToBabbageEra era -> CardanoEra era forall (eon :: * -> *) era. ToCardanoEra eon => eon era -> CardanoEra era toCardanoEra instance Convert ShelleyToBabbageEra ShelleyBasedEra where convert :: forall era. ShelleyToBabbageEra era -> ShelleyBasedEra era convert = \case ShelleyToBabbageEra era ShelleyToBabbageEraShelley -> ShelleyBasedEra era ShelleyBasedEra ShelleyEra ShelleyBasedEraShelley ShelleyToBabbageEra era ShelleyToBabbageEraAllegra -> ShelleyBasedEra era ShelleyBasedEra AllegraEra ShelleyBasedEraAllegra ShelleyToBabbageEra era ShelleyToBabbageEraMary -> ShelleyBasedEra era ShelleyBasedEra MaryEra ShelleyBasedEraMary ShelleyToBabbageEra era ShelleyToBabbageEraAlonzo -> ShelleyBasedEra era ShelleyBasedEra AlonzoEra ShelleyBasedEraAlonzo ShelleyToBabbageEra era ShelleyToBabbageEraBabbage -> ShelleyBasedEra era ShelleyBasedEra BabbageEra ShelleyBasedEraBabbage type ShelleyToBabbageEraConstraints 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) 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 ) shelleyToBabbageEraConstraints :: () => ShelleyToBabbageEra era -> (ShelleyToBabbageEraConstraints era => a) -> a shelleyToBabbageEraConstraints :: forall era a. ShelleyToBabbageEra era -> (ShelleyToBabbageEraConstraints era => a) -> a shelleyToBabbageEraConstraints = \case ShelleyToBabbageEra era ShelleyToBabbageEraShelley -> a -> a (ShelleyToBabbageEraConstraints era => a) -> a forall a. a -> a id ShelleyToBabbageEra era ShelleyToBabbageEraAllegra -> a -> a (ShelleyToBabbageEraConstraints era => a) -> a forall a. a -> a id ShelleyToBabbageEra era ShelleyToBabbageEraMary -> a -> a (ShelleyToBabbageEraConstraints era => a) -> a forall a. a -> a id ShelleyToBabbageEra era ShelleyToBabbageEraAlonzo -> a -> a (ShelleyToBabbageEraConstraints era => a) -> a forall a. a -> a id ShelleyToBabbageEra era ShelleyToBabbageEraBabbage -> a -> a (ShelleyToBabbageEraConstraints era => a) -> a forall a. a -> a id {-# DEPRECATED shelleyToBabbageEraToShelleyBasedEra "Use 'convert' instead." #-} shelleyToBabbageEraToShelleyBasedEra :: ShelleyToBabbageEra era -> ShelleyBasedEra era shelleyToBabbageEraToShelleyBasedEra :: forall era. ShelleyToBabbageEra era -> ShelleyBasedEra era shelleyToBabbageEraToShelleyBasedEra = ShelleyToBabbageEra era -> ShelleyBasedEra era forall era. ShelleyToBabbageEra era -> ShelleyBasedEra era forall a (f :: a -> *) (g :: a -> *) (era :: a). Convert f g => f era -> g era convert