{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE EmptyDataDeriving #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Cardano.Ledger.Alonzo.Data
( Data (Data),
DataHash,
hashData,
getPlutusData,
dataHashSize,
BinaryData,
hashBinaryData,
makeBinaryData,
binaryDataToData,
dataToBinaryData,
decodeBinaryData,
Datum (..),
datumDataHash,
AuxiliaryData (AuxiliaryData, AuxiliaryData', scripts, txMD),
AuxiliaryDataHash (..),
)
where
import Cardano.Binary
( DecoderError (..),
FromCBOR (..),
ToCBOR (..),
TokenType (..),
decodeAnnotator,
decodeNestedCborBytes,
encodeTag,
peekTokenType,
withSlice,
)
import Cardano.Ledger.Alonzo.Language (Language (..))
import Cardano.Ledger.Alonzo.Scripts (Script (..))
import Cardano.Ledger.AuxiliaryData (AuxiliaryDataHash (..))
import Cardano.Ledger.BaseTypes (StrictMaybe (..))
import qualified Cardano.Ledger.Core as Core
import qualified Cardano.Ledger.Crypto as CC
import Cardano.Ledger.Era (Crypto, Era)
import Cardano.Ledger.Hashes (DataHash, EraIndependentAuxiliaryData, EraIndependentData)
import Cardano.Ledger.SafeHash
( HashAnnotated,
SafeToHash (..),
hashAnnotated,
)
import Cardano.Ledger.Serialization (mapFromCBOR)
import Cardano.Ledger.Shelley.Metadata (Metadatum)
import Cardano.Prelude (HeapWords (..), heapWords0, heapWords1)
import qualified Codec.Serialise as Cborg (Serialise (..))
import Control.DeepSeq (NFData)
import Data.ByteString.Lazy (fromStrict, toStrict)
import Data.ByteString.Short (ShortByteString, fromShort, toShort)
import Data.Coders
import Data.Foldable (foldl')
import Data.Map (Map)
import Data.Maybe (mapMaybe)
import Data.MemoBytes (Mem, MemoBytes (..), memoBytes)
import Data.Sequence.Strict (StrictSeq)
import qualified Data.Sequence.Strict as StrictSeq
import Data.Typeable (Typeable)
import Data.Word (Word64)
import GHC.Generics (Generic)
import NoThunks.Class (InspectHeapNamed (..), NoThunks)
import qualified Plutus.V1.Ledger.Api as Plutus
instance FromCBOR (Annotator Plutus.Data) where
fromCBOR :: Decoder s (Annotator Data)
fromCBOR = Data -> Annotator Data
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Data -> Annotator Data)
-> Decoder s Data -> Decoder s (Annotator Data)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s Data
forall a s. Serialise a => Decoder s a
Cborg.decode
instance ToCBOR Plutus.Data where
toCBOR :: Data -> Encoding
toCBOR = Data -> Encoding
forall a. Serialise a => a -> Encoding
Cborg.encode
deriving instance NoThunks Plutus.Data
newtype Data era = DataConstr (MemoBytes Plutus.Data)
deriving (Data era -> Data era -> Bool
(Data era -> Data era -> Bool)
-> (Data era -> Data era -> Bool) -> Eq (Data era)
forall era. Data era -> Data era -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Data era -> Data era -> Bool
$c/= :: forall era. Data era -> Data era -> Bool
== :: Data era -> Data era -> Bool
$c== :: forall era. Data era -> Data era -> Bool
Eq, Eq (Data era)
Eq (Data era)
-> (Data era -> Data era -> Ordering)
-> (Data era -> Data era -> Bool)
-> (Data era -> Data era -> Bool)
-> (Data era -> Data era -> Bool)
-> (Data era -> Data era -> Bool)
-> (Data era -> Data era -> Data era)
-> (Data era -> Data era -> Data era)
-> Ord (Data era)
Data era -> Data era -> Bool
Data era -> Data era -> Ordering
Data era -> Data era -> Data era
forall era. Eq (Data era)
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall era. Data era -> Data era -> Bool
forall era. Data era -> Data era -> Ordering
forall era. Data era -> Data era -> Data era
min :: Data era -> Data era -> Data era
$cmin :: forall era. Data era -> Data era -> Data era
max :: Data era -> Data era -> Data era
$cmax :: forall era. Data era -> Data era -> Data era
>= :: Data era -> Data era -> Bool
$c>= :: forall era. Data era -> Data era -> Bool
> :: Data era -> Data era -> Bool
$c> :: forall era. Data era -> Data era -> Bool
<= :: Data era -> Data era -> Bool
$c<= :: forall era. Data era -> Data era -> Bool
< :: Data era -> Data era -> Bool
$c< :: forall era. Data era -> Data era -> Bool
compare :: Data era -> Data era -> Ordering
$ccompare :: forall era. Data era -> Data era -> Ordering
$cp1Ord :: forall era. Eq (Data era)
Ord, (forall x. Data era -> Rep (Data era) x)
-> (forall x. Rep (Data era) x -> Data era) -> Generic (Data era)
forall x. Rep (Data era) x -> Data era
forall x. Data era -> Rep (Data era) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall era x. Rep (Data era) x -> Data era
forall era x. Data era -> Rep (Data era) x
$cto :: forall era x. Rep (Data era) x -> Data era
$cfrom :: forall era x. Data era -> Rep (Data era) x
Generic, Int -> Data era -> ShowS
[Data era] -> ShowS
Data era -> String
(Int -> Data era -> ShowS)
-> (Data era -> String) -> ([Data era] -> ShowS) -> Show (Data era)
forall era. Int -> Data era -> ShowS
forall era. [Data era] -> ShowS
forall era. Data era -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Data era] -> ShowS
$cshowList :: forall era. [Data era] -> ShowS
show :: Data era -> String
$cshow :: forall era. Data era -> String
showsPrec :: Int -> Data era -> ShowS
$cshowsPrec :: forall era. Int -> Data era -> ShowS
Show)
deriving newtype (Proxy c -> Proxy index -> Data era -> SafeHash c index
Data era -> ByteString
(Data era -> ByteString)
-> (forall c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> Data era -> SafeHash c index)
-> SafeToHash (Data era)
forall era. Data era -> ByteString
forall t.
(t -> ByteString)
-> (forall c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> t -> SafeHash c index)
-> SafeToHash t
forall c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> Data era -> SafeHash c index
forall era c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> Data era -> SafeHash c index
makeHashWithExplicitProxys :: Proxy c -> Proxy index -> Data era -> SafeHash c index
$cmakeHashWithExplicitProxys :: forall era c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> Data era -> SafeHash c index
originalBytes :: Data era -> ByteString
$coriginalBytes :: forall era. Data era -> ByteString
SafeToHash, Typeable (Data era)
Typeable (Data era)
-> (Data era -> Encoding)
-> ((forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (Data era) -> Size)
-> ((forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [Data era] -> Size)
-> ToCBOR (Data era)
Data era -> Encoding
(forall t. ToCBOR t => Proxy t -> Size) -> Proxy [Data era] -> Size
(forall t. ToCBOR t => Proxy t -> Size) -> Proxy (Data era) -> Size
forall era. Typeable era => Typeable (Data era)
forall era. Typeable era => Data era -> Encoding
forall a.
Typeable a
-> (a -> Encoding)
-> ((forall t. ToCBOR t => Proxy t -> Size) -> Proxy a -> Size)
-> ((forall t. ToCBOR t => Proxy t -> Size) -> Proxy [a] -> Size)
-> ToCBOR a
forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size) -> Proxy [Data era] -> Size
forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size) -> Proxy (Data era) -> Size
encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [Data era] -> Size
$cencodedListSizeExpr :: forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size) -> Proxy [Data era] -> Size
encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (Data era) -> Size
$cencodedSizeExpr :: forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size) -> Proxy (Data era) -> Size
toCBOR :: Data era -> Encoding
$ctoCBOR :: forall era. Typeable era => Data era -> Encoding
$cp1ToCBOR :: forall era. Typeable era => Typeable (Data era)
ToCBOR, Data era -> ()
(Data era -> ()) -> NFData (Data era)
forall era. Data era -> ()
forall a. (a -> ()) -> NFData a
rnf :: Data era -> ()
$crnf :: forall era. Data era -> ()
NFData)
instance Typeable era => FromCBOR (Annotator (Data era)) where
fromCBOR :: Decoder s (Annotator (Data era))
fromCBOR = do
(Annotator FullByteString -> Data
getT, Annotator FullByteString -> LByteString
getBytes) <- Decoder s (Annotator Data)
-> Decoder s (Annotator Data, Annotator LByteString)
forall s a. Decoder s a -> Decoder s (a, Annotator LByteString)
withSlice Decoder s (Annotator Data)
forall a s. FromCBOR a => Decoder s a
fromCBOR
Annotator (Data era) -> Decoder s (Annotator (Data era))
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((FullByteString -> Data era) -> Annotator (Data era)
forall a. (FullByteString -> a) -> Annotator a
Annotator (\FullByteString
fullbytes -> MemoBytes Data -> Data era
forall era. MemoBytes Data -> Data era
DataConstr (Data -> ShortByteString -> MemoBytes Data
forall t. t -> ShortByteString -> MemoBytes t
Memo (FullByteString -> Data
getT FullByteString
fullbytes) (ByteString -> ShortByteString
toShort (LByteString -> ByteString
toStrict (FullByteString -> LByteString
getBytes FullByteString
fullbytes))))))
instance (Crypto era ~ c) => HashAnnotated (Data era) EraIndependentData c
instance NoThunks (Data era)
pattern Data :: Plutus.Data -> Data era
pattern $bData :: Data -> Data era
$mData :: forall r era. Data era -> (Data -> r) -> (Void# -> r) -> r
Data p <-
DataConstr (Memo p _)
where
Data Data
p = MemoBytes Data -> Data era
forall era. MemoBytes Data -> Data era
DataConstr (Encode ('Closed 'Dense) Data -> MemoBytes Data
forall (w :: Wrapped) t. Encode w t -> MemoBytes t
memoBytes (Data -> Encode ('Closed 'Dense) Data
forall t. ToCBOR t => t -> Encode ('Closed 'Dense) t
To Data
p))
{-# COMPLETE Data #-}
getPlutusData :: Data era -> Plutus.Data
getPlutusData :: Data era -> Data
getPlutusData (DataConstr (Memo Data
d ShortByteString
_)) = Data
d
newtype BinaryData era = BinaryData ShortByteString
deriving newtype (BinaryData era -> BinaryData era -> Bool
(BinaryData era -> BinaryData era -> Bool)
-> (BinaryData era -> BinaryData era -> Bool)
-> Eq (BinaryData era)
forall era. BinaryData era -> BinaryData era -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BinaryData era -> BinaryData era -> Bool
$c/= :: forall era. BinaryData era -> BinaryData era -> Bool
== :: BinaryData era -> BinaryData era -> Bool
$c== :: forall era. BinaryData era -> BinaryData era -> Bool
Eq, Eq (BinaryData era)
Eq (BinaryData era)
-> (BinaryData era -> BinaryData era -> Ordering)
-> (BinaryData era -> BinaryData era -> Bool)
-> (BinaryData era -> BinaryData era -> Bool)
-> (BinaryData era -> BinaryData era -> Bool)
-> (BinaryData era -> BinaryData era -> Bool)
-> (BinaryData era -> BinaryData era -> BinaryData era)
-> (BinaryData era -> BinaryData era -> BinaryData era)
-> Ord (BinaryData era)
BinaryData era -> BinaryData era -> Bool
BinaryData era -> BinaryData era -> Ordering
BinaryData era -> BinaryData era -> BinaryData era
forall era. Eq (BinaryData era)
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall era. BinaryData era -> BinaryData era -> Bool
forall era. BinaryData era -> BinaryData era -> Ordering
forall era. BinaryData era -> BinaryData era -> BinaryData era
min :: BinaryData era -> BinaryData era -> BinaryData era
$cmin :: forall era. BinaryData era -> BinaryData era -> BinaryData era
max :: BinaryData era -> BinaryData era -> BinaryData era
$cmax :: forall era. BinaryData era -> BinaryData era -> BinaryData era
>= :: BinaryData era -> BinaryData era -> Bool
$c>= :: forall era. BinaryData era -> BinaryData era -> Bool
> :: BinaryData era -> BinaryData era -> Bool
$c> :: forall era. BinaryData era -> BinaryData era -> Bool
<= :: BinaryData era -> BinaryData era -> Bool
$c<= :: forall era. BinaryData era -> BinaryData era -> Bool
< :: BinaryData era -> BinaryData era -> Bool
$c< :: forall era. BinaryData era -> BinaryData era -> Bool
compare :: BinaryData era -> BinaryData era -> Ordering
$ccompare :: forall era. BinaryData era -> BinaryData era -> Ordering
$cp1Ord :: forall era. Eq (BinaryData era)
Ord, Int -> BinaryData era -> ShowS
[BinaryData era] -> ShowS
BinaryData era -> String
(Int -> BinaryData era -> ShowS)
-> (BinaryData era -> String)
-> ([BinaryData era] -> ShowS)
-> Show (BinaryData era)
forall era. Int -> BinaryData era -> ShowS
forall era. [BinaryData era] -> ShowS
forall era. BinaryData era -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BinaryData era] -> ShowS
$cshowList :: forall era. [BinaryData era] -> ShowS
show :: BinaryData era -> String
$cshow :: forall era. BinaryData era -> String
showsPrec :: Int -> BinaryData era -> ShowS
$cshowsPrec :: forall era. Int -> BinaryData era -> ShowS
Show, Proxy c -> Proxy index -> BinaryData era -> SafeHash c index
BinaryData era -> ByteString
(BinaryData era -> ByteString)
-> (forall c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> BinaryData era -> SafeHash c index)
-> SafeToHash (BinaryData era)
forall era. BinaryData era -> ByteString
forall t.
(t -> ByteString)
-> (forall c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> t -> SafeHash c index)
-> SafeToHash t
forall c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> BinaryData era -> SafeHash c index
forall era c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> BinaryData era -> SafeHash c index
makeHashWithExplicitProxys :: Proxy c -> Proxy index -> BinaryData era -> SafeHash c index
$cmakeHashWithExplicitProxys :: forall era c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> BinaryData era -> SafeHash c index
originalBytes :: BinaryData era -> ByteString
$coriginalBytes :: forall era. BinaryData era -> ByteString
SafeToHash)
instance (Crypto era ~ c) => HashAnnotated (BinaryData era) EraIndependentData c
instance Typeable era => ToCBOR (BinaryData era) where
toCBOR :: BinaryData era -> Encoding
toCBOR (BinaryData ShortByteString
sbs) = Word -> Encoding
encodeTag Word
24 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> ShortByteString -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR ShortByteString
sbs
instance Typeable era => FromCBOR (BinaryData era) where
fromCBOR :: Decoder s (BinaryData era)
fromCBOR = do
ByteString
bs <- Decoder s ByteString
forall s. Decoder s ByteString
decodeNestedCborBytes
(String -> Decoder s (BinaryData era))
-> (BinaryData era -> Decoder s (BinaryData era))
-> Either String (BinaryData era)
-> Decoder s (BinaryData era)
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either String -> Decoder s (BinaryData era)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail BinaryData era -> Decoder s (BinaryData era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Either String (BinaryData era) -> Decoder s (BinaryData era))
-> Either String (BinaryData era) -> Decoder s (BinaryData era)
forall a b. (a -> b) -> a -> b
$! ShortByteString -> Either String (BinaryData era)
forall era. ShortByteString -> Either String (BinaryData era)
makeBinaryData (ByteString -> ShortByteString
toShort ByteString
bs)
makeBinaryData :: ShortByteString -> Either String (BinaryData era)
makeBinaryData :: ShortByteString -> Either String (BinaryData era)
makeBinaryData ShortByteString
sbs = do
let binaryData :: BinaryData era
binaryData = ShortByteString -> BinaryData era
forall era. ShortByteString -> BinaryData era
BinaryData ShortByteString
sbs
case BinaryData era -> Either DecoderError (Data era)
forall era. BinaryData era -> Either DecoderError (Data era)
decodeBinaryData BinaryData era
binaryData of
Left DecoderError
e -> String -> Either String (BinaryData era)
forall a b. a -> Either a b
Left (String -> Either String (BinaryData era))
-> String -> Either String (BinaryData era)
forall a b. (a -> b) -> a -> b
$ String
"Invalid CBOR for Data: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> DecoderError -> String
forall a. Show a => a -> String
show DecoderError
e
Right Data era
_d -> BinaryData era -> Either String (BinaryData era)
forall a b. b -> Either a b
Right BinaryData era
binaryData
decodeBinaryData :: BinaryData era -> Either DecoderError (Data era)
decodeBinaryData :: BinaryData era -> Either DecoderError (Data era)
decodeBinaryData (BinaryData ShortByteString
sbs) = do
Data
plutusData <- Text
-> (forall s. Decoder s (Annotator Data))
-> LByteString
-> Either DecoderError Data
forall a.
Text
-> (forall s. Decoder s (Annotator a))
-> LByteString
-> Either DecoderError a
decodeAnnotator Text
"Data" forall s. Decoder s (Annotator Data)
forall a s. FromCBOR a => Decoder s a
fromCBOR (ByteString -> LByteString
fromStrict (ShortByteString -> ByteString
fromShort ShortByteString
sbs))
Data era -> Either DecoderError (Data era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MemoBytes Data -> Data era
forall era. MemoBytes Data -> Data era
DataConstr (Data -> ShortByteString -> MemoBytes Data
forall t. t -> ShortByteString -> MemoBytes t
Memo Data
plutusData ShortByteString
sbs))
binaryDataToData :: BinaryData era -> Data era
binaryDataToData :: BinaryData era -> Data era
binaryDataToData BinaryData era
binaryData =
case BinaryData era -> Either DecoderError (Data era)
forall era. BinaryData era -> Either DecoderError (Data era)
decodeBinaryData BinaryData era
binaryData of
Left DecoderError
errMsg ->
String -> Data era
forall a. HasCallStack => String -> a
error (String -> Data era) -> String -> Data era
forall a b. (a -> b) -> a -> b
$ String
"Impossible: incorrectly encoded data: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ DecoderError -> String
forall a. Show a => a -> String
show DecoderError
errMsg
Right Data era
d -> Data era
d
dataToBinaryData :: Data era -> BinaryData era
dataToBinaryData :: Data era -> BinaryData era
dataToBinaryData (DataConstr (Memo Data
_ ShortByteString
sbs)) = ShortByteString -> BinaryData era
forall era. ShortByteString -> BinaryData era
BinaryData ShortByteString
sbs
hashBinaryData :: Era era => BinaryData era -> DataHash (Crypto era)
hashBinaryData :: BinaryData era -> DataHash (Crypto era)
hashBinaryData = BinaryData era -> DataHash (Crypto era)
forall c i x.
(HasAlgorithm c, HashAnnotated x i c) =>
x -> SafeHash c i
hashAnnotated
hashData :: Era era => Data era -> DataHash (Crypto era)
hashData :: Data era -> DataHash (Crypto era)
hashData = Data era -> DataHash (Crypto era)
forall c i x.
(HasAlgorithm c, HashAnnotated x i c) =>
x -> SafeHash c i
hashAnnotated
dataHashSize :: StrictMaybe (DataHash c) -> Integer
dataHashSize :: StrictMaybe (DataHash c) -> Integer
dataHashSize StrictMaybe (DataHash c)
SNothing = Integer
0
dataHashSize (SJust DataHash c
_) = Integer
10
instance (CC.Crypto c) => HeapWords (StrictMaybe (DataHash c)) where
heapWords :: StrictMaybe (DataHash c) -> Int
heapWords StrictMaybe (DataHash c)
SNothing = Int
heapWords0
heapWords (SJust DataHash c
a) = DataHash c -> Int
forall a. HeapWords a => a -> Int
heapWords1 DataHash c
a
data Datum era
= NoDatum
| DatumHash !(DataHash (Crypto era))
| Datum !(BinaryData era)
deriving (Datum era -> Datum era -> Bool
(Datum era -> Datum era -> Bool)
-> (Datum era -> Datum era -> Bool) -> Eq (Datum era)
forall era. Datum era -> Datum era -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Datum era -> Datum era -> Bool
$c/= :: forall era. Datum era -> Datum era -> Bool
== :: Datum era -> Datum era -> Bool
$c== :: forall era. Datum era -> Datum era -> Bool
Eq, Eq (Datum era)
Eq (Datum era)
-> (Datum era -> Datum era -> Ordering)
-> (Datum era -> Datum era -> Bool)
-> (Datum era -> Datum era -> Bool)
-> (Datum era -> Datum era -> Bool)
-> (Datum era -> Datum era -> Bool)
-> (Datum era -> Datum era -> Datum era)
-> (Datum era -> Datum era -> Datum era)
-> Ord (Datum era)
Datum era -> Datum era -> Bool
Datum era -> Datum era -> Ordering
Datum era -> Datum era -> Datum era
forall era. Eq (Datum era)
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall era. Datum era -> Datum era -> Bool
forall era. Datum era -> Datum era -> Ordering
forall era. Datum era -> Datum era -> Datum era
min :: Datum era -> Datum era -> Datum era
$cmin :: forall era. Datum era -> Datum era -> Datum era
max :: Datum era -> Datum era -> Datum era
$cmax :: forall era. Datum era -> Datum era -> Datum era
>= :: Datum era -> Datum era -> Bool
$c>= :: forall era. Datum era -> Datum era -> Bool
> :: Datum era -> Datum era -> Bool
$c> :: forall era. Datum era -> Datum era -> Bool
<= :: Datum era -> Datum era -> Bool
$c<= :: forall era. Datum era -> Datum era -> Bool
< :: Datum era -> Datum era -> Bool
$c< :: forall era. Datum era -> Datum era -> Bool
compare :: Datum era -> Datum era -> Ordering
$ccompare :: forall era. Datum era -> Datum era -> Ordering
$cp1Ord :: forall era. Eq (Datum era)
Ord, Int -> Datum era -> ShowS
[Datum era] -> ShowS
Datum era -> String
(Int -> Datum era -> ShowS)
-> (Datum era -> String)
-> ([Datum era] -> ShowS)
-> Show (Datum era)
forall era. Int -> Datum era -> ShowS
forall era. [Datum era] -> ShowS
forall era. Datum era -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Datum era] -> ShowS
$cshowList :: forall era. [Datum era] -> ShowS
show :: Datum era -> String
$cshow :: forall era. Datum era -> String
showsPrec :: Int -> Datum era -> ShowS
$cshowsPrec :: forall era. Int -> Datum era -> ShowS
Show)
instance Era era => ToCBOR (Datum era) where
toCBOR :: Datum era -> Encoding
toCBOR Datum era
d = Encode 'Open (Datum era) -> Encoding
forall (w :: Wrapped) t. Encode w t -> Encoding
encode (Encode 'Open (Datum era) -> Encoding)
-> Encode 'Open (Datum era) -> Encoding
forall a b. (a -> b) -> a -> b
$ case Datum era
d of
DatumHash DataHash (Crypto era)
dh -> (DataHash (Crypto era) -> Datum era)
-> Word -> Encode 'Open (DataHash (Crypto era) -> Datum era)
forall t. t -> Word -> Encode 'Open t
Sum DataHash (Crypto era) -> Datum era
forall era. DataHash (Crypto era) -> Datum era
DatumHash Word
0 Encode 'Open (DataHash (Crypto era) -> Datum era)
-> Encode ('Closed 'Dense) (DataHash (Crypto era))
-> Encode 'Open (Datum era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> DataHash (Crypto era)
-> Encode ('Closed 'Dense) (DataHash (Crypto era))
forall t. ToCBOR t => t -> Encode ('Closed 'Dense) t
To DataHash (Crypto era)
dh
Datum BinaryData era
d' -> (BinaryData era -> Datum era)
-> Word -> Encode 'Open (BinaryData era -> Datum era)
forall t. t -> Word -> Encode 'Open t
Sum BinaryData era -> Datum era
forall era. BinaryData era -> Datum era
Datum Word
1 Encode 'Open (BinaryData era -> Datum era)
-> Encode ('Closed 'Dense) (BinaryData era)
-> Encode 'Open (Datum era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> BinaryData era -> Encode ('Closed 'Dense) (BinaryData era)
forall t. ToCBOR t => t -> Encode ('Closed 'Dense) t
To BinaryData era
d'
Datum era
NoDatum -> Datum era -> Encode 'Open (Datum era)
forall t (w :: Wrapped). t -> Encode w t
OmitC Datum era
forall era. Datum era
NoDatum
instance Era era => FromCBOR (Datum era) where
fromCBOR :: Decoder s (Datum era)
fromCBOR = Decode ('Closed 'Dense) (Datum era) -> Decoder s (Datum era)
forall (w :: Wrapped) t s. Decode w t -> Decoder s t
decode (String
-> (Word -> Decode 'Open (Datum era))
-> Decode ('Closed 'Dense) (Datum era)
forall t.
String -> (Word -> Decode 'Open t) -> Decode ('Closed 'Dense) t
Summands String
"Datum" Word -> Decode 'Open (Datum era)
forall era.
(Crypto (Crypto era), Typeable era) =>
Word -> Decode 'Open (Datum era)
decodeDatum)
where
decodeDatum :: Word -> Decode 'Open (Datum era)
decodeDatum Word
0 = (DataHash (Crypto era) -> Datum era)
-> Decode 'Open (DataHash (Crypto era) -> Datum era)
forall t. t -> Decode 'Open t
SumD DataHash (Crypto era) -> Datum era
forall era. DataHash (Crypto era) -> Datum era
DatumHash Decode 'Open (DataHash (Crypto era) -> Datum era)
-> Decode ('Closed Any) (DataHash (Crypto era))
-> Decode 'Open (Datum era)
forall (w1 :: Wrapped) a t (w :: Density).
Decode w1 (a -> t) -> Decode ('Closed w) a -> Decode w1 t
<! Decode ('Closed Any) (DataHash (Crypto era))
forall t (w :: Wrapped). FromCBOR t => Decode w t
From
decodeDatum Word
1 = (BinaryData era -> Datum era)
-> Decode 'Open (BinaryData era -> Datum era)
forall t. t -> Decode 'Open t
SumD BinaryData era -> Datum era
forall era. BinaryData era -> Datum era
Datum Decode 'Open (BinaryData era -> Datum era)
-> Decode ('Closed Any) (BinaryData era)
-> Decode 'Open (Datum era)
forall (w1 :: Wrapped) a t (w :: Density).
Decode w1 (a -> t) -> Decode ('Closed w) a -> Decode w1 t
<! Decode ('Closed Any) (BinaryData era)
forall t (w :: Wrapped). FromCBOR t => Decode w t
From
decodeDatum Word
k = Word -> Decode 'Open (Datum era)
forall (w :: Wrapped) t. Word -> Decode w t
Invalid Word
k
datumDataHash :: Era era => Datum era -> StrictMaybe (DataHash (Crypto era))
datumDataHash :: Datum era -> StrictMaybe (DataHash (Crypto era))
datumDataHash = \case
Datum era
NoDatum -> StrictMaybe (DataHash (Crypto era))
forall a. StrictMaybe a
SNothing
DatumHash DataHash (Crypto era)
dh -> DataHash (Crypto era) -> StrictMaybe (DataHash (Crypto era))
forall a. a -> StrictMaybe a
SJust DataHash (Crypto era)
dh
Datum BinaryData era
bd -> DataHash (Crypto era) -> StrictMaybe (DataHash (Crypto era))
forall a. a -> StrictMaybe a
SJust (BinaryData era -> DataHash (Crypto era)
forall era. Era era => BinaryData era -> DataHash (Crypto era)
hashBinaryData BinaryData era
bd)
data AuxiliaryDataRaw era = AuxiliaryDataRaw
{ AuxiliaryDataRaw era -> Map Word64 Metadatum
txMD' :: !(Map Word64 Metadatum),
AuxiliaryDataRaw era -> StrictSeq (Script era)
scripts' :: !(StrictSeq (Core.Script era))
}
deriving ((forall x. AuxiliaryDataRaw era -> Rep (AuxiliaryDataRaw era) x)
-> (forall x. Rep (AuxiliaryDataRaw era) x -> AuxiliaryDataRaw era)
-> Generic (AuxiliaryDataRaw era)
forall x. Rep (AuxiliaryDataRaw era) x -> AuxiliaryDataRaw era
forall x. AuxiliaryDataRaw era -> Rep (AuxiliaryDataRaw era) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall era x. Rep (AuxiliaryDataRaw era) x -> AuxiliaryDataRaw era
forall era x. AuxiliaryDataRaw era -> Rep (AuxiliaryDataRaw era) x
$cto :: forall era x. Rep (AuxiliaryDataRaw era) x -> AuxiliaryDataRaw era
$cfrom :: forall era x. AuxiliaryDataRaw era -> Rep (AuxiliaryDataRaw era) x
Generic)
deriving instance Eq (Core.Script era) => Eq (AuxiliaryDataRaw era)
deriving instance Show (Core.Script era) => Show (AuxiliaryDataRaw era)
instance NFData (Core.Script era) => NFData (AuxiliaryDataRaw era)
deriving via
InspectHeapNamed "AuxiliaryDataRaw" (AuxiliaryDataRaw era)
instance
NoThunks (AuxiliaryDataRaw era)
instance
( Typeable era,
Ord (Core.Script era),
Core.Script era ~ Script era,
ToCBOR (Core.Script era),
Typeable (Crypto era)
) =>
ToCBOR (AuxiliaryDataRaw era)
where
toCBOR :: AuxiliaryDataRaw era -> Encoding
toCBOR (AuxiliaryDataRaw Map Word64 Metadatum
m StrictSeq (Script era)
s) =
Encode ('Closed 'Sparse) (AuxiliaryDataRaw era) -> Encoding
forall (w :: Wrapped) t. Encode w t -> Encoding
encode (Map Word64 Metadatum
-> StrictSeq (Script era)
-> Encode ('Closed 'Sparse) (AuxiliaryDataRaw era)
forall era.
(Script era ~ Script era, Typeable (Crypto era)) =>
Map Word64 Metadatum
-> StrictSeq (Script era)
-> Encode ('Closed 'Sparse) (AuxiliaryDataRaw era)
encodeRaw Map Word64 Metadatum
m StrictSeq (Script era)
s)
encodeRaw ::
( Core.Script era ~ Script era,
Typeable (Crypto era)
) =>
Map Word64 Metadatum ->
StrictSeq (Core.Script era) ->
Encode ('Closed 'Sparse) (AuxiliaryDataRaw era)
encodeRaw :: Map Word64 Metadatum
-> StrictSeq (Script era)
-> Encode ('Closed 'Sparse) (AuxiliaryDataRaw era)
encodeRaw Map Word64 Metadatum
metadata StrictSeq (Script era)
allScripts =
Word
-> Encode ('Closed 'Sparse) (AuxiliaryDataRaw era)
-> Encode ('Closed 'Sparse) (AuxiliaryDataRaw era)
forall (x :: Density) t.
Word -> Encode ('Closed x) t -> Encode ('Closed x) t
Tag Word
259 (Encode ('Closed 'Sparse) (AuxiliaryDataRaw era)
-> Encode ('Closed 'Sparse) (AuxiliaryDataRaw era))
-> Encode ('Closed 'Sparse) (AuxiliaryDataRaw era)
-> Encode ('Closed 'Sparse) (AuxiliaryDataRaw era)
forall a b. (a -> b) -> a -> b
$
(Map Word64 Metadatum
-> [Script era]
-> [Script era]
-> [Script era]
-> AuxiliaryDataRaw era)
-> Encode
('Closed 'Sparse)
(Map Word64 Metadatum
-> [Script era]
-> [Script era]
-> [Script era]
-> AuxiliaryDataRaw era)
forall t. t -> Encode ('Closed 'Sparse) t
Keyed
(\Map Word64 Metadatum
m [Script era]
tss [Script era]
p1 [Script era]
p2 -> Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era
forall era.
Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era
AuxiliaryDataRaw Map Word64 Metadatum
m ([Script era] -> StrictSeq (Script era)
forall a. [a] -> StrictSeq a
StrictSeq.fromList ([Script era] -> StrictSeq (Script era))
-> [Script era] -> StrictSeq (Script era)
forall a b. (a -> b) -> a -> b
$ [Script era]
tss [Script era] -> [Script era] -> [Script era]
forall a. Semigroup a => a -> a -> a
<> [Script era]
p1 [Script era] -> [Script era] -> [Script era]
forall a. Semigroup a => a -> a -> a
<> [Script era]
p2))
Encode
('Closed 'Sparse)
(Map Word64 Metadatum
-> [Script era]
-> [Script era]
-> [Script era]
-> AuxiliaryDataRaw era)
-> Encode ('Closed 'Sparse) (Map Word64 Metadatum)
-> Encode
('Closed 'Sparse)
([Script era]
-> [Script era] -> [Script era] -> AuxiliaryDataRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> (Map Word64 Metadatum -> Bool)
-> Encode ('Closed 'Sparse) (Map Word64 Metadatum)
-> Encode ('Closed 'Sparse) (Map Word64 Metadatum)
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit Map Word64 Metadatum -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Word
-> Encode ('Closed 'Dense) (Map Word64 Metadatum)
-> Encode ('Closed 'Sparse) (Map Word64 Metadatum)
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
0 (Encode ('Closed 'Dense) (Map Word64 Metadatum)
-> Encode ('Closed 'Sparse) (Map Word64 Metadatum))
-> Encode ('Closed 'Dense) (Map Word64 Metadatum)
-> Encode ('Closed 'Sparse) (Map Word64 Metadatum)
forall a b. (a -> b) -> a -> b
$ Map Word64 Metadatum
-> Encode ('Closed 'Dense) (Map Word64 Metadatum)
forall k v.
(ToCBOR k, ToCBOR v) =>
Map k v -> Encode ('Closed 'Dense) (Map k v)
mapEncode Map Word64 Metadatum
metadata)
Encode
('Closed 'Sparse)
([Script era]
-> [Script era] -> [Script era] -> AuxiliaryDataRaw era)
-> Encode ('Closed 'Sparse) [Script era]
-> Encode
('Closed 'Sparse)
([Script era] -> [Script era] -> AuxiliaryDataRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> ([Script era] -> Bool)
-> Encode ('Closed 'Sparse) [Script era]
-> Encode ('Closed 'Sparse) [Script era]
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit [Script era] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Word
-> Encode ('Closed 'Dense) [Script era]
-> Encode ('Closed 'Sparse) [Script era]
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
1 (Encode ('Closed 'Dense) [Script era]
-> Encode ('Closed 'Sparse) [Script era])
-> Encode ('Closed 'Dense) [Script era]
-> Encode ('Closed 'Sparse) [Script era]
forall a b. (a -> b) -> a -> b
$ ([Script era] -> Encoding)
-> [Script era] -> Encode ('Closed 'Dense) [Script era]
forall t. (t -> Encoding) -> t -> Encode ('Closed 'Dense) t
E ([Timelock (Crypto era)] -> Encoding
forall a (f :: * -> *). (ToCBOR a, Foldable f) => f a -> Encoding
encodeFoldable ([Timelock (Crypto era)] -> Encoding)
-> ([Script era] -> [Timelock (Crypto era)])
-> [Script era]
-> Encoding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Script era -> Maybe (Timelock (Crypto era)))
-> [Script era] -> [Timelock (Crypto era)]
forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe Script era -> Maybe (Timelock (Crypto era))
forall era. Script era -> Maybe (Timelock (Crypto era))
getTimelock) [Script era]
timelocks)
Encode
('Closed 'Sparse)
([Script era] -> [Script era] -> AuxiliaryDataRaw era)
-> Encode ('Closed 'Sparse) [Script era]
-> Encode ('Closed 'Sparse) ([Script era] -> AuxiliaryDataRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> ([Script era] -> Bool)
-> Encode ('Closed 'Sparse) [Script era]
-> Encode ('Closed 'Sparse) [Script era]
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit [Script era] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Word
-> Encode ('Closed 'Dense) [Script era]
-> Encode ('Closed 'Sparse) [Script era]
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
2 (Encode ('Closed 'Dense) [Script era]
-> Encode ('Closed 'Sparse) [Script era])
-> Encode ('Closed 'Dense) [Script era]
-> Encode ('Closed 'Sparse) [Script era]
forall a b. (a -> b) -> a -> b
$ ([Script era] -> Encoding)
-> [Script era] -> Encode ('Closed 'Dense) [Script era]
forall t. (t -> Encoding) -> t -> Encode ('Closed 'Dense) t
E ([ShortByteString] -> Encoding
forall a (f :: * -> *). (ToCBOR a, Foldable f) => f a -> Encoding
encodeFoldable ([ShortByteString] -> Encoding)
-> ([Script era] -> [ShortByteString]) -> [Script era] -> Encoding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Script era -> Maybe ShortByteString)
-> [Script era] -> [ShortByteString]
forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe Script era -> Maybe ShortByteString
forall era. Script era -> Maybe ShortByteString
getPlutus) [Script era]
plutusV1Scripts)
Encode ('Closed 'Sparse) ([Script era] -> AuxiliaryDataRaw era)
-> Encode ('Closed 'Sparse) [Script era]
-> Encode ('Closed 'Sparse) (AuxiliaryDataRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> ([Script era] -> Bool)
-> Encode ('Closed 'Sparse) [Script era]
-> Encode ('Closed 'Sparse) [Script era]
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit [Script era] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Word
-> Encode ('Closed 'Dense) [Script era]
-> Encode ('Closed 'Sparse) [Script era]
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
3 (Encode ('Closed 'Dense) [Script era]
-> Encode ('Closed 'Sparse) [Script era])
-> Encode ('Closed 'Dense) [Script era]
-> Encode ('Closed 'Sparse) [Script era]
forall a b. (a -> b) -> a -> b
$ ([Script era] -> Encoding)
-> [Script era] -> Encode ('Closed 'Dense) [Script era]
forall t. (t -> Encoding) -> t -> Encode ('Closed 'Dense) t
E ([ShortByteString] -> Encoding
forall a (f :: * -> *). (ToCBOR a, Foldable f) => f a -> Encoding
encodeFoldable ([ShortByteString] -> Encoding)
-> ([Script era] -> [ShortByteString]) -> [Script era] -> Encoding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Script era -> Maybe ShortByteString)
-> [Script era] -> [ShortByteString]
forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe Script era -> Maybe ShortByteString
forall era. Script era -> Maybe ShortByteString
getPlutus) [Script era]
plutusV2Scripts)
where
getTimelock :: Script era -> Maybe (Timelock (Crypto era))
getTimelock (TimelockScript Timelock (Crypto era)
x) = Timelock (Crypto era) -> Maybe (Timelock (Crypto era))
forall a. a -> Maybe a
Just Timelock (Crypto era)
x
getTimelock Script era
_ = Maybe (Timelock (Crypto era))
forall a. Maybe a
Nothing
getPlutus :: Script era -> Maybe ShortByteString
getPlutus (PlutusScript Language
_ ShortByteString
x) = ShortByteString -> Maybe ShortByteString
forall a. a -> Maybe a
Just ShortByteString
x
getPlutus Script era
_ = Maybe ShortByteString
forall a. Maybe a
Nothing
sortScripts :: ([Script era], [Script era], [Script era])
-> Script era -> ([Script era], [Script era], [Script era])
sortScripts ([Script era]
ts, [Script era]
v1, [Script era]
v2) s :: Script era
s@(TimelockScript Timelock (Crypto era)
_) = (Script era
s Script era -> [Script era] -> [Script era]
forall a. a -> [a] -> [a]
: [Script era]
ts, [Script era]
v1, [Script era]
v2)
sortScripts ([Script era]
ts, [Script era]
v1, [Script era]
v2) s :: Script era
s@(PlutusScript Language
PlutusV1 ShortByteString
_) = ([Script era]
ts, Script era
s Script era -> [Script era] -> [Script era]
forall a. a -> [a] -> [a]
: [Script era]
v1, [Script era]
v2)
sortScripts ([Script era]
ts, [Script era]
v1, [Script era]
v2) s :: Script era
s@(PlutusScript Language
PlutusV2 ShortByteString
_) = ([Script era]
ts, [Script era]
v1, Script era
s Script era -> [Script era] -> [Script era]
forall a. a -> [a] -> [a]
: [Script era]
v2)
([Script era]
timelocks, [Script era]
plutusV1Scripts, [Script era]
plutusV2Scripts) =
(([Script era], [Script era], [Script era])
-> Script era -> ([Script era], [Script era], [Script era]))
-> ([Script era], [Script era], [Script era])
-> StrictSeq (Script era)
-> ([Script era], [Script era], [Script era])
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' ([Script era], [Script era], [Script era])
-> Script era -> ([Script era], [Script era], [Script era])
forall era.
([Script era], [Script era], [Script era])
-> Script era -> ([Script era], [Script era], [Script era])
sortScripts ([Script era]
forall a. Monoid a => a
mempty, [Script era]
forall a. Monoid a => a
mempty, [Script era]
forall a. Monoid a => a
mempty) StrictSeq (Script era)
StrictSeq (Script era)
allScripts
instance
( Era era,
Ord (Core.Script era),
FromCBOR (Annotator (Core.Script era)),
Core.Script era ~ Script era
) =>
FromCBOR (Annotator (AuxiliaryDataRaw era))
where
fromCBOR :: Decoder s (Annotator (AuxiliaryDataRaw era))
fromCBOR =
Decoder s TokenType
forall s. Decoder s TokenType
peekTokenType Decoder s TokenType
-> (TokenType -> Decoder s (Annotator (AuxiliaryDataRaw era)))
-> Decoder s (Annotator (AuxiliaryDataRaw era))
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
TokenType
TypeMapLen -> Decoder s (Annotator (AuxiliaryDataRaw era))
forall s era. Decoder s (Annotator (AuxiliaryDataRaw era))
decodeShelley
TokenType
TypeMapLen64 -> Decoder s (Annotator (AuxiliaryDataRaw era))
forall s era. Decoder s (Annotator (AuxiliaryDataRaw era))
decodeShelley
TokenType
TypeMapLenIndef -> Decoder s (Annotator (AuxiliaryDataRaw era))
forall s era. Decoder s (Annotator (AuxiliaryDataRaw era))
decodeShelley
TokenType
TypeListLen -> Decoder s (Annotator (AuxiliaryDataRaw era))
forall s. Decoder s (Annotator (AuxiliaryDataRaw era))
decodeShelleyMA
TokenType
TypeListLen64 -> Decoder s (Annotator (AuxiliaryDataRaw era))
forall s. Decoder s (Annotator (AuxiliaryDataRaw era))
decodeShelleyMA
TokenType
TypeListLenIndef -> Decoder s (Annotator (AuxiliaryDataRaw era))
forall s. Decoder s (Annotator (AuxiliaryDataRaw era))
decodeShelleyMA
TokenType
TypeTag -> Decoder s (Annotator (AuxiliaryDataRaw era))
decodeAlonzo
TokenType
TypeTag64 -> Decoder s (Annotator (AuxiliaryDataRaw era))
decodeAlonzo
TokenType
_ -> String -> Decoder s (Annotator (AuxiliaryDataRaw era))
forall a. HasCallStack => String -> a
error String
"Failed to decode AuxiliaryData"
where
decodeShelley :: Decoder s (Annotator (AuxiliaryDataRaw era))
decodeShelley =
Decode Any (Annotator (AuxiliaryDataRaw era))
-> Decoder s (Annotator (AuxiliaryDataRaw era))
forall (w :: Wrapped) t s. Decode w t -> Decoder s t
decode
( Decode
Any
(Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era)
-> Decode
Any
(Annotator
(Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era))
forall (w :: Wrapped) t1. Decode w t1 -> Decode w (Annotator t1)
Ann ((Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era)
-> Decode
Any
(Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era)
forall t (w :: Wrapped). t -> Decode w t
Emit Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era
forall era.
Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era
AuxiliaryDataRaw)
Decode
Any
(Annotator
(Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era))
-> Decode ('Closed 'Dense) (Annotator (Map Word64 Metadatum))
-> Decode
Any (Annotator (StrictSeq (Script era) -> AuxiliaryDataRaw era))
forall (w1 :: Wrapped) a t (d :: Density).
Decode w1 (Annotator (a -> t))
-> Decode ('Closed d) (Annotator a) -> Decode w1 (Annotator t)
<*! Decode ('Closed 'Dense) (Map Word64 Metadatum)
-> Decode ('Closed 'Dense) (Annotator (Map Word64 Metadatum))
forall (w :: Wrapped) t1. Decode w t1 -> Decode w (Annotator t1)
Ann ((forall s. Decoder s (Map Word64 Metadatum))
-> Decode ('Closed 'Dense) (Map Word64 Metadatum)
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D forall s. Decoder s (Map Word64 Metadatum)
forall a b s.
(Ord a, FromCBOR a, FromCBOR b) =>
Decoder s (Map a b)
mapFromCBOR)
Decode
Any (Annotator (StrictSeq (Script era) -> AuxiliaryDataRaw era))
-> Decode ('Closed Any) (Annotator (StrictSeq (Script era)))
-> Decode Any (Annotator (AuxiliaryDataRaw era))
forall (w1 :: Wrapped) a t (d :: Density).
Decode w1 (Annotator (a -> t))
-> Decode ('Closed d) (Annotator a) -> Decode w1 (Annotator t)
<*! Decode ('Closed Any) (StrictSeq (Script era))
-> Decode ('Closed Any) (Annotator (StrictSeq (Script era)))
forall (w :: Wrapped) t1. Decode w t1 -> Decode w (Annotator t1)
Ann (StrictSeq (Script era)
-> Decode ('Closed Any) (StrictSeq (Script era))
forall t (w :: Wrapped). t -> Decode w t
Emit StrictSeq (Script era)
forall a. StrictSeq a
StrictSeq.empty)
)
decodeShelleyMA :: Decoder s (Annotator (AuxiliaryDataRaw era))
decodeShelleyMA =
Decode ('Closed 'Dense) (Annotator (AuxiliaryDataRaw era))
-> Decoder s (Annotator (AuxiliaryDataRaw era))
forall (w :: Wrapped) t s. Decode w t -> Decoder s t
decode
( Decode
('Closed 'Dense)
(Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era)
-> Decode
('Closed 'Dense)
(Annotator
(Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era))
forall (w :: Wrapped) t1. Decode w t1 -> Decode w (Annotator t1)
Ann ((Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era)
-> Decode
('Closed 'Dense)
(Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era)
forall t. t -> Decode ('Closed 'Dense) t
RecD Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era
forall era.
Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era
AuxiliaryDataRaw)
Decode
('Closed 'Dense)
(Annotator
(Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era))
-> Decode ('Closed 'Dense) (Annotator (Map Word64 Metadatum))
-> Decode
('Closed 'Dense)
(Annotator (StrictSeq (Script era) -> AuxiliaryDataRaw era))
forall (w1 :: Wrapped) a t (d :: Density).
Decode w1 (Annotator (a -> t))
-> Decode ('Closed d) (Annotator a) -> Decode w1 (Annotator t)
<*! Decode ('Closed 'Dense) (Map Word64 Metadatum)
-> Decode ('Closed 'Dense) (Annotator (Map Word64 Metadatum))
forall (w :: Wrapped) t1. Decode w t1 -> Decode w (Annotator t1)
Ann ((forall s. Decoder s (Map Word64 Metadatum))
-> Decode ('Closed 'Dense) (Map Word64 Metadatum)
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D forall s. Decoder s (Map Word64 Metadatum)
forall a b s.
(Ord a, FromCBOR a, FromCBOR b) =>
Decoder s (Map a b)
mapFromCBOR)
Decode
('Closed 'Dense)
(Annotator (StrictSeq (Script era) -> AuxiliaryDataRaw era))
-> Decode ('Closed 'Dense) (Annotator (StrictSeq (Script era)))
-> Decode ('Closed 'Dense) (Annotator (AuxiliaryDataRaw era))
forall (w1 :: Wrapped) a t (d :: Density).
Decode w1 (Annotator (a -> t))
-> Decode ('Closed d) (Annotator a) -> Decode w1 (Annotator t)
<*! (forall s. Decoder s (Annotator (StrictSeq (Script era))))
-> Decode ('Closed 'Dense) (Annotator (StrictSeq (Script era)))
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D
( StrictSeq (Annotator (Script era))
-> Annotator (StrictSeq (Script era))
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence
(StrictSeq (Annotator (Script era))
-> Annotator (StrictSeq (Script era)))
-> Decoder s (StrictSeq (Annotator (Script era)))
-> Decoder s (Annotator (StrictSeq (Script era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (Annotator (Script era))
-> Decoder s (StrictSeq (Annotator (Script era)))
forall s a. Decoder s a -> Decoder s (StrictSeq a)
decodeStrictSeq
((Timelock (Crypto era) -> Script era)
-> Annotator (Timelock (Crypto era)) -> Annotator (Script era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Timelock (Crypto era) -> Script era
forall era. Timelock (Crypto era) -> Script era
TimelockScript (Annotator (Timelock (Crypto era)) -> Annotator (Script era))
-> Decoder s (Annotator (Timelock (Crypto era)))
-> Decoder s (Annotator (Script era))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (Annotator (Timelock (Crypto era)))
forall a s. FromCBOR a => Decoder s a
fromCBOR)
)
)
decodeAlonzo :: Decoder s (Annotator (AuxiliaryDataRaw era))
decodeAlonzo =
Decode ('Closed 'Dense) (Annotator (AuxiliaryDataRaw era))
-> Decoder s (Annotator (AuxiliaryDataRaw era))
forall (w :: Wrapped) t s. Decode w t -> Decoder s t
decode (Decode ('Closed 'Dense) (Annotator (AuxiliaryDataRaw era))
-> Decoder s (Annotator (AuxiliaryDataRaw era)))
-> Decode ('Closed 'Dense) (Annotator (AuxiliaryDataRaw era))
-> Decoder s (Annotator (AuxiliaryDataRaw era))
forall a b. (a -> b) -> a -> b
$
Word
-> Decode ('Closed 'Dense) (Annotator (AuxiliaryDataRaw era))
-> Decode ('Closed 'Dense) (Annotator (AuxiliaryDataRaw era))
forall (x :: Density) t.
Word -> Decode ('Closed x) t -> Decode ('Closed x) t
TagD Word
259 (Decode ('Closed 'Dense) (Annotator (AuxiliaryDataRaw era))
-> Decode ('Closed 'Dense) (Annotator (AuxiliaryDataRaw era)))
-> Decode ('Closed 'Dense) (Annotator (AuxiliaryDataRaw era))
-> Decode ('Closed 'Dense) (Annotator (AuxiliaryDataRaw era))
forall a b. (a -> b) -> a -> b
$
String
-> Annotator (AuxiliaryDataRaw era)
-> (Word -> Field (Annotator (AuxiliaryDataRaw era)))
-> [(Word, String)]
-> Decode ('Closed 'Dense) (Annotator (AuxiliaryDataRaw era))
forall t.
Typeable t =>
String
-> t
-> (Word -> Field t)
-> [(Word, String)]
-> Decode ('Closed 'Dense) t
SparseKeyed String
"AuxiliaryData" (AuxiliaryDataRaw era -> Annotator (AuxiliaryDataRaw era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure AuxiliaryDataRaw era
forall era. AuxiliaryDataRaw era
emptyAuxData) Word -> Field (Annotator (AuxiliaryDataRaw era))
auxDataField []
auxDataField :: Word -> Field (Annotator (AuxiliaryDataRaw era))
auxDataField :: Word -> Field (Annotator (AuxiliaryDataRaw era))
auxDataField Word
0 = (Map Word64 Metadatum
-> AuxiliaryDataRaw era -> AuxiliaryDataRaw era)
-> Decode ('Closed 'Dense) (Map Word64 Metadatum)
-> Field (Annotator (AuxiliaryDataRaw era))
forall (ann :: * -> *) x t (d :: Density).
Applicative ann =>
(x -> t -> t) -> Decode ('Closed d) x -> Field (ann t)
fieldA (\Map Word64 Metadatum
x AuxiliaryDataRaw era
ad -> AuxiliaryDataRaw era
ad {txMD' :: Map Word64 Metadatum
txMD' = Map Word64 Metadatum
x}) ((forall s. Decoder s (Map Word64 Metadatum))
-> Decode ('Closed 'Dense) (Map Word64 Metadatum)
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D forall s. Decoder s (Map Word64 Metadatum)
forall a b s.
(Ord a, FromCBOR a, FromCBOR b) =>
Decoder s (Map a b)
mapFromCBOR)
auxDataField Word
1 =
(StrictSeq (Timelock (Crypto era))
-> AuxiliaryDataRaw era -> AuxiliaryDataRaw era)
-> Decode
('Closed 'Dense) (Annotator (StrictSeq (Timelock (Crypto era))))
-> Field (Annotator (AuxiliaryDataRaw era))
forall (ann :: * -> *) x t (d :: Density).
Applicative ann =>
(x -> t -> t) -> Decode ('Closed d) (ann x) -> Field (ann t)
fieldAA
(\StrictSeq (Timelock (Crypto era))
x AuxiliaryDataRaw era
ad -> AuxiliaryDataRaw era
ad {scripts' :: StrictSeq (Script era)
scripts' = AuxiliaryDataRaw era -> StrictSeq (Script era)
forall era. AuxiliaryDataRaw era -> StrictSeq (Script era)
scripts' AuxiliaryDataRaw era
ad StrictSeq (Script era)
-> StrictSeq (Script era) -> StrictSeq (Script era)
forall a. Semigroup a => a -> a -> a
<> (Timelock (Crypto era) -> Script era
forall era. Timelock (Crypto era) -> Script era
TimelockScript (Timelock (Crypto era) -> Script era)
-> StrictSeq (Timelock (Crypto era)) -> StrictSeq (Script era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> StrictSeq (Timelock (Crypto era))
x)})
((forall s.
Decoder s (Annotator (StrictSeq (Timelock (Crypto era)))))
-> Decode
('Closed 'Dense) (Annotator (StrictSeq (Timelock (Crypto era))))
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (StrictSeq (Annotator (Timelock (Crypto era)))
-> Annotator (StrictSeq (Timelock (Crypto era)))
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence (StrictSeq (Annotator (Timelock (Crypto era)))
-> Annotator (StrictSeq (Timelock (Crypto era))))
-> Decoder s (StrictSeq (Annotator (Timelock (Crypto era))))
-> Decoder s (Annotator (StrictSeq (Timelock (Crypto era))))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (Annotator (Timelock (Crypto era)))
-> Decoder s (StrictSeq (Annotator (Timelock (Crypto era))))
forall s a. Decoder s a -> Decoder s (StrictSeq a)
decodeStrictSeq Decoder s (Annotator (Timelock (Crypto era)))
forall a s. FromCBOR a => Decoder s a
fromCBOR))
auxDataField Word
2 =
(StrictSeq ShortByteString
-> AuxiliaryDataRaw era -> AuxiliaryDataRaw era)
-> Decode ('Closed 'Dense) (StrictSeq ShortByteString)
-> Field (Annotator (AuxiliaryDataRaw era))
forall (ann :: * -> *) x t (d :: Density).
Applicative ann =>
(x -> t -> t) -> Decode ('Closed d) x -> Field (ann t)
fieldA
(\StrictSeq ShortByteString
x AuxiliaryDataRaw era
ad -> AuxiliaryDataRaw era
ad {scripts' :: StrictSeq (Script era)
scripts' = AuxiliaryDataRaw era -> StrictSeq (Script era)
forall era. AuxiliaryDataRaw era -> StrictSeq (Script era)
scripts' AuxiliaryDataRaw era
ad StrictSeq (Script era)
-> StrictSeq (Script era) -> StrictSeq (Script era)
forall a. Semigroup a => a -> a -> a
<> (Language -> ShortByteString -> Script era
forall era. Language -> ShortByteString -> Script era
PlutusScript Language
PlutusV1 (ShortByteString -> Script era)
-> StrictSeq ShortByteString -> StrictSeq (Script era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> StrictSeq ShortByteString
x)})
((forall s. Decoder s (StrictSeq ShortByteString))
-> Decode ('Closed 'Dense) (StrictSeq ShortByteString)
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (Decoder s ShortByteString -> Decoder s (StrictSeq ShortByteString)
forall s a. Decoder s a -> Decoder s (StrictSeq a)
decodeStrictSeq Decoder s ShortByteString
forall a s. FromCBOR a => Decoder s a
fromCBOR))
auxDataField Word
3 =
(StrictSeq ShortByteString
-> AuxiliaryDataRaw era -> AuxiliaryDataRaw era)
-> Decode ('Closed 'Dense) (StrictSeq ShortByteString)
-> Field (Annotator (AuxiliaryDataRaw era))
forall (ann :: * -> *) x t (d :: Density).
Applicative ann =>
(x -> t -> t) -> Decode ('Closed d) x -> Field (ann t)
fieldA
(\StrictSeq ShortByteString
x AuxiliaryDataRaw era
ad -> AuxiliaryDataRaw era
ad {scripts' :: StrictSeq (Script era)
scripts' = AuxiliaryDataRaw era -> StrictSeq (Script era)
forall era. AuxiliaryDataRaw era -> StrictSeq (Script era)
scripts' AuxiliaryDataRaw era
ad StrictSeq (Script era)
-> StrictSeq (Script era) -> StrictSeq (Script era)
forall a. Semigroup a => a -> a -> a
<> (Language -> ShortByteString -> Script era
forall era. Language -> ShortByteString -> Script era
PlutusScript Language
PlutusV2 (ShortByteString -> Script era)
-> StrictSeq ShortByteString -> StrictSeq (Script era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> StrictSeq ShortByteString
x)})
((forall s. Decoder s (StrictSeq ShortByteString))
-> Decode ('Closed 'Dense) (StrictSeq ShortByteString)
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (Decoder s ShortByteString -> Decoder s (StrictSeq ShortByteString)
forall s a. Decoder s a -> Decoder s (StrictSeq a)
decodeStrictSeq Decoder s ShortByteString
forall a s. FromCBOR a => Decoder s a
fromCBOR))
auxDataField Word
n = (Any
-> Annotator (AuxiliaryDataRaw era)
-> Annotator (AuxiliaryDataRaw era))
-> Decode ('Closed Any) Any
-> Field (Annotator (AuxiliaryDataRaw era))
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Any
_ Annotator (AuxiliaryDataRaw era)
t -> Annotator (AuxiliaryDataRaw era)
t) (Word -> Decode ('Closed Any) Any
forall (w :: Wrapped) t. Word -> Decode w t
Invalid Word
n)
emptyAuxData :: AuxiliaryDataRaw era
emptyAuxData :: AuxiliaryDataRaw era
emptyAuxData = Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era
forall era.
Map Word64 Metadatum
-> StrictSeq (Script era) -> AuxiliaryDataRaw era
AuxiliaryDataRaw Map Word64 Metadatum
forall a. Monoid a => a
mempty StrictSeq (Script era)
forall a. Monoid a => a
mempty
newtype AuxiliaryData era = AuxiliaryDataConstr (MemoBytes (AuxiliaryDataRaw era))
deriving newtype (Typeable (AuxiliaryData era)
Typeable (AuxiliaryData era)
-> (AuxiliaryData era -> Encoding)
-> ((forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (AuxiliaryData era) -> Size)
-> ((forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [AuxiliaryData era] -> Size)
-> ToCBOR (AuxiliaryData era)
AuxiliaryData era -> Encoding
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [AuxiliaryData era] -> Size
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (AuxiliaryData era) -> Size
forall era. Typeable era => Typeable (AuxiliaryData era)
forall era. Typeable era => AuxiliaryData era -> Encoding
forall a.
Typeable a
-> (a -> Encoding)
-> ((forall t. ToCBOR t => Proxy t -> Size) -> Proxy a -> Size)
-> ((forall t. ToCBOR t => Proxy t -> Size) -> Proxy [a] -> Size)
-> ToCBOR a
forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [AuxiliaryData era] -> Size
forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (AuxiliaryData era) -> Size
encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [AuxiliaryData era] -> Size
$cencodedListSizeExpr :: forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [AuxiliaryData era] -> Size
encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (AuxiliaryData era) -> Size
$cencodedSizeExpr :: forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (AuxiliaryData era) -> Size
toCBOR :: AuxiliaryData era -> Encoding
$ctoCBOR :: forall era. Typeable era => AuxiliaryData era -> Encoding
$cp1ToCBOR :: forall era. Typeable era => Typeable (AuxiliaryData era)
ToCBOR, Proxy c -> Proxy index -> AuxiliaryData era -> SafeHash c index
AuxiliaryData era -> ByteString
(AuxiliaryData era -> ByteString)
-> (forall c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> AuxiliaryData era -> SafeHash c index)
-> SafeToHash (AuxiliaryData era)
forall era. AuxiliaryData era -> ByteString
forall t.
(t -> ByteString)
-> (forall c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> t -> SafeHash c index)
-> SafeToHash t
forall c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> AuxiliaryData era -> SafeHash c index
forall era c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> AuxiliaryData era -> SafeHash c index
makeHashWithExplicitProxys :: Proxy c -> Proxy index -> AuxiliaryData era -> SafeHash c index
$cmakeHashWithExplicitProxys :: forall era c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> AuxiliaryData era -> SafeHash c index
originalBytes :: AuxiliaryData era -> ByteString
$coriginalBytes :: forall era. AuxiliaryData era -> ByteString
SafeToHash)
instance (Crypto era ~ c) => HashAnnotated (AuxiliaryData era) EraIndependentAuxiliaryData c
deriving newtype instance NFData (Core.Script era) => NFData (AuxiliaryData era)
deriving instance Eq (AuxiliaryData era)
deriving instance Show (Core.Script era) => Show (AuxiliaryData era)
deriving via InspectHeapNamed "AuxiliaryDataRaw" (AuxiliaryData era) instance NoThunks (AuxiliaryData era)
deriving via
(Mem (AuxiliaryDataRaw era))
instance
( Era era,
Ord (Core.Script era),
FromCBOR (Annotator (Core.Script era)),
Script era ~ Core.Script era
) =>
FromCBOR (Annotator (AuxiliaryData era))
pattern AuxiliaryData ::
( Era era,
ToCBOR (Core.Script era),
Core.Script era ~ Script era,
Ord (Core.Script era)
) =>
Map Word64 Metadatum ->
StrictSeq (Core.Script era) ->
AuxiliaryData era
pattern $bAuxiliaryData :: Map Word64 Metadatum -> StrictSeq (Script era) -> AuxiliaryData era
$mAuxiliaryData :: forall r era.
(Era era, ToCBOR (Script era), Script era ~ Script era,
Ord (Script era)) =>
AuxiliaryData era
-> (Map Word64 Metadatum -> StrictSeq (Script era) -> r)
-> (Void# -> r)
-> r
AuxiliaryData {AuxiliaryData era
-> (Era era, ToCBOR (Script era), Script era ~ Script era,
Ord (Script era)) =>
Map Word64 Metadatum
txMD, AuxiliaryData era
-> (Era era, ToCBOR (Script era), Script era ~ Script era,
Ord (Script era)) =>
StrictSeq (Script era)
scripts} <-
AuxiliaryDataConstr (Memo (AuxiliaryDataRaw txMD scripts) _)
where
AuxiliaryData Map Word64 Metadatum
m StrictSeq (Script era)
s =
MemoBytes (AuxiliaryDataRaw era) -> AuxiliaryData era
forall era. MemoBytes (AuxiliaryDataRaw era) -> AuxiliaryData era
AuxiliaryDataConstr
( Encode ('Closed 'Sparse) (AuxiliaryDataRaw era)
-> MemoBytes (AuxiliaryDataRaw era)
forall (w :: Wrapped) t. Encode w t -> MemoBytes t
memoBytes
(Map Word64 Metadatum
-> StrictSeq (Script era)
-> Encode ('Closed 'Sparse) (AuxiliaryDataRaw era)
forall era.
(Script era ~ Script era, Typeable (Crypto era)) =>
Map Word64 Metadatum
-> StrictSeq (Script era)
-> Encode ('Closed 'Sparse) (AuxiliaryDataRaw era)
encodeRaw Map Word64 Metadatum
m StrictSeq (Script era)
s)
)
{-# COMPLETE AuxiliaryData #-}
pattern AuxiliaryData' ::
Map Word64 Metadatum ->
StrictSeq (Core.Script era) ->
AuxiliaryData era
pattern $mAuxiliaryData' :: forall r era.
AuxiliaryData era
-> (Map Word64 Metadatum -> StrictSeq (Script era) -> r)
-> (Void# -> r)
-> r
AuxiliaryData' txMD_ scripts_ <-
AuxiliaryDataConstr (Memo (AuxiliaryDataRaw txMD_ scripts_) _)
{-# COMPLETE AuxiliaryData' #-}