{-# LANGUAGE DerivingVia #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -Wno-orphans #-} module Test.Cardano.Ledger.Mary.Binary.Annotator ( module Test.Cardano.Ledger.Allegra.Binary.Annotator, ) where import Cardano.Ledger.Binary import Cardano.Ledger.Block (Block (..)) import Cardano.Ledger.Core (TxLevel (..)) import Cardano.Ledger.Mary (MaryEra, Tx (..)) import Cardano.Ledger.Mary.TxBody import Cardano.Ledger.MempoolTx.Internal (MempoolTx (..)) import Test.Cardano.Ledger.Allegra.Binary.Annotator deriving newtype instance DecCBOR (TxBody TopTx MaryEra) instance DecCBOR (MempoolTx MaryEra) where decCBOR :: forall s. Decoder s (MempoolTx MaryEra) decCBOR = Tx TopTx MaryEra -> MempoolTx MaryEra forall era. Tx TopTx era -> MempoolTx era UnsafeMkMempoolTx (Tx TopTx MaryEra -> MempoolTx MaryEra) -> (ShelleyTx TopTx MaryEra -> Tx TopTx MaryEra) -> ShelleyTx TopTx MaryEra -> MempoolTx MaryEra forall b c a. (b -> c) -> (a -> b) -> a -> c . ShelleyTx TopTx MaryEra -> Tx TopTx MaryEra forall (t :: TxLevel). ShelleyTx t MaryEra -> Tx t MaryEra MkMaryTx (ShelleyTx TopTx MaryEra -> MempoolTx MaryEra) -> Decoder s (ShelleyTx TopTx MaryEra) -> Decoder s (MempoolTx MaryEra) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Decoder s (ShelleyTx TopTx MaryEra) forall s. Decoder s (ShelleyTx TopTx MaryEra) forall a s. DecCBOR a => Decoder s a decCBOR instance DecCBOR h => DecCBOR (Block h MaryEra) where decCBOR :: forall s. Decoder s (Block h MaryEra) decCBOR = Text -> (Block h MaryEra -> Int) -> Decoder s (Block h MaryEra) -> Decoder s (Block h MaryEra) forall a s. Text -> (a -> Int) -> Decoder s a -> Decoder s a decodeRecordNamed Text "Block" (Int -> Block h MaryEra -> Int forall a b. a -> b -> a const Int 4) (Decoder s (Block h MaryEra) -> Decoder s (Block h MaryEra)) -> Decoder s (Block h MaryEra) -> Decoder s (Block h MaryEra) forall a b. (a -> b) -> a -> b $ h -> BlockBody MaryEra -> Block h MaryEra h -> ShelleyBlockBody MaryEra -> Block h MaryEra forall h era. h -> BlockBody era -> Block h era Block (h -> ShelleyBlockBody MaryEra -> Block h MaryEra) -> Decoder s h -> Decoder s (ShelleyBlockBody MaryEra -> Block h MaryEra) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Decoder s h forall s. Decoder s h forall a s. DecCBOR a => Decoder s a decCBOR Decoder s (ShelleyBlockBody MaryEra -> Block h MaryEra) -> Decoder s (ShelleyBlockBody MaryEra) -> Decoder s (Block h MaryEra) forall a b. Decoder s (a -> b) -> Decoder s a -> Decoder s b forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Decoder s (ShelleyBlockBody MaryEra) forall s. Decoder s (ShelleyBlockBody MaryEra) forall a s. DecCBOR a => Decoder s a decCBOR