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

module Test.Cardano.Ledger.Dijkstra.Binary.Annotator (

) where

import Cardano.Ledger.Address (Withdrawals (..))
import Cardano.Ledger.Allegra.Scripts (invalidBeforeL, invalidHereAfterL)
import Cardano.Ledger.Alonzo.Tx (IsValid (..))
import Cardano.Ledger.BaseTypes
import Cardano.Ledger.Binary
import Cardano.Ledger.Binary.Coders
import Cardano.Ledger.Coin (decodePositiveCoin)
import Cardano.Ledger.Conway.Governance (
  VotingProcedures (..),
 )
import Cardano.Ledger.Core
import Cardano.Ledger.Dijkstra (DijkstraEra)
import Cardano.Ledger.Dijkstra.Scripts
import Cardano.Ledger.Dijkstra.Tx (DijkstraTx (..), Tx (..))
import Cardano.Ledger.Dijkstra.TxBody
import Cardano.Ledger.MemoBytes (decodeMemoized)
import Cardano.Ledger.Val (Val (..))
import qualified Data.Map.Strict as Map
import qualified Data.OMap.Strict as OMap
import qualified Data.OSet.Strict as OSet
import Data.Typeable (Typeable)
import Lens.Micro
import Test.Cardano.Ledger.Conway.Binary.Annotator ()

deriving newtype instance Typeable l => DecCBOR (TxBody l DijkstraEra)

instance Typeable l => DecCBOR (DijkstraTxBodyRaw l DijkstraEra) where
  decCBOR :: forall s. Decoder s (DijkstraTxBodyRaw l DijkstraEra)
decCBOR = forall (l :: TxLevel) era a.
(Typeable l, HasCallStack) =>
(STxBothLevels l era -> a) -> a
withSTxBothLevels @l ((STxBothLevels l DijkstraEra
  -> Decoder s (DijkstraTxBodyRaw l DijkstraEra))
 -> Decoder s (DijkstraTxBodyRaw l DijkstraEra))
-> (STxBothLevels l DijkstraEra
    -> Decoder s (DijkstraTxBodyRaw l DijkstraEra))
-> Decoder s (DijkstraTxBodyRaw l DijkstraEra)
forall a b. (a -> b) -> a -> b
$ \STxBothLevels l DijkstraEra
sTxLevel ->
    Decode (Closed Dense) (DijkstraTxBodyRaw l DijkstraEra)
-> Decoder s (DijkstraTxBodyRaw l DijkstraEra)
forall t (w :: Wrapped) s. Typeable t => Decode w t -> Decoder s t
decode (Decode (Closed Dense) (DijkstraTxBodyRaw l DijkstraEra)
 -> Decoder s (DijkstraTxBodyRaw l DijkstraEra))
-> Decode (Closed Dense) (DijkstraTxBodyRaw l DijkstraEra)
-> Decoder s (DijkstraTxBodyRaw l DijkstraEra)
forall a b. (a -> b) -> a -> b
$
      String
-> DijkstraTxBodyRaw l DijkstraEra
-> (Word -> Field (DijkstraTxBodyRaw l DijkstraEra))
-> [(Word, String)]
-> Decode (Closed Dense) (DijkstraTxBodyRaw l DijkstraEra)
forall t.
Typeable t =>
String
-> t
-> (Word -> Field t)
-> [(Word, String)]
-> Decode (Closed Dense) t
SparseKeyed
        String
"TxBodyRaw"
        (STxBothLevels l DijkstraEra -> DijkstraTxBodyRaw l DijkstraEra
forall era (l :: TxLevel).
EraTxBody era =>
STxBothLevels l era -> DijkstraTxBodyRaw l era
basicDijkstraTxBodyRaw STxBothLevels l DijkstraEra
sTxLevel)
        (STxBothLevels l DijkstraEra
-> Word -> Field (DijkstraTxBodyRaw l DijkstraEra)
bodyFields STxBothLevels l DijkstraEra
sTxLevel)
        (STxBothLevels l DijkstraEra -> [(Word, String)]
requiredFields STxBothLevels l DijkstraEra
sTxLevel)
    where
      bodyFields :: STxBothLevels l DijkstraEra -> Word -> Field (DijkstraTxBodyRaw l DijkstraEra)
      bodyFields :: STxBothLevels l DijkstraEra
-> Word -> Field (DijkstraTxBodyRaw l DijkstraEra)
bodyFields STxBothLevels l DijkstraEra
sTxLevel = \case
        Word
