module Ouroboros.Network.Protocol.LocalTxMonitor.Codec.CDDL where

import Codec.CBOR.Read qualified as CBOR
import Codec.Serialise.Class qualified as Serialise
import Data.ByteString.Lazy qualified as BL
import Network.TypedProtocol.Codec
import Ouroboros.Network.Block (SlotNo)
import Ouroboros.Network.Protocol.LocalTxMonitor.Codec
import Ouroboros.Network.Protocol.LocalTxMonitor.Type
import Ouroboros.Network.Protocol.TxSubmission2.Test (Tx, TxId)

localTxMonitorCodec :: Codec (LocalTxMonitor TxId Tx SlotNo)
                            CBOR.DeserialiseFailure IO BL.ByteString
localTxMonitorCodec :: Codec
  (LocalTxMonitor TxId Tx SlotNo) DeserialiseFailure IO ByteString
localTxMonitorCodec =
    (TxId -> Encoding)
-> (forall s. Decoder s TxId)
-> (Tx -> Encoding)
-> (forall s. Decoder s Tx)
-> (SlotNo -> Encoding)
-> (forall s. Decoder s SlotNo)
-> Codec
     (LocalTxMonitor TxId Tx SlotNo) DeserialiseFailure IO ByteString
forall txid tx slot (m :: * -> *) ptcl.
(MonadST m, ptcl ~ LocalTxMonitor txid tx slot) =>
(txid -> Encoding)
-> (forall s. Decoder s txid)
-> (tx -> Encoding)
-> (forall s. Decoder s tx)
-> (slot -> Encoding)
-> (forall s. Decoder s slot)
-> Codec
     (LocalTxMonitor txid tx slot) DeserialiseFailure m ByteString
codecLocalTxMonitor
      TxId -> Encoding
forall a. Serialise a => a -> Encoding
Serialise.encode Decoder s TxId
forall s. Decoder s TxId
forall a s. Serialise a => Decoder s a
Serialise.decode
      Tx -> Encoding
forall a. Serialise a => a -> Encoding
Serialise.encode Decoder s Tx
forall s. Decoder s Tx
forall a s. Serialise a => Decoder s a
Serialise.decode
      SlotNo -> Encoding
forall a. Serialise a => a -> Encoding
Serialise.encode Decoder s SlotNo
forall s. Decoder s SlotNo
forall a s. Serialise a => Decoder s a
Serialise.decode