{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Test.Cardano.Ledger.Alonzo.Binary.Annotator (
  module Test.Cardano.Ledger.Mary.Binary.Annotator,
) where

import Cardano.Ledger.Alonzo (AlonzoEra)
import Cardano.Ledger.Alonzo.Scripts
import Cardano.Ledger.Alonzo.Tx
import Cardano.Ledger.Alonzo.TxAuxData
import Cardano.Ledger.Alonzo.TxBody
import Cardano.Ledger.Alonzo.TxSeq.Internal
import Cardano.Ledger.Alonzo.TxWits
import Cardano.Ledger.Binary
import Cardano.Ledger.Binary.Coders
import Cardano.Ledger.Core
import Cardano.Ledger.Plutus
import Cardano.Ledger.Shelley.BlockChain (auxDataSeqDecoder)
import qualified Data.List.NonEmpty as NE
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.MapExtras as Map (fromElems)
import Data.Maybe.Strict (maybeToStrictMaybe)
import qualified Data.Sequence as Seq
import qualified Data.Sequence.Strict as StrictSeq
import qualified Data.Set as Set
import Data.Typeable (Typeable)
import Lens.Micro
import Test.Cardano.Ledger.Common
import Test.Cardano.Ledger.Mary.Binary.Annotator
import Test.Cardano.Ledger.Shelley.Arbitrary ()

instance
  ( AlonzoEraTx era
  , DecCBOR (TxBody era)
  , DecCBOR (TxAuxData era)
  , DecCBOR (TxWits era)
  , DecCBOR (NativeScript era)
  ) =>
  DecCBOR (AlonzoTxSeq era)
  where
  decCBOR :: forall s. Decoder s (AlonzoTxSeq era)
decCBOR = do
    Annotated Seq (TxBody era)
bodies ByteString
bodiesBytes <- Decoder s (Seq (TxBody era))
-> Decoder s (Annotated (Seq (TxBody era)) ByteString)
forall s a. Decoder s a -> Decoder s (Annotated a ByteString)
decodeAnnotated Decoder s (Seq (TxBody era))
forall s. Decoder s (Seq (TxBody era))
forall a s. DecCBOR a => Decoder s a
decCBOR
    Annotated Seq (TxWits era)
wits ByteString
witsBytes <- Decoder s (Seq (TxWits era))
-> Decoder s (Annotated (Seq (TxWits era)) ByteString)
forall s a. Decoder s a -> Decoder s (Annotated a ByteString)
decodeAnnotated Decoder s (Seq (TxWits era))
forall s. Decoder s (Seq (TxWits era))
forall a s. DecCBOR a => Decoder s a
decCBOR
    Annotated IntMap (TxAuxData era)
auxDataMap ByteString
auxDataBytes <- Decoder s (IntMap (TxAuxData era))
-> Decoder s (Annotated (IntMap (TxAuxData era)) ByteString)
forall s a. Decoder s a -> Decoder s (Annotated a ByteString)
decodeAnnotated Decoder s (IntMap (TxAuxData era))
forall s. Decoder s (IntMap (TxAuxData era))
forall a s. DecCBOR a => Decoder s a
decCBOR
    let bodiesLength :: Int
bodiesLength = Seq (TxBody era) -> Int
forall a. Seq a -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length Seq (TxBody era)
bodies
        inRange :: Int -> Bool
inRange Int
x = (Int
0 Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
x) Bool -> Bool -> Bool
&& (Int
x Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= (Int
bodiesLength Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1))
        witsLength :: Int
witsLength = Seq (TxWits era) -> Int
forall a. Seq a -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length Seq (TxWits era)
wits
    Seq (Maybe (TxAuxData era))
auxData <- forall a s. Int -> IntMap a -> Decoder s (Seq (Maybe a))
auxDataSeqDecoder @(TxAuxData era) Int
bodiesLength IntMap (TxAuxData era)
auxDataMap
    Annotated [Int]
isValidIdxs ByteString
isValidBytes <- Decoder s [Int] -> Decoder s (Annotated [Int] ByteString)
forall s a. Decoder s a -> Decoder s (Annotated a ByteString)
decodeAnnotated Decoder s [Int]
forall s. Decoder s [Int]
forall a s. DecCBOR a => Decoder s a
decCBOR
    let validFlags :: Seq IsValid
validFlags = Int -> [Int] -> Seq IsValid
alignedValidFlags Int
bodiesLength [Int]
isValidIdxs
    Bool -> Decoder s () -> Decoder s ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless
      (Int
bodiesLength Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
witsLength)
      ( String -> Decoder s ()
forall a. String -> Decoder s a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Decoder s ()) -> String -> Decoder s ()
forall a b. (a -> b) -> a -> b
$
          String
"different number of transaction bodies ("
            String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. Show a => a -> String
show Int
bodiesLength
            String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
") and witness sets ("
            String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. Show a => a -> String
show Int
witsLength
            String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
")"
      )
    Bool -> Decoder s () -> Decoder s ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless
      ((Int -> Bool) -> [Int] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Int -> Bool
inRange [Int]
isValidIdxs)
      ( String -> Decoder s ()
forall a. String -> Decoder s a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail
          ( String
"Some IsValid index is not in the range: 0 .. "
              String -> String -> String
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show (Int
bodiesLength Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1)
              String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", "
              String -> String -> String
forall a. [a] -> [a] -> [a]
++ [Int] -> String
forall a. Show a => a -> String
show [Int]
isValidIdxs
          )
      )
    let mkTx :: TxBody era
-> TxWits era -> IsValid -> Maybe (TxAuxData era) -> Tx era
mkTx TxBody era
body TxWits era
wit IsValid
isValid Maybe (TxAuxData era)
aData =
          TxBody era -> Tx era
forall era. EraTx era => TxBody era -> Tx era
mkBasicTx TxBody era
body
            Tx era -> (Tx era -> Tx era) -> Tx era
forall a b. a -> (a -> b) -> b
& (TxWits era -> Identity (TxWits era))
-> Tx era -> Identity (Tx era)
forall era. EraTx era => Lens' (Tx era) (TxWits era)
Lens' (Tx era) (TxWits era)
witsTxL ((TxWits era -> Identity (TxWits era))
 -> Tx era -> Identity (Tx era))
-> TxWits era -> Tx era -> Tx era
forall s t a b. ASetter s t a b -> b -> s -> t
.~ TxWits era
wit
            Tx era -> (Tx era -> Tx era) -> Tx era
forall a b. a -> (a -> b) -> b
& (StrictMaybe (TxAuxData era)
 -> Identity (StrictMaybe (TxAuxData era)))
-> Tx era -> Identity (Tx era)
forall era.
EraTx era =>
Lens' (Tx era) (StrictMaybe (TxAuxData era))
Lens' (Tx era) (StrictMaybe (TxAuxData era))
auxDataTxL ((StrictMaybe (TxAuxData era)
  -> Identity (StrictMaybe (TxAuxData era)))
 -> Tx era -> Identity (Tx era))
-> StrictMaybe (TxAuxData era) -> Tx era -> Tx era
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Maybe (TxAuxData era) -> StrictMaybe (TxAuxData era)
forall a. Maybe a -> StrictMaybe a
maybeToStrictMaybe Maybe (TxAuxData era)
aData
            Tx era -> (Tx era -> Tx era) -> Tx era
forall a b. a -> (a -> b) -> b
& (IsValid -> Identity IsValid) -> Tx era -> Identity (Tx era)
forall era. AlonzoEraTx era => Lens' (Tx era) IsValid
Lens' (Tx era) IsValid
isValidTxL ((IsValid -> Identity IsValid) -> Tx era -> Identity (Tx era))
-> IsValid -> Tx era -> Tx era
forall s t a b. ASetter s t a b -> b -> s -> t
.~ IsValid
isValid
    let txs :: StrictSeq (Tx era)
