{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ViewPatterns #-}
module Cardano.Ledger.Babbage.TxBody
( TxOut (TxOut, TxOutCompact, TxOutCompactDH, TxOutCompactDatum, TxOutCompactRefScript),
TxBody
( TxBody,
inputs,
collateral,
referenceInputs,
outputs,
collateralReturn,
totalCollateral,
txcerts,
txwdrls,
txfee,
txvldt,
txUpdates,
reqSignerHashes,
mint,
scriptIntegrityHash,
adHash,
txnetworkid
),
Datum (..),
spendInputs',
collateralInputs',
referenceInputs',
outputs',
collateralReturn',
totalCollateral',
certs',
wdrls',
txfee',
vldt',
update',
reqSignerHashes',
mint',
scriptIntegrityHash',
adHash',
txnetworkid',
getBabbageTxOutEitherAddr,
BabbageBody,
EraIndependentScriptIntegrity,
ScriptIntegrityHash,
txOutData,
txOutDataHash,
txOutScript,
)
where
import Cardano.Binary
( DecoderError (..),
FromCBOR (..),
ToCBOR (..),
TokenType (..),
decodeAnnotator,
decodeBreakOr,
decodeListLenOrIndef,
decodeNestedCborBytes,
encodeNestedCbor,
peekTokenType,
)
import Cardano.Crypto.Hash
import Cardano.Ledger.Address (Addr (..))
import Cardano.Ledger.Alonzo.Data
( AuxiliaryDataHash (..),
BinaryData,
Data,
DataHash,
Datum (..),
binaryDataToData,
)
import Cardano.Ledger.Alonzo.TxBody
( Addr28Extra,
DataHash32,
decodeAddress28,
decodeDataHash32,
encodeAddress28,
encodeDataHash32,
getAdaOnly,
)
import qualified Cardano.Ledger.Alonzo.TxBody as Alonzo
import Cardano.Ledger.BaseTypes
( Network (..),
StrictMaybe (..),
maybeToStrictMaybe,
)
import Cardano.Ledger.Coin (Coin (..))
import Cardano.Ledger.CompactAddress
( CompactAddr,
compactAddr,
decompactAddr,
fromCborBackwardsBothAddr,
fromCborBothAddr,
fromCborRewardAcnt,
)
import Cardano.Ledger.Compactible
import Cardano.Ledger.Core (PParamsDelta)
import qualified Cardano.Ledger.Core as Core
import Cardano.Ledger.Credential (Credential (..), StakeReference (..))
import qualified Cardano.Ledger.Crypto as CC
import Cardano.Ledger.Era (Crypto, Era)
import Cardano.Ledger.Hashes
( EraIndependentScriptIntegrity,
EraIndependentTxBody,
)
import Cardano.Ledger.Keys (KeyHash (..), KeyRole (..))
import Cardano.Ledger.Mary.Value (Value (..), policies, policyID)
import qualified Cardano.Ledger.Mary.Value as Mary
import Cardano.Ledger.SafeHash
( HashAnnotated,
SafeHash,
SafeToHash,
)
import Cardano.Ledger.Serialization (Sized (..), sizedDecoder)
import Cardano.Ledger.Shelley.Delegation.Certificates (DCert)
import Cardano.Ledger.Shelley.PParams (Update)
import Cardano.Ledger.Shelley.Scripts (ScriptHash (..))
import Cardano.Ledger.Shelley.TxBody (Wdrl (Wdrl), unWdrl)
import Cardano.Ledger.ShelleyMA.Timelocks (ValidityInterval (..))
import Cardano.Ledger.TxIn (TxIn (..))
import Cardano.Ledger.Val
( DecodeNonNegative,
Val (..),
decodeMint,
decodeNonNegative,
encodeMint,
isZero,
)
import Control.DeepSeq (NFData (rnf), rwhnf)
import Control.Monad ((<$!>))
import qualified Data.ByteString.Lazy as LBS
import Data.Coders
import Data.Maybe (fromMaybe)
import Data.MemoBytes (Mem, MemoBytes (..), memoBytes)
import Data.Sequence.Strict (StrictSeq)
import qualified Data.Sequence.Strict as StrictSeq
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Sharing (FromSharedCBOR (..), Interns, interns)
import qualified Data.Text as T
import Data.Typeable (Proxy (..), Typeable, (:~:) (Refl))
import Data.Word
import GHC.Generics (Generic)
import GHC.Records (HasField (..))
import GHC.Stack (HasCallStack)
import NoThunks.Class (InspectHeapNamed (..), NoThunks)
import Prelude hiding (lookup)
data TxOut era
= TxOutCompact'
{-# UNPACK #-} !(CompactAddr (Crypto era))
!(CompactForm (Core.Value era))
| TxOutCompactDH'
{-# UNPACK #-} !(CompactAddr (Crypto era))
!(CompactForm (Core.Value era))
!(DataHash (Crypto era))
| TxOutCompactDatum
{-# UNPACK #-} !(CompactAddr (Crypto era))
!(CompactForm (Core.Value era))
{-# UNPACK #-} !(BinaryData era)
| TxOutCompactRefScript
{-# UNPACK #-} !(CompactAddr (Crypto era))
!(CompactForm (Core.Value era))
!(Datum era)
!(Core.Script era)
| TxOut_AddrHash28_AdaOnly
!(Credential 'Staking (Crypto era))
{-# UNPACK #-} !Addr28Extra
{-# UNPACK #-} !(CompactForm Coin)
| TxOut_AddrHash28_AdaOnly_DataHash32
!(Credential 'Staking (Crypto era))
{-# UNPACK #-} !Addr28Extra
{-# UNPACK #-} !(CompactForm Coin)
{-# UNPACK #-} !DataHash32
deriving stock instance
( Eq (Core.Value era),
Eq (Core.Script era),
Compactible (Core.Value era)
) =>
Eq (TxOut era)
instance NFData (TxOut era) where
rnf :: TxOut era -> ()
rnf = TxOut era -> ()
forall a. a -> ()
rwhnf
viewCompactTxOut ::
forall era.
Era era =>
TxOut era ->
(CompactAddr (Crypto era), CompactForm (Core.Value era), Datum era, StrictMaybe (Core.Script era))
viewCompactTxOut :: TxOut era
-> (CompactAddr (Crypto era), CompactForm (Value era), Datum era,
StrictMaybe (Script era))
viewCompactTxOut TxOut era
txOut = case TxOut era
txOut of
TxOutCompact' CompactAddr (Crypto era)
addr CompactForm (Value era)
val -> (CompactAddr (Crypto era)
addr, CompactForm (Value era)
val, Datum era
forall era. Datum era
NoDatum, StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing)
TxOutCompactDH' CompactAddr (Crypto era)
addr CompactForm (Value era)
val DataHash (Crypto era)
dh -> (CompactAddr (Crypto era)
addr, CompactForm (Value era)
val, DataHash (Crypto era) -> Datum era
forall era. DataHash (Crypto era) -> Datum era
DatumHash DataHash (Crypto era)
dh, StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing)
TxOutCompactDatum CompactAddr (Crypto era)
addr CompactForm (Value era)
val BinaryData era
datum -> (CompactAddr (Crypto era)
addr, CompactForm (Value era)
val, BinaryData era -> Datum era
forall era. BinaryData era -> Datum era
Datum BinaryData era
datum, StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing)
TxOutCompactRefScript CompactAddr (Crypto era)
addr CompactForm (Value era)
val Datum era
datum Script era
rs -> (CompactAddr (Crypto era)
addr, CompactForm (Value era)
val, Datum era
datum, Script era -> StrictMaybe (Script era)
forall a. a -> StrictMaybe a
SJust Script era
rs)
TxOut_AddrHash28_AdaOnly Credential 'Staking (Crypto era)
stakeRef Addr28Extra
addr28Extra CompactForm Coin
adaVal ->
let (CompactAddr (Crypto era)
a, CompactForm (Value era)
b, StrictMaybe (DataHash (Crypto era))
c) = Era era =>
TxOut era
-> (CompactAddr (Crypto era), CompactForm (Value era),
StrictMaybe (DataHash (Crypto era)))
forall era.
Era era =>
TxOut era
-> (CompactAddr (Crypto era), CompactForm (Value era),
StrictMaybe (DataHash (Crypto era)))
Alonzo.viewCompactTxOut @era (TxOut era
-> (CompactAddr (Crypto era), CompactForm (Value era),
StrictMaybe (DataHash (Crypto era))))
-> TxOut era
-> (CompactAddr (Crypto era), CompactForm (Value era),
StrictMaybe (DataHash (Crypto era)))
forall a b. (a -> b) -> a -> b
$ Credential 'Staking (Crypto era)
-> Addr28Extra -> CompactForm Coin -> TxOut era
forall era.
Credential 'Staking (Crypto era)
-> Addr28Extra -> CompactForm Coin -> TxOut era
Alonzo.TxOut_AddrHash28_AdaOnly Credential 'Staking (Crypto era)
stakeRef Addr28Extra
addr28Extra CompactForm Coin
adaVal
in (CompactAddr (Crypto era)
a, CompactForm (Value era)
b, StrictMaybe (DataHash (Crypto era)) -> Datum era
forall era. StrictMaybe (DataHash (Crypto era)) -> Datum era
toDatum StrictMaybe (DataHash (Crypto era))
c, StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing)
TxOut_AddrHash28_AdaOnly_DataHash32 Credential 'Staking (Crypto era)
stakeRef Addr28Extra
addr28Extra CompactForm Coin
adaVal DataHash32
dataHash32 ->
let (CompactAddr (Crypto era)
a, CompactForm (Value era)
b, StrictMaybe (DataHash (Crypto era))
c) =
Era era =>
TxOut era
-> (CompactAddr (Crypto era), CompactForm (Value era),
StrictMaybe (DataHash (Crypto era)))
forall era.
Era era =>
TxOut era
-> (CompactAddr (Crypto era), CompactForm (Value era),
StrictMaybe (DataHash (Crypto era)))
Alonzo.viewCompactTxOut @era (TxOut era
-> (CompactAddr (Crypto era), CompactForm (Value era),
StrictMaybe (DataHash (Crypto era))))
-> TxOut era
-> (CompactAddr (Crypto era), CompactForm (Value era),
StrictMaybe (DataHash (Crypto era)))
forall a b. (a -> b) -> a -> b
$
Credential 'Staking (Crypto era)
-> Addr28Extra -> CompactForm Coin -> DataHash32 -> TxOut era
forall era.
Credential 'Staking (Crypto era)
-> Addr28Extra -> CompactForm Coin -> DataHash32 -> TxOut era
Alonzo.TxOut_AddrHash28_AdaOnly_DataHash32 Credential 'Staking (Crypto era)
stakeRef Addr28Extra
addr28Extra CompactForm Coin
adaVal DataHash32
dataHash32
in (CompactAddr (Crypto era)
a, CompactForm (Value era)
b, StrictMaybe (DataHash (Crypto era)) -> Datum era
forall era. StrictMaybe (DataHash (Crypto era)) -> Datum era
toDatum StrictMaybe (DataHash (Crypto era))
c, StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing)
where
toDatum :: StrictMaybe (DataHash (Crypto era)) -> Datum era
toDatum = \case
StrictMaybe (DataHash (Crypto era))
SNothing -> Datum era
forall era. Datum era
NoDatum
SJust DataHash (Crypto era)
dh -> DataHash (Crypto era) -> Datum era
forall era. DataHash (Crypto era) -> Datum era
DatumHash DataHash (Crypto era)
dh
viewTxOut ::
forall era.
Era era =>
TxOut era ->
(Addr (Crypto era), Core.Value era, Datum era, StrictMaybe (Core.Script era))
viewTxOut :: TxOut era
-> (Addr (Crypto era), Value era, Datum era,
StrictMaybe (Script era))
viewTxOut (TxOutCompact' CompactAddr (Crypto era)
bs CompactForm (Value era)
c) = (Addr (Crypto era)
addr, Value era
val, Datum era
forall era. Datum era
NoDatum, StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing)
where
addr :: Addr (Crypto era)
addr = CompactAddr (Crypto era) -> Addr (Crypto era)
forall crypto. Crypto crypto => CompactAddr crypto -> Addr crypto
decompactAddr CompactAddr (Crypto era)
bs
val :: Value era
val = CompactForm (Value era) -> Value era
forall a. Compactible a => CompactForm a -> a
fromCompact CompactForm (Value era)
c
viewTxOut (TxOutCompactDH' CompactAddr (Crypto era)
bs CompactForm (Value era)
c DataHash (Crypto era)
dh) = (Addr (Crypto era)
addr, Value era
val, DataHash (Crypto era) -> Datum era
forall era. DataHash (Crypto era) -> Datum era
DatumHash DataHash (Crypto era)
dh, StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing)
where
addr :: Addr (Crypto era)
addr = CompactAddr (Crypto era) -> Addr (Crypto era)
forall crypto. Crypto crypto => CompactAddr crypto -> Addr crypto
decompactAddr CompactAddr (Crypto era)
bs
val :: Value era
val = CompactForm (Value era) -> Value era
forall a. Compactible a => CompactForm a -> a
fromCompact CompactForm (Value era)
c
viewTxOut (TxOutCompactDatum CompactAddr (Crypto era)
bs CompactForm (Value era)
c BinaryData era
d) = (Addr (Crypto era)
addr, Value era
val, BinaryData era -> Datum era
forall era. BinaryData era -> Datum era
Datum BinaryData era
d, StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing)
where
addr :: Addr (Crypto era)
addr = CompactAddr (Crypto era) -> Addr (Crypto era)
forall crypto. Crypto crypto => CompactAddr crypto -> Addr crypto
decompactAddr CompactAddr (Crypto era)
bs
val :: Value era
val = CompactForm (Value era) -> Value era
forall a. Compactible a => CompactForm a -> a
fromCompact CompactForm (Value era)
c
viewTxOut (TxOutCompactRefScript CompactAddr (Crypto era)
bs CompactForm (Value era)
c Datum era
d Script era
rs) = (Addr (Crypto era)
addr, Value era
val, Datum era
d, Script era -> StrictMaybe (Script era)
forall a. a -> StrictMaybe a
SJust Script era
rs)
where
addr :: Addr (Crypto era)
addr = CompactAddr (Crypto era) -> Addr (Crypto era)
forall crypto. Crypto crypto => CompactAddr crypto -> Addr crypto
decompactAddr CompactAddr (Crypto era)
bs
val :: Value era
val = CompactForm (Value era) -> Value era
forall a. Compactible a => CompactForm a -> a
fromCompact CompactForm (Value era)
c
viewTxOut (TxOut_AddrHash28_AdaOnly Credential 'Staking (Crypto era)
stakeRef Addr28Extra
addr28Extra CompactForm Coin
adaVal) = (Addr (Crypto era)
addr, Value era
val, Datum era
forall era. Datum era
NoDatum, StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing)
where
(Addr (Crypto era)
addr, Value era
val, StrictMaybe (DataHash (Crypto era))
_) =
Era era =>
TxOut era
-> (Addr (Crypto era), Value era,
StrictMaybe (DataHash (Crypto era)))
forall era.
Era era =>
TxOut era
-> (Addr (Crypto era), Value era,
StrictMaybe (DataHash (Crypto era)))
Alonzo.viewTxOut @era (TxOut era
-> (Addr (Crypto era), Value era,
StrictMaybe (DataHash (Crypto era))))
-> TxOut era
-> (Addr (Crypto era), Value era,
StrictMaybe (DataHash (Crypto era)))
forall a b. (a -> b) -> a -> b
$ Credential 'Staking (Crypto era)
-> Addr28Extra -> CompactForm Coin -> TxOut era
forall era.
Credential 'Staking (Crypto era)
-> Addr28Extra -> CompactForm Coin -> TxOut era
Alonzo.TxOut_AddrHash28_AdaOnly Credential 'Staking (Crypto era)
stakeRef Addr28Extra
addr28Extra CompactForm Coin
adaVal
viewTxOut (TxOut_AddrHash28_AdaOnly_DataHash32 Credential 'Staking (Crypto era)
stakeRef Addr28Extra
addr28Extra CompactForm Coin
adaVal DataHash32
dataHash32) =
case StrictMaybe (DataHash (Crypto era))
mDataHash of
StrictMaybe (DataHash (Crypto era))
SNothing -> (Addr (Crypto era)
addr, Value era
val, Datum era
forall era. Datum era
NoDatum, StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing)
SJust DataHash (Crypto era)
dh -> (Addr (Crypto era)
addr, Value era
val, DataHash (Crypto era) -> Datum era
forall era. DataHash (Crypto era) -> Datum era
DatumHash DataHash (Crypto era)
dh, StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing)
where
(Addr (Crypto era)
addr, Value era
val, StrictMaybe (DataHash (Crypto era))
mDataHash) =
Era era =>
TxOut era
-> (Addr (Crypto era), Value era,
StrictMaybe (DataHash (Crypto era)))
forall era.
Era era =>
TxOut era
-> (Addr (Crypto era), Value era,
StrictMaybe (DataHash (Crypto era)))
Alonzo.viewTxOut @era (TxOut era
-> (Addr (Crypto era), Value era,
StrictMaybe (DataHash (Crypto era))))
-> TxOut era
-> (Addr (Crypto era), Value era,
StrictMaybe (DataHash (Crypto era)))
forall a b. (a -> b) -> a -> b
$
Credential 'Staking (Crypto era)
-> Addr28Extra -> CompactForm Coin -> DataHash32 -> TxOut era
forall era.
Credential 'Staking (Crypto era)
-> Addr28Extra -> CompactForm Coin -> DataHash32 -> TxOut era
Alonzo.TxOut_AddrHash28_AdaOnly_DataHash32 Credential 'Staking (Crypto era)
stakeRef Addr28Extra
addr28Extra CompactForm Coin
adaVal DataHash32
dataHash32
instance
( Era era,
Show (Core.Value era),
Show (Core.Script era),
Show (CompactForm (Core.Value era))
) =>
Show (TxOut era)
where
show :: TxOut era -> String
show = (Addr (Crypto era), Value era, Datum era, StrictMaybe (Script era))
-> String
forall a. Show a => a -> String
show ((Addr (Crypto era), Value era, Datum era,
StrictMaybe (Script era))
-> String)
-> (TxOut era
-> (Addr (Crypto era), Value era, Datum era,
StrictMaybe (Script era)))
-> TxOut era
-> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxOut era
-> (Addr (Crypto era), Value era, Datum era,
StrictMaybe (Script era))
forall era.
Era era =>
TxOut era
-> (Addr (Crypto era), Value era, Datum era,
StrictMaybe (Script era))
viewTxOut
deriving via InspectHeapNamed "TxOut" (TxOut era) instance NoThunks (TxOut era)
pattern TxOut ::
forall era.
( Era era,
Compactible (Core.Value era),
Val (Core.Value era),
HasCallStack
) =>
Addr (Crypto era) ->
Core.Value era ->
Datum era ->
StrictMaybe (Core.Script era) ->
TxOut era
pattern $bTxOut :: Addr (Crypto era)
-> Value era -> Datum era -> StrictMaybe (Script era) -> TxOut era
$mTxOut :: forall r era.
(Era era, Compactible (Value era), Val (Value era),
HasCallStack) =>
TxOut era
-> (Addr (Crypto era)
-> Value era -> Datum era -> StrictMaybe (Script era) -> r)
-> (Void# -> r)
-> r
TxOut addr vl datum refScript <-
(viewTxOut -> (addr, vl, datum, refScript))
where
TxOut Addr (Crypto era)
addr Value era
vl Datum era
datum StrictMaybe (Script era)
refScript = Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
forall era.
(Era era, HasCallStack) =>
Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
mkTxOut Addr (Crypto era)
addr (Addr (Crypto era) -> CompactAddr (Crypto era)
forall crypto. Addr crypto -> CompactAddr crypto
compactAddr Addr (Crypto era)
addr) Value era
vl Datum era
datum StrictMaybe (Script era)
refScript
{-# COMPLETE TxOut #-}
mkTxOut ::
forall era.
(Era era, HasCallStack) =>
Addr (Crypto era) ->
CompactAddr (Crypto era) ->
Core.Value era ->
Datum era ->
StrictMaybe (Core.Script era) ->
TxOut era
mkTxOut :: Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
mkTxOut Addr (Crypto era)
addr CompactAddr (Crypto era)
_cAddr Value era
vl Datum era
NoDatum StrictMaybe (Script era)
SNothing
| Just CompactForm Coin
adaCompact <- Proxy era -> Value era -> Maybe (CompactForm Coin)
forall era.
Val (Value era) =>
Proxy era -> Value era -> Maybe (CompactForm Coin)
getAdaOnly (Proxy era
forall k (t :: k). Proxy t
Proxy @era) Value era
vl,
Addr Network
network PaymentCredential (Crypto era)
paymentCred StakeReference (Crypto era)
stakeRef <- Addr (Crypto era)
addr,
StakeRefBase StakeCredential (Crypto era)
stakeCred <- StakeReference (Crypto era)
stakeRef,
Just (SizeHash (ADDRHASH (Crypto era)) :~: 28
Refl, Addr28Extra
addr28Extra) <- Network
-> PaymentCredential (Crypto era)
-> Maybe (SizeHash (ADDRHASH (Crypto era)) :~: 28, Addr28Extra)
forall crypto.
HashAlgorithm (ADDRHASH crypto) =>
Network
-> PaymentCredential crypto
-> Maybe (SizeHash (ADDRHASH crypto) :~: 28, Addr28Extra)
encodeAddress28 Network
network PaymentCredential (Crypto era)
paymentCred =
StakeCredential (Crypto era)
-> Addr28Extra -> CompactForm Coin -> TxOut era
forall era.
Credential 'Staking (Crypto era)
-> Addr28Extra -> CompactForm Coin -> TxOut era
TxOut_AddrHash28_AdaOnly StakeCredential (Crypto era)
stakeCred Addr28Extra
addr28Extra CompactForm Coin
adaCompact
mkTxOut Addr (Crypto era)
addr CompactAddr (Crypto era)
_cAddr Value era
vl (DatumHash DataHash (Crypto era)
dh) StrictMaybe (Script era)
SNothing
| Just CompactForm Coin
adaCompact <- Proxy era -> Value era -> Maybe (CompactForm Coin)
forall era.
Val (Value era) =>
Proxy era -> Value era -> Maybe (CompactForm Coin)
getAdaOnly (Proxy era
forall k (t :: k). Proxy t
Proxy @era) Value era
vl,
Addr Network
network PaymentCredential (Crypto era)
paymentCred StakeReference (Crypto era)
stakeRef <- Addr (Crypto era)
addr,
StakeRefBase StakeCredential (Crypto era)
stakeCred <- StakeReference (Crypto era)
stakeRef,
Just (SizeHash (ADDRHASH (Crypto era)) :~: 28
Refl, Addr28Extra
addr28Extra) <- Network
-> PaymentCredential (Crypto era)
-> Maybe (SizeHash (ADDRHASH (Crypto era)) :~: 28, Addr28Extra)
forall crypto.
HashAlgorithm (ADDRHASH crypto) =>
Network
-> PaymentCredential crypto
-> Maybe (SizeHash (ADDRHASH crypto) :~: 28, Addr28Extra)
encodeAddress28 Network
network PaymentCredential (Crypto era)
paymentCred,
Just (SizeHash (HASH (Crypto era)) :~: 32
Refl, DataHash32
dataHash32) <- DataHash (Crypto era)
-> Maybe (SizeHash (HASH (Crypto era)) :~: 32, DataHash32)
forall crypto.
HashAlgorithm (HASH crypto) =>
DataHash crypto
-> Maybe (SizeHash (HASH crypto) :~: 32, DataHash32)
encodeDataHash32 DataHash (Crypto era)
dh =
StakeCredential (Crypto era)
-> Addr28Extra -> CompactForm Coin -> DataHash32 -> TxOut era
forall era.
Credential 'Staking (Crypto era)
-> Addr28Extra -> CompactForm Coin -> DataHash32 -> TxOut era
TxOut_AddrHash28_AdaOnly_DataHash32 StakeCredential (Crypto era)
stakeCred Addr28Extra
addr28Extra CompactForm Coin
adaCompact DataHash32
dataHash32
mkTxOut Addr (Crypto era)
_addr CompactAddr (Crypto era)
cAddr Value era
vl Datum era
d StrictMaybe (Script era)
rs =
let cVal :: CompactForm (Value era)
cVal = CompactForm (Value era)
-> Maybe (CompactForm (Value era)) -> CompactForm (Value era)
forall a. a -> Maybe a -> a
fromMaybe (String -> CompactForm (Value era)
forall a. HasCallStack => String -> a
error String
"Illegal value in txout") (Maybe (CompactForm (Value era)) -> CompactForm (Value era))
-> Maybe (CompactForm (Value era)) -> CompactForm (Value era)
forall a b. (a -> b) -> a -> b
$ Value era -> Maybe (CompactForm (Value era))
forall a. Compactible a => a -> Maybe (CompactForm a)
toCompact Value era
vl
in case StrictMaybe (Script era)
rs of
StrictMaybe (Script era)
SNothing -> case Datum era
d of
Datum era
NoDatum -> CompactAddr (Crypto era) -> CompactForm (Value era) -> TxOut era
forall era.
CompactAddr (Crypto era) -> CompactForm (Value era) -> TxOut era
TxOutCompact' CompactAddr (Crypto era)
cAddr CompactForm (Value era)
cVal
DatumHash DataHash (Crypto era)
dh -> CompactAddr (Crypto era)
-> CompactForm (Value era) -> DataHash (Crypto era) -> TxOut era
forall era.
CompactAddr (Crypto era)
-> CompactForm (Value era) -> DataHash (Crypto era) -> TxOut era
TxOutCompactDH' CompactAddr (Crypto era)
cAddr CompactForm (Value era)
cVal DataHash (Crypto era)
dh
Datum BinaryData era
binaryData -> CompactAddr (Crypto era)
-> CompactForm (Value era) -> BinaryData era -> TxOut era
forall era.
CompactAddr (Crypto era)
-> CompactForm (Value era) -> BinaryData era -> TxOut era
TxOutCompactDatum CompactAddr (Crypto era)
cAddr CompactForm (Value era)
cVal BinaryData era
binaryData
SJust Script era
rs' -> CompactAddr (Crypto era)
-> CompactForm (Value era) -> Datum era -> Script era -> TxOut era
forall era.
CompactAddr (Crypto era)
-> CompactForm (Value era) -> Datum era -> Script era -> TxOut era
TxOutCompactRefScript CompactAddr (Crypto era)
cAddr CompactForm (Value era)
cVal Datum era
d Script era
rs'
pattern TxOutCompact ::
( Era era,
HasCallStack
) =>
CompactAddr (Crypto era) ->
CompactForm (Core.Value era) ->
TxOut era
pattern $bTxOutCompact :: CompactAddr (Crypto era) -> CompactForm (Value era) -> TxOut era
$mTxOutCompact :: forall r era.
(Era era, HasCallStack) =>
TxOut era
-> (CompactAddr (Crypto era) -> CompactForm (Value era) -> r)
-> (Void# -> r)
-> r
TxOutCompact addr vl <-
(viewCompactTxOut -> (addr, vl, NoDatum, SNothing))
where
TxOutCompact CompactAddr (Crypto era)
cAddr CompactForm (Value era)
cVal
| CompactForm (Value era) -> Bool
forall t. Val t => CompactForm t -> Bool
isAdaOnlyCompact CompactForm (Value era)
cVal =
Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
forall era.
(Era era, HasCallStack) =>
Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
mkTxOut (CompactAddr (Crypto era) -> Addr (Crypto era)
forall crypto. Crypto crypto => CompactAddr crypto -> Addr crypto
decompactAddr CompactAddr (Crypto era)
cAddr) CompactAddr (Crypto era)
cAddr (CompactForm (Value era) -> Value era
forall a. Compactible a => CompactForm a -> a
fromCompact CompactForm (Value era)
cVal) Datum era
forall era. Datum era
NoDatum StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing
| Bool
otherwise = CompactAddr (Crypto era) -> CompactForm (Value era) -> TxOut era
forall era.
CompactAddr (Crypto era) -> CompactForm (Value era) -> TxOut era
TxOutCompact' CompactAddr (Crypto era)
cAddr CompactForm (Value era)
cVal
pattern TxOutCompactDH ::
( Era era,
HasCallStack
) =>
CompactAddr (Crypto era) ->
CompactForm (Core.Value era) ->
DataHash (Crypto era) ->
TxOut era
pattern $bTxOutCompactDH :: CompactAddr (Crypto era)
-> CompactForm (Value era) -> DataHash (Crypto era) -> TxOut era
$mTxOutCompactDH :: forall r era.
(Era era, HasCallStack) =>
TxOut era
-> (CompactAddr (Crypto era)
-> CompactForm (Value era) -> DataHash (Crypto era) -> r)
-> (Void# -> r)
-> r
TxOutCompactDH addr vl dh <-
(viewCompactTxOut -> (addr, vl, DatumHash dh, SNothing))
where
TxOutCompactDH CompactAddr (Crypto era)
cAddr CompactForm (Value era)
cVal DataHash (Crypto era)
dh
| CompactForm (Value era) -> Bool
forall t. Val t => CompactForm t -> Bool
isAdaOnlyCompact CompactForm (Value era)
cVal =
Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
forall era.
(Era era, HasCallStack) =>
Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
mkTxOut (CompactAddr (Crypto era) -> Addr (Crypto era)
forall crypto. Crypto crypto => CompactAddr crypto -> Addr crypto
decompactAddr CompactAddr (Crypto era)
cAddr) CompactAddr (Crypto era)
cAddr (CompactForm (Value era) -> Value era
forall a. Compactible a => CompactForm a -> a
fromCompact CompactForm (Value era)
cVal) (DataHash (Crypto era) -> Datum era
forall era. DataHash (Crypto era) -> Datum era
DatumHash DataHash (Crypto era)
dh) StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing
| Bool
otherwise = CompactAddr (Crypto era)
-> CompactForm (Value era) -> DataHash (Crypto era) -> TxOut era
forall era.
CompactAddr (Crypto era)
-> CompactForm (Value era) -> DataHash (Crypto era) -> TxOut era
TxOutCompactDH' CompactAddr (Crypto era)
cAddr CompactForm (Value era)
cVal DataHash (Crypto era)
dh
{-# COMPLETE TxOutCompact, TxOutCompactDH #-}
type ScriptIntegrityHash crypto = SafeHash crypto EraIndependentScriptIntegrity
data TxBodyRaw era = TxBodyRaw
{ TxBodyRaw era -> Set (TxIn (Crypto era))
_spendInputs :: !(Set (TxIn (Crypto era))),
TxBodyRaw era -> Set (TxIn (Crypto era))
_collateralInputs :: !(Set (TxIn (Crypto era))),
TxBodyRaw era -> Set (TxIn (Crypto era))
_referenceInputs :: !(Set (TxIn (Crypto era))),
TxBodyRaw era -> StrictSeq (Sized (TxOut era))
_outputs :: !(StrictSeq (Sized (TxOut era))),
TxBodyRaw era -> StrictMaybe (Sized (TxOut era))
_collateralReturn :: !(StrictMaybe (Sized (TxOut era))),
TxBodyRaw era -> StrictMaybe Coin
_totalCollateral :: !(StrictMaybe Coin),
TxBodyRaw era -> StrictSeq (DCert (Crypto era))
_certs :: !(StrictSeq (DCert (Crypto era))),
TxBodyRaw era -> Wdrl (Crypto era)
_wdrls :: !(Wdrl (Crypto era)),
TxBodyRaw era -> Coin
_txfee :: !Coin,
TxBodyRaw era -> ValidityInterval
_vldt :: !ValidityInterval,
TxBodyRaw era -> StrictMaybe (Update era)
_update :: !(StrictMaybe (Update era)),
TxBodyRaw era -> Set (KeyHash 'Witness (Crypto era))
_reqSignerHashes :: !(Set (KeyHash 'Witness (Crypto era))),
TxBodyRaw era -> Value (Crypto era)
_mint :: !(Value (Crypto era)),
TxBodyRaw era -> StrictMaybe (ScriptIntegrityHash (Crypto era))
_scriptIntegrityHash :: !(StrictMaybe (ScriptIntegrityHash (Crypto era))),
TxBodyRaw era -> StrictMaybe (AuxiliaryDataHash (Crypto era))
_adHash :: !(StrictMaybe (AuxiliaryDataHash (Crypto era))),
TxBodyRaw era -> StrictMaybe Network
_txnetworkid :: !(StrictMaybe Network)
}
deriving ((forall x. TxBodyRaw era -> Rep (TxBodyRaw era) x)
-> (forall x. Rep (TxBodyRaw era) x -> TxBodyRaw era)
-> Generic (TxBodyRaw era)
forall x. Rep (TxBodyRaw era) x -> TxBodyRaw era
forall x. TxBodyRaw era -> Rep (TxBodyRaw era) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall era x. Rep (TxBodyRaw era) x -> TxBodyRaw era
forall era x. TxBodyRaw era -> Rep (TxBodyRaw era) x
$cto :: forall era x. Rep (TxBodyRaw era) x -> TxBodyRaw era
$cfrom :: forall era x. TxBodyRaw era -> Rep (TxBodyRaw era) x
Generic, Typeable)
deriving instance
( Eq (Core.Value era),
Eq (Core.Script era),
CC.Crypto (Crypto era),
Compactible (Core.Value era),
Eq (PParamsDelta era)
) =>
Eq (TxBodyRaw era)
instance
(Typeable era, NoThunks (Core.Value era), NoThunks (PParamsDelta era)) =>
NoThunks (TxBodyRaw era)
deriving instance
( Era era,
Show (Core.Value era),
Show (Core.Script era),
Show (PParamsDelta era)
) =>
Show (TxBodyRaw era)
newtype TxBody era = TxBodyConstr (MemoBytes (TxBodyRaw era))
deriving (Typeable (TxBody era)
Typeable (TxBody era)
-> (TxBody era -> Encoding)
-> ((forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (TxBody era) -> Size)
-> ((forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [TxBody era] -> Size)
-> ToCBOR (TxBody era)
TxBody era -> Encoding
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [TxBody era] -> Size
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (TxBody era) -> Size
forall era. Typeable era => Typeable (TxBody era)
forall era. Typeable era => TxBody 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 [TxBody era] -> Size
forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (TxBody era) -> Size
encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [TxBody era] -> Size
$cencodedListSizeExpr :: forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [TxBody era] -> Size
encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (TxBody era) -> Size
$cencodedSizeExpr :: forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (TxBody era) -> Size
toCBOR :: TxBody era -> Encoding
$ctoCBOR :: forall era. Typeable era => TxBody era -> Encoding
$cp1ToCBOR :: forall era. Typeable era => Typeable (TxBody era)
ToCBOR)
deriving newtype (Proxy c -> Proxy index -> TxBody era -> SafeHash c index
TxBody era -> ByteString
(TxBody era -> ByteString)
-> (forall c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> TxBody era -> SafeHash c index)
-> SafeToHash (TxBody era)
forall era. TxBody 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 -> TxBody era -> SafeHash c index
forall era c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> TxBody era -> SafeHash c index
makeHashWithExplicitProxys :: Proxy c -> Proxy index -> TxBody era -> SafeHash c index
$cmakeHashWithExplicitProxys :: forall era c index.
HasAlgorithm c =>
Proxy c -> Proxy index -> TxBody era -> SafeHash c index
originalBytes :: TxBody era -> ByteString
$coriginalBytes :: forall era. TxBody era -> ByteString
SafeToHash)
deriving newtype instance
( CC.Crypto (Crypto era)
) =>
Eq (TxBody era)
deriving instance
( Typeable era,
NoThunks (Core.Value era),
NoThunks (PParamsDelta era)
) =>
NoThunks (TxBody era)
deriving instance
( Era era,
Compactible (Core.Value era),
Show (Core.Script era),
Show (Core.Value era),
Show (PParamsDelta era)
) =>
Show (TxBody era)
deriving via
(Mem (TxBodyRaw era))
instance
( Era era,
Typeable (Core.Script era),
Typeable (Core.AuxiliaryData era),
Compactible (Core.Value era),
Show (Core.Value era),
DecodeNonNegative (Core.Value era),
FromCBOR (Annotator (Core.Script era)),
Core.SerialisableData (PParamsDelta era)
) =>
FromCBOR (Annotator (TxBody era))
instance
( Era era,
Typeable (Core.Script era),
Typeable (Core.AuxiliaryData era),
Compactible (Core.Value era),
Show (Core.Value era),
DecodeNonNegative (Core.Value era),
FromCBOR (Annotator (Core.Script era)),
FromCBOR (PParamsDelta era),
ToCBOR (PParamsDelta era)
) =>
FromCBOR (Annotator (TxBodyRaw era))
where
fromCBOR :: Decoder s (Annotator (TxBodyRaw era))
fromCBOR = TxBodyRaw era -> Annotator (TxBodyRaw era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxBodyRaw era -> Annotator (TxBodyRaw era))
-> Decoder s (TxBodyRaw era)
-> Decoder s (Annotator (TxBodyRaw era))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (TxBodyRaw era)
forall a s. FromCBOR a => Decoder s a
fromCBOR
type BabbageBody era =
( Era era,
ToCBOR (Core.Value era),
ToCBOR (Core.Script era),
Core.SerialisableData (PParamsDelta era)
)
pattern TxBody ::
BabbageBody era =>
Set (TxIn (Crypto era)) ->
Set (TxIn (Crypto era)) ->
Set (TxIn (Crypto era)) ->
StrictSeq (Sized (TxOut era)) ->
StrictMaybe (Sized (TxOut era)) ->
StrictMaybe Coin ->
StrictSeq (DCert (Crypto era)) ->
Wdrl (Crypto era) ->
Coin ->
ValidityInterval ->
StrictMaybe (Update era) ->
Set (KeyHash 'Witness (Crypto era)) ->
Value (Crypto era) ->
StrictMaybe (ScriptIntegrityHash (Crypto era)) ->
StrictMaybe (AuxiliaryDataHash (Crypto era)) ->
StrictMaybe Network ->
TxBody era
pattern $bTxBody :: Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> Coin
-> ValidityInterval
-> StrictMaybe (Update era)
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBody era
$mTxBody :: forall r era.
BabbageBody era =>
TxBody era
-> (Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> Coin
-> ValidityInterval
-> StrictMaybe (Update era)
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> r)
-> (Void# -> r)
-> r
TxBody
{ TxBody era -> BabbageBody era => Set (TxIn (Crypto era))
inputs,
TxBody era -> BabbageBody era => Set (TxIn (Crypto era))
collateral,
TxBody era -> BabbageBody era => Set (TxIn (Crypto era))
referenceInputs,
TxBody era -> BabbageBody era => StrictSeq (Sized (TxOut era))
outputs,
TxBody era -> BabbageBody era => StrictMaybe (Sized (TxOut era))
collateralReturn,
TxBody era -> BabbageBody era => StrictMaybe Coin
totalCollateral,
TxBody era -> BabbageBody era => StrictSeq (DCert (Crypto era))
txcerts,
TxBody era -> BabbageBody era => Wdrl (Crypto era)
txwdrls,
TxBody era -> BabbageBody era => Coin
txfee,
TxBody era -> BabbageBody era => ValidityInterval
txvldt,
TxBody era -> BabbageBody era => StrictMaybe (Update era)
txUpdates,
TxBody era
-> BabbageBody era => Set (KeyHash 'Witness (Crypto era))
reqSignerHashes,
TxBody era -> BabbageBody era => Value (Crypto era)
mint,
TxBody era
-> BabbageBody era =>
StrictMaybe (ScriptIntegrityHash (Crypto era))
scriptIntegrityHash,
TxBody era
-> BabbageBody era => StrictMaybe (AuxiliaryDataHash (Crypto era))
adHash,
TxBody era -> BabbageBody era => StrictMaybe Network
txnetworkid
} <-
TxBodyConstr
( Memo
TxBodyRaw
{ _spendInputs = inputs,
_collateralInputs = collateral,
_referenceInputs = referenceInputs,
_outputs = outputs,
_collateralReturn = collateralReturn,
_totalCollateral = totalCollateral,
_certs = txcerts,
_wdrls = txwdrls,
_txfee = txfee,
_vldt = txvldt,
_update = txUpdates,
_reqSignerHashes = reqSignerHashes,
_mint = mint,
_scriptIntegrityHash = scriptIntegrityHash,
_adHash = adHash,
_txnetworkid = txnetworkid
}
_
)
where
TxBody
Set (TxIn (Crypto era))
inputsX
Set (TxIn (Crypto era))
collateralX
Set (TxIn (Crypto era))
referenceInputsX
StrictSeq (Sized (TxOut era))
outputsX
StrictMaybe (Sized (TxOut era))
collateralReturnX
StrictMaybe Coin
totalCollateralX
StrictSeq (DCert (Crypto era))
certsX
Wdrl (Crypto era)
wdrlsX
Coin
txfeeX
ValidityInterval
vldtX
StrictMaybe (Update era)
updateX
Set (KeyHash 'Witness (Crypto era))
reqSignerHashesX
Value (Crypto era)
mintX
StrictMaybe (ScriptIntegrityHash (Crypto era))
scriptIntegrityHashX
StrictMaybe (AuxiliaryDataHash (Crypto era))
adHashX
StrictMaybe Network
txnetworkidX =
MemoBytes (TxBodyRaw era) -> TxBody era
forall era. MemoBytes (TxBodyRaw era) -> TxBody era
TxBodyConstr (MemoBytes (TxBodyRaw era) -> TxBody era)
-> MemoBytes (TxBodyRaw era) -> TxBody era
forall a b. (a -> b) -> a -> b
$
Encode ('Closed 'Sparse) (TxBodyRaw era)
-> MemoBytes (TxBodyRaw era)
forall (w :: Wrapped) t. Encode w t -> MemoBytes t
memoBytes
( TxBodyRaw era -> Encode ('Closed 'Sparse) (TxBodyRaw era)
forall era.
(Era era, ToCBOR (PParamsDelta era), ToCBOR (Script era),
ToCBOR (Value era)) =>
TxBodyRaw era -> Encode ('Closed 'Sparse) (TxBodyRaw era)
encodeTxBodyRaw (TxBodyRaw era -> Encode ('Closed 'Sparse) (TxBodyRaw era))
-> TxBodyRaw era -> Encode ('Closed 'Sparse) (TxBodyRaw era)
forall a b. (a -> b) -> a -> b
$
Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> Coin
-> ValidityInterval
-> StrictMaybe (Update era)
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era
forall era.
Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> Coin
-> ValidityInterval
-> StrictMaybe (Update era)
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era
TxBodyRaw
Set (TxIn (Crypto era))
inputsX
Set (TxIn (Crypto era))
collateralX
Set (TxIn (Crypto era))
referenceInputsX
StrictSeq (Sized (TxOut era))
outputsX
StrictMaybe (Sized (TxOut era))
collateralReturnX
StrictMaybe Coin
totalCollateralX
StrictSeq (DCert (Crypto era))
certsX
Wdrl (Crypto era)
wdrlsX
Coin
txfeeX
ValidityInterval
vldtX
StrictMaybe (Update era)
updateX
Set (KeyHash 'Witness (Crypto era))
reqSignerHashesX
Value (Crypto era)
mintX
StrictMaybe (ScriptIntegrityHash (Crypto era))
scriptIntegrityHashX
StrictMaybe (AuxiliaryDataHash (Crypto era))
adHashX
StrictMaybe Network
txnetworkidX
)
{-# COMPLETE TxBody #-}
instance (c ~ Crypto era) => HashAnnotated (TxBody era) EraIndependentTxBody c
spendInputs' :: TxBody era -> Set (TxIn (Crypto era))
collateralInputs' :: TxBody era -> Set (TxIn (Crypto era))
referenceInputs' :: TxBody era -> Set (TxIn (Crypto era))
outputs' :: TxBody era -> StrictSeq (TxOut era)
collateralReturn' :: TxBody era -> StrictMaybe (TxOut era)
totalCollateral' :: TxBody era -> StrictMaybe Coin
certs' :: TxBody era -> StrictSeq (DCert (Crypto era))
txfee' :: TxBody era -> Coin
wdrls' :: TxBody era -> Wdrl (Crypto era)
vldt' :: TxBody era -> ValidityInterval
update' :: TxBody era -> StrictMaybe (Update era)
reqSignerHashes' :: TxBody era -> Set (KeyHash 'Witness (Crypto era))
adHash' :: TxBody era -> StrictMaybe (AuxiliaryDataHash (Crypto era))
mint' :: TxBody era -> Value (Crypto era)
scriptIntegrityHash' :: TxBody era -> StrictMaybe (ScriptIntegrityHash (Crypto era))
spendInputs' :: TxBody era -> Set (TxIn (Crypto era))
spendInputs' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = TxBodyRaw era -> Set (TxIn (Crypto era))
forall era. TxBodyRaw era -> Set (TxIn (Crypto era))
_spendInputs TxBodyRaw era
raw
txnetworkid' :: TxBody era -> StrictMaybe Network
collateralInputs' :: TxBody era -> Set (TxIn (Crypto era))
collateralInputs' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = TxBodyRaw era -> Set (TxIn (Crypto era))
forall era. TxBodyRaw era -> Set (TxIn (Crypto era))
_collateralInputs TxBodyRaw era
raw
referenceInputs' :: TxBody era -> Set (TxIn (Crypto era))
referenceInputs' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = TxBodyRaw era -> Set (TxIn (Crypto era))
forall era. TxBodyRaw era -> Set (TxIn (Crypto era))
_referenceInputs TxBodyRaw era
raw
outputs' :: TxBody era -> StrictSeq (TxOut era)
outputs' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = Sized (TxOut era) -> TxOut era
forall a. Sized a -> a
sizedValue (Sized (TxOut era) -> TxOut era)
-> StrictSeq (Sized (TxOut era)) -> StrictSeq (TxOut era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TxBodyRaw era -> StrictSeq (Sized (TxOut era))
forall era. TxBodyRaw era -> StrictSeq (Sized (TxOut era))
_outputs TxBodyRaw era
raw
collateralReturn' :: TxBody era -> StrictMaybe (TxOut era)
collateralReturn' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = Sized (TxOut era) -> TxOut era
forall a. Sized a -> a
sizedValue (Sized (TxOut era) -> TxOut era)
-> StrictMaybe (Sized (TxOut era)) -> StrictMaybe (TxOut era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TxBodyRaw era -> StrictMaybe (Sized (TxOut era))
forall era. TxBodyRaw era -> StrictMaybe (Sized (TxOut era))
_collateralReturn TxBodyRaw era
raw
totalCollateral' :: TxBody era -> StrictMaybe Coin
totalCollateral' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = TxBodyRaw era -> StrictMaybe Coin
forall era. TxBodyRaw era -> StrictMaybe Coin
_totalCollateral TxBodyRaw era
raw
certs' :: TxBody era -> StrictSeq (DCert (Crypto era))
certs' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = TxBodyRaw era -> StrictSeq (DCert (Crypto era))
forall era. TxBodyRaw era -> StrictSeq (DCert (Crypto era))
_certs TxBodyRaw era
raw
wdrls' :: TxBody era -> Wdrl (Crypto era)
wdrls' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = TxBodyRaw era -> Wdrl (Crypto era)
forall era. TxBodyRaw era -> Wdrl (Crypto era)
_wdrls TxBodyRaw era
raw
txfee' :: TxBody era -> Coin
txfee' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = TxBodyRaw era -> Coin
forall era. TxBodyRaw era -> Coin
_txfee TxBodyRaw era
raw
vldt' :: TxBody era -> ValidityInterval
vldt' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = TxBodyRaw era -> ValidityInterval
forall era. TxBodyRaw era -> ValidityInterval
_vldt TxBodyRaw era
raw
update' :: TxBody era -> StrictMaybe (Update era)
update' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = TxBodyRaw era -> StrictMaybe (Update era)
forall era. TxBodyRaw era -> StrictMaybe (Update era)
_update TxBodyRaw era
raw
reqSignerHashes' :: TxBody era -> Set (KeyHash 'Witness (Crypto era))
reqSignerHashes' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = TxBodyRaw era -> Set (KeyHash 'Witness (Crypto era))
forall era. TxBodyRaw era -> Set (KeyHash 'Witness (Crypto era))
_reqSignerHashes TxBodyRaw era
raw
adHash' :: TxBody era -> StrictMaybe (AuxiliaryDataHash (Crypto era))
adHash' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = TxBodyRaw era -> StrictMaybe (AuxiliaryDataHash (Crypto era))
forall era.
TxBodyRaw era -> StrictMaybe (AuxiliaryDataHash (Crypto era))
_adHash TxBodyRaw era
raw
mint' :: TxBody era -> Value (Crypto era)
mint' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = TxBodyRaw era -> Value (Crypto era)
forall era. TxBodyRaw era -> Value (Crypto era)
_mint TxBodyRaw era
raw
scriptIntegrityHash' :: TxBody era -> StrictMaybe (ScriptIntegrityHash (Crypto era))
scriptIntegrityHash' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = TxBodyRaw era -> StrictMaybe (ScriptIntegrityHash (Crypto era))
forall era.
TxBodyRaw era -> StrictMaybe (ScriptIntegrityHash (Crypto era))
_scriptIntegrityHash TxBodyRaw era
raw
txnetworkid' :: TxBody era -> StrictMaybe Network
txnetworkid' (TxBodyConstr (Memo TxBodyRaw era
raw ShortByteString
_)) = TxBodyRaw era -> StrictMaybe Network
forall era. TxBodyRaw era -> StrictMaybe Network
_txnetworkid TxBodyRaw era
raw
{-# INLINE encodeTxOut #-}
encodeTxOut ::
forall era.
(Era era, ToCBOR (Core.Script era), ToCBOR (Core.Value era)) =>
CompactAddr (Crypto era) ->
Core.Value era ->
Datum era ->
StrictMaybe (Core.Script era) ->
Encoding
encodeTxOut :: CompactAddr (Crypto era)
-> Value era -> Datum era -> StrictMaybe (Script era) -> Encoding
encodeTxOut CompactAddr (Crypto era)
addr Value era
val Datum era
datum StrictMaybe (Script era)
script =
Encode
('Closed 'Sparse)
(Any
-> (CompactAddr (Crypto era), Value era, Datum era,
StrictMaybe (Script era), Any))
-> Encoding
forall (w :: Wrapped) t. Encode w t -> Encoding
encode (Encode
('Closed 'Sparse)
(Any
-> (CompactAddr (Crypto era), Value era, Datum era,
StrictMaybe (Script era), Any))
-> Encoding)
-> Encode
('Closed 'Sparse)
(Any
-> (CompactAddr (Crypto era), Value era, Datum era,
StrictMaybe (Script era), Any))
-> Encoding
forall a b. (a -> b) -> a -> b
$
(CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> Any
-> (CompactAddr (Crypto era), Value era, Datum era,
StrictMaybe (Script era), Any))
-> Encode
('Closed 'Sparse)
(CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> Any
-> (CompactAddr (Crypto era), Value era, Datum era,
StrictMaybe (Script era), Any))
forall t. t -> Encode ('Closed 'Sparse) t
Keyed (,,,,)
Encode
('Closed 'Sparse)
(CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> Any
-> (CompactAddr (Crypto era), Value era, Datum era,
StrictMaybe (Script era), Any))
-> Encode ('Closed 'Sparse) (CompactAddr (Crypto era))
-> Encode
('Closed 'Sparse)
(Value era
-> Datum era
-> StrictMaybe (Script era)
-> Any
-> (CompactAddr (Crypto era), Value era, Datum era,
StrictMaybe (Script era), Any))
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> Word
-> Encode ('Closed 'Dense) (CompactAddr (Crypto era))
-> Encode ('Closed 'Sparse) (CompactAddr (Crypto era))
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
0 (CompactAddr (Crypto era)
-> Encode ('Closed 'Dense) (CompactAddr (Crypto era))
forall t. ToCBOR t => t -> Encode ('Closed 'Dense) t
To CompactAddr (Crypto era)
addr)
Encode
('Closed 'Sparse)
(Value era
-> Datum era
-> StrictMaybe (Script era)
-> Any
-> (CompactAddr (Crypto era), Value era, Datum era,
StrictMaybe (Script era), Any))
-> Encode ('Closed 'Sparse) (Value era)
-> Encode
('Closed 'Sparse)
(Datum era
-> StrictMaybe (Script era)
-> Any
-> (CompactAddr (Crypto era), Value era, Datum era,
StrictMaybe (Script era), Any))
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> Word
-> Encode ('Closed 'Dense) (Value era)
-> Encode ('Closed 'Sparse) (Value era)
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
1 (Value era -> Encode ('Closed 'Dense) (Value era)
forall t. ToCBOR t => t -> Encode ('Closed 'Dense) t
To Value era
val)
Encode
('Closed 'Sparse)
(Datum era
-> StrictMaybe (Script era)
-> Any
-> (CompactAddr (Crypto era), Value era, Datum era,
StrictMaybe (Script era), Any))
-> Encode ('Closed 'Sparse) (Datum era)
-> Encode
('Closed 'Sparse)
(StrictMaybe (Script era)
-> Any
-> (CompactAddr (Crypto era), Value era, Datum era,
StrictMaybe (Script era), Any))
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> (Datum era -> Bool)
-> Encode ('Closed 'Sparse) (Datum era)
-> Encode ('Closed 'Sparse) (Datum era)
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit (Datum era -> Datum era -> Bool
forall a. Eq a => a -> a -> Bool
== Datum era
forall era. Datum era
NoDatum) (Word
-> Encode ('Closed 'Dense) (Datum era)
-> Encode ('Closed 'Sparse) (Datum era)
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
2 (Datum era -> Encode ('Closed 'Dense) (Datum era)
forall t. ToCBOR t => t -> Encode ('Closed 'Dense) t
To Datum era
datum))
Encode
('Closed 'Sparse)
(StrictMaybe (Script era)
-> Any
-> (CompactAddr (Crypto era), Value era, Datum era,
StrictMaybe (Script era), Any))
-> Encode ('Closed 'Sparse) (StrictMaybe (Script era))
-> Encode
('Closed 'Sparse)
(Any
-> (CompactAddr (Crypto era), Value era, Datum era,
StrictMaybe (Script era), Any))
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> Word
-> (Script era -> Encoding)
-> StrictMaybe (Script era)
-> Encode ('Closed 'Sparse) (StrictMaybe (Script era))
forall a.
Word
-> (a -> Encoding)
-> StrictMaybe a
-> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybeWith Word
3 Script era -> Encoding
forall a. ToCBOR a => a -> Encoding
encodeNestedCbor StrictMaybe (Script era)
script
data DecodingTxOut era = DecodingTxOut
{ DecodingTxOut era
-> StrictMaybe (Addr (Crypto era), CompactAddr (Crypto era))
decodingTxOutAddr :: !(StrictMaybe (Addr (Crypto era), CompactAddr (Crypto era))),
DecodingTxOut era -> Value era
decodingTxOutVal :: !(Core.Value era),
DecodingTxOut era -> Datum era
decodingTxOutDatum :: !(Datum era),
DecodingTxOut era -> StrictMaybe (Script era)
decodingTxOutScript :: !(StrictMaybe (Core.Script era))
}
deriving (Typeable)
{-# INLINE decodeTxOut #-}
decodeTxOut ::
forall s era.
( Era era,
FromCBOR (Annotator (Core.Script era)),
DecodeNonNegative (Core.Value era)
) =>
(forall s'. Decoder s' (Addr (Crypto era), CompactAddr (Crypto era))) ->
Decoder s (TxOut era)
decodeTxOut :: (forall s'.
Decoder s' (Addr (Crypto era), CompactAddr (Crypto era)))
-> Decoder s (TxOut era)
decodeTxOut forall s'. Decoder s' (Addr (Crypto era), CompactAddr (Crypto era))
decAddr = do
DecodingTxOut era
dtxo <- Decode ('Closed 'Dense) (DecodingTxOut era)
-> Decoder s (DecodingTxOut era)
forall (w :: Wrapped) t s. Decode w t -> Decoder s t
decode (Decode ('Closed 'Dense) (DecodingTxOut era)
-> Decoder s (DecodingTxOut era))
-> Decode ('Closed 'Dense) (DecodingTxOut era)
-> Decoder s (DecodingTxOut era)
forall a b. (a -> b) -> a -> b
$ String
-> DecodingTxOut era
-> (Word -> Field (DecodingTxOut era))
-> [(Word, String)]
-> Decode ('Closed 'Dense) (DecodingTxOut era)
forall t.
Typeable t =>
String
-> t
-> (Word -> Field t)
-> [(Word, String)]
-> Decode ('Closed 'Dense) t
SparseKeyed String
"TxOut" DecodingTxOut era
initial Word -> Field (DecodingTxOut era)
bodyFields [(Word, String)]
requiredFields
case DecodingTxOut era
dtxo of
DecodingTxOut StrictMaybe (Addr (Crypto era), CompactAddr (Crypto era))
SNothing Value era
_ Datum era
_ StrictMaybe (Script era)
_ -> DecoderError -> Decoder s (TxOut era)
forall e s a. Buildable e => e -> Decoder s a
cborError (DecoderError -> Decoder s (TxOut era))
-> DecoderError -> Decoder s (TxOut era)
forall a b. (a -> b) -> a -> b
$ Text -> Text -> DecoderError
DecoderErrorCustom Text
"TxOut" Text
"Impossible: no Addr"
DecodingTxOut (SJust (Addr (Crypto era)
addr, CompactAddr (Crypto era)
cAddr)) Value era
val Datum era
d StrictMaybe (Script era)
script -> TxOut era -> Decoder s (TxOut era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxOut era -> Decoder s (TxOut era))
-> TxOut era -> Decoder s (TxOut era)
forall a b. (a -> b) -> a -> b
$ Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
forall era.
(Era era, HasCallStack) =>
Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
mkTxOut Addr (Crypto era)
addr CompactAddr (Crypto era)
cAddr Value era
val Datum era
d StrictMaybe (Script era)
script
where
initial :: DecodingTxOut era
initial :: DecodingTxOut era
initial =
StrictMaybe (Addr (Crypto era), CompactAddr (Crypto era))
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> DecodingTxOut era
forall era.
StrictMaybe (Addr (Crypto era), CompactAddr (Crypto era))
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> DecodingTxOut era
DecodingTxOut StrictMaybe (Addr (Crypto era), CompactAddr (Crypto era))
forall a. StrictMaybe a
SNothing Value era
forall a. Monoid a => a
mempty Datum era
forall era. Datum era
NoDatum StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing
bodyFields :: (Word -> Field (DecodingTxOut era))
bodyFields :: Word -> Field (DecodingTxOut era)
bodyFields Word
0 =
((Addr (Crypto era), CompactAddr (Crypto era))
-> DecodingTxOut era -> DecodingTxOut era)
-> Decode
('Closed 'Dense) (Addr (Crypto era), CompactAddr (Crypto era))
-> Field (DecodingTxOut era)
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field
(\(Addr (Crypto era), CompactAddr (Crypto era))
x DecodingTxOut era
txo -> DecodingTxOut era
txo {decodingTxOutAddr :: StrictMaybe (Addr (Crypto era), CompactAddr (Crypto era))
decodingTxOutAddr = (Addr (Crypto era), CompactAddr (Crypto era))
-> StrictMaybe (Addr (Crypto era), CompactAddr (Crypto era))
forall a. a -> StrictMaybe a
SJust (Addr (Crypto era), CompactAddr (Crypto era))
x})
((forall s'.
Decoder s' (Addr (Crypto era), CompactAddr (Crypto era)))
-> Decode
('Closed 'Dense) (Addr (Crypto era), CompactAddr (Crypto era))
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D forall s'. Decoder s' (Addr (Crypto era), CompactAddr (Crypto era))
decAddr)
bodyFields Word
1 =
(Value era -> DecodingTxOut era -> DecodingTxOut era)
-> Decode ('Closed 'Dense) (Value era) -> Field (DecodingTxOut era)
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field
(\Value era
x DecodingTxOut era
txo -> DecodingTxOut era
txo {decodingTxOutVal :: Value era
decodingTxOutVal = Value era
x})
((forall s. Decoder s (Value era))
-> Decode ('Closed 'Dense) (Value era)
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D forall s. Decoder s (Value era)
forall v s. DecodeNonNegative v => Decoder s v
decodeNonNegative)
bodyFields Word
2 =
(Datum era -> DecodingTxOut era -> DecodingTxOut era)
-> Decode ('Closed 'Dense) (Datum era) -> Field (DecodingTxOut era)
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field
(\Datum era
x DecodingTxOut era
txo -> DecodingTxOut era
txo {decodingTxOutDatum :: Datum era
decodingTxOutDatum = Datum era
x})
((forall s. Decoder s (Datum era))
-> Decode ('Closed 'Dense) (Datum era)
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D forall s. Decoder s (Datum era)
forall a s. FromCBOR a => Decoder s a
fromCBOR)
bodyFields Word
3 =
(StrictMaybe (Script era)
-> DecodingTxOut era -> DecodingTxOut era)
-> Decode ('Closed 'Dense) (Script era)
-> Field (DecodingTxOut era)
forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield
(\StrictMaybe (Script era)
x DecodingTxOut era
txo -> DecodingTxOut era
txo {decodingTxOutScript :: StrictMaybe (Script era)
decodingTxOutScript = StrictMaybe (Script era)
x})
((forall s. Decoder s (Script era))
-> Decode ('Closed 'Dense) (Script era)
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D ((forall s. Decoder s (Script era))
-> Decode ('Closed 'Dense) (Script era))
-> (forall s. Decoder s (Script era))
-> Decode ('Closed 'Dense) (Script era)
forall a b. (a -> b) -> a -> b
$ Text -> Decoder s (Script era)
forall b s. FromCBOR (Annotator b) => Text -> Decoder s b
decodeCIC Text
"Script")
bodyFields Word
n = (Any -> DecodingTxOut era -> DecodingTxOut era)
-> Decode ('Closed Any) Any -> Field (DecodingTxOut era)
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Any
_ DecodingTxOut era
t -> DecodingTxOut era
t) (Word -> Decode ('Closed Any) Any
forall (w :: Wrapped) t. Word -> Decode w t
Invalid Word
n)
requiredFields :: [(Word, String)]
requiredFields =
[ (Word
0, String
"addr"),
(Word
1, String
"val")
]
decodeCIC :: (FromCBOR (Annotator b)) => T.Text -> Decoder s b
decodeCIC :: Text -> Decoder s b
decodeCIC Text
s = do
ByteString
lbs <- Decoder s ByteString
forall s. Decoder s ByteString
decodeNestedCborBytes
case Text
-> (forall s. Decoder s (Annotator b))
-> LByteString
-> Either DecoderError b
forall a.
Text
-> (forall s. Decoder s (Annotator a))
-> LByteString
-> Either DecoderError a
decodeAnnotator Text
s forall s. Decoder s (Annotator b)
forall a s. FromCBOR a => Decoder s a
fromCBOR (ByteString -> LByteString
LBS.fromStrict ByteString
lbs) of
Left DecoderError
e -> String -> Decoder s b
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Decoder s b) -> String -> Decoder s b
forall a b. (a -> b) -> a -> b
$ Text -> String
T.unpack Text
s String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
": " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> DecoderError -> String
forall a. Show a => a -> String
show DecoderError
e
Right b
x -> b -> Decoder s b
forall (f :: * -> *) a. Applicative f => a -> f a
pure b
x
instance
( Era era,
ToCBOR (Core.Value era),
ToCBOR (Core.Script era)
) =>
ToCBOR (TxOut era)
where
toCBOR :: TxOut era -> Encoding
toCBOR (TxOut Addr (Crypto era)
addr Value era
v Datum era
d StrictMaybe (Script era)
s) = CompactAddr (Crypto era)
-> Value era -> Datum era -> StrictMaybe (Script era) -> Encoding
forall era.
(Era era, ToCBOR (Script era), ToCBOR (Value era)) =>
CompactAddr (Crypto era)
-> Value era -> Datum era -> StrictMaybe (Script era) -> Encoding
encodeTxOut (Addr (Crypto era) -> CompactAddr (Crypto era)
forall crypto. Addr crypto -> CompactAddr crypto
compactAddr Addr (Crypto era)
addr) Value era
v Datum era
d StrictMaybe (Script era)
s
instance
( Era era,
DecodeNonNegative (Core.Value era),
Show (Core.Value era),
FromCBOR (Annotator (Core.Script era)),
Compactible (Core.Value era)
) =>
FromCBOR (TxOut era)
where
fromCBOR :: Decoder s (TxOut era)
fromCBOR = (forall s'.
Decoder s' (Addr (Crypto era), CompactAddr (Crypto era)))
-> Decoder s (TxOut era)
forall era s.
(Era era, FromCBOR (Annotator (Script era)),
DecodeNonNegative (Value era)) =>
(forall s'.
Decoder s' (Addr (Crypto era), CompactAddr (Crypto era)))
-> Decoder s (TxOut era)
fromCborTxOutWithAddr forall s'. Decoder s' (Addr (Crypto era), CompactAddr (Crypto era))
forall crypto s.
Crypto crypto =>
Decoder s (Addr crypto, CompactAddr crypto)
fromCborBackwardsBothAddr
instance
( Era era,
DecodeNonNegative (Core.Value era),
Show (Core.Value era),
FromCBOR (Annotator (Core.Script era)),
Compactible (Core.Value era)
) =>
FromSharedCBOR (TxOut era)
where
type Share (TxOut era) = Interns (Credential 'Staking (Crypto era))
fromSharedCBOR :: Share (TxOut era) -> Decoder s (TxOut era)
fromSharedCBOR Share (TxOut era)
credsInterns =
TxOut era -> TxOut era
internTxOut (TxOut era -> TxOut era)
-> Decoder s (TxOut era) -> Decoder s (TxOut era)
forall (m :: * -> *) a b. Monad m => (a -> b) -> m a -> m b
<$!> (forall s'.
Decoder s' (Addr (Crypto era), CompactAddr (Crypto era)))
-> Decoder s (TxOut era)
forall era s.
(Era era, FromCBOR (Annotator (Script era)),
DecodeNonNegative (Value era)) =>
(forall s'.
Decoder s' (Addr (Crypto era), CompactAddr (Crypto era)))
-> Decoder s (TxOut era)
fromCborTxOutWithAddr forall s'. Decoder s' (Addr (Crypto era), CompactAddr (Crypto era))
forall crypto s.
Crypto crypto =>
Decoder s (Addr crypto, CompactAddr crypto)
fromCborBackwardsBothAddr
where
internTxOut :: TxOut era -> TxOut era
internTxOut = \case
TxOut_AddrHash28_AdaOnly Credential 'Staking (Crypto era)
cred Addr28Extra
addr28Extra CompactForm Coin
ada ->
Credential 'Staking (Crypto era)
-> Addr28Extra -> CompactForm Coin -> TxOut era
forall era.
Credential 'Staking (Crypto era)
-> Addr28Extra -> CompactForm Coin -> TxOut era
TxOut_AddrHash28_AdaOnly (Interns (Credential 'Staking (Crypto era))
-> Credential 'Staking (Crypto era)
-> Credential 'Staking (Crypto era)
forall k. Interns k -> k -> k
interns Interns (Credential 'Staking (Crypto era))
Share (TxOut era)
credsInterns Credential 'Staking (Crypto era)
cred) Addr28Extra
addr28Extra CompactForm Coin
ada
TxOut_AddrHash28_AdaOnly_DataHash32 Credential 'Staking (Crypto era)
cred Addr28Extra
addr28Extra CompactForm Coin
ada DataHash32
dataHash32 ->
Credential 'Staking (Crypto era)
-> Addr28Extra -> CompactForm Coin -> DataHash32 -> TxOut era
forall era.
Credential 'Staking (Crypto era)
-> Addr28Extra -> CompactForm Coin -> DataHash32 -> TxOut era
TxOut_AddrHash28_AdaOnly_DataHash32 (Interns (Credential 'Staking (Crypto era))
-> Credential 'Staking (Crypto era)
-> Credential 'Staking (Crypto era)
forall k. Interns k -> k -> k
interns Interns (Credential 'Staking (Crypto era))
Share (TxOut era)
credsInterns Credential 'Staking (Crypto era)
cred) Addr28Extra
addr28Extra CompactForm Coin
ada DataHash32
dataHash32
TxOut era
txOut -> TxOut era
txOut
fromCborTxOutWithAddr ::
( Era era,
FromCBOR (Annotator (Core.Script era)),
DecodeNonNegative (Core.Value era)
) =>
(forall s'. Decoder s' (Addr (Crypto era), CompactAddr (Crypto era))) ->
Decoder s (TxOut era)
fromCborTxOutWithAddr :: (forall s'.
Decoder s' (Addr (Crypto era), CompactAddr (Crypto era)))
-> Decoder s (TxOut era)
fromCborTxOutWithAddr forall s'. Decoder s' (Addr (Crypto era), CompactAddr (Crypto era))
decAddr = do
Decoder s TokenType
forall s. Decoder s TokenType
peekTokenType Decoder s TokenType
-> (TokenType -> Decoder s (TxOut era)) -> Decoder s (TxOut era)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
TokenType
TypeMapLenIndef -> (forall s'.
Decoder s' (Addr (Crypto era), CompactAddr (Crypto era)))
-> Decoder s (TxOut era)
forall s era.
(Era era, FromCBOR (Annotator (Script era)),
DecodeNonNegative (Value era)) =>
(forall s'.
Decoder s' (Addr (Crypto era), CompactAddr (Crypto era)))
-> Decoder s (TxOut era)
decodeTxOut forall s'. Decoder s' (Addr (Crypto era), CompactAddr (Crypto era))
decAddr
TokenType
TypeMapLen -> (forall s'.
Decoder s' (Addr (Crypto era), CompactAddr (Crypto era)))
-> Decoder s (TxOut era)
forall s era.
(Era era, FromCBOR (Annotator (Script era)),
DecodeNonNegative (Value era)) =>
(forall s'.
Decoder s' (Addr (Crypto era), CompactAddr (Crypto era)))
-> Decoder s (TxOut era)
decodeTxOut forall s'. Decoder s' (Addr (Crypto era), CompactAddr (Crypto era))
decAddr
TokenType
_ -> Decoder s (TxOut era)
oldTxOut
where
oldTxOut :: Decoder s (TxOut era)
oldTxOut = do
Maybe Int
lenOrIndef <- Decoder s (Maybe Int)
forall s. Decoder s (Maybe Int)
decodeListLenOrIndef
case Maybe Int
lenOrIndef of
Maybe Int
Nothing -> do
(Addr (Crypto era)
a, CompactAddr (Crypto era)
ca) <- Decoder s (Addr (Crypto era), CompactAddr (Crypto era))
forall crypto s.
Crypto crypto =>
Decoder s (Addr crypto, CompactAddr crypto)
fromCborBackwardsBothAddr
Value era
v <- Decoder s (Value era)
forall v s. DecodeNonNegative v => Decoder s v
decodeNonNegative
Decoder s Bool
forall s. Decoder s Bool
decodeBreakOr Decoder s Bool
-> (Bool -> Decoder s (TxOut era)) -> Decoder s (TxOut era)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Bool
True -> TxOut era -> Decoder s (TxOut era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxOut era -> Decoder s (TxOut era))
-> TxOut era -> Decoder s (TxOut era)
forall a b. (a -> b) -> a -> b
$ Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
forall era.
(Era era, HasCallStack) =>
Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
mkTxOut Addr (Crypto era)
a CompactAddr (Crypto era)
ca Value era
v Datum era
forall era. Datum era
NoDatum StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing
Bool
False -> do
DataHash (Crypto era)
dh <- Decoder s (DataHash (Crypto era))
forall a s. FromCBOR a => Decoder s a
fromCBOR
Decoder s Bool
forall s. Decoder s Bool
decodeBreakOr Decoder s Bool
-> (Bool -> Decoder s (TxOut era)) -> Decoder s (TxOut era)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Bool
True -> TxOut era -> Decoder s (TxOut era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxOut era -> Decoder s (TxOut era))
-> TxOut era -> Decoder s (TxOut era)
forall a b. (a -> b) -> a -> b
$ Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
forall era.
(Era era, HasCallStack) =>
Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
mkTxOut Addr (Crypto era)
a CompactAddr (Crypto era)
ca Value era
v (DataHash (Crypto era) -> Datum era
forall era. DataHash (Crypto era) -> Datum era
DatumHash DataHash (Crypto era)
dh) StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing
Bool
False -> DecoderError -> Decoder s (TxOut era)
forall e s a. Buildable e => e -> Decoder s a
cborError (DecoderError -> Decoder s (TxOut era))
-> DecoderError -> Decoder s (TxOut era)
forall a b. (a -> b) -> a -> b
$ Text -> Text -> DecoderError
DecoderErrorCustom Text
"txout" Text
"Excess terms in txout"
Just Int
2 -> do
(Addr (Crypto era)
a, CompactAddr (Crypto era)
ca) <- Decoder s (Addr (Crypto era), CompactAddr (Crypto era))
forall s'. Decoder s' (Addr (Crypto era), CompactAddr (Crypto era))
decAddr
Value era
v <- Decoder s (Value era)
forall v s. DecodeNonNegative v => Decoder s v
decodeNonNegative
TxOut era -> Decoder s (TxOut era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxOut era -> Decoder s (TxOut era))
-> TxOut era -> Decoder s (TxOut era)
forall a b. (a -> b) -> a -> b
$ Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
forall era.
(Era era, HasCallStack) =>
Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
mkTxOut Addr (Crypto era)
a CompactAddr (Crypto era)
ca Value era
v Datum era
forall era. Datum era
NoDatum StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing
Just Int
3 -> do
(Addr (Crypto era)
a, CompactAddr (Crypto era)
ca) <- Decoder s (Addr (Crypto era), CompactAddr (Crypto era))
forall crypto s.
Crypto crypto =>
Decoder s (Addr crypto, CompactAddr crypto)
fromCborBackwardsBothAddr
Value era
v <- Decoder s (Value era)
forall v s. DecodeNonNegative v => Decoder s v
decodeNonNegative
DataHash (Crypto era)
dh <- Decoder s (DataHash (Crypto era))
forall a s. FromCBOR a => Decoder s a
fromCBOR
TxOut era -> Decoder s (TxOut era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxOut era -> Decoder s (TxOut era))
-> TxOut era -> Decoder s (TxOut era)
forall a b. (a -> b) -> a -> b
$ Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
forall era.
(Era era, HasCallStack) =>
Addr (Crypto era)
-> CompactAddr (Crypto era)
-> Value era
-> Datum era
-> StrictMaybe (Script era)
-> TxOut era
mkTxOut Addr (Crypto era)
a CompactAddr (Crypto era)
ca Value era
v (DataHash (Crypto era) -> Datum era
forall era. DataHash (Crypto era) -> Datum era
DatumHash DataHash (Crypto era)
dh) StrictMaybe (Script era)
forall a. StrictMaybe a
SNothing
Just Int
_ -> DecoderError -> Decoder s (TxOut era)
forall e s a. Buildable e => e -> Decoder s a
cborError (DecoderError -> Decoder s (TxOut era))
-> DecoderError -> Decoder s (TxOut era)
forall a b. (a -> b) -> a -> b
$ Text -> Text -> DecoderError
DecoderErrorCustom Text
"txout" Text
"wrong number of terms in txout"
encodeTxBodyRaw ::
( Era era,
ToCBOR (PParamsDelta era),
ToCBOR (Core.Script era),
ToCBOR (Core.Value era)
) =>
TxBodyRaw era ->
Encode ('Closed 'Sparse) (TxBodyRaw era)
encodeTxBodyRaw :: TxBodyRaw era -> Encode ('Closed 'Sparse) (TxBodyRaw era)
encodeTxBodyRaw
TxBodyRaw
{ Set (TxIn (Crypto era))
_spendInputs :: Set (TxIn (Crypto era))
_spendInputs :: forall era. TxBodyRaw era -> Set (TxIn (Crypto era))
_spendInputs,
Set (TxIn (Crypto era))
_collateralInputs :: Set (TxIn (Crypto era))
_collateralInputs :: forall era. TxBodyRaw era -> Set (TxIn (Crypto era))
_collateralInputs,
Set (TxIn (Crypto era))
_referenceInputs :: Set (TxIn (Crypto era))
_referenceInputs :: forall era. TxBodyRaw era -> Set (TxIn (Crypto era))
_referenceInputs,
StrictSeq (Sized (TxOut era))
_outputs :: StrictSeq (Sized (TxOut era))
_outputs :: forall era. TxBodyRaw era -> StrictSeq (Sized (TxOut era))
_outputs,
StrictMaybe (Sized (TxOut era))
_collateralReturn :: StrictMaybe (Sized (TxOut era))
_collateralReturn :: forall era. TxBodyRaw era -> StrictMaybe (Sized (TxOut era))
_collateralReturn,
StrictMaybe Coin
_totalCollateral :: StrictMaybe Coin
_totalCollateral :: forall era. TxBodyRaw era -> StrictMaybe Coin
_totalCollateral,
StrictSeq (DCert (Crypto era))
_certs :: StrictSeq (DCert (Crypto era))
_certs :: forall era. TxBodyRaw era -> StrictSeq (DCert (Crypto era))
_certs,
Wdrl (Crypto era)
_wdrls :: Wdrl (Crypto era)
_wdrls :: forall era. TxBodyRaw era -> Wdrl (Crypto era)
_wdrls,
Coin
_txfee :: Coin
_txfee :: forall era. TxBodyRaw era -> Coin
_txfee,
_vldt :: forall era. TxBodyRaw era -> ValidityInterval
_vldt = ValidityInterval StrictMaybe SlotNo
bot StrictMaybe SlotNo
top,
StrictMaybe (Update era)
_update :: StrictMaybe (Update era)
_update :: forall era. TxBodyRaw era -> StrictMaybe (Update era)
_update,
Set (KeyHash 'Witness (Crypto era))
_reqSignerHashes :: Set (KeyHash 'Witness (Crypto era))
_reqSignerHashes :: forall era. TxBodyRaw era -> Set (KeyHash 'Witness (Crypto era))
_reqSignerHashes,
Value (Crypto era)
_mint :: Value (Crypto era)
_mint :: forall era. TxBodyRaw era -> Value (Crypto era)
_mint,
StrictMaybe (ScriptIntegrityHash (Crypto era))
_scriptIntegrityHash :: StrictMaybe (ScriptIntegrityHash (Crypto era))
_scriptIntegrityHash :: forall era.
TxBodyRaw era -> StrictMaybe (ScriptIntegrityHash (Crypto era))
_scriptIntegrityHash,
StrictMaybe (AuxiliaryDataHash (Crypto era))
_adHash :: StrictMaybe (AuxiliaryDataHash (Crypto era))
_adHash :: forall era.
TxBodyRaw era -> StrictMaybe (AuxiliaryDataHash (Crypto era))
_adHash,
StrictMaybe Network
_txnetworkid :: StrictMaybe Network
_txnetworkid :: forall era. TxBodyRaw era -> StrictMaybe Network
_txnetworkid
} =
(Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> Coin
-> StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode
('Closed 'Sparse)
(Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> Coin
-> StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
forall t. t -> Encode ('Closed 'Sparse) t
Keyed
( \Set (TxIn (Crypto era))
i Set (TxIn (Crypto era))
ifee Set (TxIn (Crypto era))
ri StrictSeq (Sized (TxOut era))
o StrictMaybe (Sized (TxOut era))
cr StrictMaybe Coin
tc Coin
f StrictMaybe SlotNo
t StrictSeq (DCert (Crypto era))
c Wdrl (Crypto era)
w StrictMaybe (Update era)
u StrictMaybe SlotNo
b Set (KeyHash 'Witness (Crypto era))
rsh Value (Crypto era)
mi StrictMaybe (ScriptIntegrityHash (Crypto era))
sh StrictMaybe (AuxiliaryDataHash (Crypto era))
ah StrictMaybe Network
ni ->
Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> Coin
-> ValidityInterval
-> StrictMaybe (Update era)
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era
forall era.
Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> Coin
-> ValidityInterval
-> StrictMaybe (Update era)
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era
TxBodyRaw Set (TxIn (Crypto era))
i Set (TxIn (Crypto era))
ifee Set (TxIn (Crypto era))
ri StrictSeq (Sized (TxOut era))
o StrictMaybe (Sized (TxOut era))
cr StrictMaybe Coin
tc StrictSeq (DCert (Crypto era))
c Wdrl (Crypto era)
w Coin
f (StrictMaybe SlotNo -> StrictMaybe SlotNo -> ValidityInterval
ValidityInterval StrictMaybe SlotNo
b StrictMaybe SlotNo
t) StrictMaybe (Update era)
u Set (KeyHash 'Witness (Crypto era))
rsh Value (Crypto era)
mi StrictMaybe (ScriptIntegrityHash (Crypto era))
sh StrictMaybe (AuxiliaryDataHash (Crypto era))
ah StrictMaybe Network
ni
)
Encode
('Closed 'Sparse)
(Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> Coin
-> StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode ('Closed 'Sparse) (Set (TxIn (Crypto era)))
-> Encode
('Closed 'Sparse)
(Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> Coin
-> StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> Word
-> Encode ('Closed 'Dense) (Set (TxIn (Crypto era)))
-> Encode ('Closed 'Sparse) (Set (TxIn (Crypto era)))
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
0 ((Set (TxIn (Crypto era)) -> Encoding)
-> Set (TxIn (Crypto era))
-> Encode ('Closed 'Dense) (Set (TxIn (Crypto era)))
forall t. (t -> Encoding) -> t -> Encode ('Closed 'Dense) t
E Set (TxIn (Crypto era)) -> Encoding
forall a (f :: * -> *). (ToCBOR a, Foldable f) => f a -> Encoding
encodeFoldable Set (TxIn (Crypto era))
_spendInputs)
Encode
('Closed 'Sparse)
(Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> Coin
-> StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode ('Closed 'Sparse) (Set (TxIn (Crypto era)))
-> Encode
('Closed 'Sparse)
(Set (TxIn (Crypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> Coin
-> StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> (Set (TxIn (Crypto era)) -> Bool)
-> Encode ('Closed 'Sparse) (Set (TxIn (Crypto era)))
-> Encode ('Closed 'Sparse) (Set (TxIn (Crypto era)))
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit Set (TxIn (Crypto era)) -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Word
-> Encode ('Closed 'Dense) (Set (TxIn (Crypto era)))
-> Encode ('Closed 'Sparse) (Set (TxIn (Crypto era)))
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
13 ((Set (TxIn (Crypto era)) -> Encoding)
-> Set (TxIn (Crypto era))
-> Encode ('Closed 'Dense) (Set (TxIn (Crypto era)))
forall t. (t -> Encoding) -> t -> Encode ('Closed 'Dense) t
E Set (TxIn (Crypto era)) -> Encoding
forall a (f :: * -> *). (ToCBOR a, Foldable f) => f a -> Encoding
encodeFoldable Set (TxIn (Crypto era))
_collateralInputs))
Encode
('Closed 'Sparse)
(Set (TxIn (Crypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> Coin
-> StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode ('Closed 'Sparse) (Set (TxIn (Crypto era)))
-> Encode
('Closed 'Sparse)
(StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> Coin
-> StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> (Set (TxIn (Crypto era)) -> Bool)
-> Encode ('Closed 'Sparse) (Set (TxIn (Crypto era)))
-> Encode ('Closed 'Sparse) (Set (TxIn (Crypto era)))
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit Set (TxIn (Crypto era)) -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Word
-> Encode ('Closed 'Dense) (Set (TxIn (Crypto era)))
-> Encode ('Closed 'Sparse) (Set (TxIn (Crypto era)))
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
18 ((Set (TxIn (Crypto era)) -> Encoding)
-> Set (TxIn (Crypto era))
-> Encode ('Closed 'Dense) (Set (TxIn (Crypto era)))
forall t. (t -> Encoding) -> t -> Encode ('Closed 'Dense) t
E Set (TxIn (Crypto era)) -> Encoding
forall a (f :: * -> *). (ToCBOR a, Foldable f) => f a -> Encoding
encodeFoldable Set (TxIn (Crypto era))
_referenceInputs))
Encode
('Closed 'Sparse)
(StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> Coin
-> StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode ('Closed 'Sparse) (StrictSeq (Sized (TxOut era)))
-> Encode
('Closed 'Sparse)
(StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> Coin
-> StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> Word
-> Encode ('Closed 'Dense) (StrictSeq (Sized (TxOut era)))
-> Encode ('Closed 'Sparse) (StrictSeq (Sized (TxOut era)))
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
1 ((StrictSeq (Sized (TxOut era)) -> Encoding)
-> StrictSeq (Sized (TxOut era))
-> Encode ('Closed 'Dense) (StrictSeq (Sized (TxOut era)))
forall t. (t -> Encoding) -> t -> Encode ('Closed 'Dense) t
E StrictSeq (Sized (TxOut era)) -> Encoding
forall a (f :: * -> *). (ToCBOR a, Foldable f) => f a -> Encoding
encodeFoldable StrictSeq (Sized (TxOut era))
_outputs)
Encode
('Closed 'Sparse)
(StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> Coin
-> StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode ('Closed 'Sparse) (StrictMaybe (Sized (TxOut era)))
-> Encode
('Closed 'Sparse)
(StrictMaybe Coin
-> Coin
-> StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> Word
-> StrictMaybe (Sized (TxOut era))
-> Encode ('Closed 'Sparse) (StrictMaybe (Sized (TxOut era)))
forall a.
ToCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
16 StrictMaybe (Sized (TxOut era))
_collateralReturn
Encode
('Closed 'Sparse)
(StrictMaybe Coin
-> Coin
-> StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode ('Closed 'Sparse) (StrictMaybe Coin)
-> Encode
('Closed 'Sparse)
(Coin
-> StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> Word
-> StrictMaybe Coin -> Encode ('Closed 'Sparse) (StrictMaybe Coin)
forall a.
ToCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
17 StrictMaybe Coin
_totalCollateral
Encode
('Closed 'Sparse)
(Coin
-> StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode ('Closed 'Sparse) Coin
-> Encode
('Closed 'Sparse)
(StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> Word
-> Encode ('Closed 'Dense) Coin -> Encode ('Closed 'Sparse) Coin
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
2 (Coin -> Encode ('Closed 'Dense) Coin
forall t. ToCBOR t => t -> Encode ('Closed 'Dense) t
To Coin
_txfee)
Encode
('Closed 'Sparse)
(StrictMaybe SlotNo
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode ('Closed 'Sparse) (StrictMaybe SlotNo)
-> Encode
('Closed 'Sparse)
(StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> Word
-> StrictMaybe SlotNo
-> Encode ('Closed 'Sparse) (StrictMaybe SlotNo)
forall a.
ToCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
3 StrictMaybe SlotNo
top
Encode
('Closed 'Sparse)
(StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode ('Closed 'Sparse) (StrictSeq (DCert (Crypto era)))
-> Encode
('Closed 'Sparse)
(Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> (StrictSeq (DCert (Crypto era)) -> Bool)
-> Encode ('Closed 'Sparse) (StrictSeq (DCert (Crypto era)))
-> Encode ('Closed 'Sparse) (StrictSeq (DCert (Crypto era)))
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit StrictSeq (DCert (Crypto era)) -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Word
-> Encode ('Closed 'Dense) (StrictSeq (DCert (Crypto era)))
-> Encode ('Closed 'Sparse) (StrictSeq (DCert (Crypto era)))
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
4 ((StrictSeq (DCert (Crypto era)) -> Encoding)
-> StrictSeq (DCert (Crypto era))
-> Encode ('Closed 'Dense) (StrictSeq (DCert (Crypto era)))
forall t. (t -> Encoding) -> t -> Encode ('Closed 'Dense) t
E StrictSeq (DCert (Crypto era)) -> Encoding
forall a (f :: * -> *). (ToCBOR a, Foldable f) => f a -> Encoding
encodeFoldable StrictSeq (DCert (Crypto era))
_certs))
Encode
('Closed 'Sparse)
(Wdrl (Crypto era)
-> StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode ('Closed 'Sparse) (Wdrl (Crypto era))
-> Encode
('Closed 'Sparse)
(StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> (Wdrl (Crypto era) -> Bool)
-> Encode ('Closed 'Sparse) (Wdrl (Crypto era))
-> Encode ('Closed 'Sparse) (Wdrl (Crypto era))
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit (Map (RewardAcnt (Crypto era)) Coin -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Map (RewardAcnt (Crypto era)) Coin -> Bool)
-> (Wdrl (Crypto era) -> Map (RewardAcnt (Crypto era)) Coin)
-> Wdrl (Crypto era)
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Wdrl (Crypto era) -> Map (RewardAcnt (Crypto era)) Coin
forall crypto. Wdrl crypto -> Map (RewardAcnt crypto) Coin
unWdrl) (Word
-> Encode ('Closed 'Dense) (Wdrl (Crypto era))
-> Encode ('Closed 'Sparse) (Wdrl (Crypto era))
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
5 (Wdrl (Crypto era) -> Encode ('Closed 'Dense) (Wdrl (Crypto era))
forall t. ToCBOR t => t -> Encode ('Closed 'Dense) t
To Wdrl (Crypto era)
_wdrls))
Encode
('Closed 'Sparse)
(StrictMaybe (Update era)
-> StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode ('Closed 'Sparse) (StrictMaybe (Update era))
-> Encode
('Closed 'Sparse)
(StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> Word
-> StrictMaybe (Update era)
-> Encode ('Closed 'Sparse) (StrictMaybe (Update era))
forall a.
ToCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
6 StrictMaybe (Update era)
_update
Encode
('Closed 'Sparse)
(StrictMaybe SlotNo
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode ('Closed 'Sparse) (StrictMaybe SlotNo)
-> Encode
('Closed 'Sparse)
(Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> Word
-> StrictMaybe SlotNo
-> Encode ('Closed 'Sparse) (StrictMaybe SlotNo)
forall a.
ToCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
8 StrictMaybe SlotNo
bot
Encode
('Closed 'Sparse)
(Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode ('Closed 'Sparse) (Set (KeyHash 'Witness (Crypto era)))
-> Encode
('Closed 'Sparse)
(Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> (Set (KeyHash 'Witness (Crypto era)) -> Bool)
-> Encode ('Closed 'Sparse) (Set (KeyHash 'Witness (Crypto era)))
-> Encode ('Closed 'Sparse) (Set (KeyHash 'Witness (Crypto era)))
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit Set (KeyHash 'Witness (Crypto era)) -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Word
-> Encode ('Closed 'Dense) (Set (KeyHash 'Witness (Crypto era)))
-> Encode ('Closed 'Sparse) (Set (KeyHash 'Witness (Crypto era)))
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
14 ((Set (KeyHash 'Witness (Crypto era)) -> Encoding)
-> Set (KeyHash 'Witness (Crypto era))
-> Encode ('Closed 'Dense) (Set (KeyHash 'Witness (Crypto era)))
forall t. (t -> Encoding) -> t -> Encode ('Closed 'Dense) t
E Set (KeyHash 'Witness (Crypto era)) -> Encoding
forall a (f :: * -> *). (ToCBOR a, Foldable f) => f a -> Encoding
encodeFoldable Set (KeyHash 'Witness (Crypto era))
_reqSignerHashes))
Encode
('Closed 'Sparse)
(Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode ('Closed 'Sparse) (Value (Crypto era))
-> Encode
('Closed 'Sparse)
(StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> (Value (Crypto era) -> Bool)
-> Encode ('Closed 'Sparse) (Value (Crypto era))
-> Encode ('Closed 'Sparse) (Value (Crypto era))
forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit Value (Crypto era) -> Bool
forall t. Val t => t -> Bool
isZero (Word
-> Encode ('Closed 'Dense) (Value (Crypto era))
-> Encode ('Closed 'Sparse) (Value (Crypto era))
forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
9 ((Value (Crypto era) -> Encoding)
-> Value (Crypto era)
-> Encode ('Closed 'Dense) (Value (Crypto era))
forall t. (t -> Encoding) -> t -> Encode ('Closed 'Dense) t
E Value (Crypto era) -> Encoding
forall v. EncodeMint v => v -> Encoding
encodeMint Value (Crypto era)
_mint))
Encode
('Closed 'Sparse)
(StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era)
-> Encode
('Closed 'Sparse) (StrictMaybe (ScriptIntegrityHash (Crypto era)))
-> Encode
('Closed 'Sparse)
(StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network -> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> Word
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> Encode
('Closed 'Sparse) (StrictMaybe (ScriptIntegrityHash (Crypto era)))
forall a.
ToCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
11 StrictMaybe (ScriptIntegrityHash (Crypto era))
_scriptIntegrityHash
Encode
('Closed 'Sparse)
(StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network -> TxBodyRaw era)
-> Encode
('Closed 'Sparse) (StrictMaybe (AuxiliaryDataHash (Crypto era)))
-> Encode ('Closed 'Sparse) (StrictMaybe Network -> TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> Word
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> Encode
('Closed 'Sparse) (StrictMaybe (AuxiliaryDataHash (Crypto era)))
forall a.
ToCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
7 StrictMaybe (AuxiliaryDataHash (Crypto era))
_adHash
Encode ('Closed 'Sparse) (StrictMaybe Network -> TxBodyRaw era)
-> Encode ('Closed 'Sparse) (StrictMaybe Network)
-> Encode ('Closed 'Sparse) (TxBodyRaw era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> Word
-> StrictMaybe Network
-> Encode ('Closed 'Sparse) (StrictMaybe Network)
forall a.
ToCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
15 StrictMaybe Network
_txnetworkid
instance
forall era.
( Era era,
Typeable (Core.Script era),
Typeable (Core.AuxiliaryData era),
Compactible (Core.Value era),
Show (Core.Value era),
DecodeNonNegative (Core.Value era),
FromCBOR (Annotator (Core.Script era)),
FromCBOR (PParamsDelta era),
ToCBOR (PParamsDelta era)
) =>
FromCBOR (TxBodyRaw era)
where
fromCBOR :: Decoder s (TxBodyRaw era)
fromCBOR =
Decode ('Closed 'Dense) (TxBodyRaw era)
-> Decoder s (TxBodyRaw era)
forall (w :: Wrapped) t s. Decode w t -> Decoder s t
decode (Decode ('Closed 'Dense) (TxBodyRaw era)
-> Decoder s (TxBodyRaw era))
-> Decode ('Closed 'Dense) (TxBodyRaw era)
-> Decoder s (TxBodyRaw era)
forall a b. (a -> b) -> a -> b
$
String
-> TxBodyRaw era
-> (Word -> Field (TxBodyRaw era))
-> [(Word, String)]
-> Decode ('Closed 'Dense) (TxBodyRaw era)
forall t.
Typeable t =>
String
-> t
-> (Word -> Field t)
-> [(Word, String)]
-> Decode ('Closed 'Dense) t
SparseKeyed
String
"TxBodyRaw"
TxBodyRaw era
initial
Word -> Field (TxBodyRaw era)
bodyFields
[(Word, String)]
requiredFields
where
initial :: TxBodyRaw era
initial :: TxBodyRaw era
initial =
Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> Coin
-> ValidityInterval
-> StrictMaybe (Update era)
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era
forall era.
Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> Set (TxIn (Crypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> StrictSeq (DCert (Crypto era))
-> Wdrl (Crypto era)
-> Coin
-> ValidityInterval
-> StrictMaybe (Update era)
-> Set (KeyHash 'Witness (Crypto era))
-> Value (Crypto era)
-> StrictMaybe (ScriptIntegrityHash (Crypto era))
-> StrictMaybe (AuxiliaryDataHash (Crypto era))
-> StrictMaybe Network
-> TxBodyRaw era
TxBodyRaw
Set (TxIn (Crypto era))
forall a. Monoid a => a
mempty
Set (TxIn (Crypto era))
forall a. Monoid a => a
mempty
Set (TxIn (Crypto era))
forall a. Monoid a => a
mempty
StrictSeq (Sized (TxOut era))
forall a. StrictSeq a
StrictSeq.empty
StrictMaybe (Sized (TxOut era))
forall a. StrictMaybe a
SNothing
StrictMaybe Coin
forall a. StrictMaybe a
SNothing
StrictSeq (DCert (Crypto era))
forall a. StrictSeq a
StrictSeq.empty
(Map (RewardAcnt (Crypto era)) Coin -> Wdrl (Crypto era)
forall crypto. Map (RewardAcnt crypto) Coin -> Wdrl crypto
Wdrl Map (RewardAcnt (Crypto era)) Coin
forall a. Monoid a => a
mempty)
Coin
forall a. Monoid a => a
mempty
(StrictMaybe SlotNo -> StrictMaybe SlotNo -> ValidityInterval
ValidityInterval StrictMaybe SlotNo
forall a. StrictMaybe a
SNothing StrictMaybe SlotNo
forall a. StrictMaybe a
SNothing)
StrictMaybe (Update era)
forall a. StrictMaybe a
SNothing
Set (KeyHash 'Witness (Crypto era))
forall a. Monoid a => a
mempty
Value (Crypto era)
forall a. Monoid a => a
mempty
StrictMaybe (ScriptIntegrityHash (Crypto era))
forall a. StrictMaybe a
SNothing
StrictMaybe (AuxiliaryDataHash (Crypto era))
forall a. StrictMaybe a
SNothing
StrictMaybe Network
forall a. StrictMaybe a
SNothing
bodyFields :: (Word -> Field (TxBodyRaw era))
bodyFields :: Word -> Field (TxBodyRaw era)
bodyFields Word
0 =
(Set (TxIn (Crypto era)) -> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed 'Dense) (Set (TxIn (Crypto era)))
-> Field (TxBodyRaw era)
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field
(\Set (TxIn (Crypto era))
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_spendInputs :: Set (TxIn (Crypto era))
_spendInputs = Set (TxIn (Crypto era))
x})
((forall s. Decoder s (Set (TxIn (Crypto era))))
-> Decode ('Closed 'Dense) (Set (TxIn (Crypto era)))
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (Decoder s (TxIn (Crypto era))
-> Decoder s (Set (TxIn (Crypto era)))
forall a s. Ord a => Decoder s a -> Decoder s (Set a)
decodeSet Decoder s (TxIn (Crypto era))
forall a s. FromCBOR a => Decoder s a
fromCBOR))
bodyFields Word
13 =
(Set (TxIn (Crypto era)) -> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed 'Dense) (Set (TxIn (Crypto era)))
-> Field (TxBodyRaw era)
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field
(\Set (TxIn (Crypto era))
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_collateralInputs :: Set (TxIn (Crypto era))
_collateralInputs = Set (TxIn (Crypto era))
x})
((forall s. Decoder s (Set (TxIn (Crypto era))))
-> Decode ('Closed 'Dense) (Set (TxIn (Crypto era)))
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (Decoder s (TxIn (Crypto era))
-> Decoder s (Set (TxIn (Crypto era)))
forall a s. Ord a => Decoder s a -> Decoder s (Set a)
decodeSet Decoder s (TxIn (Crypto era))
forall a s. FromCBOR a => Decoder s a
fromCBOR))
bodyFields Word
18 =
(Set (TxIn (Crypto era)) -> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed 'Dense) (Set (TxIn (Crypto era)))
-> Field (TxBodyRaw era)
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field
(\Set (TxIn (Crypto era))
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_referenceInputs :: Set (TxIn (Crypto era))
_referenceInputs = Set (TxIn (Crypto era))
x})
((forall s. Decoder s (Set (TxIn (Crypto era))))
-> Decode ('Closed 'Dense) (Set (TxIn (Crypto era)))
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (Decoder s (TxIn (Crypto era))
-> Decoder s (Set (TxIn (Crypto era)))
forall a s. Ord a => Decoder s a -> Decoder s (Set a)
decodeSet Decoder s (TxIn (Crypto era))
forall a s. FromCBOR a => Decoder s a
fromCBOR))
bodyFields Word
1 =
(StrictSeq (Sized (TxOut era)) -> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed 'Dense) (StrictSeq (Sized (TxOut era)))
-> Field (TxBodyRaw era)
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field
(\StrictSeq (Sized (TxOut era))
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_outputs :: StrictSeq (Sized (TxOut era))
_outputs = StrictSeq (Sized (TxOut era))
x})
((forall s. Decoder s (StrictSeq (Sized (TxOut era))))
-> Decode ('Closed 'Dense) (StrictSeq (Sized (TxOut era)))
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (Decoder s (Sized (TxOut era))
-> Decoder s (StrictSeq (Sized (TxOut era)))
forall s a. Decoder s a -> Decoder s (StrictSeq a)
decodeStrictSeq (Decoder s (TxOut era) -> Decoder s (Sized (TxOut era))
forall s a. Decoder s a -> Decoder s (Sized a)
sizedDecoder ((forall s'.
Decoder s' (Addr (Crypto era), CompactAddr (Crypto era)))
-> Decoder s (TxOut era)
forall era s.
(Era era, FromCBOR (Annotator (Script era)),
DecodeNonNegative (Value era)) =>
(forall s'.
Decoder s' (Addr (Crypto era), CompactAddr (Crypto era)))
-> Decoder s (TxOut era)
fromCborTxOutWithAddr forall s'. Decoder s' (Addr (Crypto era), CompactAddr (Crypto era))
forall crypto s.
Crypto crypto =>
Decoder s (Addr crypto, CompactAddr crypto)
fromCborBothAddr))))
bodyFields Word
16 =
(StrictMaybe (Sized (TxOut era)) -> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed 'Dense) (Sized (TxOut era))
-> Field (TxBodyRaw era)
forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield
(\StrictMaybe (Sized (TxOut era))
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_collateralReturn :: StrictMaybe (Sized (TxOut era))
_collateralReturn = StrictMaybe (Sized (TxOut era))
x})
((forall s. Decoder s (Sized (TxOut era)))
-> Decode ('Closed 'Dense) (Sized (TxOut era))
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (Decoder s (TxOut era) -> Decoder s (Sized (TxOut era))
forall s a. Decoder s a -> Decoder s (Sized a)
sizedDecoder ((forall s'.
Decoder s' (Addr (Crypto era), CompactAddr (Crypto era)))
-> Decoder s (TxOut era)
forall era s.
(Era era, FromCBOR (Annotator (Script era)),
DecodeNonNegative (Value era)) =>
(forall s'.
Decoder s' (Addr (Crypto era), CompactAddr (Crypto era)))
-> Decoder s (TxOut era)
fromCborTxOutWithAddr forall s'. Decoder s' (Addr (Crypto era), CompactAddr (Crypto era))
forall crypto s.
Crypto crypto =>
Decoder s (Addr crypto, CompactAddr crypto)
fromCborBothAddr)))
bodyFields Word
17 =
(StrictMaybe Coin -> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed Any) Coin -> Field (TxBodyRaw era)
forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield
(\StrictMaybe Coin
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_totalCollateral :: StrictMaybe Coin
_totalCollateral = StrictMaybe Coin
x})
Decode ('Closed Any) Coin
forall t (w :: Wrapped). FromCBOR t => Decode w t
From
bodyFields Word
2 = (Coin -> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed Any) Coin -> Field (TxBodyRaw era)
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Coin
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_txfee :: Coin
_txfee = Coin
x}) Decode ('Closed Any) Coin
forall t (w :: Wrapped). FromCBOR t => Decode w t
From
bodyFields Word
3 =
(StrictMaybe SlotNo -> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed Any) SlotNo -> Field (TxBodyRaw era)
forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield
(\StrictMaybe SlotNo
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_vldt :: ValidityInterval
_vldt = (TxBodyRaw era -> ValidityInterval
forall era. TxBodyRaw era -> ValidityInterval
_vldt TxBodyRaw era
tx) {invalidHereafter :: StrictMaybe SlotNo
invalidHereafter = StrictMaybe SlotNo
x}})
Decode ('Closed Any) SlotNo
forall t (w :: Wrapped). FromCBOR t => Decode w t
From
bodyFields Word
4 =
(StrictSeq (DCert (Crypto era)) -> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed 'Dense) (StrictSeq (DCert (Crypto era)))
-> Field (TxBodyRaw era)
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field
(\StrictSeq (DCert (Crypto era))
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_certs :: StrictSeq (DCert (Crypto era))
_certs = StrictSeq (DCert (Crypto era))
x})
((forall s. Decoder s (StrictSeq (DCert (Crypto era))))
-> Decode ('Closed 'Dense) (StrictSeq (DCert (Crypto era)))
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (Decoder s (DCert (Crypto era))
-> Decoder s (StrictSeq (DCert (Crypto era)))
forall s a. Decoder s a -> Decoder s (StrictSeq a)
decodeStrictSeq Decoder s (DCert (Crypto era))
forall a s. FromCBOR a => Decoder s a
fromCBOR))
bodyFields Word
5 =
(Wdrl (Crypto era) -> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed 'Dense) (Wdrl (Crypto era))
-> Field (TxBodyRaw era)
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field
(\Wdrl (Crypto era)
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_wdrls :: Wdrl (Crypto era)
_wdrls = Wdrl (Crypto era)
x})
((forall s. Decoder s (Wdrl (Crypto era)))
-> Decode ('Closed 'Dense) (Wdrl (Crypto era))
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (Map (RewardAcnt (Crypto era)) Coin -> Wdrl (Crypto era)
forall crypto. Map (RewardAcnt crypto) Coin -> Wdrl crypto
Wdrl (Map (RewardAcnt (Crypto era)) Coin -> Wdrl (Crypto era))
-> Decoder s (Map (RewardAcnt (Crypto era)) Coin)
-> Decoder s (Wdrl (Crypto era))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (RewardAcnt (Crypto era))
-> Decoder s Coin -> Decoder s (Map (RewardAcnt (Crypto era)) Coin)
forall a s b.
Ord a =>
Decoder s a -> Decoder s b -> Decoder s (Map a b)
decodeMap Decoder s (RewardAcnt (Crypto era))
forall crypto s. Crypto crypto => Decoder s (RewardAcnt crypto)
fromCborRewardAcnt Decoder s Coin
forall a s. FromCBOR a => Decoder s a
fromCBOR))
bodyFields Word
6 = (StrictMaybe (Update era) -> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed Any) (Update era) -> Field (TxBodyRaw era)
forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield (\StrictMaybe (Update era)
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_update :: StrictMaybe (Update era)
_update = StrictMaybe (Update era)
x}) Decode ('Closed Any) (Update era)
forall t (w :: Wrapped). FromCBOR t => Decode w t
From
bodyFields Word
7 = (StrictMaybe (AuxiliaryDataHash (Crypto era))
-> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed Any) (AuxiliaryDataHash (Crypto era))
-> Field (TxBodyRaw era)
forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield (\StrictMaybe (AuxiliaryDataHash (Crypto era))
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_adHash :: StrictMaybe (AuxiliaryDataHash (Crypto era))
_adHash = StrictMaybe (AuxiliaryDataHash (Crypto era))
x}) Decode ('Closed Any) (AuxiliaryDataHash (Crypto era))
forall t (w :: Wrapped). FromCBOR t => Decode w t
From
bodyFields Word
8 =
(StrictMaybe SlotNo -> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed Any) SlotNo -> Field (TxBodyRaw era)
forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield
(\StrictMaybe SlotNo
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_vldt :: ValidityInterval
_vldt = (TxBodyRaw era -> ValidityInterval
forall era. TxBodyRaw era -> ValidityInterval
_vldt TxBodyRaw era
tx) {invalidBefore :: StrictMaybe SlotNo
invalidBefore = StrictMaybe SlotNo
x}})
Decode ('Closed Any) SlotNo
forall t (w :: Wrapped). FromCBOR t => Decode w t
From
bodyFields Word
9 = (Value (Crypto era) -> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed 'Dense) (Value (Crypto era))
-> Field (TxBodyRaw era)
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Value (Crypto era)
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_mint :: Value (Crypto era)
_mint = Value (Crypto era)
x}) ((forall s. Decoder s (Value (Crypto era)))
-> Decode ('Closed 'Dense) (Value (Crypto era))
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D forall s. Decoder s (Value (Crypto era))
forall v s. DecodeMint v => Decoder s v
decodeMint)
bodyFields Word
11 = (StrictMaybe (ScriptIntegrityHash (Crypto era))
-> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed Any) (ScriptIntegrityHash (Crypto era))
-> Field (TxBodyRaw era)
forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield (\StrictMaybe (ScriptIntegrityHash (Crypto era))
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_scriptIntegrityHash :: StrictMaybe (ScriptIntegrityHash (Crypto era))
_scriptIntegrityHash = StrictMaybe (ScriptIntegrityHash (Crypto era))
x}) Decode ('Closed Any) (ScriptIntegrityHash (Crypto era))
forall t (w :: Wrapped). FromCBOR t => Decode w t
From
bodyFields Word
14 = (Set (KeyHash 'Witness (Crypto era))
-> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed 'Dense) (Set (KeyHash 'Witness (Crypto era)))
-> Field (TxBodyRaw era)
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Set (KeyHash 'Witness (Crypto era))
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_reqSignerHashes :: Set (KeyHash 'Witness (Crypto era))
_reqSignerHashes = Set (KeyHash 'Witness (Crypto era))
x}) ((forall s. Decoder s (Set (KeyHash 'Witness (Crypto era))))
-> Decode ('Closed 'Dense) (Set (KeyHash 'Witness (Crypto era)))
forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (Decoder s (KeyHash 'Witness (Crypto era))
-> Decoder s (Set (KeyHash 'Witness (Crypto era)))
forall a s. Ord a => Decoder s a -> Decoder s (Set a)
decodeSet Decoder s (KeyHash 'Witness (Crypto era))
forall a s. FromCBOR a => Decoder s a
fromCBOR))
bodyFields Word
15 = (StrictMaybe Network -> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed Any) Network -> Field (TxBodyRaw era)
forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield (\StrictMaybe Network
x TxBodyRaw era
tx -> TxBodyRaw era
tx {_txnetworkid :: StrictMaybe Network
_txnetworkid = StrictMaybe Network
x}) Decode ('Closed Any) Network
forall t (w :: Wrapped). FromCBOR t => Decode w t
From
bodyFields Word
n = (Any -> TxBodyRaw era -> TxBodyRaw era)
-> Decode ('Closed Any) Any -> Field (TxBodyRaw era)
forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Any
_ TxBodyRaw era
t -> TxBodyRaw era
t) (Word -> Decode ('Closed Any) Any
forall (w :: Wrapped) t. Word -> Decode w t
Invalid Word
n)
requiredFields :: [(Word, String)]
requiredFields =
[ (Word
0, String
"inputs"),
(Word
1, String
"outputs"),
(Word
2, String
"fee")
]
instance (Crypto era ~ c) => HasField "inputs" (TxBody era) (Set (TxIn c)) where
getField :: TxBody era -> Set (TxIn c)
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> Set (TxIn (Crypto era))
forall era. TxBodyRaw era -> Set (TxIn (Crypto era))
_spendInputs TxBodyRaw era
m
instance HasField "outputs" (TxBody era) (StrictSeq (TxOut era)) where
getField :: TxBody era -> StrictSeq (TxOut era)
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = Sized (TxOut era) -> TxOut era
forall a. Sized a -> a
sizedValue (Sized (TxOut era) -> TxOut era)
-> StrictSeq (Sized (TxOut era)) -> StrictSeq (TxOut era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TxBodyRaw era -> StrictSeq (Sized (TxOut era))
forall era. TxBodyRaw era -> StrictSeq (Sized (TxOut era))
_outputs TxBodyRaw era
m
instance HasField "sizedOutputs" (TxBody era) (StrictSeq (Sized (TxOut era))) where
getField :: TxBody era -> StrictSeq (Sized (TxOut era))
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> StrictSeq (Sized (TxOut era))
forall era. TxBodyRaw era -> StrictSeq (Sized (TxOut era))
_outputs TxBodyRaw era
m
instance Crypto era ~ crypto => HasField "certs" (TxBody era) (StrictSeq (DCert crypto)) where
getField :: TxBody era -> StrictSeq (DCert crypto)
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> StrictSeq (DCert (Crypto era))
forall era. TxBodyRaw era -> StrictSeq (DCert (Crypto era))
_certs TxBodyRaw era
m
instance Crypto era ~ crypto => HasField "wdrls" (TxBody era) (Wdrl crypto) where
getField :: TxBody era -> Wdrl crypto
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> Wdrl (Crypto era)
forall era. TxBodyRaw era -> Wdrl (Crypto era)
_wdrls TxBodyRaw era
m
instance HasField "txfee" (TxBody era) Coin where
getField :: TxBody era -> Coin
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> Coin
forall era. TxBodyRaw era -> Coin
_txfee TxBodyRaw era
m
instance HasField "update" (TxBody era) (StrictMaybe (Update era)) where
getField :: TxBody era -> StrictMaybe (Update era)
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> StrictMaybe (Update era)
forall era. TxBodyRaw era -> StrictMaybe (Update era)
_update TxBodyRaw era
m
instance
(Crypto era ~ c) =>
HasField "reqSignerHashes" (TxBody era) (Set (KeyHash 'Witness c))
where
getField :: TxBody era -> Set (KeyHash 'Witness c)
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> Set (KeyHash 'Witness (Crypto era))
forall era. TxBodyRaw era -> Set (KeyHash 'Witness (Crypto era))
_reqSignerHashes TxBodyRaw era
m
instance (Crypto era ~ c) => HasField "mint" (TxBody era) (Mary.Value c) where
getField :: TxBody era -> Value c
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> Value (Crypto era)
forall era. TxBodyRaw era -> Value (Crypto era)
_mint TxBodyRaw era
m
instance (Crypto era ~ c) => HasField "collateral" (TxBody era) (Set (TxIn c)) where
getField :: TxBody era -> Set (TxIn c)
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> Set (TxIn (Crypto era))
forall era. TxBodyRaw era -> Set (TxIn (Crypto era))
_collateralInputs TxBodyRaw era
m
instance (Crypto era ~ c) => HasField "referenceInputs" (TxBody era) (Set (TxIn c)) where
getField :: TxBody era -> Set (TxIn c)
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> Set (TxIn (Crypto era))
forall era. TxBodyRaw era -> Set (TxIn (Crypto era))
_referenceInputs TxBodyRaw era
m
instance HasField "collateralReturn" (TxBody era) (StrictMaybe (TxOut era)) where
getField :: TxBody era -> StrictMaybe (TxOut era)
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = Sized (TxOut era) -> TxOut era
forall a. Sized a -> a
sizedValue (Sized (TxOut era) -> TxOut era)
-> StrictMaybe (Sized (TxOut era)) -> StrictMaybe (TxOut era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TxBodyRaw era -> StrictMaybe (Sized (TxOut era))
forall era. TxBodyRaw era -> StrictMaybe (Sized (TxOut era))
_collateralReturn TxBodyRaw era
m
instance HasField "sizedCollateralReturn" (TxBody era) (StrictMaybe (Sized (TxOut era))) where
getField :: TxBody era -> StrictMaybe (Sized (TxOut era))
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> StrictMaybe (Sized (TxOut era))
forall era. TxBodyRaw era -> StrictMaybe (Sized (TxOut era))
_collateralReturn TxBodyRaw era
m
instance HasField "totalCollateral" (TxBody era) (StrictMaybe Coin) where
getField :: TxBody era -> StrictMaybe Coin
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> StrictMaybe Coin
forall era. TxBodyRaw era -> StrictMaybe Coin
_totalCollateral TxBodyRaw era
m
instance (Crypto era ~ c) => HasField "minted" (TxBody era) (Set (ScriptHash c)) where
getField :: TxBody era -> Set (ScriptHash c)
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = (PolicyID c -> ScriptHash c)
-> Set (PolicyID c) -> Set (ScriptHash c)
forall b a. Ord b => (a -> b) -> Set a -> Set b
Set.map PolicyID c -> ScriptHash c
forall crypto. PolicyID crypto -> ScriptHash crypto
policyID (Value c -> Set (PolicyID c)
forall crypto. Value crypto -> Set (PolicyID crypto)
policies (TxBodyRaw era -> Value (Crypto era)
forall era. TxBodyRaw era -> Value (Crypto era)
_mint TxBodyRaw era
m))
instance HasField "vldt" (TxBody era) ValidityInterval where
getField :: TxBody era -> ValidityInterval
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> ValidityInterval
forall era. TxBodyRaw era -> ValidityInterval
_vldt TxBodyRaw era
m
instance
c ~ Crypto era =>
HasField "adHash" (TxBody era) (StrictMaybe (AuxiliaryDataHash c))
where
getField :: TxBody era -> StrictMaybe (AuxiliaryDataHash c)
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> StrictMaybe (AuxiliaryDataHash (Crypto era))
forall era.
TxBodyRaw era -> StrictMaybe (AuxiliaryDataHash (Crypto era))
_adHash TxBodyRaw era
m
instance
c ~ Crypto era =>
HasField "scriptIntegrityHash" (TxBody era) (StrictMaybe (ScriptIntegrityHash c))
where
getField :: TxBody era -> StrictMaybe (ScriptIntegrityHash c)
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> StrictMaybe (ScriptIntegrityHash (Crypto era))
forall era.
TxBodyRaw era -> StrictMaybe (ScriptIntegrityHash (Crypto era))
_scriptIntegrityHash TxBodyRaw era
m
instance HasField "txnetworkid" (TxBody era) (StrictMaybe Network) where
getField :: TxBody era -> StrictMaybe Network
getField (TxBodyConstr (Memo TxBodyRaw era
m ShortByteString
_)) = TxBodyRaw era -> StrictMaybe Network
forall era. TxBodyRaw era -> StrictMaybe Network
_txnetworkid TxBodyRaw era
m
instance (Era era, Core.Value era ~ val, Compactible val) => HasField "value" (TxOut era) val where
getField :: TxOut era -> val
getField = \case
TxOutCompact' CompactAddr (Crypto era)
_ CompactForm (Value era)
cv -> CompactForm val -> val
forall a. Compactible a => CompactForm a -> a
fromCompact CompactForm val
CompactForm (Value era)
cv
TxOutCompactDH' CompactAddr (Crypto era)
_ CompactForm (Value era)
cv DataHash (Crypto era)
_ -> CompactForm val -> val
forall a. Compactible a => CompactForm a -> a
fromCompact CompactForm val
CompactForm (Value era)
cv
TxOutCompactDatum CompactAddr (Crypto era)
_ CompactForm (Value era)
cv BinaryData era
_ -> CompactForm val -> val
forall a. Compactible a => CompactForm a -> a
fromCompact CompactForm val
CompactForm (Value era)
cv
TxOutCompactRefScript CompactAddr (Crypto era)
_ CompactForm (Value era)
cv Datum era
_ Script era
_ -> CompactForm val -> val
forall a. Compactible a => CompactForm a -> a
fromCompact CompactForm val
CompactForm (Value era)
cv
TxOut_AddrHash28_AdaOnly Credential 'Staking (Crypto era)
_ Addr28Extra
_ CompactForm Coin
cc -> Coin -> val
forall t. Val t => Coin -> t
inject (CompactForm Coin -> Coin
forall a. Compactible a => CompactForm a -> a
fromCompact CompactForm Coin
cc)
TxOut_AddrHash28_AdaOnly_DataHash32 Credential 'Staking (Crypto era)
_ Addr28Extra
_ CompactForm Coin
cc DataHash32
_ -> Coin -> val
forall t. Val t => Coin -> t
inject (CompactForm Coin -> Coin
forall a. Compactible a => CompactForm a -> a
fromCompact CompactForm Coin
cc)
instance (Era era, c ~ Crypto era) => HasField "datahash" (TxOut era) (StrictMaybe (DataHash c)) where
getField :: TxOut era -> StrictMaybe (DataHash c)
getField = Maybe (DataHash c) -> StrictMaybe (DataHash c)
forall a. Maybe a -> StrictMaybe a
maybeToStrictMaybe (Maybe (DataHash c) -> StrictMaybe (DataHash c))
-> (TxOut era -> Maybe (DataHash c))
-> TxOut era
-> StrictMaybe (DataHash c)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxOut era -> Maybe (DataHash c)
forall era. Era era => TxOut era -> Maybe (DataHash (Crypto era))
txOutDataHash
instance (Era era, s ~ Core.Script era) => HasField "referenceScript" (TxOut era) (StrictMaybe s) where
getField :: TxOut era -> StrictMaybe s
getField = Maybe s -> StrictMaybe s
forall a. Maybe a -> StrictMaybe a
maybeToStrictMaybe (Maybe s -> StrictMaybe s)
-> (TxOut era -> Maybe s) -> TxOut era -> StrictMaybe s
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxOut era -> Maybe s
forall era. TxOut era -> Maybe (Script era)
txOutScript
getBabbageTxOutEitherAddr ::
HashAlgorithm (CC.ADDRHASH (Crypto era)) =>
TxOut era ->
Either (Addr (Crypto era)) (CompactAddr (Crypto era))
getBabbageTxOutEitherAddr :: TxOut era -> Either (Addr (Crypto era)) (CompactAddr (Crypto era))
getBabbageTxOutEitherAddr = \case
TxOutCompact' CompactAddr (Crypto era)
cAddr CompactForm (Value era)
_ -> CompactAddr (Crypto era)
-> Either (Addr (Crypto era)) (CompactAddr (Crypto era))
forall a b. b -> Either a b
Right CompactAddr (Crypto era)
cAddr
TxOutCompactDH' CompactAddr (Crypto era)
cAddr CompactForm (Value era)
_ DataHash (Crypto era)
_ -> CompactAddr (Crypto era)
-> Either (Addr (Crypto era)) (CompactAddr (Crypto era))
forall a b. b -> Either a b
Right CompactAddr (Crypto era)
cAddr
TxOutCompactRefScript CompactAddr (Crypto era)
cAddr CompactForm (Value era)
_ Datum era
_ Script era
_ -> CompactAddr (Crypto era)
-> Either (Addr (Crypto era)) (CompactAddr (Crypto era))
forall a b. b -> Either a b
Right CompactAddr (Crypto era)
cAddr
TxOutCompactDatum CompactAddr (Crypto era)
cAddr CompactForm (Value era)
_ BinaryData era
_ -> CompactAddr (Crypto era)
-> Either (Addr (Crypto era)) (CompactAddr (Crypto era))
forall a b. b -> Either a b
Right CompactAddr (Crypto era)
cAddr
TxOut_AddrHash28_AdaOnly Credential 'Staking (Crypto era)
stakeRef Addr28Extra
addr28Extra CompactForm Coin
_
| Just Addr (Crypto era)
addr <- Credential 'Staking (Crypto era)
-> Addr28Extra -> Maybe (Addr (Crypto era))
forall crypto.
HashAlgorithm (ADDRHASH crypto) =>
Credential 'Staking crypto -> Addr28Extra -> Maybe (Addr crypto)
decodeAddress28 Credential 'Staking (Crypto era)
stakeRef Addr28Extra
addr28Extra -> Addr (Crypto era)
-> Either (Addr (Crypto era)) (CompactAddr (Crypto era))
forall a b. a -> Either a b
Left Addr (Crypto era)
addr
| Bool
otherwise -> String -> Either (Addr (Crypto era)) (CompactAddr (Crypto era))
forall a. HasCallStack => String -> a
error String
"Impossible: Compacted an address of non-standard size"
TxOut_AddrHash28_AdaOnly_DataHash32 Credential 'Staking (Crypto era)
stakeRef Addr28Extra
addr28Extra CompactForm Coin
_ DataHash32
_
| Just Addr (Crypto era)
addr <- Credential 'Staking (Crypto era)
-> Addr28Extra -> Maybe (Addr (Crypto era))
forall crypto.
HashAlgorithm (ADDRHASH crypto) =>
Credential 'Staking crypto -> Addr28Extra -> Maybe (Addr crypto)
decodeAddress28 Credential 'Staking (Crypto era)
stakeRef Addr28Extra
addr28Extra -> Addr (Crypto era)
-> Either (Addr (Crypto era)) (CompactAddr (Crypto era))
forall a b. a -> Either a b
Left Addr (Crypto era)
addr
| Bool
otherwise -> String -> Either (Addr (Crypto era)) (CompactAddr (Crypto era))
forall a. HasCallStack => String -> a
error String
"Impossible: Compacted an address or a hash of non-standard size"
txOutData :: TxOut era -> Maybe (Data era)
txOutData :: TxOut era -> Maybe (Data era)
txOutData = \case
TxOutCompact' {} -> Maybe (Data era)
forall a. Maybe a
Nothing
TxOutCompactDH' {} -> Maybe (Data era)
forall a. Maybe a
Nothing
TxOutCompactDatum CompactAddr (Crypto era)
_ CompactForm (Value era)
_ BinaryData era
binaryData -> Data era -> Maybe (Data era)
forall a. a -> Maybe a
Just (Data era -> Maybe (Data era)) -> Data era -> Maybe (Data era)
forall a b. (a -> b) -> a -> b
$! BinaryData era -> Data era
forall era. BinaryData era -> Data era
binaryDataToData BinaryData era
binaryData
TxOutCompactRefScript CompactAddr (Crypto era)
_ CompactForm (Value era)
_ (Datum BinaryData era
binaryData) Script era
_ -> Data era -> Maybe (Data era)
forall a. a -> Maybe a
Just (Data era -> Maybe (Data era)) -> Data era -> Maybe (Data era)
forall a b. (a -> b) -> a -> b
$! BinaryData era -> Data era
forall era. BinaryData era -> Data era
binaryDataToData BinaryData era
binaryData
TxOutCompactRefScript CompactAddr (Crypto era)
_ CompactForm (Value era)
_ Datum era
_ Script era
_ -> Maybe (Data era)
forall a. Maybe a
Nothing
TxOut_AddrHash28_AdaOnly {} -> Maybe (Data era)
forall a. Maybe a
Nothing
TxOut_AddrHash28_AdaOnly_DataHash32 {} -> Maybe (Data era)
forall a. Maybe a
Nothing
txOutDataHash :: Era era => TxOut era -> Maybe (DataHash (Crypto era))
txOutDataHash :: TxOut era -> Maybe (DataHash (Crypto era))
txOutDataHash = \case
TxOutCompact' {} -> Maybe (DataHash (Crypto era))
forall a. Maybe a
Nothing
TxOutCompactDH' CompactAddr (Crypto era)
_ CompactForm (Value era)
_ DataHash (Crypto era)
dh -> DataHash (Crypto era) -> Maybe (DataHash (Crypto era))
forall a. a -> Maybe a
Just DataHash (Crypto era)
dh
TxOutCompactDatum CompactAddr (Crypto era)
_ CompactForm (Value era)
_ BinaryData era
_ -> Maybe (DataHash (Crypto era))
forall a. Maybe a
Nothing
TxOutCompactRefScript CompactAddr (Crypto era)
_ CompactForm (Value era)
_ Datum era
datum Script era
_ ->
case Datum era
datum of
Datum era
NoDatum -> Maybe (DataHash (Crypto era))
forall a. Maybe a
Nothing
DatumHash DataHash (Crypto era)
dh -> DataHash (Crypto era) -> Maybe (DataHash (Crypto era))
forall a. a -> Maybe a
Just DataHash (Crypto era)
dh
Datum BinaryData era
_d -> Maybe (DataHash (Crypto era))
forall a. Maybe a
Nothing
TxOut_AddrHash28_AdaOnly {} -> Maybe (DataHash (Crypto era))
forall a. Maybe a
Nothing
TxOut_AddrHash28_AdaOnly_DataHash32 Credential 'Staking (Crypto era)
_ Addr28Extra
_ CompactForm Coin
_ DataHash32
dataHash32 -> DataHash32 -> Maybe (DataHash (Crypto era))
forall crypto.
HashAlgorithm (HASH crypto) =>
DataHash32 -> Maybe (DataHash crypto)
decodeDataHash32 DataHash32
dataHash32
txOutScript :: TxOut era -> Maybe (Core.Script era)
txOutScript :: TxOut era -> Maybe (Script era)
txOutScript = \case
TxOutCompact' {} -> Maybe (Script era)
forall a. Maybe a
Nothing
TxOutCompactDH' {} -> Maybe (Script era)
forall a. Maybe a
Nothing
TxOutCompactDatum {} -> Maybe (Script era)
forall a. Maybe a
Nothing
TxOutCompactRefScript CompactAddr (Crypto era)
_ CompactForm (Value era)
_ Datum era
_ Script era
s -> Script era -> Maybe (Script era)
forall a. a -> Maybe a
Just Script era
s
TxOut_AddrHash28_AdaOnly {} -> Maybe (Script era)
forall a. Maybe a
Nothing
TxOut_AddrHash28_AdaOnly_DataHash32 {} -> Maybe (Script era)
forall a. Maybe a
Nothing