0 -> (Set TxIn
 -> DijkstraTxBodyRaw l DijkstraEra
 -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 11)) (Set TxIn)
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode (Closed d) x -> Field t
field ((Set TxIn -> Identity (Set TxIn))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall (l :: TxLevel) era (f :: * -> *).
Functor f =>
(Set TxIn -> f (Set TxIn))
-> DijkstraTxBodyRaw l era -> f (DijkstraTxBodyRaw l era)
inputsDijkstraTxBodyRawL ((Set TxIn -> Identity (Set TxIn))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> Set TxIn
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~) Decode (Closed (ZonkAny 11)) (Set TxIn)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
1 -> (StrictSeq (BabbageTxOut DijkstraEra)
 -> DijkstraTxBodyRaw l DijkstraEra
 -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode
     (Closed (ZonkAny 12)) (StrictSeq (BabbageTxOut DijkstraEra))
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode (Closed d) x -> Field t
field ((StrictSeq (TxOut DijkstraEra)
 -> Identity (StrictSeq (TxOut DijkstraEra)))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
(StrictSeq (BabbageTxOut DijkstraEra)
 -> Identity (StrictSeq (BabbageTxOut DijkstraEra)))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall era (l :: TxLevel).
EraTxOut era =>
Lens' (DijkstraTxBodyRaw l era) (StrictSeq (TxOut era))
Lens'
  (DijkstraTxBodyRaw l DijkstraEra) (StrictSeq (TxOut DijkstraEra))
outputsDijkstraTxBodyRawL ((StrictSeq (BabbageTxOut DijkstraEra)
  -> Identity (StrictSeq (BabbageTxOut DijkstraEra)))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> StrictSeq (BabbageTxOut DijkstraEra)
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~) Decode (Closed (ZonkAny 12)) (StrictSeq (BabbageTxOut DijkstraEra))
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
2 | STxBothLevels l DijkstraEra
STopTx <- STxBothLevels l DijkstraEra
sTxLevel -> (Coin
 -> DijkstraTxBodyRaw l DijkstraEra
 -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 13)) Coin
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
(x -> t -> t) -> Decode (Closed d) x -> Field t
field ((Coin -> Identity Coin)
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
(Coin -> Identity Coin)
-> DijkstraTxBodyRaw TopTx DijkstraEra
-> Identity (DijkstraTxBodyRaw TopTx DijkstraEra)
forall era (f :: * -> *).
Functor f =>
(Coin -> f Coin)
-> DijkstraTxBodyRaw TopTx era -> f (DijkstraTxBodyRaw TopTx era)
feeDijkstraTxBodyRawL ((Coin -> Identity Coin)
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> Coin
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~) Decode (Closed (ZonkAny 13)) Coin
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
3 -> (StrictMaybe SlotNo
 -> DijkstraTxBodyRaw l DijkstraEra
 -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 14)) SlotNo
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
(StrictMaybe x -> t -> t) -> Decode (Closed d) x -> Field t
ofield ((ValidityInterval -> Identity ValidityInterval)
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall (l :: TxLevel) era (f :: * -> *).
Functor f =>
(ValidityInterval -> f ValidityInterval)
-> DijkstraTxBodyRaw l era -> f (DijkstraTxBodyRaw l era)
vldtDijkstraTxBodyRawL ((ValidityInterval -> Identity ValidityInterval)
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> ((StrictMaybe SlotNo -> Identity (StrictMaybe SlotNo))
    -> ValidityInterval -> Identity ValidityInterval)
-> (StrictMaybe SlotNo -> Identity (StrictMaybe SlotNo))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (StrictMaybe SlotNo -> Identity (StrictMaybe SlotNo))
-> ValidityInterval -> Identity ValidityInterval
Lens' ValidityInterval (StrictMaybe SlotNo)
invalidHereAfterL ((StrictMaybe SlotNo -> Identity (StrictMaybe SlotNo))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> StrictMaybe SlotNo
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~) Decode (Closed (ZonkAny 14)) SlotNo
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
4 ->
          String
-> (OSet (DijkstraTxCert DijkstraEra) -> Bool)
-> (OSet (DijkstraTxCert DijkstraEra)
    -> DijkstraTxBodyRaw l DijkstraEra
    -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 15)) (OSet (DijkstraTxCert DijkstraEra))
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
String
-> (x -> Bool) -> (x -> t -> t) -> Decode (Closed d) x -> Field t
fieldGuarded
            (String -> String -> String
forall {a}. (Semigroup a, IsString a) => a -> a -> a
emptyFailure String
"Certificates" String
"non-empty")
            OSet (DijkstraTxCert DijkstraEra) -> Bool
forall a. OSet a -> Bool
OSet.null
            ((OSet (TxCert DijkstraEra) -> Identity (OSet (TxCert DijkstraEra)))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
(OSet (DijkstraTxCert DijkstraEra)
 -> Identity (OSet (DijkstraTxCert DijkstraEra)))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall (l :: TxLevel) era (f :: * -> *).
Functor f =>
(OSet (TxCert era) -> f (OSet (TxCert era)))
-> DijkstraTxBodyRaw l era -> f (DijkstraTxBodyRaw l era)
certsDijkstraTxBodyRawL ((OSet (DijkstraTxCert DijkstraEra)
  -> Identity (OSet (DijkstraTxCert DijkstraEra)))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> OSet (DijkstraTxCert DijkstraEra)
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~)
            Decode (Closed (ZonkAny 15)) (OSet (DijkstraTxCert DijkstraEra))
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
5 ->
          String
-> (Withdrawals -> Bool)
-> (Withdrawals
    -> DijkstraTxBodyRaw l DijkstraEra
    -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 16)) Withdrawals
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
String
-> (x -> Bool) -> (x -> t -> t) -> Decode (Closed d) x -> Field t
fieldGuarded
            (String -> String -> String
forall {a}. (Semigroup a, IsString a) => a -> a -> a
emptyFailure String
"Withdrawals" String
"non-empty")
            (Map RewardAccount Coin -> Bool
forall a. Map RewardAccount a -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Map RewardAccount Coin -> Bool)
-> (Withdrawals -> Map RewardAccount Coin) -> Withdrawals -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Withdrawals -> Map RewardAccount Coin
unWithdrawals)
            ((Withdrawals -> Identity Withdrawals)
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall (l :: TxLevel) era (f :: * -> *).
Functor f =>
(Withdrawals -> f Withdrawals)
-> DijkstraTxBodyRaw l era -> f (DijkstraTxBodyRaw l era)
withdrawalsDijkstraTxBodyRawL ((Withdrawals -> Identity Withdrawals)
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> Withdrawals
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~)
            Decode (Closed (ZonkAny 16)) Withdrawals
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
7 -> (StrictMaybe TxAuxDataHash
 -> DijkstraTxBodyRaw l DijkstraEra
 -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 17)) TxAuxDataHash
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
(StrictMaybe x -> t -> t) -> Decode (Closed d) x -> Field t
ofield ((StrictMaybe TxAuxDataHash -> Identity (StrictMaybe TxAuxDataHash))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall (l :: TxLevel) era (f :: * -> *).
Functor f =>
(StrictMaybe TxAuxDataHash -> f (StrictMaybe TxAuxDataHash))
-> DijkstraTxBodyRaw l era -> f (DijkstraTxBodyRaw l era)
auxDataHashDijkstraTxBodyRawL ((StrictMaybe TxAuxDataHash
  -> Identity (StrictMaybe TxAuxDataHash))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> StrictMaybe TxAuxDataHash
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~) Decode (Closed (ZonkAny 17)) TxAuxDataHash
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
8 -> (StrictMaybe SlotNo
 -> DijkstraTxBodyRaw l DijkstraEra
 -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 18)) SlotNo
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
(StrictMaybe x -> t -> t) -> Decode (Closed d) x -> Field t
ofield ((ValidityInterval -> Identity ValidityInterval)
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall (l :: TxLevel) era (f :: * -> *).
Functor f =>
(ValidityInterval -> f ValidityInterval)
-> DijkstraTxBodyRaw l era -> f (DijkstraTxBodyRaw l era)
vldtDijkstraTxBodyRawL ((ValidityInterval -> Identity ValidityInterval)
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> ((StrictMaybe SlotNo -> Identity (StrictMaybe SlotNo))
    -> ValidityInterval -> Identity ValidityInterval)
-> (StrictMaybe SlotNo -> Identity (StrictMaybe SlotNo))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (StrictMaybe SlotNo -> Identity (StrictMaybe SlotNo))
-> ValidityInterval -> Identity ValidityInterval
Lens' ValidityInterval (StrictMaybe SlotNo)
invalidBeforeL ((StrictMaybe SlotNo -> Identity (StrictMaybe SlotNo))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> StrictMaybe SlotNo
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~) Decode (Closed (ZonkAny 18)) SlotNo
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
9 ->
          String
-> (MultiAsset -> Bool)
-> (MultiAsset
    -> DijkstraTxBodyRaw l DijkstraEra
    -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 19)) MultiAsset
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
String
-> (x -> Bool) -> (x -> t -> t) -> Decode (Closed d) x -> Field t
fieldGuarded
            (String -> String -> String
forall {a}. (Semigroup a, IsString a) => a -> a -> a
emptyFailure String
"Mint" String
"non-empty")
            (MultiAsset -> MultiAsset -> Bool
forall a. Eq a => a -> a -> Bool
== MultiAsset
forall a. Monoid a => a
mempty)
            ((MultiAsset -> Identity MultiAsset)
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall (l :: TxLevel) era (f :: * -> *).
Functor f =>
(MultiAsset -> f MultiAsset)
-> DijkstraTxBodyRaw l era -> f (DijkstraTxBodyRaw l era)
mintDijkstraTxBodyRawL ((MultiAsset -> Identity MultiAsset)
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> MultiAsset
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~)
            Decode (Closed (ZonkAny 19)) MultiAsset
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
11 -> (StrictMaybe ScriptIntegrityHash
 -> DijkstraTxBodyRaw l DijkstraEra
 -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 20)) ScriptIntegrityHash
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
(StrictMaybe x -> t -> t) -> Decode (Closed d) x -> Field t
ofield ((StrictMaybe ScriptIntegrityHash
 -> Identity (StrictMaybe ScriptIntegrityHash))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall (l :: TxLevel) era (f :: * -> *).
Functor f =>
(StrictMaybe ScriptIntegrityHash
 -> f (StrictMaybe ScriptIntegrityHash))
-> DijkstraTxBodyRaw l era -> f (DijkstraTxBodyRaw l era)
scriptIntegrityHashDijkstraTxBodyRawL ((StrictMaybe ScriptIntegrityHash
  -> Identity (StrictMaybe ScriptIntegrityHash))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> StrictMaybe ScriptIntegrityHash
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~) Decode (Closed (ZonkAny 20)) ScriptIntegrityHash
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
13
          | STxBothLevels l DijkstraEra
STopTx <- STxBothLevels l DijkstraEra
sTxLevel ->
              String
-> (Set TxIn -> Bool)
-> (Set TxIn
    -> DijkstraTxBodyRaw l DijkstraEra
    -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 21)) (Set TxIn)
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
String
-> (x -> Bool) -> (x -> t -> t) -> Decode (Closed d) x -> Field t
fieldGuarded
                (String -> String -> String
forall {a}. (Semigroup a, IsString a) => a -> a -> a
emptyFailure String
"Collateral Inputs" String
"non-empty")
                Set TxIn -> Bool
forall a. Set a -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null
                ((Set TxIn -> Identity (Set TxIn))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
(Set TxIn -> Identity (Set TxIn))
-> DijkstraTxBodyRaw TopTx DijkstraEra
-> Identity (DijkstraTxBodyRaw TopTx DijkstraEra)
forall era (f :: * -> *).
Functor f =>
(Set TxIn -> f (Set TxIn))
-> DijkstraTxBodyRaw TopTx era -> f (DijkstraTxBodyRaw TopTx era)
collateralInputsDijkstraTxBodyRawL ((Set TxIn -> Identity (Set TxIn))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> Set TxIn
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~)
                Decode (Closed (ZonkAny 21)) (Set TxIn)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
14 ->
          (StrictMaybe (OSet (Credential Guard))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed Dense) (OSet (Credential Guard))
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
(StrictMaybe x -> t -> t) -> Decode (Closed d) x -> Field t
ofield
            (\StrictMaybe (OSet (Credential Guard))
x -> (OSet (Credential Guard) -> Identity (OSet (Credential Guard)))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall (l :: TxLevel) era (f :: * -> *).
Functor f =>
(OSet (Credential Guard) -> f (OSet (Credential Guard)))
-> DijkstraTxBodyRaw l era -> f (DijkstraTxBodyRaw l era)
guardsDijkstraTxBodyRawL ((OSet (Credential Guard) -> Identity (OSet (Credential Guard)))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> OSet (Credential Guard)
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~ OSet (Credential Guard)
-> StrictMaybe (OSet (Credential Guard)) -> OSet (Credential Guard)
forall a. a -> StrictMaybe a -> a
fromSMaybe OSet (Credential Guard)
forall a. Monoid a => a
mempty StrictMaybe (OSet (Credential Guard))
x)
            ((forall s. Decoder s (OSet (Credential Guard)))
-> Decode (Closed Dense) (OSet (Credential Guard))
forall t. (forall s. Decoder s t) -> Decode (Closed Dense) t
D Decoder s (OSet (Credential Guard))
forall s. Decoder s (OSet (Credential Guard))
decodeGuards)
        Word
15 -> (StrictMaybe Network
 -> DijkstraTxBodyRaw l DijkstraEra
 -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 22)) Network
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
(StrictMaybe x -> t -> t) -> Decode (Closed d) x -> Field t
ofield ((StrictMaybe Network -> Identity (StrictMaybe Network))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall (l :: TxLevel) era (f :: * -> *).
Functor f =>
(StrictMaybe Network -> f (StrictMaybe Network))
-> DijkstraTxBodyRaw l era -> f (DijkstraTxBodyRaw l era)
networkIdDijkstraTxBodyRawL ((StrictMaybe Network -> Identity (StrictMaybe Network))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> StrictMaybe Network
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~) Decode (Closed (ZonkAny 22)) Network
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
16
          | STxBothLevels l DijkstraEra
STopTx <- STxBothLevels l DijkstraEra
sTxLevel ->
              (StrictMaybe (BabbageTxOut DijkstraEra)
 -> DijkstraTxBodyRaw l DijkstraEra
 -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 23)) (BabbageTxOut DijkstraEra)
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
(StrictMaybe x -> t -> t) -> Decode (Closed d) x -> Field t
ofield ((StrictMaybe (TxOut DijkstraEra)
 -> Identity (StrictMaybe (TxOut DijkstraEra)))
-> DijkstraTxBodyRaw TopTx DijkstraEra
-> Identity (DijkstraTxBodyRaw TopTx DijkstraEra)
(StrictMaybe (BabbageTxOut DijkstraEra)
 -> Identity (StrictMaybe (BabbageTxOut DijkstraEra)))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall era.
EraTxBody era =>
Lens' (DijkstraTxBodyRaw TopTx era) (StrictMaybe (TxOut era))
Lens'
  (DijkstraTxBodyRaw TopTx DijkstraEra)
  (StrictMaybe (TxOut DijkstraEra))
collateralReturnDijkstraTxBodyRawL ((StrictMaybe (BabbageTxOut DijkstraEra)
  -> Identity (StrictMaybe (BabbageTxOut DijkstraEra)))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> StrictMaybe (BabbageTxOut DijkstraEra)
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~) Decode (Closed (ZonkAny 23)) (BabbageTxOut DijkstraEra)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
17
          | STxBothLevels l DijkstraEra
STopTx <- STxBothLevels l DijkstraEra
sTxLevel ->
              (StrictMaybe Coin
 -> DijkstraTxBodyRaw l DijkstraEra
 -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 24)) Coin
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
(StrictMaybe x -> t -> t) -> Decode (Closed d) x -> Field t
ofield ((StrictMaybe Coin -> Identity (StrictMaybe Coin))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
(StrictMaybe Coin -> Identity (StrictMaybe Coin))
-> DijkstraTxBodyRaw TopTx DijkstraEra
-> Identity (DijkstraTxBodyRaw TopTx DijkstraEra)
forall era (f :: * -> *).
Functor f =>
(StrictMaybe Coin -> f (StrictMaybe Coin))
-> DijkstraTxBodyRaw TopTx era -> f (DijkstraTxBodyRaw TopTx era)
totalCollateralDijkstraTxBodyRawL ((StrictMaybe Coin -> Identity (StrictMaybe Coin))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> StrictMaybe Coin
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~) Decode (Closed (ZonkAny 24)) Coin
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
18 ->
          String
-> (Set TxIn -> Bool)
-> (Set TxIn
    -> DijkstraTxBodyRaw l DijkstraEra
    -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 25)) (Set TxIn)
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
String
-> (x -> Bool) -> (x -> t -> t) -> Decode (Closed d) x -> Field t
fieldGuarded
            (String -> String -> String
forall {a}. (Semigroup a, IsString a) => a -> a -> a
emptyFailure String
"Reference Inputs" String
"non-empty")
            Set TxIn -> Bool
forall a. Set a -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null
            ((Set TxIn -> Identity (Set TxIn))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall (l :: TxLevel) era (f :: * -> *).
Functor f =>
(Set TxIn -> f (Set TxIn))
-> DijkstraTxBodyRaw l era -> f (DijkstraTxBodyRaw l era)
referenceInputsDijkstraTxBodyRawL ((Set TxIn -> Identity (Set TxIn))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> Set TxIn
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~)
            Decode (Closed (ZonkAny 25)) (Set TxIn)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
19 ->
          String
-> (VotingProcedures DijkstraEra -> Bool)
-> (VotingProcedures DijkstraEra
    -> DijkstraTxBodyRaw l DijkstraEra
    -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 26)) (VotingProcedures DijkstraEra)
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
String
-> (x -> Bool) -> (x -> t -> t) -> Decode (Closed d) x -> Field t
fieldGuarded
            (String -> String -> String
forall {a}. (Semigroup a, IsString a) => a -> a -> a
emptyFailure String
"VotingProcedures" String
"non-empty")
            (Map Voter (Map GovActionId (VotingProcedure DijkstraEra)) -> Bool
forall a. Map Voter a -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Map Voter (Map GovActionId (VotingProcedure DijkstraEra)) -> Bool)
-> (VotingProcedures DijkstraEra
    -> Map Voter (Map GovActionId (VotingProcedure DijkstraEra)))
-> VotingProcedures DijkstraEra
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. VotingProcedures DijkstraEra
-> Map Voter (Map GovActionId (VotingProcedure DijkstraEra))
forall era.
VotingProcedures era
-> Map Voter (Map GovActionId (VotingProcedure era))
unVotingProcedures)
            ((VotingProcedures DijkstraEra
 -> Identity (VotingProcedures DijkstraEra))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall (l :: TxLevel) era (f :: * -> *).
Functor f =>
(VotingProcedures era -> f (VotingProcedures era))
-> DijkstraTxBodyRaw l era -> f (DijkstraTxBodyRaw l era)
votingProceduresDijkstraTxBodyRawL ((VotingProcedures DijkstraEra
  -> Identity (VotingProcedures DijkstraEra))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> VotingProcedures DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~)
            Decode (Closed (ZonkAny 26)) (VotingProcedures DijkstraEra)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
20 ->
          String
-> (OSet (ProposalProcedure DijkstraEra) -> Bool)
-> (OSet (ProposalProcedure DijkstraEra)
    -> DijkstraTxBodyRaw l DijkstraEra
    -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode
     (Closed (ZonkAny 27)) (OSet (ProposalProcedure DijkstraEra))
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
String
-> (x -> Bool) -> (x -> t -> t) -> Decode (Closed d) x -> Field t
fieldGuarded
            (String -> String -> String
forall {a}. (Semigroup a, IsString a) => a -> a -> a
emptyFailure String
"ProposalProcedures" String
"non-empty")
            OSet (ProposalProcedure DijkstraEra) -> Bool
forall a. OSet a -> Bool
OSet.null
            ((OSet (ProposalProcedure DijkstraEra)
 -> Identity (OSet (ProposalProcedure DijkstraEra)))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall (l :: TxLevel) era (f :: * -> *).
Functor f =>
(OSet (ProposalProcedure era) -> f (OSet (ProposalProcedure era)))
-> DijkstraTxBodyRaw l era -> f (DijkstraTxBodyRaw l era)
proposalProceduresDijkstraTxBodyRawL ((OSet (ProposalProcedure DijkstraEra)
  -> Identity (OSet (ProposalProcedure DijkstraEra)))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> OSet (ProposalProcedure DijkstraEra)
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~)
            Decode (Closed (ZonkAny 27)) (OSet (ProposalProcedure DijkstraEra))
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
21 -> (StrictMaybe Coin
 -> DijkstraTxBodyRaw l DijkstraEra
 -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed (ZonkAny 28)) Coin
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
(StrictMaybe x -> t -> t) -> Decode (Closed d) x -> Field t
ofield ((StrictMaybe Coin -> Identity (StrictMaybe Coin))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall (l :: TxLevel) era (f :: * -> *).
Functor f =>
(StrictMaybe Coin -> f (StrictMaybe Coin))
-> DijkstraTxBodyRaw l era -> f (DijkstraTxBodyRaw l era)
currentTreasuryValueDijkstraTxBodyRawL ((StrictMaybe Coin -> Identity (StrictMaybe Coin))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> StrictMaybe Coin
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~) Decode (Closed (ZonkAny 28)) Coin
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
        Word
22 ->
          (StrictMaybe Coin
 -> DijkstraTxBodyRaw l DijkstraEra
 -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed Dense) Coin
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
(StrictMaybe x -> t -> t) -> Decode (Closed d) x -> Field t
ofield
            (\StrictMaybe Coin
x -> (Coin -> Identity Coin)
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
forall (l :: TxLevel) era (f :: * -> *).
Functor f =>
(Coin -> f Coin)
-> DijkstraTxBodyRaw l era -> f (DijkstraTxBodyRaw l era)
treasuryDonationDijkstraTxBodyRawL ((Coin -> Identity Coin)
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> Coin
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Coin -> StrictMaybe Coin -> Coin
forall a. a -> StrictMaybe a -> a
fromSMaybe Coin
forall t. Val t => t
zero StrictMaybe Coin
x)
            ((forall s. Decoder s Coin) -> Decode (Closed Dense) Coin
forall t. (forall s. Decoder s t) -> Decode (Closed Dense) t
D (String -> Decoder s Coin
forall s. String -> Decoder s Coin
decodePositiveCoin (String -> Decoder s Coin) -> String -> Decoder s Coin
forall a b. (a -> b) -> a -> b
$ String -> String -> String
forall {a}. (Semigroup a, IsString a) => a -> a -> a
emptyFailure String
"Treasury Donation" String
"non-zero"))
        Word
23
          | STxBothLevels l DijkstraEra
STopTx <- STxBothLevels l DijkstraEra
sTxLevel ->
              String
-> (OMap TxId (Tx SubTx DijkstraEra) -> Bool)
-> (OMap TxId (Tx SubTx DijkstraEra)
    -> DijkstraTxBodyRaw l DijkstraEra
    -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode (Closed Dense) (OMap TxId (Tx SubTx DijkstraEra))
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
String
-> (x -> Bool) -> (x -> t -> t) -> Decode (Closed d) x -> Field t
fieldGuarded
                (String -> String -> String
forall {a}. (Semigroup a, IsString a) => a -> a -> a
emptyFailure String
"Subtransactions" String
"non-empty")
                OMap TxId (Tx SubTx DijkstraEra) -> Bool
forall k v. OMap k v -> Bool
OMap.null
                ((OMap TxId (Tx SubTx DijkstraEra)
 -> Identity (OMap TxId (Tx SubTx DijkstraEra)))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
(OMap TxId (Tx SubTx DijkstraEra)
 -> Identity (OMap TxId (Tx SubTx DijkstraEra)))
-> DijkstraTxBodyRaw TopTx DijkstraEra
-> Identity (DijkstraTxBodyRaw TopTx DijkstraEra)
forall era (f :: * -> *).
Functor f =>
(OMap TxId (Tx SubTx era) -> f (OMap TxId (Tx SubTx era)))
-> DijkstraTxBodyRaw TopTx era -> f (DijkstraTxBodyRaw TopTx era)
subTransactionsDijkstraTxBodyRawL ((OMap TxId (Tx SubTx DijkstraEra)
  -> Identity (OMap TxId (Tx SubTx DijkstraEra)))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> OMap TxId (Tx SubTx DijkstraEra)
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~)
                ((forall s. Decoder s (OMap TxId (Tx SubTx DijkstraEra)))
-> Decode (Closed Dense) (OMap TxId (Tx SubTx DijkstraEra))
forall t. (forall s. Decoder s t) -> Decode (Closed Dense) t
D ((forall s. Decoder s (OMap TxId (Tx SubTx DijkstraEra)))
 -> Decode (Closed Dense) (OMap TxId (Tx SubTx DijkstraEra)))
-> (forall s. Decoder s (OMap TxId (Tx SubTx DijkstraEra)))
-> Decode (Closed Dense) (OMap TxId (Tx SubTx DijkstraEra))
forall a b. (a -> b) -> a -> b
$ Word -> Decoder s ()
forall s. Word -> Decoder s ()
allowTag Word
setTag Decoder s ()
-> Decoder s (OMap TxId (Tx SubTx DijkstraEra))
-> Decoder s (OMap TxId (Tx SubTx DijkstraEra))
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 (OMap TxId (Tx SubTx DijkstraEra))
forall s. Decoder s (OMap TxId (Tx SubTx DijkstraEra))
forall a s. DecCBOR a => Decoder s a
decCBOR)
        Word
24
          | STxBothLevels l DijkstraEra
SSubTx <- STxBothLevels l DijkstraEra
sTxLevel ->
              String
-> (Map (Credential Guard) (StrictMaybe (Data DijkstraEra))
    -> Bool)
-> (Map (Credential Guard) (StrictMaybe (Data DijkstraEra))
    -> DijkstraTxBodyRaw l DijkstraEra
    -> DijkstraTxBodyRaw l DijkstraEra)
-> Decode
     (Closed Dense)
     (Map (Credential Guard) (StrictMaybe (Data DijkstraEra)))
-> Field (DijkstraTxBodyRaw l DijkstraEra)
forall x t (d :: Density).
Typeable x =>
String
-> (x -> Bool) -> (x -> t -> t) -> Decode (Closed d) x -> Field t
fieldGuarded
                (String -> String -> String
forall {a}. (Semigroup a, IsString a) => a -> a -> a
emptyFailure String
"RequiredTopLevelGuards" String
"non-empty")
                Map (Credential Guard) (StrictMaybe (Data DijkstraEra)) -> Bool
forall k a. Map k a -> Bool
Map.null
                ((Map (Credential Guard) (StrictMaybe (Data DijkstraEra))
 -> Identity
      (Map (Credential Guard) (StrictMaybe (Data DijkstraEra))))
-> DijkstraTxBodyRaw l DijkstraEra
-> Identity (DijkstraTxBodyRaw l DijkstraEra)
(Map (Credential Guard) (StrictMaybe (Data DijkstraEra))
 -> Identity
      (Map (Credential Guard) (StrictMaybe (Data DijkstraEra))))
-> DijkstraTxBodyRaw SubTx DijkstraEra
-> Identity (DijkstraTxBodyRaw SubTx DijkstraEra)
forall era (f :: * -> *).
Functor f =>
(Map (Credential Guard) (StrictMaybe (Data era))
 -> f (Map (Credential Guard) (StrictMaybe (Data era))))
-> DijkstraTxBodyRaw SubTx era -> f (DijkstraTxBodyRaw SubTx era)
requiredTopLevelGuardsDijkstraTxBodyRawL ((Map (Credential Guard) (StrictMaybe (Data DijkstraEra))
  -> Identity
       (Map (Credential Guard) (StrictMaybe (Data DijkstraEra))))
 -> DijkstraTxBodyRaw l DijkstraEra
 -> Identity (DijkstraTxBodyRaw l DijkstraEra))
-> Map (Credential Guard) (StrictMaybe (Data DijkstraEra))
-> DijkstraTxBodyRaw l DijkstraEra
-> DijkstraTxBodyRaw l DijkstraEra
forall s t a b. ASetter s t a b -> b -> s -> t
.~)
                ((forall s.
 Decoder
   s (Map (Credential Guard) (StrictMaybe (Data DijkstraEra))))
-> Decode
     (Closed Dense)
     (Map (Credential Guard) (StrictMaybe (Data DijkstraEra)))
forall t. (forall s. Decoder s t) -> Decode (Closed Dense) t
D (Decoder s (Credential Guard)
-> Decoder s (StrictMaybe (Data DijkstraEra))
-> Decoder
     s (Map (Credential Guard) (StrictMaybe (Data DijkstraEra)))
forall k s v.
Ord k =>
Decoder s k -> Decoder s v -> Decoder s (Map k v)
decodeMap Decoder s (Credential Guard)
forall s. Decoder s (Credential Guard)
forall a s. DecCBOR a => Decoder s a
decCBOR (Decoder s (Data DijkstraEra)
-> Decoder s (StrictMaybe (Data DijkstraEra))
forall s a. Decoder s a -> Decoder s (StrictMaybe a)
decodeNullStrictMaybe Decoder s (Data DijkstraEra)
forall s. Decoder s (Data DijkstraEra)
forall a s. DecCBOR a => Decoder s a
decCBOR)))
        Word
n -> Word -> Field (DijkstraTxBodyRaw l DijkstraEra)
forall t. Word -> Field t
invalidField Word
n
      requiredFields :: STxBothLevels l DijkstraEra -> [(Word, String)]
      requiredFields :: STxBothLevels l DijkstraEra -> [(Word, String)]
requiredFields STxBothLevels l DijkstraEra
sTxLevel
        | STxBothLevels l DijkstraEra
STopTx <- STxBothLevels l DijkstraEra
sTxLevel =
            [ (Word
0, String
"inputs")
            , (Word
1, String
"outputs")
            , (Word
2, String
"fee")
            ]
        | STxBothLevels l DijkstraEra
SSubTx <- STxBothLevels l DijkstraEra
sTxLevel =
            [ (Word
0, String
"inputs")
            , (Word
1, String
"outputs")
            ]

      emptyFailure :: a -> a -> a
emptyFailure a
fieldName a
requirement =
        a
"TxBody: '" a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
fieldName a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
"' must be " a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
requirement a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
" when supplied"

instance Era era => DecCBOR (DijkstraNativeScriptRaw era) where
  decCBOR :: forall s. Decoder s (DijkstraNativeScriptRaw era)
decCBOR = Decode (Closed Dense) (DijkstraNativeScriptRaw era)
-> Decoder s (DijkstraNativeScriptRaw era)
forall t (w :: Wrapped) s. Typeable t => Decode w t -> Decoder s t
decode (Decode (Closed Dense) (DijkstraNativeScriptRaw era)
 -> Decoder s (DijkstraNativeScriptRaw era))
-> Decode (Closed Dense) (DijkstraNativeScriptRaw era)
-> Decoder s (DijkstraNativeScriptRaw era)
forall a b. (a -> b) -> a -> b
$ Text
-> (Word -> Decode Open (DijkstraNativeScriptRaw era))
-> Decode (Closed Dense) (DijkstraNativeScriptRaw era)
forall t.
Text -> (Word -> Decode Open t) -> Decode (Closed Dense) t
Summands Text
"DijkstraNativeScriptRaw" ((Word -> Decode Open (DijkstraNativeScriptRaw era))
 -> Decode (Closed Dense) (DijkstraNativeScriptRaw era))
-> (Word -> Decode Open (DijkstraNativeScriptRaw era))
-> Decode (Closed Dense) (DijkstraNativeScriptRaw era)
forall a b. (a -> b) -> a -> b
$ \case
    Word
0 -> (KeyHash Witness -> DijkstraNativeScriptRaw era)
-> Decode Open (KeyHash Witness -> DijkstraNativeScriptRaw era)
forall t. t -> Decode Open t
SumD KeyHash Witness -> DijkstraNativeScriptRaw era
forall era. KeyHash Witness -> DijkstraNativeScriptRaw era
DijkstraRequireSignature Decode Open (KeyHash Witness -> DijkstraNativeScriptRaw era)
-> Decode (Closed (ZonkAny 3)) (KeyHash Witness)
-> Decode Open (DijkstraNativeScriptRaw era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 3)) (KeyHash Witness)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
    Word
1 -> (StrictSeq (DijkstraNativeScript era)
 -> DijkstraNativeScriptRaw era)
-> Decode
     Open
     (StrictSeq (DijkstraNativeScript era)
      -> DijkstraNativeScriptRaw era)
forall t. t -> Decode Open t
SumD StrictSeq (DijkstraNativeScript era) -> DijkstraNativeScriptRaw era
forall era.
StrictSeq (DijkstraNativeScript era) -> DijkstraNativeScriptRaw era
DijkstraRequireAllOf Decode
  Open
  (StrictSeq (DijkstraNativeScript era)
   -> DijkstraNativeScriptRaw era)
-> Decode
     (Closed (ZonkAny 4)) (StrictSeq (DijkstraNativeScript era))
-> Decode Open (DijkstraNativeScriptRaw era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 4)) (StrictSeq (DijkstraNativeScript era))
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
    Word
2 -> (StrictSeq (DijkstraNativeScript era)
 -> DijkstraNativeScriptRaw era)
-> Decode
     Open
     (StrictSeq (DijkstraNativeScript era)
      -> DijkstraNativeScriptRaw era)
forall t. t -> Decode Open t
SumD StrictSeq (DijkstraNativeScript era) -> DijkstraNativeScriptRaw era
forall era.
StrictSeq (DijkstraNativeScript era) -> DijkstraNativeScriptRaw era
DijkstraRequireAnyOf Decode
  Open
  (StrictSeq (DijkstraNativeScript era)
   -> DijkstraNativeScriptRaw era)
-> Decode
     (Closed (ZonkAny 5)) (StrictSeq (DijkstraNativeScript era))
-> Decode Open (DijkstraNativeScriptRaw era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 5)) (StrictSeq (DijkstraNativeScript era))
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
    Word
3 -> (Int
 -> StrictSeq (DijkstraNativeScript era)
 -> DijkstraNativeScriptRaw era)
-> Decode
     Open
     (Int
      -> StrictSeq (DijkstraNativeScript era)
      -> DijkstraNativeScriptRaw era)
forall t. t -> Decode Open t
SumD Int
-> StrictSeq (DijkstraNativeScript era)
-> DijkstraNativeScriptRaw era
forall era.
Int
-> StrictSeq (DijkstraNativeScript era)
-> DijkstraNativeScriptRaw era
DijkstraRequireMOf Decode
  Open
  (Int
   -> StrictSeq (DijkstraNativeScript era)
   -> DijkstraNativeScriptRaw era)
-> Decode (Closed (ZonkAny 7)) Int
-> Decode
     Open
     (StrictSeq (DijkstraNativeScript era)
      -> DijkstraNativeScriptRaw era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 7)) Int
forall t (w :: Wrapped). DecCBOR t => Decode w t
From Decode
  Open
  (StrictSeq (DijkstraNativeScript era)
   -> DijkstraNativeScriptRaw era)
-> Decode
     (Closed (ZonkAny 6)) (StrictSeq (DijkstraNativeScript era))
-> Decode Open (DijkstraNativeScriptRaw era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 6)) (StrictSeq (DijkstraNativeScript era))
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
    Word
4 -> (SlotNo -> DijkstraNativeScriptRaw era)
-> Decode Open (SlotNo -> DijkstraNativeScriptRaw era)
forall t. t -> Decode Open t
SumD SlotNo -> DijkstraNativeScriptRaw era
forall era. SlotNo -> DijkstraNativeScriptRaw era
DijkstraTimeStart Decode Open (SlotNo -> DijkstraNativeScriptRaw era)
-> Decode (Closed (ZonkAny 8)) SlotNo
-> Decode Open (DijkstraNativeScriptRaw era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 8)) SlotNo
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
    Word
5 -> (SlotNo -> DijkstraNativeScriptRaw era)
-> Decode Open (SlotNo -> DijkstraNativeScriptRaw era)
forall t. t -> Decode Open t
SumD SlotNo -> DijkstraNativeScriptRaw era
forall era. SlotNo -> DijkstraNativeScriptRaw era
DijkstraTimeExpire Decode Open (SlotNo -> DijkstraNativeScriptRaw era)
-> Decode (Closed (ZonkAny 9)) SlotNo
-> Decode Open (DijkstraNativeScriptRaw era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 9)) SlotNo
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
    Word
6 -> (Credential Guard -> DijkstraNativeScriptRaw era)
-> Decode Open (Credential Guard -> DijkstraNativeScriptRaw era)
forall t. t -> Decode Open t
SumD Credential Guard -> DijkstraNativeScriptRaw era
forall era. Credential Guard -> DijkstraNativeScriptRaw era
DijkstraRequireGuard Decode Open (Credential Guard -> DijkstraNativeScriptRaw era)
-> Decode (Closed (ZonkAny 10)) (Credential Guard)
-> Decode Open (DijkstraNativeScriptRaw era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 10)) (Credential Guard)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
    Word
n -> Word -> Decode Open (DijkstraNativeScriptRaw era)
forall (w :: Wrapped) t. Word -> Decode w t
Invalid Word
n

instance Era era => DecCBOR (DijkstraNativeScript era) where
  decCBOR :: forall s. Decoder s (DijkstraNativeScript era)
decCBOR = MemoBytes (DijkstraNativeScriptRaw era) -> DijkstraNativeScript era
forall era.
MemoBytes (DijkstraNativeScriptRaw era) -> DijkstraNativeScript era
MkDijkstraNativeScript (MemoBytes (DijkstraNativeScriptRaw era)
 -> DijkstraNativeScript era)
-> Decoder s (MemoBytes (DijkstraNativeScriptRaw era))
-> Decoder s (DijkstraNativeScript era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (DijkstraNativeScriptRaw era)
-> Decoder s (MemoBytes (DijkstraNativeScriptRaw era))
forall s t. Decoder s t -> Decoder s (MemoBytes t)
decodeMemoized Decoder s (DijkstraNativeScriptRaw era)
forall s. Decoder s (DijkstraNativeScriptRaw era)
forall a s. DecCBOR a => Decoder s a
decCBOR

instance Typeable l => DecCBOR (DijkstraTx l DijkstraEra) where
  decCBOR :: forall s. Decoder s (DijkstraTx l DijkstraEra)
decCBOR =
    forall (l :: TxLevel) era a.
(Typeable l, HasCallStack) =>
(STxBothLevels l era -> a) -> a
withSTxBothLevels @l ((STxBothLevels l (ZonkAny 0)
  -> Decoder s (DijkstraTx l DijkstraEra))
 -> Decoder s (DijkstraTx l DijkstraEra))
-> (STxBothLevels l (ZonkAny 0)
    -> Decoder s (DijkstraTx l DijkstraEra))
-> Decoder s (DijkstraTx l DijkstraEra)
forall a b. (a -> b) -> a -> b
$ \case
      STxBothLevels l (ZonkAny 0)
STopTx ->
        Decoder s Int
forall s. Decoder s Int
decodeListLen Decoder s Int
-> (Int -> Decoder s (DijkstraTx l DijkstraEra))
-> Decoder s (DijkstraTx l DijkstraEra)
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
          Int
4 -> do
            body <- Decoder s (TxBody TopTx DijkstraEra)
forall s. Decoder s (TxBody TopTx DijkstraEra)
forall a s. DecCBOR a => Decoder s a
decCBOR
            wits <- decCBOR
            isValid <-
              decCBOR
                >>= \case
                  Bool
True -> IsValid -> Decoder s IsValid
forall a. a -> Decoder s a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Bool -> IsValid
IsValid Bool
True)
                  Bool
False -> String -> Decoder s IsValid
forall a. String -> Decoder s a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"value `false` not allowed for `isValid`"
            aux <- decodeNullStrictMaybe decCBOR
            pure $ DijkstraTx body wits isValid aux
          Int
3 -> do
            TxBody TopTx DijkstraEra
-> TxWits DijkstraEra
-> IsValid
-> StrictMaybe (TxAuxData DijkstraEra)
-> DijkstraTx TopTx DijkstraEra
TxBody TopTx DijkstraEra
-> AlonzoTxWits DijkstraEra
-> IsValid
-> StrictMaybe (AlonzoTxAuxData DijkstraEra)
-> DijkstraTx l DijkstraEra
forall era.
TxBody TopTx era
-> TxWits era
-> IsValid
-> StrictMaybe (TxAuxData era)
-> DijkstraTx TopTx era
DijkstraTx
              (TxBody TopTx DijkstraEra
 -> AlonzoTxWits DijkstraEra
 -> IsValid
 -> StrictMaybe (AlonzoTxAuxData DijkstraEra)
 -> DijkstraTx l DijkstraEra)
-> Decoder s (TxBody TopTx DijkstraEra)
-> Decoder
     s
     (AlonzoTxWits DijkstraEra
      -> IsValid
      -> StrictMaybe (AlonzoTxAuxData DijkstraEra)
      -> DijkstraTx l DijkstraEra)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (TxBody TopTx DijkstraEra)
forall s. Decoder s (TxBody TopTx DijkstraEra)
forall a s. DecCBOR a => Decoder s a
decCBOR
              Decoder
  s
  (AlonzoTxWits DijkstraEra
   -> IsValid
   -> StrictMaybe (AlonzoTxAuxData DijkstraEra)
   -> DijkstraTx l DijkstraEra)
-> Decoder s (AlonzoTxWits DijkstraEra)
-> Decoder
     s
     (IsValid
      -> StrictMaybe (AlonzoTxAuxData DijkstraEra)
      -> DijkstraTx l DijkstraEra)
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 (AlonzoTxWits DijkstraEra)
forall s. Decoder s (AlonzoTxWits DijkstraEra)
forall a s. DecCBOR a => Decoder s a
decCBOR
              Decoder
  s
  (IsValid
   -> StrictMaybe (AlonzoTxAuxData DijkstraEra)
   -> DijkstraTx l DijkstraEra)
-> Decoder s IsValid
-> Decoder
     s
     (StrictMaybe (AlonzoTxAuxData DijkstraEra)
      -> DijkstraTx l DijkstraEra)
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
<*> IsValid -> Decoder s IsValid
forall a. a -> Decoder s a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Bool -> IsValid
IsValid Bool
True)
              Decoder
  s
  (StrictMaybe (AlonzoTxAuxData DijkstraEra)
   -> DijkstraTx l DijkstraEra)
-> Decoder s (StrictMaybe (AlonzoTxAuxData DijkstraEra))
-> Decoder s (DijkstraTx l DijkstraEra)
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 (AlonzoTxAuxData DijkstraEra)
-> Decoder s (StrictMaybe (AlonzoTxAuxData DijkstraEra))
forall s a. Decoder s a -> Decoder s (StrictMaybe a)
decodeNullStrictMaybe Decoder s (AlonzoTxAuxData DijkstraEra)
forall s. Decoder s (AlonzoTxAuxData DijkstraEra)
forall a s. DecCBOR a => Decoder s a
decCBOR
          Int
n -> String -> Decoder s (DijkstraTx l DijkstraEra)
forall a. String -> Decoder s a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Decoder s (DijkstraTx l DijkstraEra))
-> String -> Decoder s (DijkstraTx l DijkstraEra)
forall a b. (a -> b) -> a -> b
$ String
"Unexpected list length: " String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. Show a => a -> String
show Int
n String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
". Expected: 4 or 3."
      STxBothLevels l (ZonkAny 0)
