{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIONS_GHC -Wno-deprecations #-}
module Cardano.Ledger.Api.Tx.Body (
module Cardano.Ledger.Api.Tx.Out,
module Cardano.Ledger.Api.Scripts,
EraTxBody (TxBody),
mkBasicTxBody,
inputsTxBodyL,
outputsTxBodyL,
feeTxBodyL,
withdrawalsTxBodyL,
Withdrawals (..),
auxDataHashTxBodyL,
TxAuxDataHash (..),
AuxiliaryDataHash,
spendableInputsTxBodyF,
allInputsTxBodyF,
evalBalanceTxBody,
txIdTxBody,
ShelleyEraTxBody,
ttlTxBodyL,
updateTxBodyL,
certsTxBodyL,
AllegraEraTxBody,
vldtTxBodyL,
ValidityInterval (..),
invalidBeforeL,
invalidHereAfterL,
MaryEraTxBody,
mintTxBodyL,
mintValueTxBodyF,
mintedTxBodyF,
AlonzoEraTxBody,
collateralInputsTxBodyL,
reqSignerHashesTxBodyL,
scriptIntegrityHashTxBodyL,
networkIdTxBodyL,
redeemerPointer,
redeemerPointerInverse,
BabbageEraTxBody,
sizedOutputsTxBodyL,
referenceInputsTxBodyL,
totalCollateralTxBodyL,
collateralReturnTxBodyL,
sizedCollateralReturnTxBodyL,
allSizedOutputsTxBodyF,
ConwayEraTxBody,
votingProceduresTxBodyL,
proposalProceduresTxBodyL,
)
where
import Cardano.Ledger.Address (Withdrawals (..))
import Cardano.Ledger.Allegra.Core (AllegraEraTxBody (..))
import Cardano.Ledger.Alonzo.TxBody (AlonzoEraTxBody (..))
import Cardano.Ledger.Api.Era ()
import Cardano.Ledger.Api.Scripts
import Cardano.Ledger.Api.Tx.Out
import Cardano.Ledger.AuxiliaryData (AuxiliaryDataHash)
import Cardano.Ledger.Babbage.TxBody (BabbageEraTxBody (..))
import Cardano.Ledger.BaseTypes (SlotNo, StrictMaybe (..))
import Cardano.Ledger.Coin (Coin)
import Cardano.Ledger.Conway.TxBody (ConwayEraTxBody (..))
import Cardano.Ledger.Core (EraTxBody (..), PParams, TxAuxDataHash (..), Value, txIdTxBody)
import Cardano.Ledger.Credential (Credential)
import Cardano.Ledger.Keys (KeyHash (..), KeyRole (..))
import Cardano.Ledger.Mary.Core (MaryEraTxBody (..))
import Cardano.Ledger.Shelley.Core (ShelleyEraTxBody (..))
import Cardano.Ledger.Shelley.UTxO (getProducedValue)
import Cardano.Ledger.UTxO (EraUTxO (getConsumedValue), UTxO)
import Cardano.Ledger.Val ((<->))
import Lens.Micro (Lens', lens)
evalBalanceTxBody ::
EraUTxO era =>
PParams era ->
(Credential 'Staking -> Maybe Coin) ->
(Credential 'DRepRole -> Maybe Coin) ->
(KeyHash 'StakePool -> Bool) ->
UTxO era ->
TxBody era ->
Value era
evalBalanceTxBody :: forall era.
EraUTxO era =>
PParams era
-> (Credential 'Staking -> Maybe Coin)
-> (Credential 'DRepRole -> Maybe Coin)
-> (KeyHash 'StakePool -> Bool)
-> UTxO era
-> TxBody era
-> Value era
evalBalanceTxBody PParams era
pp Credential 'Staking -> Maybe Coin
lookupKeyRefund Credential 'DRepRole -> Maybe Coin
lookupDRepRefund KeyHash 'StakePool -> Bool
isRegPoolId UTxO era
utxo TxBody era
txBody =
forall era.
EraUTxO era =>
PParams era
-> (Credential 'Staking -> Maybe Coin)
-> (Credential 'DRepRole -> Maybe Coin)
-> UTxO era
-> TxBody era
-> Value era
getConsumedValue PParams era
pp Credential 'Staking -> Maybe Coin
lookupKeyRefund Credential 'DRepRole -> Maybe Coin
lookupDRepRefund UTxO era
utxo TxBody era
txBody
forall t. Val t => t -> t -> t
<-> forall era.
EraUTxO era =>
PParams era
-> (KeyHash 'StakePool -> Bool) -> TxBody era -> Value era
getProducedValue PParams era
pp KeyHash 'StakePool -> Bool
isRegPoolId TxBody era
txBody
invalidBeforeL :: Lens' ValidityInterval (Maybe SlotNo)
invalidBeforeL :: Lens' ValidityInterval (Maybe SlotNo)
invalidBeforeL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens ValidityInterval -> Maybe SlotNo
g ValidityInterval -> Maybe SlotNo -> ValidityInterval
s
where
g :: ValidityInterval -> Maybe SlotNo
g :: ValidityInterval -> Maybe SlotNo
g (ValidityInterval StrictMaybe SlotNo
ma StrictMaybe SlotNo
_) =
case StrictMaybe SlotNo
ma of
StrictMaybe SlotNo
SNothing -> forall a. Maybe a
Nothing
SJust SlotNo
a -> forall a. a -> Maybe a
Just SlotNo
a
s :: ValidityInterval -> Maybe SlotNo -> ValidityInterval
s :: ValidityInterval -> Maybe SlotNo -> ValidityInterval
s (ValidityInterval StrictMaybe SlotNo
_ StrictMaybe SlotNo
b) Maybe SlotNo
a = StrictMaybe SlotNo -> StrictMaybe SlotNo -> ValidityInterval
ValidityInterval (forall b a. b -> (a -> b) -> Maybe a -> b
maybe forall a. StrictMaybe a
SNothing forall a. a -> StrictMaybe a
SJust Maybe SlotNo
a) StrictMaybe SlotNo
b
invalidHereAfterL :: Lens' ValidityInterval (Maybe SlotNo)
invalidHereAfterL :: Lens' ValidityInterval (Maybe SlotNo)
invalidHereAfterL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens ValidityInterval -> Maybe SlotNo
g ValidityInterval -> Maybe SlotNo -> ValidityInterval
s
where
g :: ValidityInterval -> Maybe SlotNo
g :: ValidityInterval -> Maybe SlotNo
g (ValidityInterval StrictMaybe SlotNo
_ StrictMaybe SlotNo
mb) =
case StrictMaybe SlotNo
mb of
StrictMaybe SlotNo
SNothing -> forall a. Maybe a
Nothing
SJust SlotNo
b -> forall a. a -> Maybe a
Just SlotNo
b
s :: ValidityInterval -> Maybe SlotNo -> ValidityInterval
s :: ValidityInterval -> Maybe SlotNo -> ValidityInterval
s (ValidityInterval StrictMaybe SlotNo
ma StrictMaybe SlotNo
_) = StrictMaybe SlotNo -> StrictMaybe SlotNo -> ValidityInterval
ValidityInterval StrictMaybe SlotNo
ma forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall b a. b -> (a -> b) -> Maybe a -> b
maybe forall a. StrictMaybe a
SNothing forall a. a -> StrictMaybe a
SJust