{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE UndecidableSuperClasses #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -Wno-orphans #-}
{-# OPTIONS_HADDOCK not-home #-}
module Cardano.Ledger.Conway.TxBody.Internal (
ConwayEraTxBody (..),
ConwayTxBody (
..,
ConwayTxBody,
ctbSpendInputs,
ctbCollateralInputs,
ctbReferenceInputs,
ctbOutputs,
ctbCollateralReturn,
ctbTotalCollateral,
ctbCerts,
ctbWithdrawals,
ctbTxfee,
ctbVldt,
ctbReqSignerHashes,
ctbMint,
ctbScriptIntegrityHash,
ctbAdHash,
ctbTxNetworkId,
ctbVotingProcedures,
ctbProposalProcedures,
ctbCurrentTreasuryValue,
ctbTreasuryDonation
),
ConwayTxBodyRaw (..),
conwayTotalDepositsTxBody,
conwayProposalsDeposits,
) where
import Cardano.Ledger.Alonzo.TxAuxData (AuxiliaryDataHash (..))
import Cardano.Ledger.Alonzo.TxBody (Indexable (..))
import Cardano.Ledger.Babbage.Core
import Cardano.Ledger.Babbage.TxBody (
BabbageTxBody (..),
allSizedOutputsBabbageTxBodyF,
babbageAllInputsTxBodyF,
babbageSpendableInputsTxBodyF,
)
import Cardano.Ledger.BaseTypes (Network, fromSMaybe, isSJust)
import Cardano.Ledger.Binary (
Annotator,
DecCBOR (..),
EncCBOR (..),
Sized (..),
ToCBOR (..),
mkSized,
)
import Cardano.Ledger.Binary.Coders (
Decode (..),
Density (..),
Encode (..),
Field (..),
Wrapped (..),
decode,
encode,
encodeKeyedStrictMaybe,
field,
fieldGuarded,
ofield,
(!>),
)
import Cardano.Ledger.Coin (Coin (..), decodePositiveCoin)
import Cardano.Ledger.Conway.Era (ConwayEra)
import Cardano.Ledger.Conway.Governance.Procedures (ProposalProcedure, VotingProcedures (..))
import Cardano.Ledger.Conway.PParams (ConwayEraPParams, ppGovActionDepositL)
import Cardano.Ledger.Conway.Scripts (ConwayEraScript, ConwayPlutusPurpose (..))
import Cardano.Ledger.Conway.TxCert (
ConwayEraTxCert,
ConwayTxCert (..),
ConwayTxCertUpgradeError,
)
import Cardano.Ledger.Conway.TxOut ()
import Cardano.Ledger.Crypto
import Cardano.Ledger.Keys (KeyHash (..), KeyRole (..))
import Cardano.Ledger.Mary.Value (
MaryValue (..),
MultiAsset (..),
PolicyID,
policies,
)
import Cardano.Ledger.MemoBytes (
EqRaw,
Mem,
MemoBytes (..),
MemoHashIndex,
Memoized (..),
getMemoRawType,
getMemoSafeHash,
lensMemoRawType,
mkMemoized,
)
import Cardano.Ledger.SafeHash (HashAnnotated (..), SafeToHash)
import Cardano.Ledger.TxIn (TxIn (..))
import Cardano.Ledger.Val (Val (..))
import Control.Arrow (left)
import Control.DeepSeq (NFData)
import Control.Monad (unless, when)
import Data.Maybe.Strict (StrictMaybe (..))
import qualified Data.OSet.Strict as OSet
import Data.Sequence.Strict (StrictSeq)
import Data.Set (Set)
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import Lens.Micro (Lens', to, (^.))
import NoThunks.Class (NoThunks)
instance Memoized ConwayTxBody where
type RawType ConwayTxBody = ConwayTxBodyRaw
data ConwayTxBodyRaw era = ConwayTxBodyRaw
{ forall era. ConwayTxBodyRaw era -> Set (TxIn (EraCrypto era))
ctbrSpendInputs :: !(Set (TxIn (EraCrypto era)))
, forall era. ConwayTxBodyRaw era -> Set (TxIn (EraCrypto era))
ctbrCollateralInputs :: !(Set (TxIn (EraCrypto era)))
, forall era. ConwayTxBodyRaw era -> Set (TxIn (EraCrypto era))
ctbrReferenceInputs :: !(Set (TxIn (EraCrypto era)))
, forall era. ConwayTxBodyRaw era -> StrictSeq (Sized (TxOut era))
ctbrOutputs :: !(StrictSeq (Sized (TxOut era)))
, forall era. ConwayTxBodyRaw era -> StrictMaybe (Sized (TxOut era))
ctbrCollateralReturn :: !(StrictMaybe (Sized (TxOut era)))
, forall era. ConwayTxBodyRaw era -> StrictMaybe Coin
ctbrTotalCollateral :: !(StrictMaybe Coin)
, forall era. ConwayTxBodyRaw era -> OSet (ConwayTxCert era)
ctbrCerts :: !(OSet.OSet (ConwayTxCert era))
, forall era. ConwayTxBodyRaw era -> Withdrawals (EraCrypto era)
ctbrWithdrawals :: !(Withdrawals (EraCrypto era))
, forall era. ConwayTxBodyRaw era -> Coin
ctbrTxfee :: !Coin
, forall era. ConwayTxBodyRaw era -> ValidityInterval
ctbrVldt :: !ValidityInterval
, forall era.
ConwayTxBodyRaw era -> Set (KeyHash 'Witness (EraCrypto era))
ctbrReqSignerHashes :: !(Set (KeyHash 'Witness (EraCrypto era)))
, forall era. ConwayTxBodyRaw era -> MultiAsset (EraCrypto era)
ctbrMint :: !(MultiAsset (EraCrypto era))
, forall era.
ConwayTxBodyRaw era
-> StrictMaybe (ScriptIntegrityHash (EraCrypto era))
ctbrScriptIntegrityHash :: !(StrictMaybe (ScriptIntegrityHash (EraCrypto era)))
, forall era.
ConwayTxBodyRaw era
-> StrictMaybe (AuxiliaryDataHash (EraCrypto era))
ctbrAuxDataHash :: !(StrictMaybe (AuxiliaryDataHash (EraCrypto era)))
, forall era. ConwayTxBodyRaw era -> StrictMaybe Network
ctbrTxNetworkId :: !(StrictMaybe Network)
, forall era. ConwayTxBodyRaw era -> VotingProcedures era
ctbrVotingProcedures :: !(VotingProcedures era)
, forall era. ConwayTxBodyRaw era -> OSet (ProposalProcedure era)
ctbrProposalProcedures :: !(OSet.OSet (ProposalProcedure era))
, forall era. ConwayTxBodyRaw era -> StrictMaybe Coin
ctbrCurrentTreasuryValue :: !(StrictMaybe Coin)
, forall era. ConwayTxBodyRaw era -> Coin
ctbrTreasuryDonation :: !Coin
}
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall era x. Rep (ConwayTxBodyRaw era) x -> ConwayTxBodyRaw era
forall era x. ConwayTxBodyRaw era -> Rep (ConwayTxBodyRaw era) x
$cto :: forall era x. Rep (ConwayTxBodyRaw era) x -> ConwayTxBodyRaw era
$cfrom :: forall era x. ConwayTxBodyRaw era -> Rep (ConwayTxBodyRaw era) x
Generic, Typeable)
deriving instance (EraPParams era, Eq (TxOut era)) => Eq (ConwayTxBodyRaw era)
instance
(EraPParams era, NoThunks (TxOut era)) =>
NoThunks (ConwayTxBodyRaw era)
instance
(EraPParams era, NFData (TxOut era)) =>
NFData (ConwayTxBodyRaw era)
deriving instance
(EraPParams era, Show (TxOut era)) =>
Show (ConwayTxBodyRaw era)
instance
( EraPParams era
, DecCBOR (TxOut era)
, ShelleyEraTxCert era
, TxCert era ~ ConwayTxCert era
) =>
DecCBOR (ConwayTxBodyRaw era)
where
decCBOR :: forall s. Decoder s (ConwayTxBodyRaw era)
decCBOR =
forall (w :: Wrapped) t s. Decode w t -> Decoder s t
decode forall a b. (a -> b) -> a -> b
$
forall t.
Typeable t =>
String
-> t
-> (Word -> Field t)
-> [(Word, String)]
-> Decode ('Closed 'Dense) t
SparseKeyed
String
"TxBodyRaw"
forall era. ConwayTxBodyRaw era
basicConwayTxBodyRaw
Word -> Field (ConwayTxBodyRaw era)
bodyFields
[(Word, String)]
requiredFields
where
bodyFields :: Word -> Field (ConwayTxBodyRaw era)
bodyFields :: Word -> Field (ConwayTxBodyRaw era)
bodyFields Word
0 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Set (TxIn (EraCrypto era))
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrSpendInputs :: Set (TxIn (EraCrypto era))
ctbrSpendInputs = Set (TxIn (EraCrypto era))
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
1 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\StrictSeq (Sized (TxOut era))
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrOutputs :: StrictSeq (Sized (TxOut era))
ctbrOutputs = StrictSeq (Sized (TxOut era))
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
2 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Coin
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrTxfee :: Coin
ctbrTxfee = Coin
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
3 =
forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield
(\StrictMaybe SlotNo
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrVldt :: ValidityInterval
ctbrVldt = (forall era. ConwayTxBodyRaw era -> ValidityInterval
ctbrVldt ConwayTxBodyRaw era
tx) {invalidHereafter :: StrictMaybe SlotNo
invalidHereafter = StrictMaybe SlotNo
x}})
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
4 =
forall x t (d :: Density).
String
-> (x -> Bool) -> (x -> t -> t) -> Decode ('Closed d) x -> Field t
fieldGuarded
(String -> ShowS
emptyFailure String
"Certificates" String
"non-empty")
forall a. OSet a -> Bool
OSet.null
(\OSet (ConwayTxCert era)
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrCerts :: OSet (ConwayTxCert era)
ctbrCerts = OSet (ConwayTxCert era)
x})
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
5 =
forall x t (d :: Density).
String
-> (x -> Bool) -> (x -> t -> t) -> Decode ('Closed d) x -> Field t
fieldGuarded
(String -> ShowS
emptyFailure String
"Withdrawals" String
"non-empty")
(forall (t :: * -> *) a. Foldable t => t a -> Bool
null forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c. Withdrawals c -> Map (RewardAccount c) Coin
unWithdrawals)
(\Withdrawals (EraCrypto era)
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrWithdrawals :: Withdrawals (EraCrypto era)
ctbrWithdrawals = Withdrawals (EraCrypto era)
x})
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
7 = forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield (\StrictMaybe (AuxiliaryDataHash (EraCrypto era))
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrAuxDataHash :: StrictMaybe (AuxiliaryDataHash (EraCrypto era))
ctbrAuxDataHash = StrictMaybe (AuxiliaryDataHash (EraCrypto era))
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
8 =
forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield
(\StrictMaybe SlotNo
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrVldt :: ValidityInterval
ctbrVldt = (forall era. ConwayTxBodyRaw era -> ValidityInterval
ctbrVldt ConwayTxBodyRaw era
tx) {invalidBefore :: StrictMaybe SlotNo
invalidBefore = StrictMaybe SlotNo
x}})
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
9 =
forall x t (d :: Density).
String
-> (x -> Bool) -> (x -> t -> t) -> Decode ('Closed d) x -> Field t
fieldGuarded
(String -> ShowS
emptyFailure String
"Mint" String
"non-empty")
(forall a. Eq a => a -> a -> Bool
== forall a. Monoid a => a
mempty)
(\MultiAsset (EraCrypto era)
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrMint :: MultiAsset (EraCrypto era)
ctbrMint = MultiAsset (EraCrypto era)
x})
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
11 = forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield (\StrictMaybe (ScriptIntegrityHash (EraCrypto era))
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrScriptIntegrityHash :: StrictMaybe (ScriptIntegrityHash (EraCrypto era))
ctbrScriptIntegrityHash = StrictMaybe (ScriptIntegrityHash (EraCrypto era))
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
13 =
forall x t (d :: Density).
String
-> (x -> Bool) -> (x -> t -> t) -> Decode ('Closed d) x -> Field t
fieldGuarded
(String -> ShowS
emptyFailure String
"Collateral Inputs" String
"non-empty")
forall (t :: * -> *) a. Foldable t => t a -> Bool
null
(\Set (TxIn (EraCrypto era))
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrCollateralInputs :: Set (TxIn (EraCrypto era))
ctbrCollateralInputs = Set (TxIn (EraCrypto era))
x})
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
14 =
forall x t (d :: Density).
String
-> (x -> Bool) -> (x -> t -> t) -> Decode ('Closed d) x -> Field t
fieldGuarded
(String -> ShowS
emptyFailure String
"Required Signer Hashes" String
"non-empty")
forall (t :: * -> *) a. Foldable t => t a -> Bool
null
(\Set (KeyHash 'Witness (EraCrypto era))
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrReqSignerHashes :: Set (KeyHash 'Witness (EraCrypto era))
ctbrReqSignerHashes = Set (KeyHash 'Witness (EraCrypto era))
x})
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
15 = forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield (\StrictMaybe Network
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrTxNetworkId :: StrictMaybe Network
ctbrTxNetworkId = StrictMaybe Network
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
16 = forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield (\StrictMaybe (Sized (TxOut era))
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrCollateralReturn :: StrictMaybe (Sized (TxOut era))
ctbrCollateralReturn = StrictMaybe (Sized (TxOut era))
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
17 = forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield (\StrictMaybe Coin
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrTotalCollateral :: StrictMaybe Coin
ctbrTotalCollateral = StrictMaybe Coin
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
18 =
forall x t (d :: Density).
String
-> (x -> Bool) -> (x -> t -> t) -> Decode ('Closed d) x -> Field t
fieldGuarded
(String -> ShowS
emptyFailure String
"Reference Inputs" String
"non-empty")
forall (t :: * -> *) a. Foldable t => t a -> Bool
null
(\Set (TxIn (EraCrypto era))
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrReferenceInputs :: Set (TxIn (EraCrypto era))
ctbrReferenceInputs = Set (TxIn (EraCrypto era))
x})
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
19 =
forall x t (d :: Density).
String
-> (x -> Bool) -> (x -> t -> t) -> Decode ('Closed d) x -> Field t
fieldGuarded
(String -> ShowS
emptyFailure String
"VotingProcedures" String
"non-empty")
(forall (t :: * -> *) a. Foldable t => t a -> Bool
null forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era.
VotingProcedures era
-> Map
(Voter (EraCrypto era))
(Map (GovActionId (EraCrypto era)) (VotingProcedure era))
unVotingProcedures)
(\VotingProcedures era
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrVotingProcedures :: VotingProcedures era
ctbrVotingProcedures = VotingProcedures era
x})
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
20 =
forall x t (d :: Density).
String
-> (x -> Bool) -> (x -> t -> t) -> Decode ('Closed d) x -> Field t
fieldGuarded
(String -> ShowS
emptyFailure String
"ProposalProcedures" String
"non-empty")
forall a. OSet a -> Bool
OSet.null
(\OSet (ProposalProcedure era)
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrProposalProcedures :: OSet (ProposalProcedure era)
ctbrProposalProcedures = OSet (ProposalProcedure era)
x})
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
21 = forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield (\StrictMaybe Coin
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrCurrentTreasuryValue :: StrictMaybe Coin
ctbrCurrentTreasuryValue = StrictMaybe Coin
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
bodyFields Word
22 =
forall x t (d :: Density).
(StrictMaybe x -> t -> t) -> Decode ('Closed d) x -> Field t
ofield
(\StrictMaybe Coin
x ConwayTxBodyRaw era
tx -> ConwayTxBodyRaw era
tx {ctbrTreasuryDonation :: Coin
ctbrTreasuryDonation = forall a. a -> StrictMaybe a -> a
fromSMaybe forall t. Val t => t
zero StrictMaybe Coin
x})
(forall t. (forall s. Decoder s t) -> Decode ('Closed 'Dense) t
D (forall s. String -> Decoder s Coin
decodePositiveCoin forall a b. (a -> b) -> a -> b
$ String -> ShowS
emptyFailure String
"Treasury Donation" String
"non-zero"))
bodyFields Word
n = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Any
_ ConwayTxBodyRaw era
t -> ConwayTxBodyRaw era
t) (forall (w :: Wrapped) t. Word -> Decode w t
Invalid Word
n)
requiredFields :: [(Word, String)]
requiredFields :: [(Word, String)]
requiredFields =
[ (Word
0, String
"inputs")
, (Word
1, String
"outputs")
, (Word
2, String
"fee")
]
emptyFailure :: String -> ShowS
emptyFailure String
fieldName String
requirement =
String
"TxBody: '" forall a. Semigroup a => a -> a -> a
<> String
fieldName forall a. Semigroup a => a -> a -> a
<> String
"' must be " forall a. Semigroup a => a -> a -> a
<> String
requirement forall a. Semigroup a => a -> a -> a
<> String
" when supplied"
newtype ConwayTxBody era = TxBodyConstr (MemoBytes ConwayTxBodyRaw era)
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall era x. Rep (ConwayTxBody era) x -> ConwayTxBody era
forall era x. ConwayTxBody era -> Rep (ConwayTxBody era) x
$cto :: forall era x. Rep (ConwayTxBody era) x -> ConwayTxBody era
$cfrom :: forall era x. ConwayTxBody era -> Rep (ConwayTxBody era) x
Generic, ConwayTxBody era -> Int
ConwayTxBody era -> ByteString
forall era. ConwayTxBody era -> Int
forall era. ConwayTxBody era -> ByteString
forall t.
(t -> ByteString)
-> (t -> Int)
-> (forall c index.
HashAlgorithm (HASH c) =>
Proxy c -> Proxy index -> t -> SafeHash c index)
-> SafeToHash t
forall c index.
HashAlgorithm (HASH c) =>
Proxy c -> Proxy index -> ConwayTxBody era -> SafeHash c index
forall era c index.
HashAlgorithm (HASH c) =>
Proxy c -> Proxy index -> ConwayTxBody era -> SafeHash c index
makeHashWithExplicitProxys :: forall c index.
HashAlgorithm (HASH c) =>
Proxy c -> Proxy index -> ConwayTxBody era -> SafeHash c index
$cmakeHashWithExplicitProxys :: forall era c index.
HashAlgorithm (HASH c) =>
Proxy c -> Proxy index -> ConwayTxBody era -> SafeHash c index
originalBytesSize :: ConwayTxBody era -> Int
$coriginalBytesSize :: forall era. ConwayTxBody era -> Int
originalBytes :: ConwayTxBody era -> ByteString
$coriginalBytes :: forall era. ConwayTxBody era -> ByteString
SafeToHash, ConwayTxBody era -> Encoding
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [ConwayTxBody era] -> Size
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (ConwayTxBody era) -> Size
forall {era}. Typeable era => Typeable (ConwayTxBody era)
forall era. Typeable era => ConwayTxBody 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 [ConwayTxBody era] -> Size
forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (ConwayTxBody era) -> Size
encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [ConwayTxBody era] -> Size
$cencodedListSizeExpr :: forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [ConwayTxBody era] -> Size
encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (ConwayTxBody era) -> Size
$cencodedSizeExpr :: forall era.
Typeable era =>
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy (ConwayTxBody era) -> Size
toCBOR :: ConwayTxBody era -> Encoding
$ctoCBOR :: forall era. Typeable era => ConwayTxBody era -> Encoding
ToCBOR)
deriving instance
(EraPParams era, NoThunks (TxOut era)) =>
NoThunks (ConwayTxBody era)
deriving instance
(EraPParams era, Eq (TxOut era)) =>
Eq (ConwayTxBody era)
deriving newtype instance
(EraPParams era, NFData (TxOut era)) =>
NFData (ConwayTxBody era)
deriving instance
(EraPParams era, Show (TxOut era)) =>
Show (ConwayTxBody era)
type instance MemoHashIndex ConwayTxBodyRaw = EraIndependentTxBody
instance c ~ EraCrypto era => HashAnnotated (ConwayTxBody era) EraIndependentTxBody c where
hashAnnotated :: HashAlgorithm (HASH c) =>
ConwayTxBody era -> SafeHash c EraIndependentTxBody
hashAnnotated = forall (t :: * -> *) era.
Memoized t =>
t era -> SafeHash (EraCrypto era) (MemoHashIndex (RawType t))
getMemoSafeHash
instance
( DecCBOR (TxOut era)
, EraPParams era
, ShelleyEraTxCert era
, TxCert era ~ ConwayTxCert era
) =>
DecCBOR (Annotator (ConwayTxBodyRaw era))
where
decCBOR :: forall s. Decoder s (Annotator (ConwayTxBodyRaw era))
decCBOR = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a s. DecCBOR a => Decoder s a
decCBOR
deriving via
(Mem ConwayTxBodyRaw era)
instance
( DecCBOR (TxOut era)
, EraPParams era
, ShelleyEraTxCert era
, TxCert era ~ ConwayTxCert era
) =>
DecCBOR (Annotator (ConwayTxBody era))
mkConwayTxBody :: ConwayEraTxBody era => ConwayTxBody era
mkConwayTxBody :: forall era. ConwayEraTxBody era => ConwayTxBody era
mkConwayTxBody = forall era (t :: * -> *).
(Era era, EncCBOR (RawType t era), Memoized t) =>
RawType t era -> t era
mkMemoized forall era. ConwayTxBodyRaw era
basicConwayTxBodyRaw
basicConwayTxBodyRaw :: ConwayTxBodyRaw era
basicConwayTxBodyRaw :: forall era. ConwayTxBodyRaw era
basicConwayTxBodyRaw =
forall era.
Set (TxIn (EraCrypto era))
-> Set (TxIn (EraCrypto era))
-> Set (TxIn (EraCrypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> OSet (ConwayTxCert era)
-> Withdrawals (EraCrypto era)
-> Coin
-> ValidityInterval
-> Set (KeyHash 'Witness (EraCrypto era))
-> MultiAsset (EraCrypto era)
-> StrictMaybe (ScriptIntegrityHash (EraCrypto era))
-> StrictMaybe (AuxiliaryDataHash (EraCrypto era))
-> StrictMaybe Network
-> VotingProcedures era
-> OSet (ProposalProcedure era)
-> StrictMaybe Coin
-> Coin
-> ConwayTxBodyRaw era
ConwayTxBodyRaw
forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty
forall a. StrictMaybe a
SNothing
forall a. StrictMaybe a
SNothing
forall a. OSet a
OSet.empty
(forall c. Map (RewardAccount c) Coin -> Withdrawals c
Withdrawals forall a. Monoid a => a
mempty)
forall a. Monoid a => a
mempty
(StrictMaybe SlotNo -> StrictMaybe SlotNo -> ValidityInterval
ValidityInterval forall a. StrictMaybe a
SNothing forall a. StrictMaybe a
SNothing)
forall a. Monoid a => a
mempty
forall a. Monoid a => a
mempty
forall a. StrictMaybe a
SNothing
forall a. StrictMaybe a
SNothing
forall a. StrictMaybe a
SNothing
(forall era.
Map
(Voter (EraCrypto era))
(Map (GovActionId (EraCrypto era)) (VotingProcedure era))
-> VotingProcedures era
VotingProcedures forall a. Monoid a => a
mempty)
forall a. OSet a
OSet.empty
forall a. StrictMaybe a
SNothing
forall a. Monoid a => a
mempty
data ConwayTxBodyUpgradeError c
= CTBUETxCert ConwayTxCertUpgradeError
|
CTBUEContainsUpdate
|
CTBUEContainsDuplicateCerts (Set (TxCert (ConwayEra c)))
deriving (ConwayTxBodyUpgradeError c -> ConwayTxBodyUpgradeError c -> Bool
forall c.
ConwayTxBodyUpgradeError c -> ConwayTxBodyUpgradeError c -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConwayTxBodyUpgradeError c -> ConwayTxBodyUpgradeError c -> Bool
$c/= :: forall c.
ConwayTxBodyUpgradeError c -> ConwayTxBodyUpgradeError c -> Bool
== :: ConwayTxBodyUpgradeError c -> ConwayTxBodyUpgradeError c -> Bool
$c== :: forall c.
ConwayTxBodyUpgradeError c -> ConwayTxBodyUpgradeError c -> Bool
Eq, Int -> ConwayTxBodyUpgradeError c -> ShowS
forall c. Int -> ConwayTxBodyUpgradeError c -> ShowS
forall c. [ConwayTxBodyUpgradeError c] -> ShowS
forall c. ConwayTxBodyUpgradeError c -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConwayTxBodyUpgradeError c] -> ShowS
$cshowList :: forall c. [ConwayTxBodyUpgradeError c] -> ShowS
show :: ConwayTxBodyUpgradeError c -> String
$cshow :: forall c. ConwayTxBodyUpgradeError c -> String
showsPrec :: Int -> ConwayTxBodyUpgradeError c -> ShowS
$cshowsPrec :: forall c. Int -> ConwayTxBodyUpgradeError c -> ShowS
Show)
instance Crypto c => EraTxBody (ConwayEra c) where
{-# SPECIALIZE instance EraTxBody (ConwayEra StandardCrypto) #-}
type TxBody (ConwayEra c) = ConwayTxBody (ConwayEra c)
type TxBodyUpgradeError (ConwayEra c) = ConwayTxBodyUpgradeError c
mkBasicTxBody :: TxBody (ConwayEra c)
mkBasicTxBody = forall era. ConwayEraTxBody era => ConwayTxBody era
mkConwayTxBody
inputsTxBodyL :: Lens' (TxBody (ConwayEra c)) (Set (TxIn (EraCrypto (ConwayEra c))))
inputsTxBodyL = forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era. ConwayTxBodyRaw era -> Set (TxIn (EraCrypto era))
ctbrSpendInputs (\RawType ConwayTxBody (ConwayEra c)
txb Set (TxIn c)
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrSpendInputs :: Set (TxIn (EraCrypto (ConwayEra c)))
ctbrSpendInputs = Set (TxIn c)
x})
{-# INLINE inputsTxBodyL #-}
outputsTxBodyL :: Lens' (TxBody (ConwayEra c)) (StrictSeq (TxOut (ConwayEra c)))
outputsTxBodyL =
forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType
(forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Sized a -> a
sizedValue forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era. ConwayTxBodyRaw era -> StrictSeq (Sized (TxOut era))
ctbrOutputs)
(\RawType ConwayTxBody (ConwayEra c)
txb StrictSeq (BabbageTxOut (ConwayEra c))
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrOutputs :: StrictSeq (Sized (TxOut (ConwayEra c)))
ctbrOutputs = forall a. EncCBOR a => Version -> a -> Sized a
mkSized (forall era. Era era => Version
eraProtVerLow @(ConwayEra c)) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> StrictSeq (BabbageTxOut (ConwayEra c))
x})
{-# INLINE outputsTxBodyL #-}
feeTxBodyL :: Lens' (TxBody (ConwayEra c)) Coin
feeTxBodyL = forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era. ConwayTxBodyRaw era -> Coin
ctbrTxfee (\RawType ConwayTxBody (ConwayEra c)
txb Coin
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrTxfee :: Coin
ctbrTxfee = Coin
x})
{-# INLINE feeTxBodyL #-}
auxDataHashTxBodyL :: Lens'
(TxBody (ConwayEra c))
(StrictMaybe (AuxiliaryDataHash (EraCrypto (ConwayEra c))))
auxDataHashTxBodyL = forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era.
ConwayTxBodyRaw era
-> StrictMaybe (AuxiliaryDataHash (EraCrypto era))
ctbrAuxDataHash (\RawType ConwayTxBody (ConwayEra c)
txb StrictMaybe (AuxiliaryDataHash c)
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrAuxDataHash :: StrictMaybe (AuxiliaryDataHash (EraCrypto (ConwayEra c)))
ctbrAuxDataHash = StrictMaybe (AuxiliaryDataHash c)
x})
{-# INLINE auxDataHashTxBodyL #-}
spendableInputsTxBodyF :: SimpleGetter
(TxBody (ConwayEra c)) (Set (TxIn (EraCrypto (ConwayEra c))))
spendableInputsTxBodyF = forall era.
BabbageEraTxBody era =>
SimpleGetter (TxBody era) (Set (TxIn (EraCrypto era)))
babbageSpendableInputsTxBodyF
{-# INLINE spendableInputsTxBodyF #-}
allInputsTxBodyF :: SimpleGetter
(TxBody (ConwayEra c)) (Set (TxIn (EraCrypto (ConwayEra c))))
allInputsTxBodyF = forall era.
BabbageEraTxBody era =>
SimpleGetter (TxBody era) (Set (TxIn (EraCrypto era)))
babbageAllInputsTxBodyF
{-# INLINE allInputsTxBodyF #-}
withdrawalsTxBodyL :: Lens'
(TxBody (ConwayEra c)) (Withdrawals (EraCrypto (ConwayEra c)))
withdrawalsTxBodyL = forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era. ConwayTxBodyRaw era -> Withdrawals (EraCrypto era)
ctbrWithdrawals (\RawType ConwayTxBody (ConwayEra c)
txb Withdrawals c
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrWithdrawals :: Withdrawals (EraCrypto (ConwayEra c))
ctbrWithdrawals = Withdrawals c
x})
{-# INLINE withdrawalsTxBodyL #-}
certsTxBodyL :: Lens' (TxBody (ConwayEra c)) (StrictSeq (TxCert (ConwayEra c)))
certsTxBodyL =
forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType (forall a. OSet a -> StrictSeq a
OSet.toStrictSeq forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era. ConwayTxBodyRaw era -> OSet (ConwayTxCert era)
ctbrCerts) (\RawType ConwayTxBody (ConwayEra c)
txb StrictSeq (ConwayTxCert (ConwayEra c))
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrCerts :: OSet (ConwayTxCert (ConwayEra c))
ctbrCerts = forall a. Ord a => StrictSeq a -> OSet a
OSet.fromStrictSeq StrictSeq (ConwayTxCert (ConwayEra c))
x})
{-# INLINE certsTxBodyL #-}
getTotalDepositsTxBody :: PParams (ConwayEra c)
-> (KeyHash 'StakePool (EraCrypto (ConwayEra c)) -> Bool)
-> TxBody (ConwayEra c)
-> Coin
getTotalDepositsTxBody = forall era.
ConwayEraTxBody era =>
PParams era
-> (KeyHash 'StakePool (EraCrypto era) -> Bool)
-> TxBody era
-> Coin
conwayTotalDepositsTxBody
getTotalRefundsTxBody :: PParams (ConwayEra c)
-> (Credential 'Staking (EraCrypto (ConwayEra c)) -> Maybe Coin)
-> (Credential 'DRepRole (EraCrypto (ConwayEra c)) -> Maybe Coin)
-> TxBody (ConwayEra c)
-> Coin
getTotalRefundsTxBody PParams (ConwayEra c)
pp Credential 'Staking (EraCrypto (ConwayEra c)) -> Maybe Coin
lookupStakingDeposit Credential 'DRepRole (EraCrypto (ConwayEra c)) -> Maybe Coin
lookupDRepDeposit TxBody (ConwayEra c)
txBody =
forall era (f :: * -> *).
(EraTxCert era, Foldable f) =>
PParams era
-> (Credential 'Staking (EraCrypto era) -> Maybe Coin)
-> (Credential 'DRepRole (EraCrypto era) -> Maybe Coin)
-> f (TxCert era)
-> Coin
getTotalRefundsTxCerts PParams (ConwayEra c)
pp Credential 'Staking (EraCrypto (ConwayEra c)) -> Maybe Coin
lookupStakingDeposit Credential 'DRepRole (EraCrypto (ConwayEra c)) -> Maybe Coin
lookupDRepDeposit (TxBody (ConwayEra c)
txBody forall s a. s -> Getting a s a -> a
^. forall era.
EraTxBody era =>
Lens' (TxBody era) (StrictSeq (TxCert era))
certsTxBodyL)
upgradeTxBody :: EraTxBody (PreviousEra (ConwayEra c)) =>
TxBody (PreviousEra (ConwayEra c))
-> Either (TxBodyUpgradeError (ConwayEra c)) (TxBody (ConwayEra c))
upgradeTxBody TxBody (PreviousEra (ConwayEra c))
btb = do
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (forall a. StrictMaybe a -> Bool
isSJust (forall era.
BabbageEraTxBody era =>
BabbageTxBody era -> StrictMaybe (Update era)
btbUpdate TxBody (PreviousEra (ConwayEra c))
btb)) forall a b. (a -> b) -> a -> b
$ forall a b. a -> Either a b
Left forall c. ConwayTxBodyUpgradeError c
CTBUEContainsUpdate
StrictSeq (ConwayTxCert (ConwayEra c))
certs <- forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse (forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
left forall c. ConwayTxCertUpgradeError -> ConwayTxBodyUpgradeError c
CTBUETxCert forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era.
(EraTxCert era, EraTxCert (PreviousEra era)) =>
TxCert (PreviousEra era)
-> Either (TxCertUpgradeError era) (TxCert era)
upgradeTxCert) (forall era.
BabbageEraTxBody era =>
BabbageTxBody era -> StrictSeq (TxCert era)
btbCerts TxBody (PreviousEra (ConwayEra c))
btb)
let (Set (ConwayTxCert (ConwayEra c))
duplicates, OSet (ConwayTxCert (ConwayEra c))
certsOSet) = forall a. Ord a => StrictSeq a -> (Set a, OSet a)
OSet.fromStrictSeqDuplicates StrictSeq (ConwayTxCert (ConwayEra c))
certs
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (forall (t :: * -> *) a. Foldable t => t a -> Bool
null Set (ConwayTxCert (ConwayEra c))
duplicates) forall a b. (a -> b) -> a -> b
$ forall a b. a -> Either a b
Left forall a b. (a -> b) -> a -> b
$ forall c. Set (TxCert (ConwayEra c)) -> ConwayTxBodyUpgradeError c
CTBUEContainsDuplicateCerts Set (ConwayTxCert (ConwayEra c))
duplicates
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$
ConwayTxBody
{ ctbSpendInputs :: Set (TxIn (EraCrypto (ConwayEra c)))
ctbSpendInputs = forall era.
BabbageEraTxBody era =>
BabbageTxBody era -> Set (TxIn (EraCrypto era))
btbInputs TxBody (PreviousEra (ConwayEra c))
btb
, ctbOutputs :: StrictSeq (Sized (TxOut (ConwayEra c)))
ctbOutputs =
forall a. EncCBOR a => Version -> a -> Sized a
mkSized (forall era. Era era => Version
eraProtVerLow @(ConwayEra c))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era.
(EraTxOut era, EraTxOut (PreviousEra era)) =>
TxOut (PreviousEra era) -> TxOut era
upgradeTxOut
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Sized a -> a
sizedValue
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall era.
BabbageEraTxBody era =>
BabbageTxBody era -> StrictSeq (Sized (TxOut era))
btbOutputs TxBody (PreviousEra (ConwayEra c))
btb
, ctbCerts :: OSet (ConwayTxCert (ConwayEra c))
ctbCerts = OSet (ConwayTxCert (ConwayEra c))
certsOSet
, ctbWithdrawals :: Withdrawals (EraCrypto (ConwayEra c))
ctbWithdrawals = forall era.
BabbageEraTxBody era =>
BabbageTxBody era -> Withdrawals (EraCrypto era)
btbWithdrawals TxBody (PreviousEra (ConwayEra c))
btb
, ctbTxfee :: Coin
ctbTxfee = forall era. BabbageEraTxBody era => BabbageTxBody era -> Coin
btbTxFee TxBody (PreviousEra (ConwayEra c))
btb
, ctbVldt :: ValidityInterval
ctbVldt = forall era.
BabbageEraTxBody era =>
BabbageTxBody era -> ValidityInterval
btbValidityInterval TxBody (PreviousEra (ConwayEra c))
btb
, ctbAdHash :: StrictMaybe (AuxiliaryDataHash (EraCrypto (ConwayEra c)))
ctbAdHash = forall era.
BabbageEraTxBody era =>
BabbageTxBody era
-> StrictMaybe (AuxiliaryDataHash (EraCrypto era))
btbAuxDataHash TxBody (PreviousEra (ConwayEra c))
btb
, ctbMint :: MultiAsset (EraCrypto (ConwayEra c))
ctbMint = forall era.
BabbageEraTxBody era =>
BabbageTxBody era -> MultiAsset (EraCrypto era)
btbMint TxBody (PreviousEra (ConwayEra c))
btb
, ctbCollateralInputs :: Set (TxIn (EraCrypto (ConwayEra c)))
ctbCollateralInputs = forall era.
BabbageEraTxBody era =>
BabbageTxBody era -> Set (TxIn (EraCrypto era))
btbCollateral TxBody (PreviousEra (ConwayEra c))
btb
, ctbReqSignerHashes :: Set (KeyHash 'Witness (EraCrypto (ConwayEra c)))
ctbReqSignerHashes = forall era.
BabbageEraTxBody era =>
BabbageTxBody era -> Set (KeyHash 'Witness (EraCrypto era))
btbReqSignerHashes TxBody (PreviousEra (ConwayEra c))
btb
, ctbScriptIntegrityHash :: StrictMaybe (ScriptIntegrityHash (EraCrypto (ConwayEra c)))
ctbScriptIntegrityHash = forall era.
BabbageEraTxBody era =>
BabbageTxBody era
-> StrictMaybe (ScriptIntegrityHash (EraCrypto era))
btbScriptIntegrityHash TxBody (PreviousEra (ConwayEra c))
btb
, ctbTxNetworkId :: StrictMaybe Network
ctbTxNetworkId = forall era.
BabbageEraTxBody era =>
BabbageTxBody era -> StrictMaybe Network
btbTxNetworkId TxBody (PreviousEra (ConwayEra c))
btb
, ctbReferenceInputs :: Set (TxIn (EraCrypto (ConwayEra c)))
ctbReferenceInputs = forall era.
BabbageEraTxBody era =>
BabbageTxBody era -> Set (TxIn (EraCrypto era))
btbReferenceInputs TxBody (PreviousEra (ConwayEra c))
btb
, ctbCollateralReturn :: StrictMaybe (Sized (TxOut (ConwayEra c)))
ctbCollateralReturn =
forall a. EncCBOR a => Version -> a -> Sized a
mkSized (forall era. Era era => Version
eraProtVerLow @(ConwayEra c))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era.
(EraTxOut era, EraTxOut (PreviousEra era)) =>
TxOut (PreviousEra era) -> TxOut era
upgradeTxOut
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Sized a -> a
sizedValue
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall era.
BabbageEraTxBody era =>
BabbageTxBody era -> StrictMaybe (Sized (TxOut era))
btbCollateralReturn TxBody (PreviousEra (ConwayEra c))
btb
, ctbTotalCollateral :: StrictMaybe Coin
ctbTotalCollateral = forall era.
BabbageEraTxBody era =>
BabbageTxBody era -> StrictMaybe Coin
btbTotalCollateral TxBody (PreviousEra (ConwayEra c))
btb
, ctbCurrentTreasuryValue :: StrictMaybe Coin
ctbCurrentTreasuryValue = forall a. StrictMaybe a
SNothing
, ctbProposalProcedures :: OSet (ProposalProcedure (ConwayEra c))
ctbProposalProcedures = forall a. OSet a
OSet.empty
, ctbVotingProcedures :: VotingProcedures (ConwayEra c)
ctbVotingProcedures = forall era.
Map
(Voter (EraCrypto era))
(Map (GovActionId (EraCrypto era)) (VotingProcedure era))
-> VotingProcedures era
VotingProcedures forall a. Monoid a => a
mempty
, ctbTreasuryDonation :: Coin
ctbTreasuryDonation = Integer -> Coin
Coin Integer
0
}
conwayTotalDepositsTxBody ::
ConwayEraTxBody era =>
PParams era ->
(KeyHash 'StakePool (EraCrypto era) -> Bool) ->
TxBody era ->
Coin
conwayTotalDepositsTxBody :: forall era.
ConwayEraTxBody era =>
PParams era
-> (KeyHash 'StakePool (EraCrypto era) -> Bool)
-> TxBody era
-> Coin
conwayTotalDepositsTxBody PParams era
pp KeyHash 'StakePool (EraCrypto era) -> Bool
isPoolRegisted TxBody era
txBody =
forall era (f :: * -> *).
(EraTxCert era, Foldable f) =>
PParams era
-> (KeyHash 'StakePool (EraCrypto era) -> Bool)
-> f (TxCert era)
-> Coin
getTotalDepositsTxCerts PParams era
pp KeyHash 'StakePool (EraCrypto era) -> Bool
isPoolRegisted (TxBody era
txBody forall s a. s -> Getting a s a -> a
^. forall era.
EraTxBody era =>
Lens' (TxBody era) (StrictSeq (TxCert era))
certsTxBodyL)
forall t. Val t => t -> t -> t
<+> forall era.
ConwayEraTxBody era =>
PParams era -> TxBody era -> Coin
conwayProposalsDeposits PParams era
pp TxBody era
txBody
conwayProposalsDeposits ::
ConwayEraTxBody era =>
PParams era ->
TxBody era ->
Coin
conwayProposalsDeposits :: forall era.
ConwayEraTxBody era =>
PParams era -> TxBody era -> Coin
conwayProposalsDeposits PParams era
pp TxBody era
txBody = Int
numProposals forall t i. (Val t, Integral i) => i -> t -> t
<×> Coin
depositPerProposal
where
numProposals :: Int
numProposals = forall (t :: * -> *) a. Foldable t => t a -> Int
length (TxBody era
txBody forall s a. s -> Getting a s a -> a
^. forall era.
ConwayEraTxBody era =>
Lens' (TxBody era) (OSet (ProposalProcedure era))
proposalProceduresTxBodyL)
depositPerProposal :: Coin
depositPerProposal = PParams era
pp forall s a. s -> Getting a s a -> a
^. forall era. ConwayEraPParams era => Lens' (PParams era) Coin
ppGovActionDepositL
instance Crypto c => AllegraEraTxBody (ConwayEra c) where
{-# SPECIALIZE instance AllegraEraTxBody (ConwayEra StandardCrypto) #-}
vldtTxBodyL :: Lens' (TxBody (ConwayEra c)) ValidityInterval
vldtTxBodyL = forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era. ConwayTxBodyRaw era -> ValidityInterval
ctbrVldt (\RawType ConwayTxBody (ConwayEra c)
txb ValidityInterval
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrVldt :: ValidityInterval
ctbrVldt = ValidityInterval
x})
{-# INLINE vldtTxBodyL #-}
instance Crypto c => MaryEraTxBody (ConwayEra c) where
{-# SPECIALIZE instance MaryEraTxBody (ConwayEra StandardCrypto) #-}
mintTxBodyL :: Lens' (TxBody (ConwayEra c)) (MultiAsset (EraCrypto (ConwayEra c)))
mintTxBodyL = forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era. ConwayTxBodyRaw era -> MultiAsset (EraCrypto era)
ctbrMint (\RawType ConwayTxBody (ConwayEra c)
txb MultiAsset c
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrMint :: MultiAsset (EraCrypto (ConwayEra c))
ctbrMint = MultiAsset c
x})
{-# INLINE mintTxBodyL #-}
mintValueTxBodyF :: SimpleGetter (TxBody (ConwayEra c)) (Value (ConwayEra c))
mintValueTxBodyF = forall era.
MaryEraTxBody era =>
Lens' (TxBody era) (MultiAsset (EraCrypto era))
mintTxBodyL forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s a. (s -> a) -> SimpleGetter s a
to (forall c. Coin -> MultiAsset c -> MaryValue c
MaryValue forall a. Monoid a => a
mempty)
mintedTxBodyF :: SimpleGetter
(TxBody (ConwayEra c)) (Set (PolicyID (EraCrypto (ConwayEra c))))
mintedTxBodyF =
forall s a. (s -> a) -> SimpleGetter s a
to (\(TxBodyConstr (Memo ConwayTxBodyRaw (ConwayEra c)
txBodyRaw ShortByteString
_)) -> forall c. MultiAsset c -> Set (PolicyID c)
policies (forall era. ConwayTxBodyRaw era -> MultiAsset (EraCrypto era)
ctbrMint ConwayTxBodyRaw (ConwayEra c)
txBodyRaw))
{-# INLINE mintedTxBodyF #-}
instance Crypto c => AlonzoEraTxBody (ConwayEra c) where
{-# SPECIALIZE instance AlonzoEraTxBody (ConwayEra StandardCrypto) #-}
collateralInputsTxBodyL :: Lens' (TxBody (ConwayEra c)) (Set (TxIn (EraCrypto (ConwayEra c))))
collateralInputsTxBodyL =
forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era. ConwayTxBodyRaw era -> Set (TxIn (EraCrypto era))
ctbrCollateralInputs (\RawType ConwayTxBody (ConwayEra c)
txb Set (TxIn c)
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrCollateralInputs :: Set (TxIn (EraCrypto (ConwayEra c)))
ctbrCollateralInputs = Set (TxIn c)
x})
{-# INLINE collateralInputsTxBodyL #-}
reqSignerHashesTxBodyL :: Lens'
(TxBody (ConwayEra c))
(Set (KeyHash 'Witness (EraCrypto (ConwayEra c))))
reqSignerHashesTxBodyL =
forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era.
ConwayTxBodyRaw era -> Set (KeyHash 'Witness (EraCrypto era))
ctbrReqSignerHashes (\RawType ConwayTxBody (ConwayEra c)
txb Set (KeyHash 'Witness c)
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrReqSignerHashes :: Set (KeyHash 'Witness (EraCrypto (ConwayEra c)))
ctbrReqSignerHashes = Set (KeyHash 'Witness c)
x})
{-# INLINE reqSignerHashesTxBodyL #-}
scriptIntegrityHashTxBodyL :: Lens'
(TxBody (ConwayEra c))
(StrictMaybe (ScriptIntegrityHash (EraCrypto (ConwayEra c))))
scriptIntegrityHashTxBodyL =
forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era.
ConwayTxBodyRaw era
-> StrictMaybe (ScriptIntegrityHash (EraCrypto era))
ctbrScriptIntegrityHash (\RawType ConwayTxBody (ConwayEra c)
txb StrictMaybe (ScriptIntegrityHash c)
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrScriptIntegrityHash :: StrictMaybe (ScriptIntegrityHash (EraCrypto (ConwayEra c)))
ctbrScriptIntegrityHash = StrictMaybe (ScriptIntegrityHash c)
x})
{-# INLINE scriptIntegrityHashTxBodyL #-}
networkIdTxBodyL :: Lens' (TxBody (ConwayEra c)) (StrictMaybe Network)
networkIdTxBodyL = forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era. ConwayTxBodyRaw era -> StrictMaybe Network
ctbrTxNetworkId (\RawType ConwayTxBody (ConwayEra c)
txb StrictMaybe Network
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrTxNetworkId :: StrictMaybe Network
ctbrTxNetworkId = StrictMaybe Network
x})
{-# INLINE networkIdTxBodyL #-}
redeemerPointer :: TxBody (ConwayEra c)
-> PlutusPurpose AsItem (ConwayEra c)
-> StrictMaybe (PlutusPurpose AsIx (ConwayEra c))
redeemerPointer = forall era.
ConwayEraTxBody era =>
TxBody era
-> ConwayPlutusPurpose AsItem era
-> StrictMaybe (ConwayPlutusPurpose AsIx era)
conwayRedeemerPointer
redeemerPointerInverse :: TxBody (ConwayEra c)
-> PlutusPurpose AsIx (ConwayEra c)
-> StrictMaybe (PlutusPurpose AsIxItem (ConwayEra c))
redeemerPointerInverse = forall era.
ConwayEraTxBody era =>
TxBody era
-> ConwayPlutusPurpose AsIx era
-> StrictMaybe (ConwayPlutusPurpose AsIxItem era)
conwayRedeemerPointerInverse
instance Crypto c => BabbageEraTxBody (ConwayEra c) where
{-# SPECIALIZE instance BabbageEraTxBody (ConwayEra StandardCrypto) #-}
sizedOutputsTxBodyL :: Lens'
(TxBody (ConwayEra c)) (StrictSeq (Sized (TxOut (ConwayEra c))))
sizedOutputsTxBodyL = forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era. ConwayTxBodyRaw era -> StrictSeq (Sized (TxOut era))
ctbrOutputs (\RawType ConwayTxBody (ConwayEra c)
txb StrictSeq (Sized (BabbageTxOut (ConwayEra c)))
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrOutputs :: StrictSeq (Sized (TxOut (ConwayEra c)))
ctbrOutputs = StrictSeq (Sized (BabbageTxOut (ConwayEra c)))
x})
{-# INLINE sizedOutputsTxBodyL #-}
referenceInputsTxBodyL :: Lens' (TxBody (ConwayEra c)) (Set (TxIn (EraCrypto (ConwayEra c))))
referenceInputsTxBodyL =
forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era. ConwayTxBodyRaw era -> Set (TxIn (EraCrypto era))
ctbrReferenceInputs (\RawType ConwayTxBody (ConwayEra c)
txb Set (TxIn c)
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrReferenceInputs :: Set (TxIn (EraCrypto (ConwayEra c)))
ctbrReferenceInputs = Set (TxIn c)
x})
{-# INLINE referenceInputsTxBodyL #-}
totalCollateralTxBodyL :: Lens' (TxBody (ConwayEra c)) (StrictMaybe Coin)
totalCollateralTxBodyL =
forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era. ConwayTxBodyRaw era -> StrictMaybe Coin
ctbrTotalCollateral (\RawType ConwayTxBody (ConwayEra c)
txb StrictMaybe Coin
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrTotalCollateral :: StrictMaybe Coin
ctbrTotalCollateral = StrictMaybe Coin
x})
{-# INLINE totalCollateralTxBodyL #-}
collateralReturnTxBodyL :: Lens' (TxBody (ConwayEra c)) (StrictMaybe (TxOut (ConwayEra c)))
collateralReturnTxBodyL =
forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType
(forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Sized a -> a
sizedValue forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era. ConwayTxBodyRaw era -> StrictMaybe (Sized (TxOut era))
ctbrCollateralReturn)
(\RawType ConwayTxBody (ConwayEra c)
txb StrictMaybe (BabbageTxOut (ConwayEra c))
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrCollateralReturn :: StrictMaybe (Sized (TxOut (ConwayEra c)))
ctbrCollateralReturn = forall a. EncCBOR a => Version -> a -> Sized a
mkSized (forall era. Era era => Version
eraProtVerLow @(ConwayEra c)) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> StrictMaybe (BabbageTxOut (ConwayEra c))
x})
{-# INLINE collateralReturnTxBodyL #-}
sizedCollateralReturnTxBodyL :: Lens'
(TxBody (ConwayEra c)) (StrictMaybe (Sized (TxOut (ConwayEra c))))
sizedCollateralReturnTxBodyL =
forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era. ConwayTxBodyRaw era -> StrictMaybe (Sized (TxOut era))
ctbrCollateralReturn (\RawType ConwayTxBody (ConwayEra c)
txb StrictMaybe (Sized (BabbageTxOut (ConwayEra c)))
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrCollateralReturn :: StrictMaybe (Sized (TxOut (ConwayEra c)))
ctbrCollateralReturn = StrictMaybe (Sized (BabbageTxOut (ConwayEra c)))
x})
{-# INLINE sizedCollateralReturnTxBodyL #-}
allSizedOutputsTxBodyF :: SimpleGetter
(TxBody (ConwayEra c)) (StrictSeq (Sized (TxOut (ConwayEra c))))
allSizedOutputsTxBodyF = forall era.
BabbageEraTxBody era =>
SimpleGetter (TxBody era) (StrictSeq (Sized (TxOut era)))
allSizedOutputsBabbageTxBodyF
{-# INLINE allSizedOutputsTxBodyF #-}
instance Crypto c => ConwayEraTxBody (ConwayEra c) where
votingProceduresTxBodyL :: Lens' (TxBody (ConwayEra c)) (VotingProcedures (ConwayEra c))
votingProceduresTxBodyL =
forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era. ConwayTxBodyRaw era -> VotingProcedures era
ctbrVotingProcedures (\RawType ConwayTxBody (ConwayEra c)
txb VotingProcedures (ConwayEra c)
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrVotingProcedures :: VotingProcedures (ConwayEra c)
ctbrVotingProcedures = VotingProcedures (ConwayEra c)
x})
{-# INLINE votingProceduresTxBodyL #-}
proposalProceduresTxBodyL :: Lens'
(TxBody (ConwayEra c)) (OSet (ProposalProcedure (ConwayEra c)))
proposalProceduresTxBodyL =
forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era. ConwayTxBodyRaw era -> OSet (ProposalProcedure era)
ctbrProposalProcedures (\RawType ConwayTxBody (ConwayEra c)
txb OSet (ProposalProcedure (ConwayEra c))
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrProposalProcedures :: OSet (ProposalProcedure (ConwayEra c))
ctbrProposalProcedures = OSet (ProposalProcedure (ConwayEra c))
x})
{-# INLINE proposalProceduresTxBodyL #-}
currentTreasuryValueTxBodyL :: Lens' (TxBody (ConwayEra c)) (StrictMaybe Coin)
currentTreasuryValueTxBodyL =
forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era. ConwayTxBodyRaw era -> StrictMaybe Coin
ctbrCurrentTreasuryValue (\RawType ConwayTxBody (ConwayEra c)
txb StrictMaybe Coin
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrCurrentTreasuryValue :: StrictMaybe Coin
ctbrCurrentTreasuryValue = StrictMaybe Coin
x})
{-# INLINE currentTreasuryValueTxBodyL #-}
treasuryDonationTxBodyL :: Lens' (TxBody (ConwayEra c)) Coin
treasuryDonationTxBodyL =
forall era (t :: * -> *) a b.
(Era era, EncCBOR (RawType t era), Memoized t) =>
(RawType t era -> a)
-> (RawType t era -> b -> RawType t era)
-> Lens (t era) (t era) a b
lensMemoRawType forall era. ConwayTxBodyRaw era -> Coin
ctbrTreasuryDonation (\RawType ConwayTxBody (ConwayEra c)
txb Coin
x -> RawType ConwayTxBody (ConwayEra c)
txb {ctbrTreasuryDonation :: Coin
ctbrTreasuryDonation = Coin
x})
{-# INLINE treasuryDonationTxBodyL #-}
instance
(EraPParams era, Eq (TxOut era), Eq (TxCert era)) =>
EqRaw (ConwayTxBody era)
pattern ConwayTxBody ::
ConwayEraTxBody era =>
Set (TxIn (EraCrypto era)) ->
Set (TxIn (EraCrypto era)) ->
Set (TxIn (EraCrypto era)) ->
StrictSeq (Sized (TxOut era)) ->
StrictMaybe (Sized (TxOut era)) ->
StrictMaybe Coin ->
OSet.OSet (ConwayTxCert era) ->
Withdrawals (EraCrypto era) ->
Coin ->
ValidityInterval ->
Set (KeyHash 'Witness (EraCrypto era)) ->
MultiAsset (EraCrypto era) ->
StrictMaybe (ScriptIntegrityHash (EraCrypto era)) ->
StrictMaybe (AuxiliaryDataHash (EraCrypto era)) ->
StrictMaybe Network ->
VotingProcedures era ->
OSet.OSet (ProposalProcedure era) ->
StrictMaybe Coin ->
Coin ->
ConwayTxBody era
pattern $bConwayTxBody :: forall era.
ConwayEraTxBody era =>
Set (TxIn (EraCrypto era))
-> Set (TxIn (EraCrypto era))
-> Set (TxIn (EraCrypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> OSet (ConwayTxCert era)
-> Withdrawals (EraCrypto era)
-> Coin
-> ValidityInterval
-> Set (KeyHash 'Witness (EraCrypto era))
-> MultiAsset (EraCrypto era)
-> StrictMaybe (ScriptIntegrityHash (EraCrypto era))
-> StrictMaybe (AuxiliaryDataHash (EraCrypto era))
-> StrictMaybe Network
-> VotingProcedures era
-> OSet (ProposalProcedure era)
-> StrictMaybe Coin
-> Coin
-> ConwayTxBody era
$mConwayTxBody :: forall {r} {era}.
ConwayEraTxBody era =>
ConwayTxBody era
-> (Set (TxIn (EraCrypto era))
-> Set (TxIn (EraCrypto era))
-> Set (TxIn (EraCrypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> OSet (ConwayTxCert era)
-> Withdrawals (EraCrypto era)
-> Coin
-> ValidityInterval
-> Set (KeyHash 'Witness (EraCrypto era))
-> MultiAsset (EraCrypto era)
-> StrictMaybe (ScriptIntegrityHash (EraCrypto era))
-> StrictMaybe (AuxiliaryDataHash (EraCrypto era))
-> StrictMaybe Network
-> VotingProcedures era
-> OSet (ProposalProcedure era)
-> StrictMaybe Coin
-> Coin
-> r)
-> ((# #) -> r)
-> r
ConwayTxBody
{ forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> Set (TxIn (EraCrypto era))
ctbSpendInputs
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> Set (TxIn (EraCrypto era))
ctbCollateralInputs
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> Set (TxIn (EraCrypto era))
ctbReferenceInputs
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> StrictSeq (Sized (TxOut era))
ctbOutputs
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> StrictMaybe (Sized (TxOut era))
ctbCollateralReturn
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> StrictMaybe Coin
ctbTotalCollateral
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> OSet (ConwayTxCert era)
ctbCerts
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> Withdrawals (EraCrypto era)
ctbWithdrawals
, forall era. ConwayEraTxBody era => ConwayTxBody era -> Coin
ctbTxfee
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> ValidityInterval
ctbVldt
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> Set (KeyHash 'Witness (EraCrypto era))
ctbReqSignerHashes
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> MultiAsset (EraCrypto era)
ctbMint
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era
-> StrictMaybe (ScriptIntegrityHash (EraCrypto era))
ctbScriptIntegrityHash
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> StrictMaybe (AuxiliaryDataHash (EraCrypto era))
ctbAdHash
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> StrictMaybe Network
ctbTxNetworkId
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> VotingProcedures era
ctbVotingProcedures
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> OSet (ProposalProcedure era)
ctbProposalProcedures
, forall era.
ConwayEraTxBody era =>
ConwayTxBody era -> StrictMaybe Coin
ctbCurrentTreasuryValue
, forall era. ConwayEraTxBody era => ConwayTxBody era -> Coin
ctbTreasuryDonation
} <-
( getMemoRawType ->
ConwayTxBodyRaw
{ ctbrSpendInputs = ctbSpendInputs
, ctbrCollateralInputs = ctbCollateralInputs
, ctbrReferenceInputs = ctbReferenceInputs
, ctbrOutputs = ctbOutputs
, ctbrCollateralReturn = ctbCollateralReturn
, ctbrTotalCollateral = ctbTotalCollateral
, ctbrCerts = ctbCerts
, ctbrWithdrawals = ctbWithdrawals
, ctbrTxfee = ctbTxfee
, ctbrVldt = ctbVldt
, ctbrReqSignerHashes = ctbReqSignerHashes
, ctbrMint = ctbMint
, ctbrScriptIntegrityHash = ctbScriptIntegrityHash
, ctbrAuxDataHash = ctbAdHash
, ctbrTxNetworkId = ctbTxNetworkId
, ctbrVotingProcedures = ctbVotingProcedures
, ctbrProposalProcedures = ctbProposalProcedures
, ctbrCurrentTreasuryValue = ctbCurrentTreasuryValue
, ctbrTreasuryDonation = ctbTreasuryDonation
}
)
where
ConwayTxBody
Set (TxIn (EraCrypto era))
inputsX
Set (TxIn (EraCrypto era))
collateralX
Set (TxIn (EraCrypto era))
referenceInputsX
StrictSeq (Sized (TxOut era))
outputsX
StrictMaybe (Sized (TxOut era))
collateralReturnX
StrictMaybe Coin
totalCollateralX
OSet (ConwayTxCert era)
certsX
Withdrawals (EraCrypto era)
withdrawalsX
Coin
txfeeX
ValidityInterval
vldtX
Set (KeyHash 'Witness (EraCrypto era))
reqSignerHashesX
MultiAsset (EraCrypto era)
mintX
StrictMaybe (ScriptIntegrityHash (EraCrypto era))
scriptIntegrityHashX
StrictMaybe (AuxiliaryDataHash (EraCrypto era))
adHashX
StrictMaybe Network
txnetworkidX
VotingProcedures era
votingProcedures
OSet (ProposalProcedure era)
proposalProcedures
StrictMaybe Coin
currentTreasuryValue
Coin
treasuryDonation =
forall era (t :: * -> *).
(Era era, EncCBOR (RawType t era), Memoized t) =>
RawType t era -> t era
mkMemoized forall a b. (a -> b) -> a -> b
$
forall era.
Set (TxIn (EraCrypto era))
-> Set (TxIn (EraCrypto era))
-> Set (TxIn (EraCrypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> OSet (ConwayTxCert era)
-> Withdrawals (EraCrypto era)
-> Coin
-> ValidityInterval
-> Set (KeyHash 'Witness (EraCrypto era))
-> MultiAsset (EraCrypto era)
-> StrictMaybe (ScriptIntegrityHash (EraCrypto era))
-> StrictMaybe (AuxiliaryDataHash (EraCrypto era))
-> StrictMaybe Network
-> VotingProcedures era
-> OSet (ProposalProcedure era)
-> StrictMaybe Coin
-> Coin
-> ConwayTxBodyRaw era
ConwayTxBodyRaw
Set (TxIn (EraCrypto era))
inputsX
Set (TxIn (EraCrypto era))
collateralX
Set (TxIn (EraCrypto era))
referenceInputsX
StrictSeq (Sized (TxOut era))
outputsX
StrictMaybe (Sized (TxOut era))
collateralReturnX
StrictMaybe Coin
totalCollateralX
OSet (ConwayTxCert era)
certsX
Withdrawals (EraCrypto era)
withdrawalsX
Coin
txfeeX
ValidityInterval
vldtX
Set (KeyHash 'Witness (EraCrypto era))
reqSignerHashesX
MultiAsset (EraCrypto era)
mintX
StrictMaybe (ScriptIntegrityHash (EraCrypto era))
scriptIntegrityHashX
StrictMaybe (AuxiliaryDataHash (EraCrypto era))
adHashX
StrictMaybe Network
txnetworkidX
VotingProcedures era
votingProcedures
OSet (ProposalProcedure era)
proposalProcedures
StrictMaybe Coin
currentTreasuryValue
Coin
treasuryDonation
{-# COMPLETE ConwayTxBody #-}
encodeTxBodyRaw ::
ConwayEraTxBody era =>
ConwayTxBodyRaw era ->
Encode ('Closed 'Sparse) (ConwayTxBodyRaw era)
encodeTxBodyRaw :: forall era.
ConwayEraTxBody era =>
ConwayTxBodyRaw era
-> Encode ('Closed 'Sparse) (ConwayTxBodyRaw era)
encodeTxBodyRaw ConwayTxBodyRaw {Set (TxIn (EraCrypto era))
Set (KeyHash 'Witness (EraCrypto era))
OSet (ProposalProcedure era)
OSet (ConwayTxCert era)
Withdrawals (EraCrypto era)
ValidityInterval
StrictMaybe (AuxiliaryDataHash (EraCrypto era))
StrictMaybe (Sized (TxOut era))
StrictMaybe Coin
StrictMaybe Network
StrictMaybe (ScriptIntegrityHash (EraCrypto era))
StrictSeq (Sized (TxOut era))
Coin
MultiAsset (EraCrypto era)
VotingProcedures era
ctbrTreasuryDonation :: Coin
ctbrCurrentTreasuryValue :: StrictMaybe Coin
ctbrProposalProcedures :: OSet (ProposalProcedure era)
ctbrVotingProcedures :: VotingProcedures era
ctbrTxNetworkId :: StrictMaybe Network
ctbrAuxDataHash :: StrictMaybe (AuxiliaryDataHash (EraCrypto era))
ctbrScriptIntegrityHash :: StrictMaybe (ScriptIntegrityHash (EraCrypto era))
ctbrMint :: MultiAsset (EraCrypto era)
ctbrReqSignerHashes :: Set (KeyHash 'Witness (EraCrypto era))
ctbrVldt :: ValidityInterval
ctbrTxfee :: Coin
ctbrWithdrawals :: Withdrawals (EraCrypto era)
ctbrCerts :: OSet (ConwayTxCert era)
ctbrTotalCollateral :: StrictMaybe Coin
ctbrCollateralReturn :: StrictMaybe (Sized (TxOut era))
ctbrOutputs :: StrictSeq (Sized (TxOut era))
ctbrReferenceInputs :: Set (TxIn (EraCrypto era))
ctbrCollateralInputs :: Set (TxIn (EraCrypto era))
ctbrSpendInputs :: Set (TxIn (EraCrypto era))
ctbrTreasuryDonation :: forall era. ConwayTxBodyRaw era -> Coin
ctbrCurrentTreasuryValue :: forall era. ConwayTxBodyRaw era -> StrictMaybe Coin
ctbrProposalProcedures :: forall era. ConwayTxBodyRaw era -> OSet (ProposalProcedure era)
ctbrVotingProcedures :: forall era. ConwayTxBodyRaw era -> VotingProcedures era
ctbrTxNetworkId :: forall era. ConwayTxBodyRaw era -> StrictMaybe Network
ctbrAuxDataHash :: forall era.
ConwayTxBodyRaw era
-> StrictMaybe (AuxiliaryDataHash (EraCrypto era))
ctbrScriptIntegrityHash :: forall era.
ConwayTxBodyRaw era
-> StrictMaybe (ScriptIntegrityHash (EraCrypto era))
ctbrMint :: forall era. ConwayTxBodyRaw era -> MultiAsset (EraCrypto era)
ctbrReqSignerHashes :: forall era.
ConwayTxBodyRaw era -> Set (KeyHash 'Witness (EraCrypto era))
ctbrVldt :: forall era. ConwayTxBodyRaw era -> ValidityInterval
ctbrTxfee :: forall era. ConwayTxBodyRaw era -> Coin
ctbrWithdrawals :: forall era. ConwayTxBodyRaw era -> Withdrawals (EraCrypto era)
ctbrCerts :: forall era. ConwayTxBodyRaw era -> OSet (ConwayTxCert era)
ctbrTotalCollateral :: forall era. ConwayTxBodyRaw era -> StrictMaybe Coin
ctbrCollateralReturn :: forall era. ConwayTxBodyRaw era -> StrictMaybe (Sized (TxOut era))
ctbrOutputs :: forall era. ConwayTxBodyRaw era -> StrictSeq (Sized (TxOut era))
ctbrReferenceInputs :: forall era. ConwayTxBodyRaw era -> Set (TxIn (EraCrypto era))
ctbrCollateralInputs :: forall era. ConwayTxBodyRaw era -> Set (TxIn (EraCrypto era))
ctbrSpendInputs :: forall era. ConwayTxBodyRaw era -> Set (TxIn (EraCrypto era))
..} =
let ValidityInterval StrictMaybe SlotNo
bot StrictMaybe SlotNo
top = ValidityInterval
ctbrVldt
in forall t. t -> Encode ('Closed 'Sparse) t
Keyed
( \Set (TxIn (EraCrypto era))
i Set (TxIn (EraCrypto era))
ci Set (TxIn (EraCrypto era))
ri StrictSeq (Sized (TxOut era))
o StrictMaybe (Sized (TxOut era))
cr StrictMaybe Coin
tc Coin
f StrictMaybe SlotNo
t OSet (ConwayTxCert era)
c Withdrawals (EraCrypto era)
w StrictMaybe SlotNo
b ->
forall era.
Set (TxIn (EraCrypto era))
-> Set (TxIn (EraCrypto era))
-> Set (TxIn (EraCrypto era))
-> StrictSeq (Sized (TxOut era))
-> StrictMaybe (Sized (TxOut era))
-> StrictMaybe Coin
-> OSet (ConwayTxCert era)
-> Withdrawals (EraCrypto era)
-> Coin
-> ValidityInterval
-> Set (KeyHash 'Witness (EraCrypto era))
-> MultiAsset (EraCrypto era)
-> StrictMaybe (ScriptIntegrityHash (EraCrypto era))
-> StrictMaybe (AuxiliaryDataHash (EraCrypto era))
-> StrictMaybe Network
-> VotingProcedures era
-> OSet (ProposalProcedure era)
-> StrictMaybe Coin
-> Coin
-> ConwayTxBodyRaw era
ConwayTxBodyRaw Set (TxIn (EraCrypto era))
i Set (TxIn (EraCrypto era))
ci Set (TxIn (EraCrypto era))
ri StrictSeq (Sized (TxOut era))
o StrictMaybe (Sized (TxOut era))
cr StrictMaybe Coin
tc OSet (ConwayTxCert era)
c Withdrawals (EraCrypto era)
w Coin
f (StrictMaybe SlotNo -> StrictMaybe SlotNo -> ValidityInterval
ValidityInterval StrictMaybe SlotNo
b StrictMaybe SlotNo
t)
)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
0 (forall t. EncCBOR t => t -> Encode ('Closed 'Dense) t
To Set (TxIn (EraCrypto era))
ctbrSpendInputs)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit forall (t :: * -> *) a. Foldable t => t a -> Bool
null (forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
13 (forall t. EncCBOR t => t -> Encode ('Closed 'Dense) t
To Set (TxIn (EraCrypto era))
ctbrCollateralInputs))
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit forall (t :: * -> *) a. Foldable t => t a -> Bool
null (forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
18 (forall t. EncCBOR t => t -> Encode ('Closed 'Dense) t
To Set (TxIn (EraCrypto era))
ctbrReferenceInputs))
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
1 (forall t. EncCBOR t => t -> Encode ('Closed 'Dense) t
To StrictSeq (Sized (TxOut era))
ctbrOutputs)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
EncCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
16 StrictMaybe (Sized (TxOut era))
ctbrCollateralReturn
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
EncCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
17 StrictMaybe Coin
ctbrTotalCollateral
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
2 (forall t. EncCBOR t => t -> Encode ('Closed 'Dense) t
To Coin
ctbrTxfee)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
EncCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
3 StrictMaybe SlotNo
top
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit forall a. OSet a -> Bool
OSet.null (forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
4 (forall t. EncCBOR t => t -> Encode ('Closed 'Dense) t
To OSet (ConwayTxCert era)
ctbrCerts))
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit (forall (t :: * -> *) a. Foldable t => t a -> Bool
null forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c. Withdrawals c -> Map (RewardAccount c) Coin
unWithdrawals) (forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
5 (forall t. EncCBOR t => t -> Encode ('Closed 'Dense) t
To Withdrawals (EraCrypto era)
ctbrWithdrawals))
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
EncCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
8 StrictMaybe SlotNo
bot
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit forall (t :: * -> *) a. Foldable t => t a -> Bool
null (forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
14 (forall t. EncCBOR t => t -> Encode ('Closed 'Dense) t
To Set (KeyHash 'Witness (EraCrypto era))
ctbrReqSignerHashes))
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit (forall a. Eq a => a -> a -> Bool
== forall a. Monoid a => a
mempty) (forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
9 (forall t. EncCBOR t => t -> Encode ('Closed 'Dense) t
To MultiAsset (EraCrypto era)
ctbrMint))
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
EncCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
11 StrictMaybe (ScriptIntegrityHash (EraCrypto era))
ctbrScriptIntegrityHash
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
EncCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
7 StrictMaybe (AuxiliaryDataHash (EraCrypto era))
ctbrAuxDataHash
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
EncCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
15 StrictMaybe Network
ctbrTxNetworkId
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit (forall (t :: * -> *) a. Foldable t => t a -> Bool
null forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era.
VotingProcedures era
-> Map
(Voter (EraCrypto era))
(Map (GovActionId (EraCrypto era)) (VotingProcedure era))
unVotingProcedures) (forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
19 (forall t. EncCBOR t => t -> Encode ('Closed 'Dense) t
To VotingProcedures era
ctbrVotingProcedures))
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit forall a. OSet a -> Bool
OSet.null (forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
20 (forall t. EncCBOR t => t -> Encode ('Closed 'Dense) t
To OSet (ProposalProcedure era)
ctbrProposalProcedures))
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
EncCBOR a =>
Word -> StrictMaybe a -> Encode ('Closed 'Sparse) (StrictMaybe a)
encodeKeyedStrictMaybe Word
21 StrictMaybe Coin
ctbrCurrentTreasuryValue
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit (forall a. Eq a => a -> a -> Bool
== forall a. Monoid a => a
mempty) (forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
22 forall a b. (a -> b) -> a -> b
$ forall t. EncCBOR t => t -> Encode ('Closed 'Dense) t
To Coin
ctbrTreasuryDonation)
instance ConwayEraTxBody era => EncCBOR (ConwayTxBodyRaw era) where
encCBOR :: ConwayTxBodyRaw era -> Encoding
encCBOR = forall (w :: Wrapped) t. Encode w t -> Encoding
encode forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era.
ConwayEraTxBody era =>
ConwayTxBodyRaw era
-> Encode ('Closed 'Sparse) (ConwayTxBodyRaw era)
encodeTxBodyRaw
instance Era era => EncCBOR (ConwayTxBody era)
class
(BabbageEraTxBody era, ConwayEraTxCert era, ConwayEraPParams era, ConwayEraScript era) =>
ConwayEraTxBody era
where
currentTreasuryValueTxBodyL :: Lens' (TxBody era) (StrictMaybe Coin)
votingProceduresTxBodyL :: Lens' (TxBody era) (VotingProcedures era)
proposalProceduresTxBodyL :: Lens' (TxBody era) (OSet.OSet (ProposalProcedure era))
treasuryDonationTxBodyL :: Lens' (TxBody era) Coin
conwayRedeemerPointer ::
forall era.
ConwayEraTxBody era =>
TxBody era ->
ConwayPlutusPurpose AsItem era ->
StrictMaybe (ConwayPlutusPurpose AsIx era)
conwayRedeemerPointer :: forall era.
ConwayEraTxBody era =>
TxBody era
-> ConwayPlutusPurpose AsItem era
-> StrictMaybe (ConwayPlutusPurpose AsIx era)
conwayRedeemerPointer TxBody era
txBody = \case
ConwayMinting AsItem Word32 (PolicyID (EraCrypto era))
policyID ->
forall (f :: * -> * -> *) era.
f Word32 (PolicyID (EraCrypto era)) -> ConwayPlutusPurpose f era
ConwayMinting forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall elem container.
Indexable elem container =>
AsItem Word32 elem -> container -> StrictMaybe (AsIx Word32 elem)
indexOf AsItem Word32 (PolicyID (EraCrypto era))
policyID (TxBody era
txBody forall s a. s -> Getting a s a -> a
^. forall era.
MaryEraTxBody era =>
SimpleGetter (TxBody era) (Set (PolicyID (EraCrypto era)))
mintedTxBodyF :: Set (PolicyID (EraCrypto era)))
ConwaySpending AsItem Word32 (TxIn (EraCrypto era))
txIn ->
forall (f :: * -> * -> *) era.
f Word32 (TxIn (EraCrypto era)) -> ConwayPlutusPurpose f era
ConwaySpending forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall elem container.
Indexable elem container =>
AsItem Word32 elem -> container -> StrictMaybe (AsIx Word32 elem)
indexOf AsItem Word32 (TxIn (EraCrypto era))
txIn (TxBody era
txBody forall s a. s -> Getting a s a -> a
^. forall era.
EraTxBody era =>
Lens' (TxBody era) (Set (TxIn (EraCrypto era)))
inputsTxBodyL)
ConwayRewarding AsItem Word32 (RewardAccount (EraCrypto era))
rewardAccount ->
forall (f :: * -> * -> *) era.
f Word32 (RewardAccount (EraCrypto era))
-> ConwayPlutusPurpose f era
ConwayRewarding forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall elem container.
Indexable elem container =>
AsItem Word32 elem -> container -> StrictMaybe (AsIx Word32 elem)
indexOf AsItem Word32 (RewardAccount (EraCrypto era))
rewardAccount (forall c. Withdrawals c -> Map (RewardAccount c) Coin
unWithdrawals (TxBody era
txBody forall s a. s -> Getting a s a -> a
^. forall era.
EraTxBody era =>
Lens' (TxBody era) (Withdrawals (EraCrypto era))
withdrawalsTxBodyL))
ConwayCertifying AsItem Word32 (TxCert era)
txCert ->
forall (f :: * -> * -> *) era.
f Word32 (TxCert era) -> ConwayPlutusPurpose f era
ConwayCertifying forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall elem container.
Indexable elem container =>
AsItem Word32 elem -> container -> StrictMaybe (AsIx Word32 elem)
indexOf AsItem Word32 (TxCert era)
txCert (TxBody era
txBody forall s a. s -> Getting a s a -> a
^. forall era.
EraTxBody era =>
Lens' (TxBody era) (StrictSeq (TxCert era))
certsTxBodyL)
ConwayVoting AsItem Word32 (Voter (EraCrypto era))
votingProcedure ->
forall (f :: * -> * -> *) era.
f Word32 (Voter (EraCrypto era)) -> ConwayPlutusPurpose f era
ConwayVoting forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall elem container.
Indexable elem container =>
AsItem Word32 elem -> container -> StrictMaybe (AsIx Word32 elem)
indexOf AsItem Word32 (Voter (EraCrypto era))
votingProcedure (TxBody era
txBody forall s a. s -> Getting a s a -> a
^. forall era.
ConwayEraTxBody era =>
Lens' (TxBody era) (VotingProcedures era)
votingProceduresTxBodyL)
ConwayProposing AsItem Word32 (ProposalProcedure era)
proposalProcedure ->
forall (f :: * -> * -> *) era.
f Word32 (ProposalProcedure era) -> ConwayPlutusPurpose f era
ConwayProposing forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall elem container.
Indexable elem container =>
AsItem Word32 elem -> container -> StrictMaybe (AsIx Word32 elem)
indexOf AsItem Word32 (ProposalProcedure era)
proposalProcedure (TxBody era
txBody forall s a. s -> Getting a s a -> a
^. forall era.
ConwayEraTxBody era =>
Lens' (TxBody era) (OSet (ProposalProcedure era))
proposalProceduresTxBodyL)
conwayRedeemerPointerInverse ::
ConwayEraTxBody era =>
TxBody era ->
ConwayPlutusPurpose AsIx era ->
StrictMaybe (ConwayPlutusPurpose AsIxItem era)
conwayRedeemerPointerInverse :: forall era.
ConwayEraTxBody era =>
TxBody era
-> ConwayPlutusPurpose AsIx era
-> StrictMaybe (ConwayPlutusPurpose AsIxItem era)
conwayRedeemerPointerInverse TxBody era
txBody = \case
ConwayMinting AsIx Word32 (PolicyID (EraCrypto era))
idx ->
forall (f :: * -> * -> *) era.
f Word32 (PolicyID (EraCrypto era)) -> ConwayPlutusPurpose f era
ConwayMinting forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall elem container.
Indexable elem container =>
AsIx Word32 elem -> container -> StrictMaybe (AsIxItem Word32 elem)
fromIndex AsIx Word32 (PolicyID (EraCrypto era))
idx (TxBody era
txBody forall s a. s -> Getting a s a -> a
^. forall era.
MaryEraTxBody era =>
SimpleGetter (TxBody era) (Set (PolicyID (EraCrypto era)))
mintedTxBodyF)
ConwaySpending AsIx Word32 (TxIn (EraCrypto era))
idx ->
forall (f :: * -> * -> *) era.
f Word32 (TxIn (EraCrypto era)) -> ConwayPlutusPurpose f era
ConwaySpending forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall elem container.
Indexable elem container =>
AsIx Word32 elem -> container -> StrictMaybe (AsIxItem Word32 elem)
fromIndex AsIx Word32 (TxIn (EraCrypto era))
idx (TxBody era
txBody forall s a. s -> Getting a s a -> a
^. forall era.
EraTxBody era =>
Lens' (TxBody era) (Set (TxIn (EraCrypto era)))
inputsTxBodyL)
ConwayRewarding AsIx Word32 (RewardAccount (EraCrypto era))
idx ->
forall (f :: * -> * -> *) era.
f Word32 (RewardAccount (EraCrypto era))
-> ConwayPlutusPurpose f era
ConwayRewarding forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall elem container.
Indexable elem container =>
AsIx Word32 elem -> container -> StrictMaybe (AsIxItem Word32 elem)
fromIndex AsIx Word32 (RewardAccount (EraCrypto era))
idx (forall c. Withdrawals c -> Map (RewardAccount c) Coin
unWithdrawals (TxBody era
txBody forall s a. s -> Getting a s a -> a
^. forall era.
EraTxBody era =>
Lens' (TxBody era) (Withdrawals (EraCrypto era))
withdrawalsTxBodyL))
ConwayCertifying AsIx Word32 (TxCert era)
idx ->
forall (f :: * -> * -> *) era.
f Word32 (TxCert era) -> ConwayPlutusPurpose f era
ConwayCertifying forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall elem container.
Indexable elem container =>
AsIx Word32 elem -> container -> StrictMaybe (AsIxItem Word32 elem)
fromIndex AsIx Word32 (TxCert era)
idx (TxBody era
txBody forall s a. s -> Getting a s a -> a
^. forall era.
EraTxBody era =>
Lens' (TxBody era) (StrictSeq (TxCert era))
certsTxBodyL)
ConwayVoting AsIx Word32 (Voter (EraCrypto era))
idx ->
forall (f :: * -> * -> *) era.
f Word32 (Voter (EraCrypto era)) -> ConwayPlutusPurpose f era
ConwayVoting forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall elem container.
Indexable elem container =>
AsIx Word32 elem -> container -> StrictMaybe (AsIxItem Word32 elem)
fromIndex AsIx Word32 (Voter (EraCrypto era))
idx (TxBody era
txBody forall s a. s -> Getting a s a -> a
^. forall era.
ConwayEraTxBody era =>
Lens' (TxBody era) (VotingProcedures era)
votingProceduresTxBodyL)
ConwayProposing AsIx Word32 (ProposalProcedure era)
idx ->
forall (f :: * -> * -> *) era.
f Word32 (ProposalProcedure era) -> ConwayPlutusPurpose f era
ConwayProposing forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall elem container.
Indexable elem container =>
AsIx Word32 elem -> container -> StrictMaybe (AsIxItem Word32 elem)
fromIndex AsIx Word32 (ProposalProcedure era)
idx (TxBody era
txBody forall s a. s -> Getting a s a -> a
^. forall era.
ConwayEraTxBody era =>
Lens' (TxBody era) (OSet (ProposalProcedure era))
proposalProceduresTxBodyL)