SSubTx ->
        Decode (Closed Dense) (DijkstraTx l DijkstraEra)
-> Decoder s (DijkstraTx l DijkstraEra)
forall t (w :: Wrapped) s. Typeable t => Decode w t -> Decoder s t
decode (Decode (Closed Dense) (DijkstraTx l DijkstraEra)
 -> Decoder s (DijkstraTx l DijkstraEra))
-> Decode (Closed Dense) (DijkstraTx l DijkstraEra)
-> Decoder s (DijkstraTx l DijkstraEra)
forall a b. (a -> b) -> a -> b
$
          (TxBody SubTx DijkstraEra
 -> AlonzoTxWits DijkstraEra
 -> StrictMaybe (AlonzoTxAuxData DijkstraEra)
 -> DijkstraTx l DijkstraEra)
-> Decode
     (Closed Dense)
     (TxBody SubTx DijkstraEra
      -> AlonzoTxWits DijkstraEra
      -> StrictMaybe (AlonzoTxAuxData DijkstraEra)
      -> DijkstraTx l DijkstraEra)
forall t. t -> Decode (Closed Dense) t
RecD TxBody SubTx DijkstraEra
-> TxWits DijkstraEra
-> StrictMaybe (TxAuxData DijkstraEra)
-> DijkstraTx SubTx DijkstraEra
TxBody SubTx DijkstraEra
-> AlonzoTxWits DijkstraEra
-> StrictMaybe (AlonzoTxAuxData DijkstraEra)
-> DijkstraTx l DijkstraEra
forall era.
TxBody SubTx era
-> TxWits era
-> StrictMaybe (TxAuxData era)
-> DijkstraTx SubTx era
DijkstraSubTx
            Decode
  (Closed Dense)
  (TxBody SubTx DijkstraEra
   -> AlonzoTxWits DijkstraEra
   -> StrictMaybe (AlonzoTxAuxData DijkstraEra)
   -> DijkstraTx l DijkstraEra)
