{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Cardano.Ledger.Alonzo.TxWitness
( RdmrPtr (..),
Redeemers
( Redeemers,
Redeemers'
),
unRedeemers,
nullRedeemers,
TxDats (TxDats, TxDats'),
TxWitness
( TxWitness,
txwitsVKey,
txwitsBoot,
txscripts,
txdats,
txrdmrs,
TxWitness',
txwitsVKey',
txwitsBoot',
txscripts',
txdats',
txrdmrs'
),
unTxDats,
nullDats,
)
where
import Cardano.Binary
( FromCBOR (..),
ToCBOR (..),
encodeListLen,
serializeEncoding',
)
import Cardano.Crypto.DSIGN.Class (SigDSIGN, VerKeyDSIGN)
import Cardano.Ledger.Alonzo.Data (Data, DataHash, hashData)
import Cardano.Ledger.Alonzo.Language (Language (..))
import Cardano.Ledger.Alonzo.Scripts (ExUnits (..), Script (..), Tag)
import qualified Cardano.Ledger.Core as Core
import qualified Cardano.Ledger.Crypto as CC
import Cardano.Ledger.Era (Era (Crypto), ValidateScript, hashScript)
import Cardano.Ledger.Keys
import Cardano.Ledger.SafeHash (SafeToHash (..))
import Cardano.Ledger.Serialization (FromCBORGroup (..), ToCBORGroup (..))
import Cardano.Ledger.Shelley.Address.Bootstrap (BootstrapWitness)
import Cardano.Ledger.Shelley.Scripts (ScriptHash)
import Cardano.Ledger.Shelley.TxBody (WitVKey)
import Control.DeepSeq
import qualified Data.ByteString.Short as SBS
import Data.Coders
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.Maybe (mapMaybe)
import Data.MemoBytes (Mem, MemoBytes (..), memoBytes)
import Data.Proxy (Proxy (..))
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Typeable (Typeable)
import Data.Word (Word64)
import GHC.Generics
import GHC.Records
import NoThunks.Class (NoThunks)
data RdmrPtr
= RdmrPtr
!Tag
{-# UNPACK #-} !Word64
deriving (RdmrPtr -> RdmrPtr -> Bool
(RdmrPtr -> RdmrPtr -> Bool)
-> (RdmrPtr -> RdmrPtr -> Bool) -> Eq RdmrPtr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RdmrPtr -> RdmrPtr -> Bool
$c/= :: RdmrPtr -> RdmrPtr -> Bool
== :: RdmrPtr -> RdmrPtr -> Bool
$c== :: RdmrPtr -> RdmrPtr -> Bool
Eq, Eq RdmrPtr
Eq RdmrPtr
-> (RdmrPtr -> RdmrPtr -> Ordering)
-> (RdmrPtr -> RdmrPtr -> Bool)
-> (RdmrPtr -> RdmrPtr -> Bool)
-> (RdmrPtr -> RdmrPtr -> Bool)
-> (RdmrPtr -> RdmrPtr -> Bool)
-> (RdmrPtr -> RdmrPtr -> RdmrPtr)
-> (RdmrPtr -> RdmrPtr -> RdmrPtr)
-> Ord RdmrPtr
RdmrPtr -> RdmrPtr -> Bool
RdmrPtr -> RdmrPtr -> Ordering
RdmrPtr -> RdmrPtr -> RdmrPtr
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
min :: RdmrPtr -> RdmrPtr -> RdmrPtr
$cmin :: RdmrPtr -> RdmrPtr -> RdmrPtr
max :: RdmrPtr -> RdmrPtr -> RdmrPtr
$cmax :: RdmrPtr -> RdmrPtr -> RdmrPtr
>= :: RdmrPtr -> RdmrPtr -> Bool
$c>= :: RdmrPtr -> RdmrPtr -> Bool
> :: RdmrPtr -> RdmrPtr -> Bool
$c> :: RdmrPtr -> RdmrPtr -> Bool
<= :: RdmrPtr -> RdmrPtr -> Bool
$c<= :: RdmrPtr -> RdmrPtr -> Bool
< :: RdmrPtr -> RdmrPtr -> Bool
$c< :: RdmrPtr -> RdmrPtr -> Bool
compare :: RdmrPtr -> RdmrPtr -> Ordering
$ccompare :: RdmrPtr -> RdmrPtr -> Ordering
$cp1Ord :: Eq RdmrPtr
Ord, Int -> RdmrPtr -> ShowS
[RdmrPtr] -> ShowS
RdmrPtr -> String
(Int -> RdmrPtr -> ShowS)
-> (RdmrPtr -> String) -> ([RdmrPtr] -> ShowS) -> Show RdmrPtr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RdmrPtr] -> ShowS
$cshowList :: [RdmrPtr] -> ShowS
show :: RdmrPtr -> String
$cshow :: RdmrPtr -> String
showsPrec :: Int -> RdmrPtr -> ShowS
$cshowsPrec :: Int -> RdmrPtr -> ShowS
Show, (forall x. RdmrPtr -> Rep RdmrPtr x)
-> (forall x. Rep RdmrPtr x -> RdmrPtr) -> Generic RdmrPtr
forall x. Rep RdmrPtr x -> RdmrPtr
forall x. RdmrPtr -> Rep RdmrPtr x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RdmrPtr x -> RdmrPtr
$cfrom :: forall x. RdmrPtr -> Rep RdmrPtr x
Generic)
instance NoThunks RdmrPtr
instance NFData RdmrPtr
instance FromCBOR RdmrPtr where
fromCBOR :: Decoder s RdmrPtr
fromCBOR = Tag -> Word64 -> RdmrPtr
RdmrPtr (Tag -> Word64 -> RdmrPtr)
-> Decoder s Tag -> Decoder s (Word64 -> RdmrPtr)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s Tag
forall a s. FromCBOR a => Decoder s a
fromCBOR Decoder s (Word64 -> RdmrPtr)
-> Decoder s Word64 -> Decoder s RdmrPtr
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Decoder s Word64
forall a s. FromCBOR a => Decoder s a
fromCBOR
instance ToCBOR RdmrPtr where
toCBOR :: RdmrPtr -> Encoding
toCBOR (RdmrPtr Tag
t Word64
w) = Tag -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR Tag
t Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word64 -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR Word64
w
instance ToCBORGroup RdmrPtr where
listLen :: RdmrPtr -> Word
listLen RdmrPtr
_ = Word
2
listLenBound :: Proxy RdmrPtr -> Word
listLenBound Proxy RdmrPtr
_ = Word
2
toCBORGroup :: RdmrPtr -> Encoding
toCBORGroup (RdmrPtr Tag
t Word64
w) = Tag -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR Tag
t Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word64 -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR Word64
w
encodedGroupSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy RdmrPtr -> Size
encodedGroupSizeExpr forall t. ToCBOR t => Proxy t -> Size
size_ Proxy RdmrPtr
_proxy =
(forall t. ToCBOR t => Proxy t -> Size) -> Proxy Tag -> Size
forall a.
ToCBOR a =>
(forall t. ToCBOR t => Proxy t -> Size) -> Proxy a -> Size
encodedSizeExpr forall t. ToCBOR t => Proxy t -> Size
size_ (Proxy Tag
forall k (t :: k). Proxy t
Proxy :: Proxy Tag)
Size -> Size -> Size
forall a. Num a => a -> a -> a
+ (forall t. ToCBOR t => Proxy t -> Size) -> Proxy Word64 -> Size
forall a.
ToCBOR a =>
(forall t. ToCBOR t => Proxy t -> Size) -> Proxy a -> Size
encodedSizeExpr forall t. ToCBOR t => Proxy t -> Size
size_ (Proxy Word64
forall k (t :: k). Proxy t
Proxy :: Proxy Word64)
instance FromCBORGroup RdmrPtr where
fromCBORGroup :: Decoder s RdmrPtr
fromCBORGroup = Tag -> Word64 -> RdmrPtr
RdmrPtr (Tag -> Word64 -> RdmrPtr)
-> Decoder s Tag -> Decoder s (Word64 -> RdmrPtr)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s Tag
forall a s. FromCBOR a => Decoder s a
fromCBOR Decoder s (Word64 -> RdmrPtr)
-> Decoder s Word64 -> Decoder s RdmrPtr
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Decoder s Word64
forall a s. FromCBOR a => Decoder s a
fromCBOR
newtype RedeemersRaw era = RedeemersRaw (Map RdmrPtr (Data era, ExUnits))
deriving (RedeemersRaw era -> RedeemersRaw era -> Bool
(RedeemersRaw era -> RedeemersRaw era -> Bool)
-> (RedeemersRaw era -> RedeemersRaw era -> Bool)
-> Eq (RedeemersRaw era)
forall era. RedeemersRaw era -> RedeemersRaw era -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RedeemersRaw era -> RedeemersRaw era -> Bool
$c/= :: forall era. RedeemersRaw era -> RedeemersRaw era -> Bool
== :: RedeemersRaw era -> RedeemersRaw era -> Bool
$c== :: forall era. RedeemersRaw era -> RedeemersRaw era -> Bool
Eq, Int -> RedeemersRaw era -> ShowS
[RedeemersRaw era] -> ShowS
RedeemersRaw era -> String
(Int -> RedeemersRaw era -> ShowS)
-> (RedeemersRaw era -> String)
-> ([RedeemersRaw era] -> ShowS)
-> Show (RedeemersRaw era)
forall era. Int -> RedeemersRaw era -> ShowS
forall era. [RedeemersRaw era] -> ShowS
forall era. RedeemersRaw era -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RedeemersRaw era] -> ShowS
$cshowList :: forall era. [RedeemersRaw era] -> ShowS
show :: RedeemersRaw era -> String
$cshow :: forall era. RedeemersRaw era -> String
showsPrec :: Int -> RedeemersRaw era -> ShowS
$cshowsPrec :: forall era. Int -> RedeemersRaw era -> ShowS
Show, (forall x. RedeemersRaw era -> Rep (RedeemersRaw era) x)
-> (forall x. Rep (RedeemersRaw era) x -> RedeemersRaw era)
-> Generic (RedeemersRaw era)
forall x. Rep (RedeemersRaw era) x -> RedeemersRaw era
forall x. RedeemersRaw era -> Rep (RedeemersRaw era) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall era x. Rep (RedeemersRaw era) x -> RedeemersRaw era
forall era x. RedeemersRaw era -> Rep (RedeemersRaw era) x
$cto :: forall era x. Rep (RedeemersRaw era) x -> RedeemersRaw era
$cfrom :: forall era x. RedeemersRaw era -> Rep (RedeemersRaw era) x
Generic, Typeable, RedeemersRaw era -> ()
(RedeemersRaw era -> ()) -> NFData (RedeemersRaw era)
forall era. RedeemersRaw era -> ()
forall a. (a -> ()) -> NFData a
rnf :: RedeemersRaw era -> ()
$crnf :: forall era. RedeemersRaw era -> ()
NFData)
deriving newtype (Context -> RedeemersRaw era -> IO (Maybe ThunkInfo)
Proxy (RedeemersRaw era) -> String
(Context -> RedeemersRaw era -> IO (Maybe ThunkInfo))
-> (Context -> RedeemersRaw era -> IO (Maybe ThunkInfo))
-> (Proxy (RedeemersRaw era) -> String)
-> NoThunks (RedeemersRaw era)
forall era. Context -> RedeemersRaw era -> IO (Maybe ThunkInfo)
forall era. Proxy (RedeemersRaw era) -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy (RedeemersRaw era) -> String
$cshowTypeOf :: forall era. Proxy (RedeemersRaw era) -> String
wNoThunks :: Context -> RedeemersRaw era -> IO (Maybe ThunkInfo)
$cwNoThunks :: forall era. Context -> RedeemersRaw era -> IO (Maybe ThunkInfo)
noThunks :: Context -> RedeemersRaw era -> IO (Maybe ThunkInfo)
$cnoThunks :: forall era. Context -> RedeemersRaw era -> IO (Maybe ThunkInfo)
NoThunks)
newtype Redeemers era = RedeemersConstr (MemoBytes (RedeemersRaw era))
deriving newtype (Redeemers era -> Redeemers era -> Bool
(Redeemers era -> Redeemers era -> Bool)
-> (Redeemers era -> Redeemers era -> Bool) -> Eq (Redeemers era)
forall era. Redeemers era -> Redeemers era -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Redeemers era -> Redeemers era -> Bool
$c/= :: forall era. Redeemers era -> Redeemers era -> Bool
== :: Redeemers era -> Redeemers era -> Bool
$c== :: forall era. Redeemers era -> Redeemers era -> Bool
Eq, Int -> Redeemers era -> ShowS
[Redeemers era] -> ShowS
Redeemers era -> String
(Int -> Redeemers era -> ShowS)
-> (Redeemers era -> String)
-> ([Redeemers era] -> ShowS)
-> Show (Redeemers era)
forall era. Int -> Redeemers era -> ShowS
forall era. [Redeemers era] -> ShowS
forall era. Redeemers era -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Redeemers era] -> ShowS
$cshowList :: forall era. [Redeemers era] -> ShowS
show :: Redeemers era -> String
$cshow :: forall era. Redeemers era -> String
showsPrec :: Int -> Redeemers era -> ShowS
$cshowsPrec :: forall era. Int -> Redeemers era -> ShowS
Show, Typeable (Redeemers era)
Typeable (Redeemers era)
-> (Redeemers era -> Encoding)
-> ((forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (Redeemers era) -> Size)
-> ((forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [Redeemers era] -> Size)
-> ToCBOR (Redeemers era)
Redeemers era -> Encoding
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [Redeemers era] -> Size
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (Redeemers era) -> Size
forall era. Typeable era => Typeable (Redeemers era)
forall era. Typeable era => Redeemers 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 [Redeemers era] -> Size
forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (Redeemers era) -> Size
encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [Redeemers era] -> Size
$cencodedListSizeExpr :: forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [Redeemers era] -> Size
encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (Redeemers era) -> Size
$cencodedSizeExpr :: forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (Redeemers era) -> Size
toCBOR :: Redeemers era -> Encoding
$ctoCBOR :: forall era. Typeable era => Redeemers era -> Encoding
$cp1ToCBOR :: forall era. Typeable era => Typeable (Redeemers era)
ToCBOR, Context -> Redeemers era -> IO (Maybe ThunkInfo)
Proxy (Redeemers era) -> String
(Context -> Redeemers era -> IO (Maybe ThunkInfo))
-> (Context -> Redeemers era -> IO (Maybe ThunkInfo))
-> (Proxy (Redeemers era) -> String)
-> NoThunks (Redeemers era)
forall era.
Typeable era =>
Context -> Redeemers era -> IO (Maybe ThunkInfo)
forall era. Typeable era => Proxy (Redeemers era) -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy (Redeemers era) -> String
$cshowTypeOf :: forall era. Typeable era => Proxy (Redeemers era) -> String
wNoThunks :: Context -> Redeemers era -> IO (Maybe ThunkInfo)
$cwNoThunks :: forall era.
Typeable era =>
Context -> Redeemers era -> IO (Maybe ThunkInfo)
noThunks :: Context -> Redeemers era -> IO (Maybe ThunkInfo)
$cnoThunks :: forall era.
Typeable era =>
Context -> Redeemers era -> IO (Maybe ThunkInfo)
NoThunks, Proxy c -> Proxy index -> Redeemers era -> SafeHash c index
Redeemers era -> ByteString
(Redeemers era -> ByteString)
-> (forall c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> Redeemers era -> SafeHash c index)
-> SafeToHash (Redeemers era)
forall era. Redeemers 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 -> Redeemers era -> SafeHash c index
forall era c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> Redeemers era -> SafeHash c index
makeHashWithExplicitProxys :: Proxy c -> Proxy index -> Redeemers era -> SafeHash c index
$cmakeHashWithExplicitProxys :: forall era c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> Redeemers era -> SafeHash c index
originalBytes :: Redeemers era -> ByteString
$coriginalBytes :: forall era. Redeemers era -> ByteString
SafeToHash, Typeable, Redeemers era -> ()
(Redeemers era -> ()) -> NFData (Redeemers era)
forall era. Redeemers era -> ()
forall a. (a -> ()) -> NFData a
rnf :: Redeemers era -> ()
$crnf :: forall era. Redeemers era -> ()
NFData)
pattern Redeemers' ::
Map RdmrPtr (Data era, ExUnits) ->
Redeemers era
pattern $mRedeemers' :: forall r era.
Redeemers era
-> (Map RdmrPtr (Data era, ExUnits) -> r) -> (Void# -> r) -> r
Redeemers' rs' <-
RedeemersConstr (Memo (RedeemersRaw rs') _)
{-# COMPLETE Redeemers' #-}
pattern Redeemers ::
Era era =>
Map RdmrPtr (Data era, ExUnits) ->
Redeemers era
pattern $bRedeemers :: Map RdmrPtr (Data era, ExUnits) -> Redeemers era
$mRedeemers :: forall r era.
Era era =>
Redeemers era
-> (Map RdmrPtr (Data era, ExUnits) -> r) -> (Void# -> r) -> r
Redeemers rs <-
RedeemersConstr (Memo (RedeemersRaw rs) _)
where
Redeemers Map RdmrPtr (Data era, ExUnits)
rs' =
let enc :: [(RdmrPtr, (Data era, ExUnits))] -> Encoding
enc = ((RdmrPtr, (Data era, ExUnits)) -> Encoding)
-> [(RdmrPtr, (Data era, ExUnits))] -> Encoding
forall (f :: * -> *) a.
Foldable f =>
(a -> Encoding) -> f a -> Encoding
encodeFoldableEncoder (((RdmrPtr, (Data era, ExUnits)) -> Encoding)
-> [(RdmrPtr, (Data era, ExUnits))] -> Encoding)
-> ((RdmrPtr, (Data era, ExUnits)) -> Encoding)
-> [(RdmrPtr, (Data era, ExUnits))]
-> Encoding
forall a b. (a -> b) -> a -> b
$ \(RdmrPtr
ptr, (Data era
dats, ExUnits
exs)) ->
Word -> Encoding
encodeListLen Word
4
Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> RdmrPtr -> Encoding
forall a. ToCBORGroup a => a -> Encoding
toCBORGroup RdmrPtr
ptr
Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Data era -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR Data era
dats
Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> ExUnits -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR ExUnits
exs
in MemoBytes (RedeemersRaw era) -> Redeemers era
forall era. MemoBytes (RedeemersRaw era) -> Redeemers era
RedeemersConstr (MemoBytes (RedeemersRaw era) -> Redeemers era)
-> MemoBytes (RedeemersRaw era) -> Redeemers era
forall a b. (a -> b) -> a -> b
$
RedeemersRaw era -> ShortByteString -> MemoBytes (RedeemersRaw era)
forall t. t -> ShortByteString -> MemoBytes t
Memo
(Map RdmrPtr (Data era, ExUnits) -> RedeemersRaw era
forall era. Map RdmrPtr (Data era, ExUnits) -> RedeemersRaw era
RedeemersRaw Map RdmrPtr (Data era, ExUnits)
rs')
(ByteString -> ShortByteString
SBS.toShort (ByteString -> ShortByteString)
-> (Map RdmrPtr (Data era, ExUnits) -> ByteString)
-> Map RdmrPtr (Data era, ExUnits)
-> ShortByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Encoding -> ByteString
serializeEncoding' (Encoding -> ByteString)
-> (Map RdmrPtr (Data era, ExUnits) -> Encoding)
-> Map RdmrPtr (Data era, ExUnits)
-> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(RdmrPtr, (Data era, ExUnits))] -> Encoding
enc ([(RdmrPtr, (Data era, ExUnits))] -> Encoding)
-> (Map RdmrPtr (Data era, ExUnits)
-> [(RdmrPtr, (Data era, ExUnits))])
-> Map RdmrPtr (Data era, ExUnits)
-> Encoding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map RdmrPtr (Data era, ExUnits) -> [(RdmrPtr, (Data era, ExUnits))]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map RdmrPtr (Data era, ExUnits) -> ShortByteString)
-> Map RdmrPtr (Data era, ExUnits) -> ShortByteString
forall a b. (a -> b) -> a -> b
$ Map RdmrPtr (Data era, ExUnits)
rs')
{-# COMPLETE Redeemers #-}
unRedeemers :: Redeemers era -> Map RdmrPtr (Data era, ExUnits)
unRedeemers :: Redeemers era -> Map RdmrPtr (Data era, ExUnits)
unRedeemers (Redeemers' Map RdmrPtr (Data era, ExUnits)
rs) = Map RdmrPtr (Data era, ExUnits)
rs
nullRedeemers :: Redeemers era -> Bool
nullRedeemers :: Redeemers era -> Bool
nullRedeemers = Map RdmrPtr (Data era, ExUnits) -> Bool
forall k a. Map k a -> Bool
Map.null (Map RdmrPtr (Data era, ExUnits) -> Bool)
-> (Redeemers era -> Map RdmrPtr (Data era, ExUnits))
-> Redeemers era
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Redeemers era -> Map RdmrPtr (Data era, ExUnits)
forall era. Redeemers era -> Map RdmrPtr (Data era, ExUnits)
unRedeemers
data TxWitnessRaw era = TxWitnessRaw
{ TxWitnessRaw era -> Set (WitVKey 'Witness (Crypto era))
_txwitsVKey :: Set (WitVKey 'Witness (Crypto era)),
TxWitnessRaw era -> Set (BootstrapWitness (Crypto era))
_txwitsBoot :: Set (BootstrapWitness (Crypto era)),
TxWitnessRaw era -> Map (ScriptHash (Crypto era)) (Script era)
_txscripts :: Map (ScriptHash (Crypto era)) (Core.Script era),
TxWitnessRaw era -> TxDats era
_txdats :: TxDats era,
TxWitnessRaw era -> Redeemers era
_txrdmrs :: Redeemers era
}
deriving ((forall x. TxWitnessRaw era -> Rep (TxWitnessRaw era) x)
-> (forall x. Rep (TxWitnessRaw era) x -> TxWitnessRaw era)
-> Generic (TxWitnessRaw era)
forall x. Rep (TxWitnessRaw era) x -> TxWitnessRaw era
forall x. TxWitnessRaw era -> Rep (TxWitnessRaw era) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall era x. Rep (TxWitnessRaw era) x -> TxWitnessRaw era
forall era x. TxWitnessRaw era -> Rep (TxWitnessRaw era) x
$cto :: forall era x. Rep (TxWitnessRaw era) x -> TxWitnessRaw era
$cfrom :: forall era x. TxWitnessRaw era -> Rep (TxWitnessRaw era) x
Generic, Typeable)
instance
( Era era,
Core.Script era ~ Script era,
crypto ~ Crypto era,
NFData (TxDats era),
NFData (Redeemers era),
NFData (SigDSIGN (CC.DSIGN crypto)),
NFData (VerKeyDSIGN (CC.DSIGN crypto))
) =>
NFData (TxWitnessRaw era)
newtype TxWitness era = TxWitnessConstr (MemoBytes (TxWitnessRaw era))
deriving newtype (Proxy c -> Proxy index -> TxWitness era -> SafeHash c index
TxWitness era -> ByteString
(TxWitness era -> ByteString)
-> (forall c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> TxWitness era -> SafeHash c index)
-> SafeToHash (TxWitness era)
forall era. TxWitness 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 -> TxWitness era -> SafeHash c index
forall era c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> TxWitness era -> SafeHash c index
makeHashWithExplicitProxys :: Proxy c -> Proxy index -> TxWitness era -> SafeHash c index
$cmakeHashWithExplicitProxys :: forall era c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> TxWitness era -> SafeHash c index
originalBytes :: TxWitness era -> ByteString
$coriginalBytes :: forall era. TxWitness era -> ByteString
SafeToHash, Typeable (TxWitness era)
Typeable (TxWitness era)
-> (TxWitness era -> Encoding)
-> ((forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (TxWitness era) -> Size)
-> ((forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [TxWitness era] -> Size)
-> ToCBOR (TxWitness era)
TxWitness era -> Encoding
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [TxWitness era] -> Size
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (TxWitness era) -> Size
forall era. Typeable era => Typeable (TxWitness era)
forall era. Typeable era => TxWitness 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 [TxWitness era] -> Size
forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (TxWitness era) -> Size
encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [TxWitness era] -> Size
$cencodedListSizeExpr :: forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [TxWitness era] -> Size
encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (TxWitness era) -> Size
$cencodedSizeExpr :: forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (TxWitness era) -> Size
toCBOR :: TxWitness era -> Encoding
$ctoCBOR :: forall era. Typeable era => TxWitness era -> Encoding
$cp1ToCBOR :: forall era. Typeable era => Typeable (TxWitness era)
ToCBOR)
instance (Era era, Core.Script era ~ Script era) => Semigroup (TxWitness era) where
<> :: TxWitness era -> TxWitness era -> TxWitness era
(<>) TxWitness era
x TxWitness era
y | TxWitness era -> Bool
forall era. TxWitness era -> Bool
isEmptyTxWitness TxWitness era
x = TxWitness era
y
(<>) TxWitness era
x TxWitness era
y | TxWitness era -> Bool
forall era. TxWitness era -> Bool
isEmptyTxWitness TxWitness era
y = TxWitness era
x
(<>)
(TxWitnessConstr (Memo (TxWitnessRaw Set (WitVKey 'Witness (Crypto era))
a Set (BootstrapWitness (Crypto era))
b Map (ScriptHash (Crypto era)) (Script era)
c TxDats era
d (Redeemers' Map RdmrPtr (Data era, ExUnits)
e)) ShortByteString
_))
(TxWitnessConstr (Memo (TxWitnessRaw Set (WitVKey 'Witness (Crypto era))
u Set (BootstrapWitness (Crypto era))
v Map (ScriptHash (Crypto era)) (Script era)
w TxDats era
x (Redeemers' Map RdmrPtr (Data era, ExUnits)
y)) ShortByteString
_)) =
Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitness era
forall era.
(Era era, Script era ~ Script era) =>
Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitness era
TxWitness (Set (WitVKey 'Witness (Crypto era))
a Set (WitVKey 'Witness (Crypto era))
-> Set (WitVKey 'Witness (Crypto era))
-> Set (WitVKey 'Witness (Crypto era))
forall a. Semigroup a => a -> a -> a
<> Set (WitVKey 'Witness (Crypto era))
u) (Set (BootstrapWitness (Crypto era))
b Set (BootstrapWitness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
forall a. Semigroup a => a -> a -> a
<> Set (BootstrapWitness (Crypto era))
v) (Map (ScriptHash (Crypto era)) (Script era)
Map (ScriptHash (Crypto era)) (Script era)
c Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
forall a. Semigroup a => a -> a -> a
<> Map (ScriptHash (Crypto era)) (Script era)
Map (ScriptHash (Crypto era)) (Script era)
w) (TxDats era
d TxDats era -> TxDats era -> TxDats era
forall a. Semigroup a => a -> a -> a
<> TxDats era
x) (Map RdmrPtr (Data era, ExUnits) -> Redeemers era
forall era.
Era era =>
Map RdmrPtr (Data era, ExUnits) -> Redeemers era
Redeemers (Map RdmrPtr (Data era, ExUnits)
e Map RdmrPtr (Data era, ExUnits)
-> Map RdmrPtr (Data era, ExUnits)
-> Map RdmrPtr (Data era, ExUnits)
forall a. Semigroup a => a -> a -> a
<> Map RdmrPtr (Data era, ExUnits)
y))
instance (Era era, Core.Script era ~ Script era) => Monoid (TxWitness era) where
mempty :: TxWitness era
mempty = Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitness era
forall era.
(Era era, Script era ~ Script era) =>
Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitness era
TxWitness Set (WitVKey 'Witness (Crypto era))
forall a. Monoid a => a
mempty Set (BootstrapWitness (Crypto era))
forall a. Monoid a => a
mempty Map (ScriptHash (Crypto era)) (Script era)
forall a. Monoid a => a
mempty TxDats era
forall a. Monoid a => a
mempty (Map RdmrPtr (Data era, ExUnits) -> Redeemers era
forall era.
Era era =>
Map RdmrPtr (Data era, ExUnits) -> Redeemers era
Redeemers Map RdmrPtr (Data era, ExUnits)
forall a. Monoid a => a
mempty)
deriving instance
( Era era,
Core.Script era ~ Script era,
crypto ~ Crypto era,
NFData (TxDats era),
NFData (Redeemers era),
NFData (SigDSIGN (CC.DSIGN crypto)),
NFData (VerKeyDSIGN (CC.DSIGN crypto))
) =>
NFData (TxWitness era)
isEmptyTxWitness :: TxWitness era -> Bool
isEmptyTxWitness :: TxWitness era -> Bool
isEmptyTxWitness (TxWitnessConstr (Memo (TxWitnessRaw Set (WitVKey 'Witness (Crypto era))
a Set (BootstrapWitness (Crypto era))
b Map (ScriptHash (Crypto era)) (Script era)
c TxDats era
d (Redeemers' Map RdmrPtr (Data era, ExUnits)
e)) ShortByteString
_)) =
Set (WitVKey 'Witness (Crypto era)) -> Bool
forall a. Set a -> Bool
Set.null Set (WitVKey 'Witness (Crypto era))
a Bool -> Bool -> Bool
&& Set (BootstrapWitness (Crypto era)) -> Bool
forall a. Set a -> Bool
Set.null Set (BootstrapWitness (Crypto era))
b Bool -> Bool -> Bool
&& Map (ScriptHash (Crypto era)) (Script era) -> Bool
forall k a. Map k a -> Bool
Map.null Map (ScriptHash (Crypto era)) (Script era)
c Bool -> Bool -> Bool
&& TxDats era -> Bool
forall era. TxDats era -> Bool
nullDats TxDats era
d Bool -> Bool -> Bool
&& Map RdmrPtr (Data era, ExUnits) -> Bool
forall k a. Map k a -> Bool
Map.null Map RdmrPtr (Data era, ExUnits)
e
newtype TxDatsRaw era = TxDatsRaw (Map (DataHash (Crypto era)) (Data era))
deriving ((forall x. TxDatsRaw era -> Rep (TxDatsRaw era) x)
-> (forall x. Rep (TxDatsRaw era) x -> TxDatsRaw era)
-> Generic (TxDatsRaw era)
forall x. Rep (TxDatsRaw era) x -> TxDatsRaw era
forall x. TxDatsRaw era -> Rep (TxDatsRaw era) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall era x. Rep (TxDatsRaw era) x -> TxDatsRaw era
forall era x. TxDatsRaw era -> Rep (TxDatsRaw era) x
$cto :: forall era x. Rep (TxDatsRaw era) x -> TxDatsRaw era
$cfrom :: forall era x. TxDatsRaw era -> Rep (TxDatsRaw era) x
Generic, Typeable, TxDatsRaw era -> TxDatsRaw era -> Bool
(TxDatsRaw era -> TxDatsRaw era -> Bool)
-> (TxDatsRaw era -> TxDatsRaw era -> Bool) -> Eq (TxDatsRaw era)
forall era. TxDatsRaw era -> TxDatsRaw era -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TxDatsRaw era -> TxDatsRaw era -> Bool
$c/= :: forall era. TxDatsRaw era -> TxDatsRaw era -> Bool
== :: TxDatsRaw era -> TxDatsRaw era -> Bool
$c== :: forall era. TxDatsRaw era -> TxDatsRaw era -> Bool
Eq, Int -> TxDatsRaw era -> ShowS
[TxDatsRaw era] -> ShowS
TxDatsRaw era -> String
(Int -> TxDatsRaw era -> ShowS)
-> (TxDatsRaw era -> String)
-> ([TxDatsRaw era] -> ShowS)
-> Show (TxDatsRaw era)
forall era. Int -> TxDatsRaw era -> ShowS
forall era. [TxDatsRaw era] -> ShowS
forall era. TxDatsRaw era -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TxDatsRaw era] -> ShowS
$cshowList :: forall era. [TxDatsRaw era] -> ShowS
show :: TxDatsRaw era -> String
$cshow :: forall era. TxDatsRaw era -> String
showsPrec :: Int -> TxDatsRaw era -> ShowS
$cshowsPrec :: forall era. Int -> TxDatsRaw era -> ShowS
Show)
deriving newtype (Context -> TxDatsRaw era -> IO (Maybe ThunkInfo)
Proxy (TxDatsRaw era) -> String
(Context -> TxDatsRaw era -> IO (Maybe ThunkInfo))
-> (Context -> TxDatsRaw era -> IO (Maybe ThunkInfo))
-> (Proxy (TxDatsRaw era) -> String)
-> NoThunks (TxDatsRaw era)
forall era. Context -> TxDatsRaw era -> IO (Maybe ThunkInfo)
forall era. Proxy (TxDatsRaw era) -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy (TxDatsRaw era) -> String
$cshowTypeOf :: forall era. Proxy (TxDatsRaw era) -> String
wNoThunks :: Context -> TxDatsRaw era -> IO (Maybe ThunkInfo)
$cwNoThunks :: forall era. Context -> TxDatsRaw era -> IO (Maybe ThunkInfo)
noThunks :: Context -> TxDatsRaw era -> IO (Maybe ThunkInfo)
$cnoThunks :: forall era. Context -> TxDatsRaw era -> IO (Maybe ThunkInfo)
NoThunks, TxDatsRaw era -> ()
(TxDatsRaw era -> ()) -> NFData (TxDatsRaw era)
forall era. TxDatsRaw era -> ()
forall a. (a -> ()) -> NFData a
rnf :: TxDatsRaw era -> ()
$crnf :: forall era. TxDatsRaw era -> ()
NFData)
encodeTxDatsRaw ::
ToCBOR (Data era) =>
TxDatsRaw era ->
Encode ('Closed 'Dense) (TxDatsRaw era)
encodeTxDatsRaw :: TxDatsRaw era -> Encode ('Closed 'Dense) (TxDatsRaw era)
encodeTxDatsRaw = (TxDatsRaw era -> Encoding)
-> TxDatsRaw era -> Encode ('Closed 'Dense) (TxDatsRaw era)
forall t. (t -> Encoding) -> t -> Encode ('Closed 'Dense) t
E ([Data era] -> Encoding
forall a (f :: * -> *). (ToCBOR a, Foldable f) => f a -> Encoding
encodeFoldable ([Data era] -> Encoding)
-> (TxDatsRaw era -> [Data era]) -> TxDatsRaw era -> Encoding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map (DataHash (Crypto era)) (Data era) -> [Data era]
forall k a. Map k a -> [a]
Map.elems (Map (DataHash (Crypto era)) (Data era) -> [Data era])
-> (TxDatsRaw era -> Map (DataHash (Crypto era)) (Data era))
-> TxDatsRaw era
-> [Data era]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxDatsRaw era -> Map (DataHash (Crypto era)) (Data era)
forall era. TxDatsRaw era -> Map (DataHash (Crypto era)) (Data era)
unTxDatsRaw)
where
unTxDatsRaw :: TxDatsRaw era -> Map (DataHash (Crypto era)) (Data era)
unTxDatsRaw (TxDatsRaw Map (DataHash (Crypto era)) (Data era)
m) = Map (DataHash (Crypto era)) (Data era)
m
pattern TxDats' :: Map (DataHash (Crypto era)) (Data era) -> TxDats era
pattern $mTxDats' :: forall r era.
TxDats era
-> (Map (DataHash (Crypto era)) (Data era) -> r)
-> (Void# -> r)
-> r
TxDats' m <- TxDatsConstr (Memo (TxDatsRaw m) _)
{-# COMPLETE TxDats' #-}
pattern TxDats :: Typeable era => Map (DataHash (Crypto era)) (Data era) -> TxDats era
pattern $bTxDats :: Map (DataHash (Crypto era)) (Data era) -> TxDats era
$mTxDats :: forall r era.
Typeable era =>
TxDats era
-> (Map (DataHash (Crypto era)) (Data era) -> r)
-> (Void# -> r)
-> r
TxDats m <-
TxDatsConstr (Memo (TxDatsRaw m) _)
where
TxDats Map (DataHash (Crypto era)) (Data era)
m = MemoBytes (TxDatsRaw era) -> TxDats era
forall era. MemoBytes (TxDatsRaw era) -> TxDats era
TxDatsConstr (MemoBytes (TxDatsRaw era) -> TxDats era)
-> MemoBytes (TxDatsRaw era) -> TxDats era
forall a b. (a -> b) -> a -> b
$ Encode ('Closed 'Dense) (TxDatsRaw era)
-> MemoBytes (TxDatsRaw era)
forall (w :: Wrapped) t. Encode w t -> MemoBytes t
memoBytes (TxDatsRaw era -> Encode ('Closed 'Dense) (TxDatsRaw era)
forall era.
ToCBOR (Data era) =>
TxDatsRaw era -> Encode ('Closed 'Dense) (TxDatsRaw era)
encodeTxDatsRaw (Map (DataHash (Crypto era)) (Data era) -> TxDatsRaw era
forall era. Map (DataHash (Crypto era)) (Data era) -> TxDatsRaw era
TxDatsRaw Map (DataHash (Crypto era)) (Data era)
m))
{-# COMPLETE TxDats #-}
unTxDats :: TxDats era -> Map (DataHash (Crypto era)) (Data era)
unTxDats :: TxDats era -> Map (DataHash (Crypto era)) (Data era)
unTxDats (TxDats' Map (DataHash (Crypto era)) (Data era)
m) = Map (DataHash (Crypto era)) (Data era)
m
nullDats :: TxDats era -> Bool
nullDats :: TxDats era -> Bool
nullDats (TxDats' Map (DataHash (Crypto era)) (Data era)
d) = Map (DataHash (Crypto era)) (Data era) -> Bool
forall k a. Map k a -> Bool
Map.null Map (DataHash (Crypto era)) (Data era)
d
instance (Typeable era, Era era) => FromCBOR (Annotator (TxDatsRaw era)) where
fromCBOR :: Decoder s (Annotator (TxDatsRaw era))
fromCBOR = Decode ('Closed 'Dense) (Annotator (TxDatsRaw era))
-> Decoder s (Annotator (TxDatsRaw era))
forall (w :: Wrapped) t s. Decode w t -> Decoder s t
decode (Decode ('Closed 'Dense) (Annotator (TxDatsRaw era))
-> Decoder s (Annotator (TxDatsRaw era)))
-> Decode ('Closed 'Dense) (Annotator (TxDatsRaw era))
-> Decoder s (Annotator (TxDatsRaw era))
forall a b. (a -> b) -> a -> b
$ ([Data era] -> TxDatsRaw era)
-> Annotator [Data era] -> Annotator (TxDatsRaw era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Map (SafeHash (Crypto era) EraIndependentData) (Data era)
-> TxDatsRaw era
forall era. Map (DataHash (Crypto era)) (Data era) -> TxDatsRaw era
TxDatsRaw (Map (SafeHash (Crypto era) EraIndependentData) (Data era)
-> TxDatsRaw era)
-> ([Data era]
-> Map (SafeHash (Crypto era) EraIndependentData) (Data era))
-> [Data era]
-> TxDatsRaw era
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Data era -> SafeHash (Crypto era) EraIndependentData)
-> [Data era]
-> Map (SafeHash (Crypto era) EraIndependentData) (Data era)
forall a b. Ord b => (a -> b) -> [a] -> Map b a
keyBy Data era -> SafeHash (Crypto era) EraIndependentData
forall era. Era era => Data era -> DataHash (Crypto era)
hashData) (Annotator [Data era] -> Annotator (TxDatsRaw era))
-> Decode ('Closed 'Dense) (Annotator [Data era])
-> Decode ('Closed 'Dense) (Annotator (TxDatsRaw era))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decode ('Closed 'Dense) (Annotator (Data era))
-> Decode ('Closed 'Dense) (Annotator [Data era])
forall x.
Decode ('Closed 'Dense) (Annotator x)
-> Decode ('Closed 'Dense) (Annotator [x])
listDecodeA Decode ('Closed 'Dense) (Annotator (Data era))
forall t (w :: Wrapped). FromCBOR t => Decode w t
From
newtype TxDats era = TxDatsConstr (MemoBytes (TxDatsRaw era))
deriving newtype (Proxy c -> Proxy index -> TxDats era -> SafeHash c index
TxDats era -> ByteString
(TxDats era -> ByteString)
-> (forall c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> TxDats era -> SafeHash c index)
-> SafeToHash (TxDats era)
forall era. TxDats 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 -> TxDats era -> SafeHash c index
forall era c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> TxDats era -> SafeHash c index
makeHashWithExplicitProxys :: Proxy c -> Proxy index -> TxDats era -> SafeHash c index
$cmakeHashWithExplicitProxys :: forall era c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> TxDats era -> SafeHash c index
originalBytes :: TxDats era -> ByteString
$coriginalBytes :: forall era. TxDats era -> ByteString
SafeToHash, Typeable (TxDats era)
Typeable (TxDats era)
-> (TxDats era -> Encoding)
-> ((forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (TxDats era) -> Size)
-> ((forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [TxDats era] -> Size)
-> ToCBOR (TxDats era)
TxDats era -> Encoding
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [TxDats era] -> Size
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (TxDats era) -> Size
forall era. Typeable era => Typeable (TxDats era)
forall era. Typeable era => TxDats 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 [TxDats era] -> Size
forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (TxDats era) -> Size
encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [TxDats era] -> Size
$cencodedListSizeExpr :: forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [TxDats era] -> Size
encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (TxDats era) -> Size
$cencodedSizeExpr :: forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (TxDats era) -> Size
toCBOR :: TxDats era -> Encoding
$ctoCBOR :: forall era. Typeable era => TxDats era -> Encoding
$cp1ToCBOR :: forall era. Typeable era => Typeable (TxDats era)
ToCBOR, TxDats era -> TxDats era -> Bool
(TxDats era -> TxDats era -> Bool)
-> (TxDats era -> TxDats era -> Bool) -> Eq (TxDats era)
forall era. TxDats era -> TxDats era -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TxDats era -> TxDats era -> Bool
$c/= :: forall era. TxDats era -> TxDats era -> Bool
== :: TxDats era -> TxDats era -> Bool
$c== :: forall era. TxDats era -> TxDats era -> Bool
Eq, Int -> TxDats era -> ShowS
[TxDats era] -> ShowS
TxDats era -> String
(Int -> TxDats era -> ShowS)
-> (TxDats era -> String)
-> ([TxDats era] -> ShowS)
-> Show (TxDats era)
forall era. Int -> TxDats era -> ShowS
forall era. [TxDats era] -> ShowS
forall era. TxDats era -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TxDats era] -> ShowS
$cshowList :: forall era. [TxDats era] -> ShowS
show :: TxDats era -> String
$cshow :: forall era. TxDats era -> String
showsPrec :: Int -> TxDats era -> ShowS
$cshowsPrec :: forall era. Int -> TxDats era -> ShowS
Show, Context -> TxDats era -> IO (Maybe ThunkInfo)
Proxy (TxDats era) -> String
(Context -> TxDats era -> IO (Maybe ThunkInfo))
-> (Context -> TxDats era -> IO (Maybe ThunkInfo))
-> (Proxy (TxDats era) -> String)
-> NoThunks (TxDats era)
forall era.
Typeable era =>
Context -> TxDats era -> IO (Maybe ThunkInfo)
forall era. Typeable era => Proxy (TxDats era) -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy (TxDats era) -> String
$cshowTypeOf :: forall era. Typeable era => Proxy (TxDats era) -> String
wNoThunks :: Context -> TxDats era -> IO (Maybe ThunkInfo)
$cwNoThunks :: forall era.
Typeable era =>
Context -> TxDats era -> IO (Maybe ThunkInfo)
noThunks :: Context -> TxDats era -> IO (Maybe ThunkInfo)
$cnoThunks :: forall era.
Typeable era =>
Context -> TxDats era -> IO (Maybe ThunkInfo)
NoThunks, TxDats era -> ()
(TxDats era -> ()) -> NFData (TxDats era)
forall era. TxDats era -> ()
forall a. (a -> ()) -> NFData a
rnf :: TxDats era -> ()
$crnf :: forall era. TxDats era -> ()
NFData)
instance Typeable era => Semigroup (TxDats era) where
(TxDats Map (DataHash (Crypto era)) (Data era)
m) <> :: TxDats era -> TxDats era -> TxDats era
<> (TxDats Map (DataHash (Crypto era)) (Data era)
m') = Map (DataHash (Crypto era)) (Data era) -> TxDats era
forall era.
Typeable era =>
Map (DataHash (Crypto era)) (Data era) -> TxDats era
TxDats (Map (DataHash (Crypto era)) (Data era)
m Map (DataHash (Crypto era)) (Data era)
-> Map (DataHash (Crypto era)) (Data era)
-> Map (DataHash (Crypto era)) (Data era)
forall a. Semigroup a => a -> a -> a
<> Map (DataHash (Crypto era)) (Data era)
m')
instance Typeable era => Monoid (TxDats era) where
mempty :: TxDats era
mempty = Map (DataHash (Crypto era)) (Data era) -> TxDats era
forall era.
Typeable era =>
Map (DataHash (Crypto era)) (Data era) -> TxDats era
TxDats Map (DataHash (Crypto era)) (Data era)
forall a. Monoid a => a
mempty
deriving via
(Mem (TxDatsRaw era))
instance
(Era era) => FromCBOR (Annotator (TxDats era))
deriving stock instance
( Era era,
Eq (Core.Script era)
) =>
Eq (TxWitnessRaw era)
deriving stock instance
(Era era, Show (Core.Script era)) =>
Show (TxWitnessRaw era)
instance (Era era, NoThunks (Core.Script era)) => NoThunks (TxWitnessRaw era)
deriving newtype instance Eq (TxWitness era)
deriving newtype instance
(Era era, Show (Core.Script era)) =>
Show (TxWitness era)
deriving newtype instance
(Era era, NoThunks (Core.Script era)) =>
NoThunks (TxWitness era)
pattern TxWitness' ::
Set (WitVKey 'Witness (Crypto era)) ->
Set (BootstrapWitness (Crypto era)) ->
Map (ScriptHash (Crypto era)) (Core.Script era) ->
TxDats era ->
Redeemers era ->
TxWitness era
pattern $mTxWitness' :: forall r era.
TxWitness era
-> (Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> r)
-> (Void# -> r)
-> r
TxWitness' {TxWitness era -> Set (WitVKey 'Witness (Crypto era))
txwitsVKey', TxWitness era -> Set (BootstrapWitness (Crypto era))
txwitsBoot', TxWitness era -> Map (ScriptHash (Crypto era)) (Script era)
txscripts', TxWitness era -> TxDats era
txdats', TxWitness era -> Redeemers era
txrdmrs'} <-
TxWitnessConstr
(Memo (TxWitnessRaw txwitsVKey' txwitsBoot' txscripts' txdats' txrdmrs') _)
{-# COMPLETE TxWitness' #-}
pattern TxWitness ::
(Era era, Core.Script era ~ Script era) =>
Set (WitVKey 'Witness (Crypto era)) ->
Set (BootstrapWitness (Crypto era)) ->
Map (ScriptHash (Crypto era)) (Core.Script era) ->
TxDats era ->
Redeemers era ->
TxWitness era
pattern $bTxWitness :: Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitness era
$mTxWitness :: forall r era.
(Era era, Script era ~ Script era) =>
TxWitness era
-> (Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> r)
-> (Void# -> r)
-> r
TxWitness {TxWitness era
-> (Era era, Script era ~ Script era) =>
Set (WitVKey 'Witness (Crypto era))
txwitsVKey, TxWitness era
-> (Era era, Script era ~ Script era) =>
Set (BootstrapWitness (Crypto era))
txwitsBoot, TxWitness era
-> (Era era, Script era ~ Script era) =>
Map (ScriptHash (Crypto era)) (Script era)
txscripts, TxWitness era -> (Era era, Script era ~ Script era) => TxDats era
txdats, TxWitness era
-> (Era era, Script era ~ Script era) => Redeemers era
txrdmrs} <-
TxWitnessConstr
(Memo (TxWitnessRaw txwitsVKey txwitsBoot txscripts txdats txrdmrs) _)
where
TxWitness Set (WitVKey 'Witness (Crypto era))
witsVKey' Set (BootstrapWitness (Crypto era))
witsBoot' Map (ScriptHash (Crypto era)) (Script era)
witsScript' TxDats era
witsDat' Redeemers era
witsRdmr' =
MemoBytes (TxWitnessRaw era) -> TxWitness era
forall era. MemoBytes (TxWitnessRaw era) -> TxWitness era
TxWitnessConstr
(MemoBytes (TxWitnessRaw era) -> TxWitness era)
-> (Encode ('Closed 'Sparse) (TxWitnessRaw era)
-> MemoBytes (TxWitnessRaw era))
-> Encode ('Closed 'Sparse) (TxWitnessRaw era)
-> TxWitness era
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Encode ('Closed 'Sparse) (TxWitnessRaw era)
-> MemoBytes (TxWitnessRaw era)
forall (w :: Wrapped) t. Encode w t -> MemoBytes t
memoBytes
(Encode ('Closed 'Sparse) (TxWitnessRaw era) -> TxWitness era)
-> Encode ('Closed 'Sparse) (TxWitnessRaw era) -> TxWitness era
forall a b. (a -> b) -> a -> b
$ Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> Encode ('Closed 'Sparse) (TxWitnessRaw era)
forall era.
(Era era, Script era ~ Script era) =>
Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> Encode ('Closed 'Sparse) (TxWitnessRaw era)
encodeWitnessRaw Set (WitVKey 'Witness (Crypto era))
witsVKey' Set (BootstrapWitness (Crypto era))
witsBoot' Map (ScriptHash (Crypto era)) (Script era)
witsScript' TxDats era
witsDat' Redeemers era
witsRdmr'
{-# COMPLETE TxWitness #-}
instance
(Core.Script era ~ script, Crypto era ~ crypto) =>
HasField "txscripts" (TxWitness era) (Map (ScriptHash crypto) script)
where
getField :: TxWitness era -> Map (ScriptHash crypto) script
getField (TxWitnessConstr (Memo (TxWitnessRaw Set (WitVKey 'Witness (Crypto era))
_ Set (BootstrapWitness (Crypto era))
_ Map (ScriptHash (Crypto era)) (Script era)
s TxDats era
_ Redeemers era
_) ShortByteString
_)) = Map (ScriptHash crypto) script
Map (ScriptHash (Crypto era)) (Script era)
s
instance HasField "txdats" (TxWitness era) (TxDats era) where
getField :: TxWitness era -> TxDats era
getField (TxWitnessConstr (Memo (TxWitnessRaw Set (WitVKey 'Witness (Crypto era))
_ Set (BootstrapWitness (Crypto era))
_ Map (ScriptHash (Crypto era)) (Script era)
_ TxDats era
d Redeemers era
_) ShortByteString
_)) = TxDats era
d
instance HasField "txrdmrs" (TxWitness era) (Redeemers era) where
getField :: TxWitness era -> Redeemers era
getField (TxWitnessConstr (Memo (TxWitnessRaw Set (WitVKey 'Witness (Crypto era))
_ Set (BootstrapWitness (Crypto era))
_ Map (ScriptHash (Crypto era)) (Script era)
_ TxDats era
_ Redeemers era
r) ShortByteString
_)) = Redeemers era
r
instance
(Crypto era ~ crypto) =>
HasField "addrWits" (TxWitness era) (Set (WitVKey 'Witness crypto))
where
getField :: TxWitness era -> Set (WitVKey 'Witness crypto)
getField (TxWitnessConstr (Memo (TxWitnessRaw Set (WitVKey 'Witness (Crypto era))
w Set (BootstrapWitness (Crypto era))
_ Map (ScriptHash (Crypto era)) (Script era)
_ TxDats era
_ Redeemers era
_) ShortByteString
_)) = Set (WitVKey 'Witness crypto)
Set (WitVKey 'Witness (Crypto era))
w
instance
(Core.Script era ~ script, Crypto era ~ crypto) =>
HasField "scriptWits" (TxWitness era) (Map (ScriptHash crypto) script)
where
getField :: TxWitness era -> Map (ScriptHash crypto) script
getField (TxWitnessConstr (Memo (TxWitnessRaw Set (WitVKey 'Witness (Crypto era))
_ Set (BootstrapWitness (Crypto era))
_ Map (ScriptHash (Crypto era)) (Script era)
s TxDats era
_ Redeemers era
_) ShortByteString
_)) = Map (ScriptHash crypto) script
Map (ScriptHash (Crypto era)) (Script era)
s
encodeWitnessRaw ::
(Era era, Core.Script era ~ Script era) =>
Set (WitVKey 'Witness (Crypto era)) ->
Set (BootstrapWitness (Crypto era)) ->
Map (ScriptHash (Crypto era)) (Core.Script era) ->
TxDats era ->
Redeemers era ->
Encode ('Closed 'Sparse) (TxWitnessRaw era)
encodeWitnessRaw :: Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> Encode ('Closed 'Sparse) (TxWitnessRaw era)
encodeWitnessRaw Set (WitVKey 'Witness (Crypto era))
vkeys Set (BootstrapWitness (Crypto era))
boots Map (ScriptHash (Crypto era)) (Script era)
scripts TxDats era
dats Redeemers era
rdmrs =
(Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitnessRaw era)
-> Encode
('Closed 'Sparse)
(Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitnessRaw era)
forall t. t -> Encode ('Closed 'Sparse) t
Keyed
(\Set (WitVKey 'Witness (Crypto era))
a Set (BootstrapWitness (Crypto era))
b Map (ScriptHash (Crypto era)) (Script era)
c Map (ScriptHash (Crypto era)) (Script era)
d Map (ScriptHash (Crypto era)) (Script era)
e TxDats era
f Redeemers era
g -> Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitnessRaw era
forall era.
Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitnessRaw era
TxWitnessRaw Set (WitVKey 'Witness (Crypto era))
a Set (BootstrapWitness (Crypto era))
b (Map (ScriptHash (Crypto era)) (Script era)
c Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
forall a. Semigroup a => a -> a -> a
<> Map (ScriptHash (Crypto era)) (Script era)
d Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
forall a. Semigroup a => a -> a -> a
<> Map (ScriptHash (Crypto era)) (Script era)
e) TxDats era
f Redeemers era
g)
Encode
('Closed 'Sparse)
(Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitnessRaw era)
-> Encode ('Closed 'Sparse) (Set (WitVKey 'Witness (Crypto era)))
-> Encode
('Closed 'Sparse)
(Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitnessRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> (Set (WitVKey 'Witness (Crypto era)) -> Bool)
-> Encode ('Closed 'Sparse) (Set (WitVKey 'Witness (Crypto era)))
-> Encode ('Closed 'Sparse) (Set (WitVKey 'Witness (Crypto era)))
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit Set (WitVKey 'Witness (Crypto era)) -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Word
-> Encode ('Closed 'Dense) (Set (WitVKey 'Witness (Crypto era)))
-> Encode ('Closed 'Sparse) (Set (WitVKey 'Witness (Crypto era)))
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
0 (Encode ('Closed 'Dense) (Set (WitVKey 'Witness (Crypto era)))
-> Encode ('Closed 'Sparse) (Set (WitVKey 'Witness (Crypto era))))
-> Encode ('Closed 'Dense) (Set (WitVKey 'Witness (Crypto era)))
-> Encode ('Closed 'Sparse) (Set (WitVKey 'Witness (Crypto era)))
forall a b. (a -> b) -> a -> b
$ Set (WitVKey 'Witness (Crypto era))
-> Encode ('Closed 'Dense) (Set (WitVKey 'Witness (Crypto era)))
forall v. ToCBOR v => Set v -> Encode ('Closed 'Dense) (Set v)
setEncode Set (WitVKey 'Witness (Crypto era))
vkeys)
Encode
('Closed 'Sparse)
(Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitnessRaw era)
-> Encode ('Closed 'Sparse) (Set (BootstrapWitness (Crypto era)))
-> Encode
('Closed 'Sparse)
(Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitnessRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> (Set (BootstrapWitness (Crypto era)) -> Bool)
-> Encode ('Closed 'Sparse) (Set (BootstrapWitness (Crypto era)))
-> Encode ('Closed 'Sparse) (Set (BootstrapWitness (Crypto era)))
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit Set (BootstrapWitness (Crypto era)) -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Word
-> Encode ('Closed 'Dense) (Set (BootstrapWitness (Crypto era)))
-> Encode ('Closed 'Sparse) (Set (BootstrapWitness (Crypto era)))
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
2 (Encode ('Closed 'Dense) (Set (BootstrapWitness (Crypto era)))
-> Encode ('Closed 'Sparse) (Set (BootstrapWitness (Crypto era))))
-> Encode ('Closed 'Dense) (Set (BootstrapWitness (Crypto era)))
-> Encode ('Closed 'Sparse) (Set (BootstrapWitness (Crypto era)))
forall a b. (a -> b) -> a -> b
$ Set (BootstrapWitness (Crypto era))
-> Encode ('Closed 'Dense) (Set (BootstrapWitness (Crypto era)))
forall v. ToCBOR v => Set v -> Encode ('Closed 'Dense) (Set v)
setEncode Set (BootstrapWitness (Crypto era))
boots)
Encode
('Closed 'Sparse)
(Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitnessRaw era)
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era))
-> Encode
('Closed 'Sparse)
(Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitnessRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> (Map (ScriptHash (Crypto era)) (Script era) -> Bool)
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era))
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era))
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit
Map (ScriptHash (Crypto era)) (Script era) -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null
( Word
-> Encode
('Closed 'Dense) (Map (ScriptHash (Crypto era)) (Script era))
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era))
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
1 (Encode
('Closed 'Dense) (Map (ScriptHash (Crypto era)) (Script era))
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era)))
-> Encode
('Closed 'Dense) (Map (ScriptHash (Crypto era)) (Script era))
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era))
forall a b. (a -> b) -> a -> b
$
(Map (ScriptHash (Crypto era)) (Script era) -> Encoding)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Encode
('Closed 'Dense) (Map (ScriptHash (Crypto era)) (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)
-> (Map (ScriptHash (Crypto era)) (Script era)
-> [Timelock (Crypto era)])
-> Map (ScriptHash (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))
unwrapTS ([Script era] -> [Timelock (Crypto era)])
-> (Map (ScriptHash (Crypto era)) (Script era) -> [Script era])
-> Map (ScriptHash (Crypto era)) (Script era)
-> [Timelock (Crypto era)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map (ScriptHash (Crypto era)) (Script era) -> [Script era]
forall k a. Map k a -> [a]
Map.elems)
((Script era -> Bool)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
forall a k. (a -> Bool) -> Map k a -> Map k a
Map.filter Script era -> Bool
forall era. Script era -> Bool
isTimelock Map (ScriptHash (Crypto era)) (Script era)
Map (ScriptHash (Crypto era)) (Script era)
scripts)
)
Encode
('Closed 'Sparse)
(Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitnessRaw era)
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era))
-> Encode
('Closed 'Sparse)
(Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era -> Redeemers era -> TxWitnessRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> (Map (ScriptHash (Crypto era)) (Script era) -> Bool)
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era))
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era))
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit
Map (ScriptHash (Crypto era)) (Script era) -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null
( Word
-> Encode
('Closed 'Dense) (Map (ScriptHash (Crypto era)) (Script era))
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era))
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
3 (Encode
('Closed 'Dense) (Map (ScriptHash (Crypto era)) (Script era))
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era)))
-> Encode
('Closed 'Dense) (Map (ScriptHash (Crypto era)) (Script era))
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era))
forall a b. (a -> b) -> a -> b
$
(Map (ScriptHash (Crypto era)) (Script era) -> Encoding)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Encode
('Closed 'Dense) (Map (ScriptHash (Crypto era)) (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)
-> (Map (ScriptHash (Crypto era)) (Script era)
-> [ShortByteString])
-> Map (ScriptHash (Crypto era)) (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
unwrapPS1 ([Script era] -> [ShortByteString])
-> (Map (ScriptHash (Crypto era)) (Script era) -> [Script era])
-> Map (ScriptHash (Crypto era)) (Script era)
-> [ShortByteString]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map (ScriptHash (Crypto era)) (Script era) -> [Script era]
forall k a. Map k a -> [a]
Map.elems)
((Script era -> Bool)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
forall a k. (a -> Bool) -> Map k a -> Map k a
Map.filter (Language -> Script era -> Bool
forall era. Language -> Script era -> Bool
isPlutus Language
PlutusV1) Map (ScriptHash (Crypto era)) (Script era)
Map (ScriptHash (Crypto era)) (Script era)
scripts)
)
Encode
('Closed 'Sparse)
(Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era -> Redeemers era -> TxWitnessRaw era)
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era))
-> Encode
('Closed 'Sparse) (TxDats era -> Redeemers era -> TxWitnessRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> (Map (ScriptHash (Crypto era)) (Script era) -> Bool)
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era))
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era))
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit
Map (ScriptHash (Crypto era)) (Script era) -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null
( Word
-> Encode
('Closed 'Dense) (Map (ScriptHash (Crypto era)) (Script era))
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era))
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
6 (Encode
('Closed 'Dense) (Map (ScriptHash (Crypto era)) (Script era))
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era)))
-> Encode
('Closed 'Dense) (Map (ScriptHash (Crypto era)) (Script era))
-> Encode
('Closed 'Sparse) (Map (ScriptHash (Crypto era)) (Script era))
forall a b. (a -> b) -> a -> b
$
(Map (ScriptHash (Crypto era)) (Script era) -> Encoding)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Encode
('Closed 'Dense) (Map (ScriptHash (Crypto era)) (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)
-> (Map (ScriptHash (Crypto era)) (Script era)
-> [ShortByteString])
-> Map (ScriptHash (Crypto era)) (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
unwrapPS2 ([Script era] -> [ShortByteString])
-> (Map (ScriptHash (Crypto era)) (Script era) -> [Script era])
-> Map (ScriptHash (Crypto era)) (Script era)
-> [ShortByteString]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map (ScriptHash (Crypto era)) (Script era) -> [Script era]
forall k a. Map k a -> [a]
Map.elems)
((Script era -> Bool)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
forall a k. (a -> Bool) -> Map k a -> Map k a
Map.filter (Language -> Script era -> Bool
forall era. Language -> Script era -> Bool
isPlutus Language
PlutusV2) Map (ScriptHash (Crypto era)) (Script era)
Map (ScriptHash (Crypto era)) (Script era)
scripts)
)
Encode
('Closed 'Sparse) (TxDats era -> Redeemers era -> TxWitnessRaw era)
-> Encode ('Closed 'Sparse) (TxDats era)
-> Encode ('Closed 'Sparse) (Redeemers era -> TxWitnessRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> (TxDats era -> Bool)
-> Encode ('Closed 'Sparse) (TxDats era)
-> Encode ('Closed 'Sparse) (TxDats era)
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit TxDats era -> Bool
forall era. TxDats era -> Bool
nullDats (Word
-> Encode ('Closed 'Dense) (TxDats era)
-> Encode ('Closed 'Sparse) (TxDats era)
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
4 (Encode ('Closed 'Dense) (TxDats era)
-> Encode ('Closed 'Sparse) (TxDats era))
-> Encode ('Closed 'Dense) (TxDats era)
-> Encode ('Closed 'Sparse) (TxDats era)
forall a b. (a -> b) -> a -> b
$ (TxDats era -> Encoding)
-> TxDats era -> Encode ('Closed 'Dense) (TxDats era)
forall t. (t -> Encoding) -> t -> Encode ('Closed 'Dense) t
E TxDats era -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR TxDats era
dats)
Encode ('Closed 'Sparse) (Redeemers era -> TxWitnessRaw era)
-> Encode ('Closed 'Sparse) (Redeemers era)
-> Encode ('Closed 'Sparse) (TxWitnessRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> (Redeemers era -> Bool)
-> Encode ('Closed 'Sparse) (Redeemers era)
-> Encode ('Closed 'Sparse) (Redeemers era)
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit Redeemers era -> Bool
forall era. Redeemers era -> Bool
nullRedeemers (Word
-> Encode ('Closed 'Dense) (Redeemers era)
-> Encode ('Closed 'Sparse) (Redeemers era)
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
5 (Encode ('Closed 'Dense) (Redeemers era)
-> Encode ('Closed 'Sparse) (Redeemers era))
-> Encode ('Closed 'Dense) (Redeemers era)
-> Encode ('Closed 'Sparse) (Redeemers era)
forall a b. (a -> b) -> a -> b
$ Redeemers era -> Encode ('Closed 'Dense) (Redeemers era)
forall t. ToCBOR t => t -> Encode ('Closed 'Dense) t
To Redeemers era
rdmrs)
where
unwrapTS :: Script era -> Maybe (Timelock (Crypto era))
unwrapTS (TimelockScript Timelock (Crypto era)
x) = Timelock (Crypto era) -> Maybe (Timelock (Crypto era))
forall a. a -> Maybe a
Just Timelock (Crypto era)
x
unwrapTS Script era
_ = Maybe (Timelock (Crypto era))
forall a. Maybe a
Nothing
unwrapPS1 :: Script era -> Maybe ShortByteString
unwrapPS1 (PlutusScript Language
PlutusV1 ShortByteString
x) = ShortByteString -> Maybe ShortByteString
forall a. a -> Maybe a
Just ShortByteString
x
unwrapPS1 Script era
_ = Maybe ShortByteString
forall a. Maybe a
Nothing
unwrapPS2 :: Script era -> Maybe ShortByteString
unwrapPS2 (PlutusScript Language
PlutusV2 ShortByteString
x) = ShortByteString -> Maybe ShortByteString
forall a. a -> Maybe a
Just ShortByteString
x
unwrapPS2 Script era
_ = Maybe ShortByteString
forall a. Maybe a
Nothing
isTimelock :: Script era -> Bool
isTimelock (TimelockScript Timelock (Crypto era)
_) = Bool
True
isTimelock (PlutusScript Language
_ ShortByteString
_) = Bool
False
isPlutus :: Language -> Script era -> Bool
isPlutus Language
_ (TimelockScript Timelock (Crypto era)
_) = Bool
False
isPlutus Language
lang (PlutusScript Language
l ShortByteString
_) = Language
lang Language -> Language -> Bool
forall a. Eq a => a -> a -> Bool
== Language
l
instance
(Era era) =>
FromCBOR (Annotator (RedeemersRaw era))
where
fromCBOR :: Decoder s (Annotator (RedeemersRaw era))
fromCBOR = (Map RdmrPtr (Data era, ExUnits) -> RedeemersRaw era)
-> Annotator (Map RdmrPtr (Data era, ExUnits))
-> Annotator (RedeemersRaw era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Map RdmrPtr (Data era, ExUnits) -> RedeemersRaw era
forall era. Map RdmrPtr (Data era, ExUnits) -> RedeemersRaw era
RedeemersRaw (Annotator (Map RdmrPtr (Data era, ExUnits))
-> Annotator (RedeemersRaw era))
-> Decoder s (Annotator (Map RdmrPtr (Data era, ExUnits)))
-> Decoder s (Annotator (RedeemersRaw era))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (Annotator (Map RdmrPtr (Data era, ExUnits)))
forall s. Decoder s (Annotator (Map RdmrPtr (Data era, ExUnits)))
dec
where
dec :: forall s. Decoder s (Annotator (Map RdmrPtr (Data era, ExUnits)))
dec :: Decoder s (Annotator (Map RdmrPtr (Data era, ExUnits)))
dec = do
Annotator [(RdmrPtr, (Data era, ExUnits))]
entries <- ([Annotator (RdmrPtr, (Data era, ExUnits))]
-> Annotator [(RdmrPtr, (Data era, ExUnits))])
-> Decoder s [Annotator (RdmrPtr, (Data era, ExUnits))]
-> Decoder s (Annotator [(RdmrPtr, (Data era, ExUnits))])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap [Annotator (RdmrPtr, (Data era, ExUnits))]
-> Annotator [(RdmrPtr, (Data era, ExUnits))]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence (Decoder s [Annotator (RdmrPtr, (Data era, ExUnits))]
-> Decoder s (Annotator [(RdmrPtr, (Data era, ExUnits))]))
-> (Decoder s (Annotator (RdmrPtr, (Data era, ExUnits)))
-> Decoder s [Annotator (RdmrPtr, (Data era, ExUnits))])
-> Decoder s (Annotator (RdmrPtr, (Data era, ExUnits)))
-> Decoder s (Annotator [(RdmrPtr, (Data era, ExUnits))])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Decoder s (Annotator (RdmrPtr, (Data era, ExUnits)))
-> Decoder s [Annotator (RdmrPtr, (Data era, ExUnits))]
forall s a. Decoder s a -> Decoder s [a]
decodeList
(Decoder s (Annotator (RdmrPtr, (Data era, ExUnits)))
-> Decoder s [Annotator (RdmrPtr, (Data era, ExUnits))])
-> (Decoder s (Annotator (RdmrPtr, (Data era, ExUnits)))
-> Decoder s (Annotator (RdmrPtr, (Data era, ExUnits))))
-> Decoder s (Annotator (RdmrPtr, (Data era, ExUnits)))
-> Decoder s [Annotator (RdmrPtr, (Data era, ExUnits))]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text
-> (Annotator (RdmrPtr, (Data era, ExUnits)) -> Int)
-> Decoder s (Annotator (RdmrPtr, (Data era, ExUnits)))
-> Decoder s (Annotator (RdmrPtr, (Data era, ExUnits)))
forall a s. Text -> (a -> Int) -> Decoder s a -> Decoder s a
decodeRecordNamed Text
"redeemer" (Int -> Annotator (RdmrPtr, (Data era, ExUnits)) -> Int
forall a b. a -> b -> a
const Int
4)
(Decoder s (Annotator (RdmrPtr, (Data era, ExUnits)))
-> Decoder s (Annotator [(RdmrPtr, (Data era, ExUnits))]))
-> Decoder s (Annotator (RdmrPtr, (Data era, ExUnits)))
-> Decoder s (Annotator [(RdmrPtr, (Data era, ExUnits))])
forall a b. (a -> b) -> a -> b
$ do
RdmrPtr
rdmrPtr <- Decoder s RdmrPtr
forall a s. FromCBORGroup a => Decoder s a
fromCBORGroup
Annotator (Data era)
dat <- Decoder s (Annotator (Data era))
forall a s. FromCBOR a => Decoder s a
fromCBOR
ExUnits
ex <- Decoder s ExUnits
forall a s. FromCBOR a => Decoder s a
fromCBOR
let f :: a -> a -> b -> (a, (a, b))
f a
x a
y b
z = (a
x, (a
y, b
z))
Annotator (RdmrPtr, (Data era, ExUnits))
-> Decoder s (Annotator (RdmrPtr, (Data era, ExUnits)))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Annotator (RdmrPtr, (Data era, ExUnits))
-> Decoder s (Annotator (RdmrPtr, (Data era, ExUnits))))
-> Annotator (RdmrPtr, (Data era, ExUnits))
-> Decoder s (Annotator (RdmrPtr, (Data era, ExUnits)))
forall a b. (a -> b) -> a -> b
$ RdmrPtr -> Data era -> ExUnits -> (RdmrPtr, (Data era, ExUnits))
forall a a b. a -> a -> b -> (a, (a, b))
f RdmrPtr
rdmrPtr (Data era -> ExUnits -> (RdmrPtr, (Data era, ExUnits)))
-> Annotator (Data era)
-> Annotator (ExUnits -> (RdmrPtr, (Data era, ExUnits)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Annotator (Data era)
dat Annotator (ExUnits -> (RdmrPtr, (Data era, ExUnits)))
-> Annotator ExUnits -> Annotator (RdmrPtr, (Data era, ExUnits))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ExUnits -> Annotator ExUnits
forall (f :: * -> *) a. Applicative f => a -> f a
pure ExUnits
ex
Annotator (Map RdmrPtr (Data era, ExUnits))
-> Decoder s (Annotator (Map RdmrPtr (Data era, ExUnits)))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Annotator (Map RdmrPtr (Data era, ExUnits))
-> Decoder s (Annotator (Map RdmrPtr (Data era, ExUnits))))
-> Annotator (Map RdmrPtr (Data era, ExUnits))
-> Decoder s (Annotator (Map RdmrPtr (Data era, ExUnits)))
forall a b. (a -> b) -> a -> b
$ [(RdmrPtr, (Data era, ExUnits))] -> Map RdmrPtr (Data era, ExUnits)
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(RdmrPtr, (Data era, ExUnits))]
-> Map RdmrPtr (Data era, ExUnits))
-> Annotator [(RdmrPtr, (Data era, ExUnits))]
-> Annotator (Map RdmrPtr (Data era, ExUnits))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Annotator [(RdmrPtr, (Data era, ExUnits))]
entries
deriving via
(Mem (RedeemersRaw era))
instance
(Era era) => FromCBOR (Annotator (Redeemers era))
instance
( Era era,
ToCBOR (Data era),
ToCBOR (Core.Script era),
Typeable (Core.Script era),
ValidateScript era,
Core.Script era ~ Script era
) =>
FromCBOR (Annotator (TxWitnessRaw era))
where
fromCBOR :: Decoder s (Annotator (TxWitnessRaw era))
fromCBOR =
Decode ('Closed 'Dense) (Annotator (TxWitnessRaw era))
-> Decoder s (Annotator (TxWitnessRaw era))
forall (w :: Wrapped) t s. Decode w t -> Decoder s t
decode (Decode ('Closed 'Dense) (Annotator (TxWitnessRaw era))
-> Decoder s (Annotator (TxWitnessRaw era)))
-> Decode ('Closed 'Dense) (Annotator (TxWitnessRaw era))
-> Decoder s (Annotator (TxWitnessRaw era))
forall a b. (a -> b) -> a -> b
$
String
-> Annotator (TxWitnessRaw era)
-> (Word -> Field (Annotator (TxWitnessRaw era)))
-> [(Word, String)]
-> Decode ('Closed 'Dense) (Annotator (TxWitnessRaw era))
forall t.
Typeable t =>
String
-> t
-> (Word -> Field t)
-> [(Word, String)]
-> Decode ('Closed 'Dense) t
SparseKeyed
String
"TxWitness"
(TxWitnessRaw era -> Annotator (TxWitnessRaw era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxWitnessRaw era
emptyTxWitness)
Word -> Field (Annotator (TxWitnessRaw era))
txWitnessField
[]
where
emptyTxWitness :: TxWitnessRaw era
emptyTxWitness = Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitnessRaw era
forall era.
Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitnessRaw era
TxWitnessRaw Set (WitVKey 'Witness (Crypto era))
forall a. Monoid a => a
mempty Set (BootstrapWitness (Crypto era))
forall a. Monoid a => a
mempty Map (ScriptHash (Crypto era)) (Script era)
forall a. Monoid a => a
mempty TxDats era
forall a. Monoid a => a
mempty Redeemers era
emptyRedeemers
emptyRedeemers :: Redeemers era
emptyRedeemers = Map RdmrPtr (Data era, ExUnits) -> Redeemers era
forall era.
Era era =>
Map RdmrPtr (Data era, ExUnits) -> Redeemers era
Redeemers Map RdmrPtr (Data era, ExUnits)
forall a. Monoid a => a
mempty
txWitnessField :: Word -> Field (Annotator (TxWitnessRaw era))
txWitnessField :: Word -> Field (Annotator (TxWitnessRaw era))
txWitnessField Word
0 =
(Set (WitVKey 'Witness (Crypto era))
-> TxWitnessRaw era -> TxWitnessRaw era)
-> Decode
('Closed 'Dense) (Annotator (Set (WitVKey 'Witness (Crypto era))))
-> Field (Annotator (TxWitnessRaw era))
forall (ann :: * -> *) x t (d :: Density).
Applicative ann =>
(x -> t -> t) -> Decode ('Closed d) (ann x) -> Field (ann t)
fieldAA
(\Set (WitVKey 'Witness (Crypto era))
x TxWitnessRaw era
wits -> TxWitnessRaw era
wits {_txwitsVKey :: Set (WitVKey 'Witness (Crypto era))
_txwitsVKey = Set (WitVKey 'Witness (Crypto era))
x})
(Decode ('Closed 'Dense) (Annotator (WitVKey 'Witness (Crypto era)))
-> Decode
('Closed 'Dense) (Annotator (Set (WitVKey 'Witness (Crypto era))))
forall x.
Ord x =>
Decode ('Closed 'Dense) (Annotator x)
-> Decode ('Closed 'Dense) (Annotator (Set x))
setDecodeA Decode ('Closed 'Dense) (Annotator (WitVKey 'Witness (Crypto era)))
forall t (w :: Wrapped). FromCBOR t => Decode w t
From)
txWitnessField Word
2 =
(Set (BootstrapWitness (Crypto era))
-> TxWitnessRaw era -> TxWitnessRaw era)
-> Decode
('Closed 'Dense) (Annotator (Set (BootstrapWitness (Crypto era))))
-> Field (Annotator (TxWitnessRaw era))
forall (ann :: * -> *) x t (d :: Density).
Applicative ann =>
(x -> t -> t) -> Decode ('Closed d) (ann x) -> Field (ann t)
fieldAA
(\Set (BootstrapWitness (Crypto era))
x TxWitnessRaw era
wits -> TxWitnessRaw era
wits {_txwitsBoot :: Set (BootstrapWitness (Crypto era))
_txwitsBoot = Set (BootstrapWitness (Crypto era))
x})
(Decode ('Closed 'Dense) (Annotator (BootstrapWitness (Crypto era)))
-> Decode
('Closed 'Dense) (Annotator (Set (BootstrapWitness (Crypto era))))
forall x.
Ord x =>
Decode ('Closed 'Dense) (Annotator x)
-> Decode ('Closed 'Dense) (Annotator (Set x))
setDecodeA Decode ('Closed 'Dense) (Annotator (BootstrapWitness (Crypto era)))
forall t (w :: Wrapped). FromCBOR t => Decode w t
From)
txWitnessField Word
1 =
([Script era] -> TxWitnessRaw era -> TxWitnessRaw era)
-> Decode ('Closed 'Dense) (Annotator [Script era])
-> Field (Annotator (TxWitnessRaw era))
forall (ann :: * -> *) x t (d :: Density).
Applicative ann =>
(x -> t -> t) -> Decode ('Closed d) (ann x) -> Field (ann t)
fieldAA
[Script era] -> TxWitnessRaw era -> TxWitnessRaw era
addScripts
(Decode ('Closed 'Dense) (Annotator (Script era))
-> Decode ('Closed 'Dense) (Annotator [Script era])
forall x.
Decode ('Closed 'Dense) (Annotator x)
-> Decode ('Closed 'Dense) (Annotator [x])
listDecodeA ((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))
-> Decode ('Closed 'Dense) (Annotator (Timelock (Crypto era)))
-> Decode ('Closed 'Dense) (Annotator (Script era))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decode ('Closed 'Dense) (Annotator (Timelock (Crypto era)))
forall t (w :: Wrapped). FromCBOR t => Decode w t
From))
txWitnessField Word
3 =
([Script era] -> TxWitnessRaw era -> TxWitnessRaw era)
-> Decode ('Closed 'Dense) [Script era]
-> Field (Annotator (TxWitnessRaw era))
forall (ann :: * -> *) x t (d :: Density).
Applicative ann =>
(x -> t -> t) -> Decode ('Closed d) x -> Field (ann t)
fieldA
[Script era] -> TxWitnessRaw era -> TxWitnessRaw era
addScripts
((ShortByteString -> Script era)
-> [ShortByteString] -> [Script era]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Language -> ShortByteString -> Script era
forall era. Language -> ShortByteString -> Script era
PlutusScript Language
PlutusV1) ([ShortByteString] -> [Script era])
-> Decode ('Closed 'Dense) [ShortByteString]
-> Decode ('Closed 'Dense) [Script era]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decode ('Closed 'Dense) [ShortByteString]
forall v. FromCBOR v => Decode ('Closed 'Dense) [v]
listDecode)
txWitnessField Word
4 =
(TxDats era -> TxWitnessRaw era -> TxWitnessRaw era)
-> Decode ('Closed Any) (Annotator (TxDats era))
-> Field (Annotator (TxWitnessRaw era))
forall (ann :: * -> *) x t (d :: Density).
Applicative ann =>
(x -> t -> t) -> Decode ('Closed d) (ann x) -> Field (ann t)
fieldAA
(\TxDats era
x TxWitnessRaw era
wits -> TxWitnessRaw era
wits {_txdats :: TxDats era
_txdats = TxDats era
x})
Decode ('Closed Any) (Annotator (TxDats era))
forall t (w :: Wrapped). FromCBOR t => Decode w t
From
txWitnessField Word
5 = (Redeemers era -> TxWitnessRaw era -> TxWitnessRaw era)
-> Decode ('Closed Any) (Annotator (Redeemers era))
-> Field (Annotator (TxWitnessRaw era))
forall (ann :: * -> *) x t (d :: Density).
Applicative ann =>
(x -> t -> t) -> Decode ('Closed d) (ann x) -> Field (ann t)
fieldAA (\Redeemers era
x TxWitnessRaw era
wits -> TxWitnessRaw era
wits {_txrdmrs :: Redeemers era
_txrdmrs = Redeemers era
x}) Decode ('Closed Any) (Annotator (Redeemers era))
forall t (w :: Wrapped). FromCBOR t => Decode w t
From
txWitnessField Word
6 =
([Script era] -> TxWitnessRaw era -> TxWitnessRaw era)
-> Decode ('Closed 'Dense) [Script era]
-> Field (Annotator (TxWitnessRaw era))
forall (ann :: * -> *) x t (d :: Density).
Applicative ann =>
(x -> t -> t) -> Decode ('Closed d) x -> Field (ann t)
fieldA
[Script era] -> TxWitnessRaw era -> TxWitnessRaw era
addScripts
((ShortByteString -> Script era)
-> [ShortByteString] -> [Script era]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Language -> ShortByteString -> Script era
forall era. Language -> ShortByteString -> Script era
PlutusScript Language
PlutusV2) ([ShortByteString] -> [Script era])
-> Decode ('Closed 'Dense) [ShortByteString]
-> Decode ('Closed 'Dense) [Script era]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decode ('Closed 'Dense) [ShortByteString]
forall v. FromCBOR v => Decode ('Closed 'Dense) [v]
listDecode)
txWitnessField Word
n = (Any
-> Annotator (TxWitnessRaw era) -> Annotator (TxWitnessRaw era))
-> Decode ('Closed Any) Any -> Field (Annotator (TxWitnessRaw era))
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Any
_ Annotator (TxWitnessRaw era)
t -> Annotator (TxWitnessRaw era)
t) (Word -> Decode ('Closed Any) Any
forall (w :: Wrapped) t. Word -> Decode w t
Invalid Word
n)
addScripts :: [Script era] -> TxWitnessRaw era -> TxWitnessRaw era
addScripts :: [Script era] -> TxWitnessRaw era -> TxWitnessRaw era
addScripts [Script era]
x TxWitnessRaw era
wits = TxWitnessRaw era
wits {_txscripts :: Map (ScriptHash (Crypto era)) (Script era)
_txscripts = [era] -> [Script era] -> Map (ScriptHash (Crypto era)) (Script era)
forall (proxy :: * -> *) e.
ValidateScript e =>
proxy e -> [Script e] -> Map (ScriptHash (Crypto e)) (Script e)
getKeys ([] :: [era]) [Script era]
[Script era]
x Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
-> Map (ScriptHash (Crypto era)) (Script era)
forall a. Semigroup a => a -> a -> a
<> TxWitnessRaw era -> Map (ScriptHash (Crypto era)) (Script era)
forall era.
TxWitnessRaw era -> Map (ScriptHash (Crypto era)) (Script era)
_txscripts TxWitnessRaw era
wits}
getKeys ::
forall proxy e.
ValidateScript e =>
proxy e ->
[Core.Script e] ->
Map (ScriptHash (Crypto e)) (Core.Script e)
getKeys :: proxy e -> [Script e] -> Map (ScriptHash (Crypto e)) (Script e)
getKeys proxy e
_ = (Script e -> ScriptHash (Crypto e))
-> [Script e] -> Map (ScriptHash (Crypto e)) (Script e)
forall a b. Ord b => (a -> b) -> [a] -> Map b a
keyBy (ValidateScript e => Script e -> ScriptHash (Crypto e)
forall era.
ValidateScript era =>
Script era -> ScriptHash (Crypto era)
hashScript @e)
keyBy :: forall a b. Ord b => (a -> b) -> [a] -> Map b a
keyBy :: (a -> b) -> [a] -> Map b a
keyBy a -> b
f [a]
xs = [(b, a)] -> Map b a
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(b, a)] -> Map b a) -> [(b, a)] -> Map b a
forall a b. (a -> b) -> a -> b
$ (\a
x -> (a -> b
f a
x, a
x)) (a -> (b, a)) -> [a] -> [(b, a)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [a]
xs
deriving via
(Mem (TxWitnessRaw era))
instance
( Era era,
ValidateScript era,
Core.Script era ~ Script era
) =>
FromCBOR (Annotator (TxWitness era))