txs =
          Seq (Tx era) -> StrictSeq (Tx era)
forall a. Seq a -> StrictSeq a
StrictSeq.forceToStrict (Seq (Tx era) -> StrictSeq (Tx era))
-> Seq (Tx era) -> StrictSeq (Tx era)
forall a b. (a -> b) -> a -> b
$
            (TxBody era
 -> TxWits era -> IsValid -> Maybe (TxAuxData era) -> Tx era)
-> Seq (TxBody era)
-> Seq (TxWits era)
-> Seq IsValid
-> Seq (Maybe (TxAuxData era))
-> Seq (Tx era)
forall a b c d e.
(a -> b -> c -> d -> e)
-> Seq a -> Seq b -> Seq c -> Seq d -> Seq e
Seq.zipWith4 TxBody era
-> TxWits era -> IsValid -> Maybe (TxAuxData era) -> Tx era
forall {era}.
(Assert
   (OrdCond
      (CmpNat (ProtVerLow era) (ProtVerHigh era)) 'True 'True 'False)
   (TypeError ...),
 Assert
   (OrdCond (CmpNat MinVersion (ProtVerLow era)) 'True 'True 'False)
   (TypeError ...),
 Assert
   (OrdCond (CmpNat MinVersion (ProtVerHigh era)) 'True 'True 'False)
   (TypeError ...),
 AlonzoEraTx era) =>
TxBody era
-> TxWits era -> IsValid -> Maybe (TxAuxData era) -> Tx era
mkTx Seq (TxBody era)
bodies Seq (TxWits era)
wits Seq IsValid
validFlags Seq (Maybe (TxAuxData era))
auxData
    AlonzoTxSeq era -> Decoder s (AlonzoTxSeq era)
forall a. a -> Decoder s a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AlonzoTxSeq era -> Decoder s (AlonzoTxSeq era))
-> AlonzoTxSeq era -> Decoder s (AlonzoTxSeq era)
forall a b. (a -> b) -> a -> b
$
      StrictSeq (Tx era)
-> ByteString
-> ByteString
-> ByteString
-> ByteString
-> AlonzoTxSeq era
forall era.
StrictSeq (Tx era)
-> ByteString
-> ByteString
-> ByteString
-> ByteString
-> AlonzoTxSeq era
AlonzoTxSeqRaw
        StrictSeq (Tx era)
txs
        ByteString
bodiesBytes
        ByteString
witsBytes
        ByteString
auxDataBytes
        ByteString
isValidBytes

deriving newtype instance DecCBOR (TxBody AlonzoEra)

instance
  ( Typeable era
  , DecCBOR (TxBody era)
  , DecCBOR (TxWits era)
  , DecCBOR (TxAuxData era)
  ) =>
  DecCBOR (AlonzoTx era)
  where
  decCBOR :: forall s. Decoder s (AlonzoTx era)
decCBOR =
    Decode ('Closed 'Dense) (AlonzoTx era) -> Decoder s (AlonzoTx era)
forall t (w :: Wrapped) s. Typeable t => Decode w t -> Decoder s t
decode (Decode ('Closed 'Dense) (AlonzoTx era)
 -> Decoder s (AlonzoTx era))
-> Decode ('Closed 'Dense) (AlonzoTx era)
-> Decoder s (AlonzoTx era)
forall a b. (a -> b) -> a -> b
$
      (TxBody era
 -> TxWits era
 -> IsValid
 -> StrictMaybe (TxAuxData era)
 -> AlonzoTx era)
-> Decode
     ('Closed 'Dense)
     (TxBody era
      -> TxWits era
      -> IsValid
      -> StrictMaybe (TxAuxData era)
      -> AlonzoTx era)
forall t. t -> Decode ('Closed 'Dense) t
RecD TxBody era
-> TxWits era
-> IsValid
-> StrictMaybe (TxAuxData era)
-> AlonzoTx era
forall era.
TxBody era
-> TxWits era
-> IsValid
-> StrictMaybe (TxAuxData era)
-> AlonzoTx era
AlonzoTx
        Decode
  ('Closed 'Dense)
  (TxBody era
   -> TxWits era
   -> IsValid
   -> StrictMaybe (TxAuxData era)
   -> AlonzoTx era)
-> Decode ('Closed Any) (TxBody era)
-> Decode
     ('Closed 'Dense)
     (TxWits era
      -> IsValid -> StrictMaybe (TxAuxData era) -> AlonzoTx era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode ('Closed w) a -> Decode w1 t
<! Decode ('Closed Any) (TxBody era)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Decode
  ('Closed 'Dense)
  (TxWits era
   -> IsValid -> StrictMaybe (TxAuxData era) -> AlonzoTx era)
-> Decode ('Closed Any) (TxWits era)
-> Decode
     ('Closed 'Dense)
     (IsValid -> StrictMaybe (TxAuxData era) -> AlonzoTx era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode ('Closed w) a -> Decode w1 t
<! Decode ('Closed Any) (TxWits era)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Decode
  ('Closed 'Dense)
  (IsValid -> StrictMaybe (TxAuxData era) -> AlonzoTx era)
-> Decode ('Closed Any) IsValid
-> Decode
     ('Closed 'Dense) (StrictMaybe (TxAuxData era) -> AlonzoTx era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode ('Closed w) a -> Decode w1 t
<! Decode ('Closed Any) IsValid
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Decode
  ('Closed 'Dense) (StrictMaybe (TxAuxData era) -> AlonzoTx era)
-> Decode ('Closed 'Dense) (StrictMaybe (TxAuxData era))
-> Decode ('Closed 'Dense) (AlonzoTx era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode ('Closed w) a -> Decode w1 t
<! (forall s. Decoder s (StrictMaybe (TxAuxData era)))
-> Decode ('Closed 'Dense) (StrictMaybe (TxAuxData era))
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (Decoder s (TxAuxData era)
-> Decoder s (StrictMaybe (TxAuxData era))
forall s a. Decoder s a -> Decoder s (StrictMaybe a)
decodeNullStrictMaybe Decoder s (TxAuxData era)
forall s. Decoder s (TxAuxData era)
forall a s. DecCBOR a => Decoder s a
decCBOR)
  {-# INLINE decCBOR #-}

instance Era era => DecCBOR (AlonzoTxAuxDataRaw era) where
  decCBOR :: forall s. Decoder s (AlonzoTxAuxDataRaw era)
decCBOR =
    forall t s.
Decoder s t -> Decoder s t -> Decoder s t -> Decoder s t
decodeTxAuxDataByTokenType @(AlonzoTxAuxDataRaw era)
      Decoder s (AlonzoTxAuxDataRaw era)
forall s. Decoder s (AlonzoTxAuxDataRaw era)
decodeShelley
      Decoder s (AlonzoTxAuxDataRaw era)
forall s. Decoder s (AlonzoTxAuxDataRaw era)
decodeAllegra
      Decoder s (AlonzoTxAuxDataRaw era)
decodeAlonzo
    where
      decodeShelley :: Decoder s (AlonzoTxAuxDataRaw era)
decodeShelley =
        Decode Any (AlonzoTxAuxDataRaw era)
-> Decoder s (AlonzoTxAuxDataRaw era)
forall t (w :: Wrapped) s. Typeable t => Decode w t -> Decoder s t
decode
          ((Map Word64 Metadatum
 -> StrictSeq (Timelock era)
 -> Map Language (NonEmpty PlutusBinary)
 -> AlonzoTxAuxDataRaw era)
-> Decode
     Any
     (Map Word64 Metadatum
      -> StrictSeq (Timelock era)
      -> Map Language (NonEmpty PlutusBinary)
      -> AlonzoTxAuxDataRaw era)
forall t (w :: Wrapped). t -> Decode w t
Emit Map Word64 Metadatum
-> StrictSeq (Timelock era)
-> Map Language (NonEmpty PlutusBinary)
-> AlonzoTxAuxDataRaw era
forall era.
Map Word64 Metadatum
-> StrictSeq (Timelock era)
-> Map Language (NonEmpty PlutusBinary)
-> AlonzoTxAuxDataRaw era
AlonzoTxAuxDataRaw Decode
  Any
  (Map Word64 Metadatum
   -> StrictSeq (Timelock era)
   -> Map Language (NonEmpty PlutusBinary)
   -> AlonzoTxAuxDataRaw era)
-> Decode ('Closed Any) (Map Word64 Metadatum)
-> Decode
     Any
     (StrictSeq (Timelock era)
      -> Map Language (NonEmpty PlutusBinary) -> AlonzoTxAuxDataRaw era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode ('Closed w) a -> Decode w1 t
<! Decode ('Closed Any) (Map Word64 Metadatum)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From Decode
  Any
  (StrictSeq (Timelock era)
   -> Map Language (NonEmpty PlutusBinary) -> AlonzoTxAuxDataRaw era)
-> Decode ('Closed Any) (StrictSeq (Timelock era))
-> Decode
     Any
     (Map Language (NonEmpty PlutusBinary) -> AlonzoTxAuxDataRaw era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode ('Closed w) a -> Decode w1 t
<! StrictSeq (Timelock era)
-> Decode ('Closed Any) (StrictSeq (Timelock era))
forall t (w :: Wrapped). t -> Decode w t
Emit StrictSeq (Timelock era)
forall a. StrictSeq a
StrictSeq.empty Decode
  Any
  (Map Language (NonEmpty PlutusBinary) -> AlonzoTxAuxDataRaw era)
-> Decode ('Closed Any) (Map Language (NonEmpty PlutusBinary))
-> Decode Any (AlonzoTxAuxDataRaw era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode ('Closed w) a -> Decode w1 t
<! Map Language (NonEmpty PlutusBinary)
-> Decode ('Closed Any) (Map Language (NonEmpty PlutusBinary))
forall t (w :: Wrapped). t -> Decode w t
Emit Map Language (NonEmpty PlutusBinary)
forall k a. Map k a
Map.empty)
      decodeAllegra :: Decoder s (AlonzoTxAuxDataRaw era)
decodeAllegra =
        Decode ('Closed 'Dense) (AlonzoTxAuxDataRaw era)
-> Decoder s (AlonzoTxAuxDataRaw era)
forall t (w :: Wrapped) s. Typeable t => Decode w t -> Decoder s t
decode
          ((Map Word64 Metadatum
 -> StrictSeq (Timelock era)
 -> Map Language (NonEmpty PlutusBinary)
 -> AlonzoTxAuxDataRaw era)
-> Decode
     ('Closed 'Dense)
     (Map Word64 Metadatum
      -> StrictSeq (Timelock era)
      -> Map Language (NonEmpty PlutusBinary)
      -> AlonzoTxAuxDataRaw era)
forall t. t -> Decode ('Closed 'Dense) t
RecD Map Word64 Metadatum
-> StrictSeq (Timelock era)
-> Map Language (NonEmpty PlutusBinary)
-> AlonzoTxAuxDataRaw era
forall era.
Map Word64 Metadatum
-> StrictSeq (Timelock era)
-> Map Language (NonEmpty PlutusBinary)
-> AlonzoTxAuxDataRaw era
AlonzoTxAuxDataRaw Decode
  ('Closed 'Dense)
  (Map Word64 Metadatum
   -> StrictSeq (Timelock era)
   -> Map Language (NonEmpty PlutusBinary)
   -> AlonzoTxAuxDataRaw era)
-> Decode ('Closed Any) (Map Word64 Metadatum)
-> Decode
     ('Closed 'Dense)
     (StrictSeq (Timelock era)
      -> Map Language (NonEmpty PlutusBinary) -> AlonzoTxAuxDataRaw era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode ('Closed w) a -> Decode w1 t
<! Decode ('Closed Any) (Map Word64 Metadatum)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From Decode
  ('Closed 'Dense)
  (StrictSeq (Timelock era)
   -> Map Language (NonEmpty PlutusBinary) -> AlonzoTxAuxDataRaw era)
-> Decode ('Closed Any) (StrictSeq (Timelock era))
-> Decode
     ('Closed 'Dense)
     (Map Language (NonEmpty PlutusBinary) -> AlonzoTxAuxDataRaw era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode ('Closed w) a -> Decode w1 t
<! Decode ('Closed Any) (StrictSeq (Timelock era))
forall t (w :: Wrapped). DecCBOR t => Decode w t
From Decode
  ('Closed 'Dense)
  (Map Language (NonEmpty PlutusBinary) -> AlonzoTxAuxDataRaw era)
-> Decode ('Closed Any) (Map Language (NonEmpty PlutusBinary))
-> Decode ('Closed 'Dense) (AlonzoTxAuxDataRaw era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode ('Closed w) a -> Decode w1 t
<! Map Language (NonEmpty PlutusBinary)
-> Decode ('Closed Any) (Map Language (NonEmpty PlutusBinary))
forall t (w :: Wrapped). t -> Decode w t
Emit Map Language (NonEmpty PlutusBinary)
forall k a. Map k a
Map.empty)
      decodeAlonzo :: Decoder s (AlonzoTxAuxDataRaw era)
decodeAlonzo =
        Decode ('Closed 'Dense) (AlonzoTxAuxDataRaw era)
-> Decoder s (AlonzoTxAuxDataRaw era)
forall t (w :: Wrapped) s. Typeable t => Decode w t -> Decoder s t
decode (Decode ('Closed 'Dense) (AlonzoTxAuxDataRaw era)
 -> Decoder s (AlonzoTxAuxDataRaw era))
-> Decode ('Closed 'Dense) (AlonzoTxAuxDataRaw era)
-> Decoder s (AlonzoTxAuxDataRaw era)
forall a b. (a -> b) -> a -> b
$
          Word
-> Decode ('Closed 'Dense) (AlonzoTxAuxDataRaw era)
-> Decode ('Closed 'Dense) (AlonzoTxAuxDataRaw era)
forall (x :: Density) t.
Word -> Decode ('Closed x) t -> Decode ('Closed x) t
TagD Word
259 (Decode ('Closed 'Dense) (AlonzoTxAuxDataRaw era)
 -> Decode ('Closed 'Dense) (AlonzoTxAuxDataRaw era))
-> Decode ('Closed 'Dense) (AlonzoTxAuxDataRaw era)
-> Decode ('Closed 'Dense) (AlonzoTxAuxDataRaw era)
forall a b. (a -> b) -> a -> b
$
            String
-> AlonzoTxAuxDataRaw era
-> (Word -> Field (AlonzoTxAuxDataRaw era))
-> [(Word, String)]
-> Decode ('Closed 'Dense) (AlonzoTxAuxDataRaw era)
forall t.
Typeable t =>
String
-> t
-> (Word -> Field t)
-> [(Word, String)]
-> Decode ('Closed 'Dense) t
SparseKeyed String
"AlonzoTxAuxData" AlonzoTxAuxDataRaw era
forall era. AlonzoTxAuxDataRaw era
emptyAlonzoTxAuxDataRaw Word -> Field (AlonzoTxAuxDataRaw era)
auxDataField []

      auxDataField :: Word -> Field (AlonzoTxAuxDataRaw era)
      auxDataField :: Word -> Field (AlonzoTxAuxDataRaw era)
auxDataField Word
0 = (Map Word64 Metadatum
 -> AlonzoTxAuxDataRaw era -> AlonzoTxAuxDataRaw era)
-> Decode ('Closed Any) (Map Word64 Metadatum)
-> Field (AlonzoTxAuxDataRaw era)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Map Word64 Metadatum
x AlonzoTxAuxDataRaw era
ad -> AlonzoTxAuxDataRaw era
ad {atadrMetadata = x}) Decode ('Closed Any) (Map Word64 Metadatum)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
      auxDataField Word
1 = (StrictSeq (Timelock era)
 -> AlonzoTxAuxDataRaw era -> AlonzoTxAuxDataRaw era)
-> Decode ('Closed Any) (StrictSeq (Timelock era))
-> Field (AlonzoTxAuxDataRaw era)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\StrictSeq (Timelock era)
x AlonzoTxAuxDataRaw era
ad -> AlonzoTxAuxDataRaw era
ad {atadrTimelock = atadrTimelock ad <> x}) Decode ('Closed Any) (StrictSeq (Timelock era))
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
      auxDataField Word
2 = ([PlutusBinary]
 -> AlonzoTxAuxDataRaw era -> AlonzoTxAuxDataRaw era)
-> Decode ('Closed 'Dense) [PlutusBinary]
-> Field (AlonzoTxAuxDataRaw era)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (Language
-> [PlutusBinary]
-> AlonzoTxAuxDataRaw era
-> AlonzoTxAuxDataRaw era
forall era.
Language
-> [PlutusBinary]
-> AlonzoTxAuxDataRaw era
-> AlonzoTxAuxDataRaw era
addPlutusScripts Language
PlutusV1) ((forall s. Decoder s [PlutusBinary])
-> Decode ('Closed 'Dense) [PlutusBinary]
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (Language -> Decoder s ()
forall s. Language -> Decoder s ()
guardPlutus Language
PlutusV1 Decoder s ()
-> Decoder s [PlutusBinary] -> Decoder s [PlutusBinary]
forall a b. Decoder s a -> Decoder s b -> Decoder s b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Decoder s [PlutusBinary]
forall s. Decoder s [PlutusBinary]
forall a s. DecCBOR a => Decoder s a
decCBOR))
      auxDataField Word
3 = ([PlutusBinary]
 -> AlonzoTxAuxDataRaw era -> AlonzoTxAuxDataRaw era)
-> Decode ('Closed 'Dense) [PlutusBinary]
-> Field (AlonzoTxAuxDataRaw era)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (Language
-> [PlutusBinary]
-> AlonzoTxAuxDataRaw era
-> AlonzoTxAuxDataRaw era
forall era.
Language
-> [PlutusBinary]
-> AlonzoTxAuxDataRaw era
-> AlonzoTxAuxDataRaw era
addPlutusScripts Language
PlutusV2) ((forall s. Decoder s [PlutusBinary])
-> Decode ('Closed 'Dense) [PlutusBinary]
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (Language -> Decoder s ()
forall s. Language -> Decoder s ()
guardPlutus Language
PlutusV2 Decoder s ()
-> Decoder s [PlutusBinary] -> Decoder s [PlutusBinary]
forall a b. Decoder s a -> Decoder s b -> Decoder s b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Decoder s [PlutusBinary]
forall s. Decoder s [PlutusBinary]
forall a s. DecCBOR a => Decoder s a
decCBOR))
      auxDataField Word
4 = ([PlutusBinary]
 -> AlonzoTxAuxDataRaw era -> AlonzoTxAuxDataRaw era)
-> Decode ('Closed 'Dense) [PlutusBinary]
-> Field (AlonzoTxAuxDataRaw era)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (Language
-> [PlutusBinary]
-> AlonzoTxAuxDataRaw era
-> AlonzoTxAuxDataRaw era
forall era.
Language
-> [PlutusBinary]
-> AlonzoTxAuxDataRaw era
-> AlonzoTxAuxDataRaw era
addPlutusScripts Language
PlutusV3) ((forall s. Decoder s [PlutusBinary])
-> Decode ('Closed 'Dense) [PlutusBinary]
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (Language -> Decoder s ()
forall s. Language -> Decoder s ()
guardPlutus Language
PlutusV3 Decoder s ()
-> Decoder s [PlutusBinary] -> Decoder s [PlutusBinary]
forall a b. Decoder s a -> Decoder s b -> Decoder s b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Decoder s [PlutusBinary]
forall s. Decoder s [PlutusBinary]
forall a s. DecCBOR a => Decoder s a
decCBOR))
      auxDataField Word
n = Word -> Field (AlonzoTxAuxDataRaw era)
forall t. Word -> Field t
invalidField Word
n

deriving newtype instance Era era => DecCBOR (AlonzoTxAuxData era)

instance (AlonzoEraScript era, DecCBOR (NativeScript era)) => DecCBOR (AlonzoTxWitsRaw era) where
  decCBOR :: forall s. Decoder s (AlonzoTxWitsRaw era)
decCBOR =
    Decode ('Closed 'Dense) (AlonzoTxWitsRaw era)
-> Decoder s (AlonzoTxWitsRaw era)
forall t (w :: Wrapped) s. Typeable t => Decode w t -> Decoder s t
decode (Decode ('Closed 'Dense) (AlonzoTxWitsRaw era)
 -> Decoder s (AlonzoTxWitsRaw era))
-> Decode ('Closed 'Dense) (AlonzoTxWitsRaw era)
-> Decoder s (AlonzoTxWitsRaw era)
forall a b. (a -> b) -> a -> b
$
      String
-> AlonzoTxWitsRaw era
-> (Word -> Field (AlonzoTxWitsRaw era))
-> [(Word, String)]
-> Decode ('Closed 'Dense) (AlonzoTxWitsRaw era)
forall t.
Typeable t =>
String
-> t
-> (Word -> Field t)
-> [(Word, String)]
-> Decode ('Closed 'Dense) t
SparseKeyed
        String
"AlonzoTxWits"
        AlonzoTxWitsRaw era
forall era. AlonzoEraScript era => AlonzoTxWitsRaw era
emptyTxWitsRaw
        Word -> Field (AlonzoTxWitsRaw era)
txWitnessField
        []
    where
      txWitnessField :: Word -> Field (AlonzoTxWitsRaw era)
      txWitnessField :: Word -> Field (AlonzoTxWitsRaw era)
txWitnessField Word
0 =
        (Set (WitVKey 'Witness)
 -> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era)
-> Decode ('Closed 'Dense) (Set (WitVKey 'Witness))
-> Field (AlonzoTxWitsRaw era)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field
          (\Set (WitVKey 'Witness)
x AlonzoTxWitsRaw era
wits -> AlonzoTxWitsRaw era
wits {atwrAddrTxWits = x})
          ( (forall s. Decoder s (Set (WitVKey 'Witness)))
-> Decode ('Closed 'Dense) (Set (WitVKey 'Witness))
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D ((forall s. Decoder s (Set (WitVKey 'Witness)))
 -> Decode ('Closed 'Dense) (Set (WitVKey 'Witness)))
-> (forall s. Decoder s (Set (WitVKey 'Witness)))
-> Decode ('Closed 'Dense) (Set (WitVKey 'Witness))
forall a b. (a -> b) -> a -> b
$
              Version
-> Decoder s (Set (WitVKey 'Witness))
-> Decoder s (Set (WitVKey 'Witness))
-> Decoder s (Set (WitVKey 'Witness))
forall s a. Version -> Decoder s a -> Decoder s a -> Decoder s a
ifDecoderVersionAtLeast
                (forall (v :: Nat).
(KnownNat v, MinVersion <= v, v <= MaxVersion) =>
Version
natVersion @9)
                ( Word -> Decoder s ()
forall s. Word -> Decoder s ()
allowTag Word
setTag
                    Decoder s ()
-> Decoder s (Set (WitVKey 'Witness))
-> Decoder s (Set (WitVKey 'Witness))
forall a b. Decoder s a -> Decoder s b -> Decoder s b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [WitVKey 'Witness] -> Set (WitVKey 'Witness)
forall a. Ord a => [a] -> Set a
Set.fromList ([WitVKey 'Witness] -> Set (WitVKey 'Witness))
-> (NonEmpty (WitVKey 'Witness) -> [WitVKey 'Witness])
-> NonEmpty (WitVKey 'Witness)
-> Set (WitVKey 'Witness)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty (WitVKey 'Witness) -> [WitVKey 'Witness]
forall a. NonEmpty a -> [a]
NE.toList (NonEmpty (WitVKey 'Witness) -> Set (WitVKey 'Witness))
-> Decoder s (NonEmpty (WitVKey 'Witness))
-> Decoder s (Set (WitVKey 'Witness))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (WitVKey 'Witness)
-> Decoder s (NonEmpty (WitVKey 'Witness))
forall s a. Decoder s a -> Decoder s (NonEmpty a)
decodeNonEmptyList Decoder s (WitVKey 'Witness)
forall s. Decoder s (WitVKey 'Witness)
forall a s. DecCBOR a => Decoder s a
decCBOR
                )
                ([WitVKey 'Witness] -> Set (WitVKey 'Witness)
forall a. Ord a => [a] -> Set a
Set.fromList ([WitVKey 'Witness] -> Set (WitVKey 'Witness))
-> Decoder s [WitVKey 'Witness]
-> Decoder s (Set (WitVKey 'Witness))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (WitVKey 'Witness) -> Decoder s [WitVKey 'Witness]
forall s a. Decoder s a -> Decoder s [a]
decodeList Decoder s (WitVKey 'Witness)
forall s. Decoder s (WitVKey 'Witness)
forall a s. DecCBOR a => Decoder s a
decCBOR)
          )
      txWitnessField Word
1 = (Map ScriptHash (Script era)
 -> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era)
-> Decode ('Closed 'Dense) (Map ScriptHash (Script era))
-> Field (AlonzoTxWitsRaw era)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field Map ScriptHash (Script era)
-> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era
forall era.
Map ScriptHash (Script era)
-> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era
addScriptsTxWitsRaw ((forall s. Decoder s (Map ScriptHash (Script era)))
-> Decode ('Closed 'Dense) (Map ScriptHash (Script era))
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D Decoder s (Map ScriptHash (Script era))
forall s. Decoder s (Map ScriptHash (Script era))
nativeScriptsDecoder)
      txWitnessField Word
2 =
        (Set BootstrapWitness
 -> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era)
-> Decode ('Closed 'Dense) (Set BootstrapWitness)
-> Field (AlonzoTxWitsRaw era)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field
          (\Set BootstrapWitness
x AlonzoTxWitsRaw era
wits -> AlonzoTxWitsRaw era
wits {atwrBootAddrTxWits = x})
          ( (forall s. Decoder s (Set BootstrapWitness))
-> Decode ('Closed 'Dense) (Set BootstrapWitness)
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D ((forall s. Decoder s (Set BootstrapWitness))
 -> Decode ('Closed 'Dense) (Set BootstrapWitness))
-> (forall s. Decoder s (Set BootstrapWitness))
-> Decode ('Closed 'Dense) (Set BootstrapWitness)
forall a b. (a -> b) -> a -> b
$
              Version
-> Decoder s (Set BootstrapWitness)
-> Decoder s (Set BootstrapWitness)
-> Decoder s (Set BootstrapWitness)
forall s a. Version -> Decoder s a -> Decoder s a -> Decoder s a
ifDecoderVersionAtLeast
                (forall (v :: Nat).
(KnownNat v, MinVersion <= v, v <= MaxVersion) =>
Version
natVersion @9)
                ( Word -> Decoder s ()
forall s. Word -> Decoder s ()
allowTag Word
setTag
                    Decoder s ()
-> Decoder s (Set BootstrapWitness)
-> Decoder s (Set BootstrapWitness)
forall a b. Decoder s a -> Decoder s b -> Decoder s b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [BootstrapWitness] -> Set BootstrapWitness
forall a. Ord a => [a] -> Set a
Set.fromList ([BootstrapWitness] -> Set BootstrapWitness)
-> (NonEmpty BootstrapWitness -> [BootstrapWitness])
-> NonEmpty BootstrapWitness
-> Set BootstrapWitness
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty BootstrapWitness -> [BootstrapWitness]
forall a. NonEmpty a -> [a]
NE.toList (NonEmpty BootstrapWitness -> Set BootstrapWitness)
-> Decoder s (NonEmpty BootstrapWitness)
-> Decoder s (Set BootstrapWitness)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s BootstrapWitness -> Decoder s (NonEmpty BootstrapWitness)
forall s a. Decoder s a -> Decoder s (NonEmpty a)
decodeNonEmptyList Decoder s BootstrapWitness
forall s. Decoder s BootstrapWitness
forall a s. DecCBOR a => Decoder s a
decCBOR
                )
                ([BootstrapWitness] -> Set BootstrapWitness
forall a. Ord a => [a] -> Set a
Set.fromList ([BootstrapWitness] -> Set BootstrapWitness)
-> Decoder s [BootstrapWitness] -> Decoder s (Set BootstrapWitness)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s BootstrapWitness -> Decoder s [BootstrapWitness]
forall s a. Decoder s a -> Decoder s [a]
decodeList Decoder s BootstrapWitness
forall s. Decoder s BootstrapWitness
forall a s. DecCBOR a => Decoder s a
decCBOR)
          )
      txWitnessField Word
3 = (Map ScriptHash (Script era)
 -> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era)
-> Decode ('Closed 'Dense) (Map ScriptHash (Script era))
-> Field (AlonzoTxWitsRaw era)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field Map ScriptHash (Script era)
-> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era
forall era.
Map ScriptHash (Script era)
-> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era
addScriptsTxWitsRaw (SLanguage 'PlutusV1
-> Decode ('Closed 'Dense) (Map ScriptHash (Script era))
forall era (l :: Language).
(AlonzoEraScript era, PlutusLanguage l) =>
SLanguage l
-> Decode ('Closed 'Dense) (Map ScriptHash (Script era))
decodeAlonzoPlutusScript SLanguage 'PlutusV1
SPlutusV1)
      txWitnessField Word
4 = (TxDats era -> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era)
-> Decode ('Closed Any) (TxDats era) -> Field (AlonzoTxWitsRaw era)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\TxDats era
x AlonzoTxWitsRaw era
wits -> AlonzoTxWitsRaw era
wits {atwrDatsTxWits = x}) Decode ('Closed Any) (TxDats era)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
      txWitnessField Word
5 = (Redeemers era -> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era)
-> Decode ('Closed Any) (Redeemers era)
-> Field (AlonzoTxWitsRaw era)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Redeemers era
x AlonzoTxWitsRaw era
wits -> AlonzoTxWitsRaw era
wits {atwrRdmrsTxWits = x}) Decode ('Closed Any) (Redeemers era)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
      txWitnessField Word
6 = (Map ScriptHash (Script era)
 -> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era)
-> Decode ('Closed 'Dense) (Map ScriptHash (Script era))
-> Field (AlonzoTxWitsRaw era)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field Map ScriptHash (Script era)
-> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era
forall era.
Map ScriptHash (Script era)
-> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era
addScriptsTxWitsRaw (SLanguage 'PlutusV2
-> Decode ('Closed 'Dense) (Map ScriptHash (Script era))
forall era (l :: Language).
(AlonzoEraScript era, PlutusLanguage l) =>
SLanguage l
-> Decode ('Closed 'Dense) (Map ScriptHash (Script era))
decodeAlonzoPlutusScript SLanguage 'PlutusV2
SPlutusV2)
      txWitnessField Word
7 = (Map ScriptHash (Script era)
 -> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era)
-> Decode ('Closed 'Dense) (Map ScriptHash (Script era))
-> Field (AlonzoTxWitsRaw era)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field Map ScriptHash (Script era)
-> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era
forall era.
Map ScriptHash (Script era)
-> AlonzoTxWitsRaw era -> AlonzoTxWitsRaw era
addScriptsTxWitsRaw (SLanguage 'PlutusV3
-> Decode ('Closed 'Dense) (Map ScriptHash (Script era))
forall era (l :: Language).
(AlonzoEraScript era, PlutusLanguage l) =>
SLanguage l
-> Decode ('Closed 'Dense) (Map ScriptHash (Script era))
decodeAlonzoPlutusScript SLanguage 'PlutusV3
SPlutusV3)
      txWitnessField Word
n = Word -> Field (AlonzoTxWitsRaw era)
forall t. Word -> Field t
invalidField Word
n
      {-# INLINE txWitnessField #-}

      nativeScriptsDecoder :: Decoder s (Map ScriptHash (Script era))
      nativeScriptsDecoder :: forall s. Decoder s (Map ScriptHash (Script era))
nativeScriptsDecoder =
        Version
-> Decoder s (Map ScriptHash (Script era))
-> Decoder s (Map ScriptHash (Script era))
-> Decoder s (Map ScriptHash (Script era))
forall s a. Version -> Decoder s a -> Decoder s a -> Decoder s a
ifDecoderVersionAtLeast
          (forall (v :: Nat).
(KnownNat v, MinVersion <= v, v <= MaxVersion) =>
Version
natVersion @9)
          ( Word -> Decoder s ()
forall s. Word -> Decoder s ()
allowTag Word
setTag
              Decoder s ()
-> Decoder s (Map ScriptHash (Script era))
-> Decoder s (Map ScriptHash (Script era))
forall a b. Decoder s a -> Decoder s b -> Decoder s b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [(ScriptHash, Script era)] -> Map ScriptHash (Script era)
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(ScriptHash, Script era)] -> Map ScriptHash (Script era))
-> (NonEmpty (ScriptHash, Script era)
    -> [(ScriptHash, Script era)])
-> NonEmpty (ScriptHash, Script era)
-> Map ScriptHash (Script era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty (ScriptHash, Script era) -> [(ScriptHash, Script era)]
forall a. NonEmpty a -> [a]
NE.toList (NonEmpty (ScriptHash, Script era) -> Map ScriptHash (Script era))
-> Decoder s (NonEmpty (ScriptHash, Script era))
-> Decoder s (Map ScriptHash (Script era))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (ScriptHash, Script era)
-> Decoder s (NonEmpty (ScriptHash, Script era))
forall s a. Decoder s a -> Decoder s (NonEmpty a)
decodeNonEmptyList Decoder s (ScriptHash, Script era)
forall s. Decoder s (ScriptHash, Script era)
pairDecoder
          )
          ([(ScriptHash, Script era)] -> Map ScriptHash (Script era)
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(ScriptHash, Script era)] -> Map ScriptHash (Script era))
-> Decoder s [(ScriptHash, Script era)]
-> Decoder s (Map ScriptHash (Script era))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (ScriptHash, Script era)
-> Decoder s [(ScriptHash, Script era)]
forall s a. Decoder s a -> Decoder s [a]
decodeList Decoder s (ScriptHash, Script era)
forall s. Decoder s (ScriptHash, Script era)
pairDecoder)
        where
          pairDecoder :: Decoder s (ScriptHash, Script era)
          pairDecoder :: forall s. Decoder s (ScriptHash, Script era)
pairDecoder = forall era. EraScript era => Script era -> (ScriptHash, Script era)
asHashedScriptPair @era (Script era -> (ScriptHash, Script era))
-> (NativeScript era -> Script era)
-> NativeScript era
-> (ScriptHash, Script era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NativeScript era -> Script era
forall era. EraScript era => NativeScript era -> Script era
fromNativeScript (NativeScript era -> (ScriptHash, Script era))
-> Decoder s (NativeScript era)
-> Decoder s (ScriptHash, Script era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (NativeScript era)
forall s. Decoder s (NativeScript era)
forall a s. DecCBOR a => Decoder s a
decCBOR
          {-# INLINE pairDecoder #-}
      {-# INLINE nativeScriptsDecoder #-}

deriving newtype instance
  (AlonzoEraScript era, DecCBOR (NativeScript era)) =>
  DecCBOR (AlonzoTxWits era)

instance AlonzoEraScript era => DecCBOR (RedeemersRaw era) where
  decCBOR :: forall s. Decoder s (RedeemersRaw era)
decCBOR =
    Version
-> Decoder s (RedeemersRaw era)
-> Decoder s (RedeemersRaw era)
-> Decoder s (RedeemersRaw era)
forall s a. Version -> Decoder s a -> Decoder s a -> Decoder s a
ifDecoderVersionAtLeast
      (forall (v :: Nat).
(KnownNat v, MinVersion <= v, v <= MaxVersion) =>
Version
natVersion @9)
      ( Decoder s TokenType
forall s. Decoder s TokenType
peekTokenType Decoder s TokenType
-> (TokenType -> Decoder s (RedeemersRaw era))
-> Decoder s (RedeemersRaw era)
forall a b. Decoder s a -> (a -> Decoder s b) -> Decoder s b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
          TokenType
TypeMapLenIndef -> Decoder s (RedeemersRaw era)
forall s. Decoder s (RedeemersRaw era)
decodeMapRedeemers
          TokenType
TypeMapLen -> Decoder s (RedeemersRaw era)
forall s. Decoder s (RedeemersRaw era)
decodeMapRedeemers
          TokenType
_ -> Decoder s (RedeemersRaw era)
forall s. Decoder s (RedeemersRaw era)
decodeListRedeemers
      )
      (Map (PlutusPurpose AsIx era) (Data era, ExUnits)
-> RedeemersRaw era
forall era.
Map (PlutusPurpose AsIx era) (Data era, ExUnits)
-> RedeemersRaw era
RedeemersRaw (Map (PlutusPurpose AsIx era) (Data era, ExUnits)
 -> RedeemersRaw era)
-> ([(PlutusPurpose AsIx era, (Data era, ExUnits))]
    -> Map (PlutusPurpose AsIx era) (Data era, ExUnits))
-> [(PlutusPurpose AsIx era, (Data era, ExUnits))]
-> RedeemersRaw era
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(PlutusPurpose AsIx era, (Data era, ExUnits))]
-> Map (PlutusPurpose AsIx era) (Data era, ExUnits)
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(PlutusPurpose AsIx era, (Data era, ExUnits))]
 -> RedeemersRaw era)
-> Decoder s [(PlutusPurpose AsIx era, (Data era, ExUnits))]
-> Decoder s (RedeemersRaw era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits))
-> Decoder s [(PlutusPurpose AsIx era, (Data era, ExUnits))]
forall s a. Decoder s a -> Decoder s [a]
decodeList Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits))
forall s. Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits))
decodeElement)
    where
      decodeMapRedeemers :: Decoder s (RedeemersRaw era)
      decodeMapRedeemers :: forall s. Decoder s (RedeemersRaw era)
decodeMapRedeemers =
        Map (PlutusPurpose AsIx era) (Data era, ExUnits)
-> RedeemersRaw era
forall era.
Map (PlutusPurpose AsIx era) (Data era, ExUnits)
-> RedeemersRaw era
RedeemersRaw (Map (PlutusPurpose AsIx era) (Data era, ExUnits)
 -> RedeemersRaw era)
-> (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
    -> Map (PlutusPurpose AsIx era) (Data era, ExUnits))
-> NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
-> RedeemersRaw era
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(PlutusPurpose AsIx era, (Data era, ExUnits))]
-> Map (PlutusPurpose AsIx era) (Data era, ExUnits)
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(PlutusPurpose AsIx era, (Data era, ExUnits))]
 -> Map (PlutusPurpose AsIx era) (Data era, ExUnits))
-> (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
    -> [(PlutusPurpose AsIx era, (Data era, ExUnits))])
-> NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
-> Map (PlutusPurpose AsIx era) (Data era, ExUnits)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
-> [(PlutusPurpose AsIx era, (Data era, ExUnits))]
forall a. NonEmpty a -> [a]
NE.toList (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
 -> RedeemersRaw era)
-> Decoder
     s (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits)))
-> Decoder s (RedeemersRaw era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> do
          (Int
_, [(PlutusPurpose AsIx era, (Data era, ExUnits))]
xs) <- Decoder s (Maybe Int)
-> ((PlutusPurpose AsIx era, (Data era, ExUnits))
    -> [(PlutusPurpose AsIx era, (Data era, ExUnits))]
    -> [(PlutusPurpose AsIx era, (Data era, ExUnits))])
-> ([(PlutusPurpose AsIx era, (Data era, ExUnits))]
    -> Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits)))
-> Decoder s (Int, [(PlutusPurpose AsIx era, (Data era, ExUnits))])
forall s a b.
Monoid b =>
Decoder s (Maybe Int)
-> (a -> b -> b) -> (b -> Decoder s a) -> Decoder s (Int, b)
decodeListLikeWithCount Decoder s (Maybe Int)
forall s. Decoder s (Maybe Int)
decodeMapLenOrIndef (:) (([(PlutusPurpose AsIx era, (Data era, ExUnits))]
  -> Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits)))
 -> Decoder
      s (Int, [(PlutusPurpose AsIx era, (Data era, ExUnits))]))
-> ([(PlutusPurpose AsIx era, (Data era, ExUnits))]
    -> Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits)))
-> Decoder s (Int, [(PlutusPurpose AsIx era, (Data era, ExUnits))])
forall a b. (a -> b) -> a -> b
$ \[(PlutusPurpose AsIx era, (Data era, ExUnits))]
_ -> do
            PlutusPurpose AsIx era
ptr <- Decoder s (PlutusPurpose AsIx era)
forall s. Decoder s (PlutusPurpose AsIx era)
forall a s. DecCBOR a => Decoder s a
decCBOR
            (Data era
annData, ExUnits
exUnits) <- Decoder s (Data era, ExUnits)
forall s. Decoder s (Data era, ExUnits)
forall a s. DecCBOR a => Decoder s a
decCBOR
            (PlutusPurpose AsIx era, (Data era, ExUnits))
-> Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits))
forall a. a -> Decoder s a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PlutusPurpose AsIx era
ptr, (Data era
annData, ExUnits
exUnits))
          case [(PlutusPurpose AsIx era, (Data era, ExUnits))]
-> Maybe (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits)))
forall a. [a] -> Maybe (NonEmpty a)
NE.nonEmpty [(PlutusPurpose AsIx era, (Data era, ExUnits))]
xs of
            Maybe (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits)))
Nothing -> String
-> Decoder
     s (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits)))
forall a. String -> Decoder s a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Expected redeemers map to be non-empty"
            Just NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
neList -> NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
-> Decoder
     s (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits)))
forall a. a -> Decoder s a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
 -> Decoder
      s (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))))
-> NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
-> Decoder
     s (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits)))
forall a b. (a -> b) -> a -> b
$ NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
-> NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
forall a. NonEmpty a -> NonEmpty a
NE.reverse NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
neList
      {-# INLINE decodeMapRedeemers #-}
      decodeListRedeemers :: Decoder s (RedeemersRaw era)
      decodeListRedeemers :: forall s. Decoder s (RedeemersRaw era)
decodeListRedeemers =
        Map (PlutusPurpose AsIx era) (Data era, ExUnits)
-> RedeemersRaw era
forall era.
Map (PlutusPurpose AsIx era) (Data era, ExUnits)
-> RedeemersRaw era
RedeemersRaw (Map (PlutusPurpose AsIx era) (Data era, ExUnits)
 -> RedeemersRaw era)
-> (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
    -> Map (PlutusPurpose AsIx era) (Data era, ExUnits))
-> NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
-> RedeemersRaw era
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(PlutusPurpose AsIx era, (Data era, ExUnits))]
-> Map (PlutusPurpose AsIx era) (Data era, ExUnits)
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(PlutusPurpose AsIx era, (Data era, ExUnits))]
 -> Map (PlutusPurpose AsIx era) (Data era, ExUnits))
-> (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
    -> [(PlutusPurpose AsIx era, (Data era, ExUnits))])
-> NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
-> Map (PlutusPurpose AsIx era) (Data era, ExUnits)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
-> [(PlutusPurpose AsIx era, (Data era, ExUnits))]
forall a. NonEmpty a -> [a]
NE.toList
          (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits))
 -> RedeemersRaw era)
-> Decoder
     s (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits)))
-> Decoder s (RedeemersRaw era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits))
-> Decoder
     s (NonEmpty (PlutusPurpose AsIx era, (Data era, ExUnits)))
forall s a. Decoder s a -> Decoder s (NonEmpty a)
decodeNonEmptyList Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits))
forall s. Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits))
decodeElement
      {-# INLINE decodeListRedeemers #-}
      decodeElement :: Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits))
      decodeElement :: forall s. Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits))
decodeElement = do
        Text
-> ((PlutusPurpose AsIx era, (Data era, ExUnits)) -> Int)
-> Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits))
-> Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits))
forall a s. Text -> (a -> Int) -> Decoder s a -> Decoder s a
decodeRecordNamed Text
"Redeemer" (\(PlutusPurpose AsIx era
redeemerPtr, (Data era, ExUnits)
_) -> Word -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (PlutusPurpose AsIx era -> Word
forall a. EncCBORGroup a => a -> Word
listLen PlutusPurpose AsIx era
redeemerPtr) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
2) (Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits))
 -> Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits)))
-> Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits))
-> Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits))
forall a b. (a -> b) -> a -> b
$ do
          !PlutusPurpose AsIx era
redeemerPtr <- Decoder s (PlutusPurpose AsIx era)
forall s. Decoder s (PlutusPurpose AsIx era)
forall a s. DecCBORGroup a => Decoder s a
decCBORGroup
          !Data era
redeemerData <- Decoder s (Data era)
forall s. Decoder s (Data era)
forall a s. DecCBOR a => Decoder s a
decCBOR
          !ExUnits
redeemerExUnits <- Decoder s ExUnits
forall s. Decoder s ExUnits
forall a s. DecCBOR a => Decoder s a
decCBOR
          (PlutusPurpose AsIx era, (Data era, ExUnits))
-> Decoder s (PlutusPurpose AsIx era, (Data era, ExUnits))
forall a. a -> Decoder s a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PlutusPurpose AsIx era
redeemerPtr, (Data era
redeemerData, ExUnits
redeemerExUnits))
      {-# INLINE decodeElement #-}
  {-# INLINE decCBOR #-}

deriving newtype instance AlonzoEraScript era => DecCBOR (Redeemers era)

instance AlonzoEraScript era => DecCBOR (AlonzoScript era) where
  decCBOR :: forall s. Decoder s (AlonzoScript era)
decCBOR = Decode ('Closed 'Dense) (AlonzoScript era)
-> Decoder s (AlonzoScript era)
forall t (w :: Wrapped) s. Typeable t => Decode w t -> Decoder s t
decode (Text
-> (Word -> Decode 'Open (AlonzoScript era))
-> Decode ('Closed 'Dense) (AlonzoScript era)
forall t.
Text -> (Word -> Decode 'Open t) -> Decode ('Closed 'Dense) t
Summands Text
"AlonzoScript" Word -> Decode 'Open (AlonzoScript era)
decodeScript)
    where
      decodeScript :: Word -> Decode 'Open (AlonzoScript era)
decodeScript = \case
        Word
0 -> (Timelock era -> AlonzoScript era)
-> Decode 'Open (Timelock era -> AlonzoScript era)
forall t. t -> Decode 'Open t
SumD Timelock era -> AlonzoScript era
forall era. Timelock era -> AlonzoScript era
TimelockScript Decode 'Open (Timelock era -> AlonzoScript era)
-> Decode ('Closed Any) (Timelock era)
-> Decode 'Open (AlonzoScript era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode ('Closed w) a -> Decode w1 t
<! Decode ('Closed Any) (Timelock era)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
1 -> SLanguage 'PlutusV1 -> Decode 'Open (AlonzoScript era)
forall {era} {l :: Language}.
(Assert
   (OrdCond
      (CmpNat (ProtVerLow era) (ProtVerHigh era)) 'True 'True 'False)
   (TypeError ...),
 Assert
   (OrdCond (CmpNat MinVersion (ProtVerLow era)) 'True 'True 'False)
   (TypeError ...),
 Assert
   (OrdCond (CmpNat MinVersion (ProtVerHigh era)) 'True 'True 'False)
   (TypeError ...),
 AlonzoEraScript era, PlutusLanguage l) =>
SLanguage l -> Decode 'Open (AlonzoScript era)
decodePlutus SLanguage 'PlutusV1
SPlutusV1
        Word
2 -> SLanguage 'PlutusV2 -> Decode 'Open (AlonzoScript era)
forall {era} {l :: Language}.
(Assert
   (OrdCond
      (CmpNat (ProtVerLow era) (ProtVerHigh era)) 'True 'True 'False)
   (TypeError ...),
 Assert
   (OrdCond (CmpNat MinVersion (ProtVerLow era)) 'True 'True 'False)
   (TypeError ...),
 Assert
   (OrdCond (CmpNat MinVersion (ProtVerHigh era)) 'True 'True 'False)
   (TypeError ...),
 AlonzoEraScript era, PlutusLanguage l) =>
SLanguage l -> Decode 'Open (AlonzoScript era)
decodePlutus SLanguage 'PlutusV2
SPlutusV2
        Word
3 -> SLanguage 'PlutusV3 -> Decode 'Open (AlonzoScript era)
forall {era} {l :: Language}.
(Assert
   (OrdCond
      (CmpNat (ProtVerLow era) (ProtVerHigh era)) 'True 'True 'False)
   (TypeError ...),
 Assert
   (OrdCond (CmpNat MinVersion (ProtVerLow era)) 'True 'True 'False)
   (TypeError ...),
 Assert
   (OrdCond (CmpNat MinVersion (ProtVerHigh era)) 'True 'True 'False)
   (TypeError ...),
 AlonzoEraScript era, PlutusLanguage l) =>
SLanguage l -> Decode 'Open (AlonzoScript era)
decodePlutus SLanguage 'PlutusV3
SPlutusV3
        Word
n -> Word -> Decode 'Open (AlonzoScript era)
forall (w :: Wrapped) t. Word -> Decode w t
Invalid Word
n
      decodePlutus :: SLanguage l -> Decode 'Open (AlonzoScript era)
decodePlutus SLanguage l
slang =
        (PlutusScript era -> AlonzoScript era)
-> Decode 'Open (PlutusScript era -> AlonzoScript era)
forall t. t -> Decode 'Open t
SumD PlutusScript era -> AlonzoScript era
forall era. PlutusScript era -> AlonzoScript era
PlutusScript Decode 'Open (PlutusScript era -> AlonzoScript era)
-> Decode ('Closed 'Dense) (PlutusScript era)
-> Decode 'Open (AlonzoScript era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode ('Closed w) a -> Decode w1 t
<! (forall s. Decoder s (PlutusScript era))
-> Decode ('Closed 'Dense) (PlutusScript era)
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (SLanguage l -> Decoder s (PlutusScript era)
forall era (l :: Language) s.
(AlonzoEraScript era, PlutusLanguage l) =>
SLanguage l -> Decoder s (PlutusScript era)
decodePlutusScript SLanguage l
slang)

instance Era era => DecCBOR (TxDatsRaw era) where
  decCBOR :: forall s. Decoder s (TxDatsRaw era)
decCBOR =
    Version
-> Decoder s (TxDatsRaw era)
-> Decoder s (TxDatsRaw era)
-> Decoder s (TxDatsRaw era)
forall s a. Version -> Decoder s a -> Decoder s a -> Decoder s a
ifDecoderVersionAtLeast
      (forall (v :: Nat).
(KnownNat v, MinVersion <= v, v <= MaxVersion) =>
Version
natVersion @9)
      ( Word -> Decoder s ()
forall s. Word -> Decoder s ()
allowTag Word
setTag
          Decoder s ()
-> Decoder s (TxDatsRaw era) -> Decoder s (TxDatsRaw era)
forall a b. Decoder s a -> Decoder s b -> Decoder s b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Map DataHash (Data era) -> TxDatsRaw era
forall era. Map DataHash (Data era) -> TxDatsRaw era
TxDatsRaw (Map DataHash (Data era) -> TxDatsRaw era)
-> (NonEmpty (Data era) -> Map DataHash (Data era))
-> NonEmpty (Data era)
-> TxDatsRaw era
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Data era -> DataHash) -> [Data era] -> Map DataHash (Data era)
forall (f :: * -> *) k v.
(Foldable f, Ord k) =>
(v -> k) -> f v -> Map k v
Map.fromElems Data era -> DataHash
forall era. Data era -> DataHash
hashData ([Data era] -> Map DataHash (Data era))
-> (NonEmpty (Data era) -> [Data era])
-> NonEmpty (Data era)
-> Map DataHash (Data era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty (Data era) -> [Data era]
forall a. NonEmpty a -> [a]
NE.toList (NonEmpty (Data era) -> TxDatsRaw era)
-> Decoder s (NonEmpty (Data era)) -> Decoder s (TxDatsRaw era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (Data era) -> Decoder s (NonEmpty (Data era))
forall s a. Decoder s a -> Decoder s (NonEmpty a)
decodeNonEmptyList Decoder s (Data era)
forall s. Decoder s (Data era)
forall a s. DecCBOR a => Decoder s a
decCBOR
      )
      (Map DataHash (Data era) -> TxDatsRaw era
forall era. Map DataHash (Data era) -> TxDatsRaw era
TxDatsRaw (Map DataHash (Data era) -> TxDatsRaw era)
-> ([Data era] -> Map DataHash (Data era))
-> [Data era]
-> TxDatsRaw era
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Data era -> DataHash) -> [Data era] -> Map DataHash (Data era)
forall (f :: * -> *) k v.
(Foldable f, Ord k) =>
(v -> k) -> f v -> Map k v
Map.fromElems Data era -> DataHash
forall era. Data era -> DataHash
hashData ([Data era] -> TxDatsRaw era)
-> Decoder s [Data era] -> Decoder s (TxDatsRaw era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (Data era) -> Decoder s [Data era]
forall s a. Decoder s a -> Decoder s [a]
decodeList Decoder s (Data era)
forall s. Decoder s (Data era)
forall a s. DecCBOR a => Decoder s a
decCBOR)
  {-# INLINE decCBOR #-}

deriving newtype instance Era era => DecCBOR (TxDats era)