-> Decode (Closed (ZonkAny 2)) (TxBody SubTx DijkstraEra)
-> Decode
     (Closed Dense)
     (AlonzoTxWits DijkstraEra
      -> StrictMaybe (AlonzoTxAuxData DijkstraEra)
      -> DijkstraTx l DijkstraEra)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 2)) (TxBody SubTx DijkstraEra)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
            Decode
  (Closed Dense)
  (AlonzoTxWits DijkstraEra
   -> StrictMaybe (AlonzoTxAuxData DijkstraEra)
   -> DijkstraTx l DijkstraEra)
-> Decode (Closed (ZonkAny 1)) (AlonzoTxWits DijkstraEra)
-> Decode
     (Closed Dense)
     (StrictMaybe (AlonzoTxAuxData DijkstraEra)
      -> DijkstraTx l DijkstraEra)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 1)) (AlonzoTxWits DijkstraEra)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
            Decode
  (Closed Dense)
  (StrictMaybe (AlonzoTxAuxData DijkstraEra)
   -> DijkstraTx l DijkstraEra)
-> Decode
     (Closed Dense) (StrictMaybe (AlonzoTxAuxData DijkstraEra))
-> Decode (Closed Dense) (DijkstraTx l DijkstraEra)
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 (AlonzoTxAuxData DijkstraEra)))
-> Decode
     (Closed Dense) (StrictMaybe (AlonzoTxAuxData DijkstraEra))
forall t. (forall s. Decoder s t) -> Decode (Closed Dense) t
D (Decoder s (AlonzoTxAuxData DijkstraEra)
-> Decoder s (StrictMaybe (AlonzoTxAuxData DijkstraEra))
forall s a. Decoder s a -> Decoder s (StrictMaybe a)
decodeNullStrictMaybe Decoder s (AlonzoTxAuxData DijkstraEra)
forall s. Decoder s (AlonzoTxAuxData DijkstraEra)
forall a s. DecCBOR a => Decoder s a
decCBOR)
  {-# INLINE decCBOR #-}

deriving newtype instance Typeable l => DecCBOR (Tx l DijkstraEra)