diff --git a/cardano-api/src/Cardano/Api/LedgerState.hs b/cardano-api/src/Cardano/Api/LedgerState.hs index 8ae6db7362c..811db2dcbd1 100644 --- a/cardano-api/src/Cardano/Api/LedgerState.hs +++ b/cardano-api/src/Cardano/Api/LedgerState.hs @@ -23,6 +23,8 @@ module Cardano.Api.LedgerState , LedgerStateAllegra , LedgerStateMary , LedgerStateAlonzo + , LedgerStateBabbage + , LedgerStateConway ) , encodeLedgerState , decodeLedgerState @@ -284,11 +286,23 @@ pattern LedgerStateAlonzo -> LedgerState pattern LedgerStateAlonzo st <- LedgerState (Consensus.LedgerStateAlonzo st) +pattern LedgerStateBabbage + :: Ledger.LedgerState (Shelley.ShelleyBlock protocol (Shelley.BabbageEra Shelley.StandardCrypto)) + -> LedgerState +pattern LedgerStateBabbage st <- LedgerState (Consensus.LedgerStateBabbage st) + +pattern LedgerStateConway + :: Ledger.LedgerState (Shelley.ShelleyBlock protocol (Shelley.ConwayEra Shelley.StandardCrypto)) + -> LedgerState +pattern LedgerStateConway st <- LedgerState (Consensus.LedgerStateConway st) + {-# COMPLETE LedgerStateByron , LedgerStateShelley , LedgerStateAllegra , LedgerStateMary - , LedgerStateAlonzo #-} + , LedgerStateAlonzo + , LedgerStateBabbage + , LedgerStateConway #-} data FoldBlocksError = FoldBlocksInitialLedgerStateError InitialLedgerStateError diff --git a/cardano-api/src/Cardano/Api/Orphans.hs b/cardano-api/src/Cardano/Api/Orphans.hs index 3f41caff066..de24300988d 100644 --- a/cardano-api/src/Cardano/Api/Orphans.hs +++ b/cardano-api/src/Cardano/Api/Orphans.hs @@ -47,28 +47,28 @@ import Cardano.Api.Script import qualified Cardano.Binary as CBOR import qualified Cardano.Crypto.Hash.Class as Crypto import qualified Cardano.Ledger.Alonzo.Data as Alonzo +import Cardano.Ledger.Alonzo.Scripts (AlonzoScript) +import Cardano.Ledger.Babbage.PParams (BabbagePParams, BabbagePParamsUpdate) import qualified Cardano.Ledger.Babbage.PParams as Babbage -import Cardano.Ledger.Babbage.PParams (BabbagePParamsUpdate, BabbagePParams) import qualified Cardano.Ledger.Babbage.TxBody as Babbage import qualified Cardano.Ledger.Coin as Shelley import Cardano.Ledger.Core (EraTxOut) import qualified Cardano.Ledger.Core as Core import qualified Cardano.Ledger.Crypto as Crypto +import Cardano.Ledger.Mary.Value (MaryValue (..)) +import qualified Cardano.Ledger.Mary.Value as Mary import qualified Cardano.Ledger.PoolDistr as Ledger import qualified Cardano.Ledger.SafeHash as SafeHash -import Cardano.Ledger.Val (Val) +import Cardano.Ledger.Shelley.API (ShelleyTxOut (..)) import qualified Cardano.Ledger.Shelley.API as Shelley -import qualified Cardano.Ledger.Mary.Value as Mary -import Cardano.Ledger.Mary.Value (MaryValue(..)) -import Cardano.Ledger.Alonzo.Scripts (AlonzoScript) -import Cardano.Ledger.Shelley.API (ShelleyTxOut(..)) +import Cardano.Ledger.Val (Val) +import Cardano.Ledger.Babbage.TxBody (BabbageTxOut (..)) import qualified Cardano.Ledger.Shelley.EpochBoundary as ShelleyEpoch import qualified Cardano.Ledger.Shelley.LedgerState as ShelleyLedger import Cardano.Ledger.Shelley.PParams (ShelleyPParamsUpdate) import qualified Cardano.Ledger.Shelley.Rewards as Shelley import qualified Cardano.Ledger.Shelley.RewardUpdate as Shelley -import Cardano.Ledger.Babbage.TxBody (BabbageTxOut(..)) import qualified Ouroboros.Consensus.Shelley.Eras as Consensus import qualified Ouroboros.Consensus.Shelley.Ledger.Query as Consensus diff --git a/cardano-client-demo/StakeCredentialHistory.hs b/cardano-client-demo/StakeCredentialHistory.hs index 794a69d36f1..4fc95f40204 100644 --- a/cardano-client-demo/StakeCredentialHistory.hs +++ b/cardano-client-demo/StakeCredentialHistory.hs @@ -7,8 +7,10 @@ import Cardano.Api import Cardano.Api.Shelley + import Cardano.Ledger.Address (getRewardAcnt) import Cardano.Ledger.Alonzo.PParams (AlonzoPParamsHKD (..)) +import Cardano.Ledger.Babbage.PParams (BabbagePParamsHKD (..)) import qualified Cardano.Ledger.BaseTypes as L import Cardano.Ledger.Compactible (Compactible (..)) import qualified Cardano.Ledger.Core as LC @@ -16,6 +18,9 @@ import qualified Cardano.Ledger.Shelley.API as L import qualified Cardano.Ledger.Shelley.Rewards as L import qualified Cardano.Ledger.Shelley.RewardUpdate as L import qualified Cardano.Ledger.UnifiedMap as UM +import Ouroboros.Consensus.Shelley.Eras (StandardCrypto) +import qualified Ouroboros.Consensus.Shelley.Ledger as Shelley + import qualified Codec.Binary.Bech32 as Bech32 import Control.Monad.Trans.Except (runExceptT) import qualified Data.Binary.Get as B @@ -34,8 +39,6 @@ import qualified Data.VMap as VMap import GHC.Records (HasField (..)) import Options.Applicative (Parser, (<**>), (<|>)) import qualified Options.Applicative as Opt -import Ouroboros.Consensus.Shelley.Eras (StandardCrypto) -import qualified Ouroboros.Consensus.Shelley.Ledger as Shelley data State = State { lastCheckpoint :: SlotNo @@ -278,6 +281,10 @@ main = do ("mary", L.nesEL ls, Just (L.nesRu ls, getGoSnapshot ls, getBalances ls, getPV ls)) LedgerStateAlonzo (Shelley.ShelleyLedgerState _ ls _) -> ("alonzo", L.nesEL ls, Just (L.nesRu ls, getGoSnapshot ls, getBalances ls, getPV ls)) + LedgerStateBabbage (Shelley.ShelleyLedgerState _ ls _) -> + ("babbage", L.nesEL ls, Just (L.nesRu ls, getGoSnapshot ls, getBalances ls, getPV ls)) + LedgerStateConway (Shelley.ShelleyLedgerState _ ls _) -> + ("conway", L.nesEL ls, Just (L.nesRu ls, getGoSnapshot ls, getBalances ls, getPV ls)) let txBodyComponents = map ( (\(TxBody txbc) -> txbc) . getTxBody ) transactions diff --git a/cardano-client-demo/cardano-client-demo.cabal b/cardano-client-demo/cardano-client-demo.cabal index 48c95df9986..eadc1babc4e 100644 --- a/cardano-client-demo/cardano-client-demo.cabal +++ b/cardano-client-demo/cardano-client-demo.cabal @@ -102,6 +102,7 @@ executable stake-credential-history cardano-ledger-alonzo, cardano-api, cardano-data, + cardano-ledger-babbage, cardano-ledger-core, cardano-ledger-shelley, vector-map,