{-# LANGUAGE DataKinds #-}
{-# LANGUAGE RankNTypes #-}

{- HLINT ignore "Eta reduce" -}

module Cardano.Api.Ledger.Lens
  ( -- * Types
    TxBody (..)

    -- * Constructors
  , mkAdaOnlyTxOut
  , mkAdaValue

    -- * Lenses
  , strictMaybeL
  , L.invalidBeforeL
  , L.invalidHereAfterL
  , invalidBeforeStrictL
  , invalidHereAfterStrictL
  , invalidBeforeTxBodyL
  , invalidHereAfterTxBodyL
  , ttlAsInvalidHereAfterTxBodyL
  , updateTxBodyL
  , txBodyL
  , mintTxBodyL
  , scriptIntegrityHashTxBodyL
  , collateralInputsTxBodyL
  , reqSignerHashesTxBodyL
  , referenceInputsTxBodyL
  , collateralReturnTxBodyL
  , totalCollateralTxBodyL
  , certsTxBodyL
  , votingProceduresTxBodyL
  , proposalProceduresTxBodyL
  , currentTreasuryValueTxBodyL
  , treasuryDonationTxBodyL
  , adaAssetL
  , multiAssetL
  , valueTxOutL
  , valueTxOutAdaAssetL
  )
where

import           Cardano.Api.Eon.AllegraEraOnwards
import           Cardano.Api.Eon.AlonzoEraOnwards
import           Cardano.Api.Eon.BabbageEraOnwards
import           Cardano.Api.Eon.ConwayEraOnwards
import           Cardano.Api.Eon.MaryEraOnwards
import           Cardano.Api.Eon.ShelleyBasedEra
import           Cardano.Api.Eon.ShelleyEraOnly
import           Cardano.Api.Eon.ShelleyToAllegraEra
import           Cardano.Api.Eon.ShelleyToBabbageEra
import           Cardano.Api.Eras.Case
import           Cardano.Api.Orphans ()

import qualified Cardano.Ledger.Allegra.Core as L
import qualified Cardano.Ledger.Alonzo.Core as L
import qualified Cardano.Ledger.Api as L
import           Cardano.Ledger.BaseTypes (SlotNo, StrictMaybe (..))
import qualified Cardano.Ledger.Coin as L
import qualified Cardano.Ledger.Conway.Core as L
import qualified Cardano.Ledger.Keys as L
import qualified Cardano.Ledger.Mary.Value as L
import qualified Cardano.Ledger.Shelley.PParams as L
import qualified Cardano.Ledger.TxIn as L

import qualified Data.OSet.Strict as L
import qualified Data.Sequence.Strict as L
import           Data.Set (Set)
import           Lens.Micro

newtype TxBody era = TxBody
  { forall era. TxBody era -> TxBody (ShelleyLedgerEra era)
unTxBody :: L.TxBody (ShelleyLedgerEra era)
  }

strictMaybeL :: Lens' (StrictMaybe a) (Maybe a)
strictMaybeL :: forall a (f :: * -> *).
Functor f =>
(Maybe a -> f (Maybe a)) -> StrictMaybe a -> f (StrictMaybe a)
strictMaybeL = (StrictMaybe a -> Maybe a)
-> (StrictMaybe a -> Maybe a -> StrictMaybe a)
-> Lens (StrictMaybe a) (StrictMaybe a) (Maybe a) (Maybe a)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens StrictMaybe a -> Maybe a
forall a. StrictMaybe a -> Maybe a
g StrictMaybe a -> Maybe a -> StrictMaybe a
forall a. StrictMaybe a -> Maybe a -> StrictMaybe a
s
 where
  g :: StrictMaybe a -> Maybe a
  g :: forall a. StrictMaybe a -> Maybe a
g StrictMaybe a
SNothing = Maybe a
forall a. Maybe a
Nothing
  g (SJust a
x) = a -> Maybe a
forall a. a -> Maybe a
Just a
x

  s :: StrictMaybe a -> Maybe a -> StrictMaybe a
  s :: forall a. StrictMaybe a -> Maybe a -> StrictMaybe a
s StrictMaybe a
_ = StrictMaybe a -> (a -> StrictMaybe a) -> Maybe a -> StrictMaybe a
forall b a. b -> (a -> b) -> Maybe a -> b
maybe StrictMaybe a
forall a. StrictMaybe a
SNothing a -> StrictMaybe a
forall a. a -> StrictMaybe a
SJust

txBodyL :: Lens' (TxBody era) (L.TxBody (ShelleyLedgerEra era))
txBodyL :: forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL = (TxBody era -> TxBody (ShelleyLedgerEra era))
-> (TxBody era -> TxBody (ShelleyLedgerEra era) -> TxBody era)
-> Lens
     (TxBody era)
     (TxBody era)
     (TxBody (ShelleyLedgerEra era))
     (TxBody (ShelleyLedgerEra era))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens TxBody era -> TxBody (ShelleyLedgerEra era)
forall era. TxBody era -> TxBody (ShelleyLedgerEra era)
unTxBody (\TxBody era
_ TxBody (ShelleyLedgerEra era)
x -> TxBody (ShelleyLedgerEra era) -> TxBody era
forall era. TxBody (ShelleyLedgerEra era) -> TxBody era
TxBody TxBody (ShelleyLedgerEra era)
x)

invalidBeforeTxBodyL :: AllegraEraOnwards era -> Lens' (TxBody era) (Maybe SlotNo)
invalidBeforeTxBodyL :: forall era.
AllegraEraOnwards era -> Lens' (TxBody era) (Maybe SlotNo)
invalidBeforeTxBodyL AllegraEraOnwards era
w = AllegraEraOnwards era
-> (AllegraEraOnwardsConstraints era =>
    (Maybe SlotNo -> f (Maybe SlotNo)) -> TxBody era -> f (TxBody era))
-> (Maybe SlotNo -> f (Maybe SlotNo))
-> TxBody era
-> f (TxBody era)
forall era a.
AllegraEraOnwards era
-> (AllegraEraOnwardsConstraints era => a) -> a
allegraEraOnwardsConstraints AllegraEraOnwards era
w ((AllegraEraOnwardsConstraints era =>
  (Maybe SlotNo -> f (Maybe SlotNo)) -> TxBody era -> f (TxBody era))
 -> (Maybe SlotNo -> f (Maybe SlotNo))
 -> TxBody era
 -> f (TxBody era))
-> (AllegraEraOnwardsConstraints era =>
    (Maybe SlotNo -> f (Maybe SlotNo)) -> TxBody era -> f (TxBody era))
-> (Maybe SlotNo -> f (Maybe SlotNo))
-> TxBody era
-> f (TxBody era)
forall a b. (a -> b) -> a -> b
$ (TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> f (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> f (TxBody era))
-> ((Maybe SlotNo -> f (Maybe SlotNo))
    -> TxBody (ShelleyLedgerEra era)
    -> f (TxBody (ShelleyLedgerEra era)))
-> (Maybe SlotNo -> f (Maybe SlotNo))
-> TxBody era
-> f (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ValidityInterval -> f ValidityInterval)
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall era.
AllegraEraTxBody era =>
Lens' (TxBody era) ValidityInterval
Lens' (TxBody (ShelleyLedgerEra era)) ValidityInterval
L.vldtTxBodyL ((ValidityInterval -> f ValidityInterval)
 -> TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> ((Maybe SlotNo -> f (Maybe SlotNo))
    -> ValidityInterval -> f ValidityInterval)
-> (Maybe SlotNo -> f (Maybe SlotNo))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe SlotNo -> f (Maybe SlotNo))
-> ValidityInterval -> f ValidityInterval
Lens' ValidityInterval (Maybe SlotNo)
L.invalidBeforeL

-- | Compatibility lens that provides a consistent interface over 'ttlTxBodyL' and
-- 'vldtTxBodyL . invalidHereAfterStrictL' across all shelley based eras.
--
-- The ledger uses 'ttlTxBodyL' in 'Shelley' only and from Allegra onwards uses 'vldtTxBodyL' instead.
--
-- The former is a 'SlotNo' with no limit represented as 'maxBound'.
--
-- The latter is a 'ValidityInterval' which is a pair of 'SlotNo's that represent the lower and upper
-- bounds.
--
-- The upper bound field is similar t 'ttlTxBodyL' except it is a 'StrictMaybe SlotNo' type where
-- no bounds is represented by 'SNothing'.
--
-- 'invalidHereAfterTxBodyL' lens over both with a 'Maybe SlotNo' type representation.  Withing the
-- Shelley era, setting Nothing will set the ttl to 'maxBound' in the underlying ledger type.
invalidHereAfterTxBodyL :: ShelleyBasedEra era -> Lens' (TxBody era) (Maybe SlotNo)
invalidHereAfterTxBodyL :: forall era.
ShelleyBasedEra era -> Lens' (TxBody era) (Maybe SlotNo)
invalidHereAfterTxBodyL =
  (ShelleyEraOnlyConstraints era =>
 ShelleyEraOnly era
 -> (Maybe SlotNo -> f (Maybe SlotNo))
 -> TxBody era
 -> f (TxBody era))
-> (AllegraEraOnwardsConstraints era =>
    AllegraEraOnwards era
    -> (Maybe SlotNo -> f (Maybe SlotNo))
    -> TxBody era
    -> f (TxBody era))
-> ShelleyBasedEra era
-> (Maybe SlotNo -> f (Maybe SlotNo))
-> TxBody era
-> f (TxBody era)
forall era a.
(ShelleyEraOnlyConstraints era => ShelleyEraOnly era -> a)
-> (AllegraEraOnwardsConstraints era => AllegraEraOnwards era -> a)
-> ShelleyBasedEra era
-> a
caseShelleyEraOnlyOrAllegraEraOnwards
    ShelleyEraOnlyConstraints era =>
ShelleyEraOnly era
-> (Maybe SlotNo -> f (Maybe SlotNo))
-> TxBody era
-> f (TxBody era)
ShelleyEraOnly era
-> (Maybe SlotNo -> f (Maybe SlotNo))
-> TxBody era
-> f (TxBody era)
ShelleyEraOnly era -> Lens' (TxBody era) (Maybe SlotNo)
forall era. ShelleyEraOnly era -> Lens' (TxBody era) (Maybe SlotNo)
ttlAsInvalidHereAfterTxBodyL
    (((Maybe SlotNo -> f (Maybe SlotNo))
 -> TxBody era -> f (TxBody era))
-> AllegraEraOnwards era
-> (Maybe SlotNo -> f (Maybe SlotNo))
-> TxBody era
-> f (TxBody era)
forall a b. a -> b -> a
const (((Maybe SlotNo -> f (Maybe SlotNo))
  -> TxBody era -> f (TxBody era))
 -> AllegraEraOnwards era
 -> (Maybe SlotNo -> f (Maybe SlotNo))
 -> TxBody era
 -> f (TxBody era))
-> ((Maybe SlotNo -> f (Maybe SlotNo))
    -> TxBody era -> f (TxBody era))
-> AllegraEraOnwards era
-> (Maybe SlotNo -> f (Maybe SlotNo))
-> TxBody era
-> f (TxBody era)
forall a b. (a -> b) -> a -> b
$ (TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> f (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> f (TxBody era))
-> ((Maybe SlotNo -> f (Maybe SlotNo))
    -> TxBody (ShelleyLedgerEra era)
    -> f (TxBody (ShelleyLedgerEra era)))
-> (Maybe SlotNo -> f (Maybe SlotNo))
-> TxBody era
-> f (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ValidityInterval -> f ValidityInterval)
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall era.
AllegraEraTxBody era =>
Lens' (TxBody era) ValidityInterval
Lens' (TxBody (ShelleyLedgerEra era)) ValidityInterval
L.vldtTxBodyL ((ValidityInterval -> f ValidityInterval)
 -> TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> ((Maybe SlotNo -> f (Maybe SlotNo))
    -> ValidityInterval -> f ValidityInterval)
-> (Maybe SlotNo -> f (Maybe SlotNo))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe SlotNo -> f (Maybe SlotNo))
-> ValidityInterval -> f ValidityInterval
Lens' ValidityInterval (Maybe SlotNo)
L.invalidHereAfterL)

-- | Compatibility lens over 'ttlTxBodyL' which represents 'maxBound' as Nothing and all other values as 'Just'.
ttlAsInvalidHereAfterTxBodyL :: ShelleyEraOnly era -> Lens' (TxBody era) (Maybe SlotNo)
ttlAsInvalidHereAfterTxBodyL :: forall era. ShelleyEraOnly era -> Lens' (TxBody era) (Maybe SlotNo)
ttlAsInvalidHereAfterTxBodyL ShelleyEraOnly era
w = (TxBody era -> Maybe SlotNo)
-> (TxBody era -> Maybe SlotNo -> TxBody era)
-> Lens (TxBody era) (TxBody era) (Maybe SlotNo) (Maybe SlotNo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens (ShelleyEraOnly era -> TxBody era -> Maybe SlotNo
forall era. ShelleyEraOnly era -> TxBody era -> Maybe SlotNo
g ShelleyEraOnly era
w) (ShelleyEraOnly era -> TxBody era -> Maybe SlotNo -> TxBody era
forall era.
ShelleyEraOnly era -> TxBody era -> Maybe SlotNo -> TxBody era
s ShelleyEraOnly era
w)
 where
  g :: ShelleyEraOnly era -> TxBody era -> Maybe SlotNo
  g :: forall era. ShelleyEraOnly era -> TxBody era -> Maybe SlotNo
g ShelleyEraOnly era
w' TxBody era
txBody =
    ShelleyEraOnly era
-> (ShelleyEraOnlyConstraints era => Maybe SlotNo) -> Maybe SlotNo
forall era a.
ShelleyEraOnly era -> (ShelleyEraOnlyConstraints era => a) -> a
shelleyEraOnlyConstraints ShelleyEraOnly era
w' ((ShelleyEraOnlyConstraints era => Maybe SlotNo) -> Maybe SlotNo)
-> (ShelleyEraOnlyConstraints era => Maybe SlotNo) -> Maybe SlotNo
forall a b. (a -> b) -> a -> b
$
      let ttl :: SlotNo
ttl = TxBody era
txBody TxBody era -> Getting SlotNo (TxBody era) SlotNo -> SlotNo
forall s a. s -> Getting a s a -> a
^. (TxBody (ShelleyLedgerEra era)
 -> Const SlotNo (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> Const SlotNo (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> Const SlotNo (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> Const SlotNo (TxBody era))
-> ((SlotNo -> Const SlotNo SlotNo)
    -> TxBody (ShelleyLedgerEra era)
    -> Const SlotNo (TxBody (ShelleyLedgerEra era)))
-> Getting SlotNo (TxBody era) SlotNo
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SlotNo -> Const SlotNo SlotNo)
-> TxBody (ShelleyLedgerEra era)
-> Const SlotNo (TxBody (ShelleyLedgerEra era))
forall era.
(ShelleyEraTxBody era, ExactEra ShelleyEra era) =>
Lens' (TxBody era) SlotNo
Lens' (TxBody (ShelleyLedgerEra era)) SlotNo
L.ttlTxBodyL in if SlotNo
ttl SlotNo -> SlotNo -> Bool
forall a. Eq a => a -> a -> Bool
== SlotNo
forall a. Bounded a => a
maxBound then Maybe SlotNo
forall a. Maybe a
Nothing else SlotNo -> Maybe SlotNo
forall a. a -> Maybe a
Just SlotNo
ttl

  s :: ShelleyEraOnly era -> TxBody era -> Maybe SlotNo -> TxBody era
  s :: forall era.
ShelleyEraOnly era -> TxBody era -> Maybe SlotNo -> TxBody era
s ShelleyEraOnly era
w' TxBody era
txBody Maybe SlotNo
mSlotNo =
    ShelleyEraOnly era
-> (ShelleyEraOnlyConstraints era => TxBody era) -> TxBody era
forall era a.
ShelleyEraOnly era -> (ShelleyEraOnlyConstraints era => a) -> a
shelleyEraOnlyConstraints ShelleyEraOnly era
w' ((ShelleyEraOnlyConstraints era => TxBody era) -> TxBody era)
-> (ShelleyEraOnlyConstraints era => TxBody era) -> TxBody era
forall a b. (a -> b) -> a -> b
$
      case Maybe SlotNo
mSlotNo of
        Maybe SlotNo
Nothing -> TxBody era
txBody TxBody era -> (TxBody era -> TxBody era) -> TxBody era
forall a b. a -> (a -> b) -> b
& (TxBody (ShelleyLedgerEra era)
 -> Identity (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> Identity (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> Identity (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> Identity (TxBody era))
-> ((SlotNo -> Identity SlotNo)
    -> TxBody (ShelleyLedgerEra era)
    -> Identity (TxBody (ShelleyLedgerEra era)))
-> (SlotNo -> Identity SlotNo)
-> TxBody era
-> Identity (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SlotNo -> Identity SlotNo)
-> TxBody (ShelleyLedgerEra era)
-> Identity (TxBody (ShelleyLedgerEra era))
forall era.
(ShelleyEraTxBody era, ExactEra ShelleyEra era) =>
Lens' (TxBody era) SlotNo
Lens' (TxBody (ShelleyLedgerEra era)) SlotNo
L.ttlTxBodyL ((SlotNo -> Identity SlotNo)
 -> TxBody era -> Identity (TxBody era))
-> SlotNo -> TxBody era -> TxBody era
forall s t a b. ASetter s t a b -> b -> s -> t
.~ SlotNo
forall a. Bounded a => a
maxBound
        Just SlotNo
ttl -> TxBody era
txBody TxBody era -> (TxBody era -> TxBody era) -> TxBody era
forall a b. a -> (a -> b) -> b
& (TxBody (ShelleyLedgerEra era)
 -> Identity (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> Identity (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> Identity (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> Identity (TxBody era))
-> ((SlotNo -> Identity SlotNo)
    -> TxBody (ShelleyLedgerEra era)
    -> Identity (TxBody (ShelleyLedgerEra era)))
-> (SlotNo -> Identity SlotNo)
-> TxBody era
-> Identity (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SlotNo -> Identity SlotNo)
-> TxBody (ShelleyLedgerEra era)
-> Identity (TxBody (ShelleyLedgerEra era))
forall era.
(ShelleyEraTxBody era, ExactEra ShelleyEra era) =>
Lens' (TxBody era) SlotNo
Lens' (TxBody (ShelleyLedgerEra era)) SlotNo
L.ttlTxBodyL ((SlotNo -> Identity SlotNo)
 -> TxBody era -> Identity (TxBody era))
-> SlotNo -> TxBody era -> TxBody era
forall s t a b. ASetter s t a b -> b -> s -> t
.~ SlotNo
ttl

-- | Lens to access the 'invalidBefore' field of a 'ValidityInterval' as a 'StrictMaybe SlotNo'.
-- Ideally this should be defined in cardano-ledger
invalidBeforeStrictL :: Lens' L.ValidityInterval (StrictMaybe SlotNo)
invalidBeforeStrictL :: Lens' ValidityInterval (StrictMaybe SlotNo)
invalidBeforeStrictL = (ValidityInterval -> StrictMaybe SlotNo)
-> (ValidityInterval -> StrictMaybe SlotNo -> ValidityInterval)
-> Lens' ValidityInterval (StrictMaybe SlotNo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens ValidityInterval -> StrictMaybe SlotNo
g ValidityInterval -> StrictMaybe SlotNo -> ValidityInterval
s
 where
  g :: L.ValidityInterval -> StrictMaybe SlotNo
  g :: ValidityInterval -> StrictMaybe SlotNo
g (L.ValidityInterval StrictMaybe SlotNo
a StrictMaybe SlotNo
_) = StrictMaybe SlotNo
a

  s :: L.ValidityInterval -> StrictMaybe SlotNo -> L.ValidityInterval
  s :: ValidityInterval -> StrictMaybe SlotNo -> ValidityInterval
s (L.ValidityInterval StrictMaybe SlotNo
_ StrictMaybe SlotNo
b) StrictMaybe SlotNo
a = StrictMaybe SlotNo -> StrictMaybe SlotNo -> ValidityInterval
L.ValidityInterval StrictMaybe SlotNo
a StrictMaybe SlotNo
b

-- | Lens to access the 'invalidHereAfter' field of a 'ValidityInterval' as a 'StrictMaybe SlotNo'.
-- Ideally this should be defined in cardano-ledger
invalidHereAfterStrictL :: Lens' L.ValidityInterval (StrictMaybe SlotNo)
invalidHereAfterStrictL :: Lens' ValidityInterval (StrictMaybe SlotNo)
invalidHereAfterStrictL = (ValidityInterval -> StrictMaybe SlotNo)
-> (ValidityInterval -> StrictMaybe SlotNo -> ValidityInterval)
-> Lens' ValidityInterval (StrictMaybe SlotNo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens ValidityInterval -> StrictMaybe SlotNo
g ValidityInterval -> StrictMaybe SlotNo -> ValidityInterval
s
 where
  g :: L.ValidityInterval -> StrictMaybe SlotNo
  g :: ValidityInterval -> StrictMaybe SlotNo
g (L.ValidityInterval StrictMaybe SlotNo
_ StrictMaybe SlotNo
b) = StrictMaybe SlotNo
b

  s :: L.ValidityInterval -> StrictMaybe SlotNo -> L.ValidityInterval
  s :: ValidityInterval -> StrictMaybe SlotNo -> ValidityInterval
s (L.ValidityInterval StrictMaybe SlotNo
a StrictMaybe SlotNo
_) StrictMaybe SlotNo
b = StrictMaybe SlotNo -> StrictMaybe SlotNo -> ValidityInterval
L.ValidityInterval StrictMaybe SlotNo
a StrictMaybe SlotNo
b

updateTxBodyL
  :: ShelleyToBabbageEra era -> Lens' (TxBody era) (StrictMaybe (L.Update (ShelleyLedgerEra era)))
updateTxBodyL :: forall era.
ShelleyToBabbageEra era
-> Lens' (TxBody era) (StrictMaybe (Update (ShelleyLedgerEra era)))
updateTxBodyL ShelleyToBabbageEra era
w = ShelleyToBabbageEra era
-> (ShelleyToBabbageEraConstraints era =>
    (StrictMaybe (Update (ShelleyLedgerEra era))
     -> f (StrictMaybe (Update (ShelleyLedgerEra era))))
    -> TxBody era -> f (TxBody era))
-> (StrictMaybe (Update (ShelleyLedgerEra era))
    -> f (StrictMaybe (Update (ShelleyLedgerEra era))))
-> TxBody era
-> f (TxBody era)
forall era a.
ShelleyToBabbageEra era
-> (ShelleyToBabbageEraConstraints era => a) -> a
shelleyToBabbageEraConstraints ShelleyToBabbageEra era
w ((ShelleyToBabbageEraConstraints era =>
  (StrictMaybe (Update (ShelleyLedgerEra era))
   -> f (StrictMaybe (Update (ShelleyLedgerEra era))))
  -> TxBody era -> f (TxBody era))
 -> (StrictMaybe (Update (ShelleyLedgerEra era))
     -> f (StrictMaybe (Update (ShelleyLedgerEra era))))
 -> TxBody era
 -> f (TxBody era))
-> (ShelleyToBabbageEraConstraints era =>
    (StrictMaybe (Update (ShelleyLedgerEra era))
     -> f (StrictMaybe (Update (ShelleyLedgerEra era))))
    -> TxBody era -> f (TxBody era))
-> (StrictMaybe (Update (ShelleyLedgerEra era))
    -> f (StrictMaybe (Update (ShelleyLedgerEra era))))
-> TxBody era
-> f (TxBody era)
forall a b. (a -> b) -> a -> b
$ (TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> f (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> f (TxBody era))
-> ((StrictMaybe (Update (ShelleyLedgerEra era))
     -> f (StrictMaybe (Update (ShelleyLedgerEra era))))
    -> TxBody (ShelleyLedgerEra era)
    -> f (TxBody (ShelleyLedgerEra era)))
-> (StrictMaybe (Update (ShelleyLedgerEra era))
    -> f (StrictMaybe (Update (ShelleyLedgerEra era))))
-> TxBody era
-> f (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (StrictMaybe (Update (ShelleyLedgerEra era))
 -> f (StrictMaybe (Update (ShelleyLedgerEra era))))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall era.
ShelleyEraTxBody era =>
Lens' (TxBody era) (StrictMaybe (Update era))
Lens'
  (TxBody (ShelleyLedgerEra era))
  (StrictMaybe (Update (ShelleyLedgerEra era)))
L.updateTxBodyL

mintTxBodyL :: MaryEraOnwards era -> Lens' (TxBody era) (L.MultiAsset L.StandardCrypto)
mintTxBodyL :: forall era.
MaryEraOnwards era
-> Lens' (TxBody era) (MultiAsset StandardCrypto)
mintTxBodyL MaryEraOnwards era
w = MaryEraOnwards era
-> (MaryEraOnwardsConstraints era =>
    (MultiAsset StandardCrypto -> f (MultiAsset StandardCrypto))
    -> TxBody era -> f (TxBody era))
-> (MultiAsset StandardCrypto -> f (MultiAsset StandardCrypto))
-> TxBody era
-> f (TxBody era)
forall era a.
MaryEraOnwards era -> (MaryEraOnwardsConstraints era => a) -> a
maryEraOnwardsConstraints MaryEraOnwards era
w ((MaryEraOnwardsConstraints era =>
  (MultiAsset StandardCrypto -> f (MultiAsset StandardCrypto))
  -> TxBody era -> f (TxBody era))
 -> (MultiAsset StandardCrypto -> f (MultiAsset StandardCrypto))
 -> TxBody era
 -> f (TxBody era))
-> (MaryEraOnwardsConstraints era =>
    (MultiAsset StandardCrypto -> f (MultiAsset StandardCrypto))
    -> TxBody era -> f (TxBody era))
-> (MultiAsset StandardCrypto -> f (MultiAsset StandardCrypto))
-> TxBody era
-> f (TxBody era)
forall a b. (a -> b) -> a -> b
$ (TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> f (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> f (TxBody era))
-> ((MultiAsset StandardCrypto -> f (MultiAsset StandardCrypto))
    -> TxBody (ShelleyLedgerEra era)
    -> f (TxBody (ShelleyLedgerEra era)))
-> (MultiAsset StandardCrypto -> f (MultiAsset StandardCrypto))
-> TxBody era
-> f (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (MultiAsset (EraCrypto (ShelleyLedgerEra era))
 -> f (MultiAsset (EraCrypto (ShelleyLedgerEra era))))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
(MultiAsset StandardCrypto -> f (MultiAsset StandardCrypto))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall era.
MaryEraTxBody era =>
Lens' (TxBody era) (MultiAsset (EraCrypto era))
Lens'
  (TxBody (ShelleyLedgerEra era))
  (MultiAsset (EraCrypto (ShelleyLedgerEra era)))
L.mintTxBodyL

scriptIntegrityHashTxBodyL
  :: AlonzoEraOnwards era -> Lens' (TxBody era) (StrictMaybe (L.ScriptIntegrityHash L.StandardCrypto))
scriptIntegrityHashTxBodyL :: forall era.
AlonzoEraOnwards era
-> Lens'
     (TxBody era) (StrictMaybe (ScriptIntegrityHash StandardCrypto))
scriptIntegrityHashTxBodyL AlonzoEraOnwards era
w = AlonzoEraOnwards era
-> (AlonzoEraOnwardsConstraints era =>
    (StrictMaybe (ScriptIntegrityHash StandardCrypto)
     -> f (StrictMaybe (ScriptIntegrityHash StandardCrypto)))
    -> TxBody era -> f (TxBody era))
-> (StrictMaybe (ScriptIntegrityHash StandardCrypto)
    -> f (StrictMaybe (ScriptIntegrityHash StandardCrypto)))
-> TxBody era
-> f (TxBody era)
forall era a.
AlonzoEraOnwards era -> (AlonzoEraOnwardsConstraints era => a) -> a
alonzoEraOnwardsConstraints AlonzoEraOnwards era
w ((AlonzoEraOnwardsConstraints era =>
  (StrictMaybe (ScriptIntegrityHash StandardCrypto)
   -> f (StrictMaybe (ScriptIntegrityHash StandardCrypto)))
  -> TxBody era -> f (TxBody era))
 -> (StrictMaybe (ScriptIntegrityHash StandardCrypto)
     -> f (StrictMaybe (ScriptIntegrityHash StandardCrypto)))
 -> TxBody era
 -> f (TxBody era))
-> (AlonzoEraOnwardsConstraints era =>
    (StrictMaybe (ScriptIntegrityHash StandardCrypto)
     -> f (StrictMaybe (ScriptIntegrityHash StandardCrypto)))
    -> TxBody era -> f (TxBody era))
-> (StrictMaybe (ScriptIntegrityHash StandardCrypto)
    -> f (StrictMaybe (ScriptIntegrityHash StandardCrypto)))
-> TxBody era
-> f (TxBody era)
forall a b. (a -> b) -> a -> b
$ (TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> f (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> f (TxBody era))
-> ((StrictMaybe (ScriptIntegrityHash StandardCrypto)
     -> f (StrictMaybe (ScriptIntegrityHash StandardCrypto)))
    -> TxBody (ShelleyLedgerEra era)
    -> f (TxBody (ShelleyLedgerEra era)))
-> (StrictMaybe (ScriptIntegrityHash StandardCrypto)
    -> f (StrictMaybe (ScriptIntegrityHash StandardCrypto)))
-> TxBody era
-> f (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (StrictMaybe
   (ScriptIntegrityHash (EraCrypto (ShelleyLedgerEra era)))
 -> f (StrictMaybe
         (ScriptIntegrityHash (EraCrypto (ShelleyLedgerEra era)))))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
(StrictMaybe (ScriptIntegrityHash StandardCrypto)
 -> f (StrictMaybe (ScriptIntegrityHash StandardCrypto)))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall era.
AlonzoEraTxBody era =>
Lens'
  (TxBody era) (StrictMaybe (ScriptIntegrityHash (EraCrypto era)))
Lens'
  (TxBody (ShelleyLedgerEra era))
  (StrictMaybe
     (ScriptIntegrityHash (EraCrypto (ShelleyLedgerEra era))))
L.scriptIntegrityHashTxBodyL

collateralInputsTxBodyL
  :: AlonzoEraOnwards era -> Lens' (TxBody era) (Set (L.TxIn L.StandardCrypto))
collateralInputsTxBodyL :: forall era.
AlonzoEraOnwards era
-> Lens' (TxBody era) (Set (TxIn StandardCrypto))
collateralInputsTxBodyL AlonzoEraOnwards era
w = AlonzoEraOnwards era
-> (AlonzoEraOnwardsConstraints era =>
    (Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
    -> TxBody era -> f (TxBody era))
-> (Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
-> TxBody era
-> f (TxBody era)
forall era a.
AlonzoEraOnwards era -> (AlonzoEraOnwardsConstraints era => a) -> a
alonzoEraOnwardsConstraints AlonzoEraOnwards era
w ((AlonzoEraOnwardsConstraints era =>
  (Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
  -> TxBody era -> f (TxBody era))
 -> (Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
 -> TxBody era
 -> f (TxBody era))
-> (AlonzoEraOnwardsConstraints era =>
    (Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
    -> TxBody era -> f (TxBody era))
-> (Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
-> TxBody era
-> f (TxBody era)
forall a b. (a -> b) -> a -> b
$ (TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> f (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> f (TxBody era))
-> ((Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
    -> TxBody (ShelleyLedgerEra era)
    -> f (TxBody (ShelleyLedgerEra era)))
-> (Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
-> TxBody era
-> f (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Set (TxIn (EraCrypto (ShelleyLedgerEra era)))
 -> f (Set (TxIn (EraCrypto (ShelleyLedgerEra era)))))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
(Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall era.
AlonzoEraTxBody era =>
Lens' (TxBody era) (Set (TxIn (EraCrypto era)))
Lens'
  (TxBody (ShelleyLedgerEra era))
  (Set (TxIn (EraCrypto (ShelleyLedgerEra era))))
L.collateralInputsTxBodyL

reqSignerHashesTxBodyL
  :: AlonzoEraOnwards era -> Lens' (TxBody era) (Set (L.KeyHash L.Witness L.StandardCrypto))
reqSignerHashesTxBodyL :: forall era.
AlonzoEraOnwards era
-> Lens' (TxBody era) (Set (KeyHash 'Witness StandardCrypto))
reqSignerHashesTxBodyL AlonzoEraOnwards era
w = AlonzoEraOnwards era
-> (AlonzoEraOnwardsConstraints era =>
    (Set (KeyHash 'Witness StandardCrypto)
     -> f (Set (KeyHash 'Witness StandardCrypto)))
    -> TxBody era -> f (TxBody era))
-> (Set (KeyHash 'Witness StandardCrypto)
    -> f (Set (KeyHash 'Witness StandardCrypto)))
-> TxBody era
-> f (TxBody era)
forall era a.
AlonzoEraOnwards era -> (AlonzoEraOnwardsConstraints era => a) -> a
alonzoEraOnwardsConstraints AlonzoEraOnwards era
w ((AlonzoEraOnwardsConstraints era =>
  (Set (KeyHash 'Witness StandardCrypto)
   -> f (Set (KeyHash 'Witness StandardCrypto)))
  -> TxBody era -> f (TxBody era))
 -> (Set (KeyHash 'Witness StandardCrypto)
     -> f (Set (KeyHash 'Witness StandardCrypto)))
 -> TxBody era
 -> f (TxBody era))
-> (AlonzoEraOnwardsConstraints era =>
    (Set (KeyHash 'Witness StandardCrypto)
     -> f (Set (KeyHash 'Witness StandardCrypto)))
    -> TxBody era -> f (TxBody era))
-> (Set (KeyHash 'Witness StandardCrypto)
    -> f (Set (KeyHash 'Witness StandardCrypto)))
-> TxBody era
-> f (TxBody era)
forall a b. (a -> b) -> a -> b
$ (TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> f (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> f (TxBody era))
-> ((Set (KeyHash 'Witness StandardCrypto)
     -> f (Set (KeyHash 'Witness StandardCrypto)))
    -> TxBody (ShelleyLedgerEra era)
    -> f (TxBody (ShelleyLedgerEra era)))
-> (Set (KeyHash 'Witness StandardCrypto)
    -> f (Set (KeyHash 'Witness StandardCrypto)))
-> TxBody era
-> f (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Set (KeyHash 'Witness (EraCrypto (ShelleyLedgerEra era)))
 -> f (Set (KeyHash 'Witness (EraCrypto (ShelleyLedgerEra era)))))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
(Set (KeyHash 'Witness StandardCrypto)
 -> f (Set (KeyHash 'Witness StandardCrypto)))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall era.
AlonzoEraTxBody era =>
Lens' (TxBody era) (Set (KeyHash 'Witness (EraCrypto era)))
Lens'
  (TxBody (ShelleyLedgerEra era))
  (Set (KeyHash 'Witness (EraCrypto (ShelleyLedgerEra era))))
L.reqSignerHashesTxBodyL

referenceInputsTxBodyL
  :: BabbageEraOnwards era -> Lens' (TxBody era) (Set (L.TxIn L.StandardCrypto))
referenceInputsTxBodyL :: forall era.
BabbageEraOnwards era
-> Lens' (TxBody era) (Set (TxIn StandardCrypto))
referenceInputsTxBodyL BabbageEraOnwards era
w = BabbageEraOnwards era
-> (BabbageEraOnwardsConstraints era =>
    (Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
    -> TxBody era -> f (TxBody era))
-> (Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
-> TxBody era
-> f (TxBody era)
forall era a.
BabbageEraOnwards era
-> (BabbageEraOnwardsConstraints era => a) -> a
babbageEraOnwardsConstraints BabbageEraOnwards era
w ((BabbageEraOnwardsConstraints era =>
  (Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
  -> TxBody era -> f (TxBody era))
 -> (Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
 -> TxBody era
 -> f (TxBody era))
-> (BabbageEraOnwardsConstraints era =>
    (Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
    -> TxBody era -> f (TxBody era))
-> (Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
-> TxBody era
-> f (TxBody era)
forall a b. (a -> b) -> a -> b
$ (TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> f (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> f (TxBody era))
-> ((Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
    -> TxBody (ShelleyLedgerEra era)
    -> f (TxBody (ShelleyLedgerEra era)))
-> (Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
-> TxBody era
-> f (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Set (TxIn (EraCrypto (ShelleyLedgerEra era)))
 -> f (Set (TxIn (EraCrypto (ShelleyLedgerEra era)))))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
(Set (TxIn StandardCrypto) -> f (Set (TxIn StandardCrypto)))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall era.
BabbageEraTxBody era =>
Lens' (TxBody era) (Set (TxIn (EraCrypto era)))
Lens'
  (TxBody (ShelleyLedgerEra era))
  (Set (TxIn (EraCrypto (ShelleyLedgerEra era))))
L.referenceInputsTxBodyL

collateralReturnTxBodyL
  :: BabbageEraOnwards era -> Lens' (TxBody era) (StrictMaybe (L.TxOut (ShelleyLedgerEra era)))
collateralReturnTxBodyL :: forall era.
BabbageEraOnwards era
-> Lens' (TxBody era) (StrictMaybe (TxOut (ShelleyLedgerEra era)))
collateralReturnTxBodyL BabbageEraOnwards era
w = BabbageEraOnwards era
-> (BabbageEraOnwardsConstraints era =>
    (StrictMaybe (TxOut (ShelleyLedgerEra era))
     -> f (StrictMaybe (TxOut (ShelleyLedgerEra era))))
    -> TxBody era -> f (TxBody era))
-> (StrictMaybe (TxOut (ShelleyLedgerEra era))
    -> f (StrictMaybe (TxOut (ShelleyLedgerEra era))))
-> TxBody era
-> f (TxBody era)
forall era a.
BabbageEraOnwards era
-> (BabbageEraOnwardsConstraints era => a) -> a
babbageEraOnwardsConstraints BabbageEraOnwards era
w ((BabbageEraOnwardsConstraints era =>
  (StrictMaybe (TxOut (ShelleyLedgerEra era))
   -> f (StrictMaybe (TxOut (ShelleyLedgerEra era))))
  -> TxBody era -> f (TxBody era))
 -> (StrictMaybe (TxOut (ShelleyLedgerEra era))
     -> f (StrictMaybe (TxOut (ShelleyLedgerEra era))))
 -> TxBody era
 -> f (TxBody era))
-> (BabbageEraOnwardsConstraints era =>
    (StrictMaybe (TxOut (ShelleyLedgerEra era))
     -> f (StrictMaybe (TxOut (ShelleyLedgerEra era))))
    -> TxBody era -> f (TxBody era))
-> (StrictMaybe (TxOut (ShelleyLedgerEra era))
    -> f (StrictMaybe (TxOut (ShelleyLedgerEra era))))
-> TxBody era
-> f (TxBody era)
forall a b. (a -> b) -> a -> b
$ (TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> f (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> f (TxBody era))
-> ((StrictMaybe (BabbageTxOut (ShelleyLedgerEra era))
     -> f (StrictMaybe (BabbageTxOut (ShelleyLedgerEra era))))
    -> TxBody (ShelleyLedgerEra era)
    -> f (TxBody (ShelleyLedgerEra era)))
-> (StrictMaybe (BabbageTxOut (ShelleyLedgerEra era))
    -> f (StrictMaybe (BabbageTxOut (ShelleyLedgerEra era))))
-> TxBody era
-> f (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (StrictMaybe (TxOut (ShelleyLedgerEra era))
 -> f (StrictMaybe (TxOut (ShelleyLedgerEra era))))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
(StrictMaybe (BabbageTxOut (ShelleyLedgerEra era))
 -> f (StrictMaybe (BabbageTxOut (ShelleyLedgerEra era))))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall era.
BabbageEraTxBody era =>
Lens' (TxBody era) (StrictMaybe (TxOut era))
Lens'
  (TxBody (ShelleyLedgerEra era))
  (StrictMaybe (TxOut (ShelleyLedgerEra era)))
L.collateralReturnTxBodyL

totalCollateralTxBodyL :: BabbageEraOnwards era -> Lens' (TxBody era) (StrictMaybe L.Coin)
totalCollateralTxBodyL :: forall era.
BabbageEraOnwards era -> Lens' (TxBody era) (StrictMaybe Coin)
totalCollateralTxBodyL BabbageEraOnwards era
w = BabbageEraOnwards era
-> (BabbageEraOnwardsConstraints era =>
    (StrictMaybe Coin -> f (StrictMaybe Coin))
    -> TxBody era -> f (TxBody era))
-> (StrictMaybe Coin -> f (StrictMaybe Coin))
-> TxBody era
-> f (TxBody era)
forall era a.
BabbageEraOnwards era
-> (BabbageEraOnwardsConstraints era => a) -> a
babbageEraOnwardsConstraints BabbageEraOnwards era
w ((BabbageEraOnwardsConstraints era =>
  (StrictMaybe Coin -> f (StrictMaybe Coin))
  -> TxBody era -> f (TxBody era))
 -> (StrictMaybe Coin -> f (StrictMaybe Coin))
 -> TxBody era
 -> f (TxBody era))
-> (BabbageEraOnwardsConstraints era =>
    (StrictMaybe Coin -> f (StrictMaybe Coin))
    -> TxBody era -> f (TxBody era))
-> (StrictMaybe Coin -> f (StrictMaybe Coin))
-> TxBody era
-> f (TxBody era)
forall a b. (a -> b) -> a -> b
$ (TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> f (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> f (TxBody era))
-> ((StrictMaybe Coin -> f (StrictMaybe Coin))
    -> TxBody (ShelleyLedgerEra era)
    -> f (TxBody (ShelleyLedgerEra era)))
-> (StrictMaybe Coin -> f (StrictMaybe Coin))
-> TxBody era
-> f (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (StrictMaybe Coin -> f (StrictMaybe Coin))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall era.
BabbageEraTxBody era =>
Lens' (TxBody era) (StrictMaybe Coin)
Lens' (TxBody (ShelleyLedgerEra era)) (StrictMaybe Coin)
L.totalCollateralTxBodyL

certsTxBodyL
  :: ShelleyBasedEra era -> Lens' (TxBody era) (L.StrictSeq (L.TxCert (ShelleyLedgerEra era)))
certsTxBodyL :: forall era.
ShelleyBasedEra era
-> Lens' (TxBody era) (StrictSeq (TxCert (ShelleyLedgerEra era)))
certsTxBodyL ShelleyBasedEra era
w = ShelleyBasedEra era
-> (ShelleyBasedEraConstraints era =>
    (StrictSeq (TxCert (ShelleyLedgerEra era))
     -> f (StrictSeq (TxCert (ShelleyLedgerEra era))))
    -> TxBody era -> f (TxBody era))
-> (StrictSeq (TxCert (ShelleyLedgerEra era))
    -> f (StrictSeq (TxCert (ShelleyLedgerEra era))))
-> TxBody era
-> f (TxBody era)
forall era a.
ShelleyBasedEra era -> (ShelleyBasedEraConstraints era => a) -> a
shelleyBasedEraConstraints ShelleyBasedEra era
w ((ShelleyBasedEraConstraints era =>
  (StrictSeq (TxCert (ShelleyLedgerEra era))
   -> f (StrictSeq (TxCert (ShelleyLedgerEra era))))
  -> TxBody era -> f (TxBody era))
 -> (StrictSeq (TxCert (ShelleyLedgerEra era))
     -> f (StrictSeq (TxCert (ShelleyLedgerEra era))))
 -> TxBody era
 -> f (TxBody era))
-> (ShelleyBasedEraConstraints era =>
    (StrictSeq (TxCert (ShelleyLedgerEra era))
     -> f (StrictSeq (TxCert (ShelleyLedgerEra era))))
    -> TxBody era -> f (TxBody era))
-> (StrictSeq (TxCert (ShelleyLedgerEra era))
    -> f (StrictSeq (TxCert (ShelleyLedgerEra era))))
-> TxBody era
-> f (TxBody era)
forall a b. (a -> b) -> a -> b
$ (TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> f (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> f (TxBody era))
-> ((StrictSeq (TxCert (ShelleyLedgerEra era))
     -> f (StrictSeq (TxCert (ShelleyLedgerEra era))))
    -> TxBody (ShelleyLedgerEra era)
    -> f (TxBody (ShelleyLedgerEra era)))
-> (StrictSeq (TxCert (ShelleyLedgerEra era))
    -> f (StrictSeq (TxCert (ShelleyLedgerEra era))))
-> TxBody era
-> f (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (StrictSeq (TxCert (ShelleyLedgerEra era))
 -> f (StrictSeq (TxCert (ShelleyLedgerEra era))))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall era.
EraTxBody era =>
Lens' (TxBody era) (StrictSeq (TxCert era))
Lens'
  (TxBody (ShelleyLedgerEra era))
  (StrictSeq (TxCert (ShelleyLedgerEra era)))
L.certsTxBodyL

votingProceduresTxBodyL
  :: ConwayEraOnwards era -> Lens' (TxBody era) (L.VotingProcedures (ShelleyLedgerEra era))
votingProceduresTxBodyL :: forall era.
ConwayEraOnwards era
-> Lens' (TxBody era) (VotingProcedures (ShelleyLedgerEra era))
votingProceduresTxBodyL ConwayEraOnwards era
w = ConwayEraOnwards era
-> (ConwayEraOnwardsConstraints era =>
    (VotingProcedures (ShelleyLedgerEra era)
     -> f (VotingProcedures (ShelleyLedgerEra era)))
    -> TxBody era -> f (TxBody era))
-> (VotingProcedures (ShelleyLedgerEra era)
    -> f (VotingProcedures (ShelleyLedgerEra era)))
-> TxBody era
-> f (TxBody era)
forall era a.
ConwayEraOnwards era -> (ConwayEraOnwardsConstraints era => a) -> a
conwayEraOnwardsConstraints ConwayEraOnwards era
w ((ConwayEraOnwardsConstraints era =>
  (VotingProcedures (ShelleyLedgerEra era)
   -> f (VotingProcedures (ShelleyLedgerEra era)))
  -> TxBody era -> f (TxBody era))
 -> (VotingProcedures (ShelleyLedgerEra era)
     -> f (VotingProcedures (ShelleyLedgerEra era)))
 -> TxBody era
 -> f (TxBody era))
-> (ConwayEraOnwardsConstraints era =>
    (VotingProcedures (ShelleyLedgerEra era)
     -> f (VotingProcedures (ShelleyLedgerEra era)))
    -> TxBody era -> f (TxBody era))
-> (VotingProcedures (ShelleyLedgerEra era)
    -> f (VotingProcedures (ShelleyLedgerEra era)))
-> TxBody era
-> f (TxBody era)
forall a b. (a -> b) -> a -> b
$ (TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> f (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> f (TxBody era))
-> ((VotingProcedures (ShelleyLedgerEra era)
     -> f (VotingProcedures (ShelleyLedgerEra era)))
    -> TxBody (ShelleyLedgerEra era)
    -> f (TxBody (ShelleyLedgerEra era)))
-> (VotingProcedures (ShelleyLedgerEra era)
    -> f (VotingProcedures (ShelleyLedgerEra era)))
-> TxBody era
-> f (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (VotingProcedures (ShelleyLedgerEra era)
 -> f (VotingProcedures (ShelleyLedgerEra era)))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall era.
ConwayEraTxBody era =>
Lens' (TxBody era) (VotingProcedures era)
Lens'
  (TxBody (ShelleyLedgerEra era))
  (VotingProcedures (ShelleyLedgerEra era))
L.votingProceduresTxBodyL

proposalProceduresTxBodyL
  :: ConwayEraOnwards era -> Lens' (TxBody era) (L.OSet (L.ProposalProcedure (ShelleyLedgerEra era)))
proposalProceduresTxBodyL :: forall era.
ConwayEraOnwards era
-> Lens'
     (TxBody era) (OSet (ProposalProcedure (ShelleyLedgerEra era)))
proposalProceduresTxBodyL ConwayEraOnwards era
w = ConwayEraOnwards era
-> (ConwayEraOnwardsConstraints era =>
    (OSet (ProposalProcedure (ShelleyLedgerEra era))
     -> f (OSet (ProposalProcedure (ShelleyLedgerEra era))))
    -> TxBody era -> f (TxBody era))
-> (OSet (ProposalProcedure (ShelleyLedgerEra era))
    -> f (OSet (ProposalProcedure (ShelleyLedgerEra era))))
-> TxBody era
-> f (TxBody era)
forall era a.
ConwayEraOnwards era -> (ConwayEraOnwardsConstraints era => a) -> a
conwayEraOnwardsConstraints ConwayEraOnwards era
w ((ConwayEraOnwardsConstraints era =>
  (OSet (ProposalProcedure (ShelleyLedgerEra era))
   -> f (OSet (ProposalProcedure (ShelleyLedgerEra era))))
  -> TxBody era -> f (TxBody era))
 -> (OSet (ProposalProcedure (ShelleyLedgerEra era))
     -> f (OSet (ProposalProcedure (ShelleyLedgerEra era))))
 -> TxBody era
 -> f (TxBody era))
-> (ConwayEraOnwardsConstraints era =>
    (OSet (ProposalProcedure (ShelleyLedgerEra era))
     -> f (OSet (ProposalProcedure (ShelleyLedgerEra era))))
    -> TxBody era -> f (TxBody era))
-> (OSet (ProposalProcedure (ShelleyLedgerEra era))
    -> f (OSet (ProposalProcedure (ShelleyLedgerEra era))))
-> TxBody era
-> f (TxBody era)
forall a b. (a -> b) -> a -> b
$ (TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> f (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> f (TxBody era))
-> ((OSet (ProposalProcedure (ShelleyLedgerEra era))
     -> f (OSet (ProposalProcedure (ShelleyLedgerEra era))))
    -> TxBody (ShelleyLedgerEra era)
    -> f (TxBody (ShelleyLedgerEra era)))
-> (OSet (ProposalProcedure (ShelleyLedgerEra era))
    -> f (OSet (ProposalProcedure (ShelleyLedgerEra era))))
-> TxBody era
-> f (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (OSet (ProposalProcedure (ShelleyLedgerEra era))
 -> f (OSet (ProposalProcedure (ShelleyLedgerEra era))))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall era.
ConwayEraTxBody era =>
Lens' (TxBody era) (OSet (ProposalProcedure era))
Lens'
  (TxBody (ShelleyLedgerEra era))
  (OSet (ProposalProcedure (ShelleyLedgerEra era)))
L.proposalProceduresTxBodyL

currentTreasuryValueTxBodyL :: ConwayEraOnwards era -> Lens' (TxBody era) (StrictMaybe L.Coin)
currentTreasuryValueTxBodyL :: forall era.
ConwayEraOnwards era -> Lens' (TxBody era) (StrictMaybe Coin)
currentTreasuryValueTxBodyL ConwayEraOnwards era
w = ConwayEraOnwards era
-> (ConwayEraOnwardsConstraints era =>
    (StrictMaybe Coin -> f (StrictMaybe Coin))
    -> TxBody era -> f (TxBody era))
-> (StrictMaybe Coin -> f (StrictMaybe Coin))
-> TxBody era
-> f (TxBody era)
forall era a.
ConwayEraOnwards era -> (ConwayEraOnwardsConstraints era => a) -> a
conwayEraOnwardsConstraints ConwayEraOnwards era
w ((ConwayEraOnwardsConstraints era =>
  (StrictMaybe Coin -> f (StrictMaybe Coin))
  -> TxBody era -> f (TxBody era))
 -> (StrictMaybe Coin -> f (StrictMaybe Coin))
 -> TxBody era
 -> f (TxBody era))
-> (ConwayEraOnwardsConstraints era =>
    (StrictMaybe Coin -> f (StrictMaybe Coin))
    -> TxBody era -> f (TxBody era))
-> (StrictMaybe Coin -> f (StrictMaybe Coin))
-> TxBody era
-> f (TxBody era)
forall a b. (a -> b) -> a -> b
$ (TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> f (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> f (TxBody era))
-> ((StrictMaybe Coin -> f (StrictMaybe Coin))
    -> TxBody (ShelleyLedgerEra era)
    -> f (TxBody (ShelleyLedgerEra era)))
-> (StrictMaybe Coin -> f (StrictMaybe Coin))
-> TxBody era
-> f (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (StrictMaybe Coin -> f (StrictMaybe Coin))
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall era.
ConwayEraTxBody era =>
Lens' (TxBody era) (StrictMaybe Coin)
Lens' (TxBody (ShelleyLedgerEra era)) (StrictMaybe Coin)
L.currentTreasuryValueTxBodyL

treasuryDonationTxBodyL :: ConwayEraOnwards era -> Lens' (TxBody era) L.Coin
treasuryDonationTxBodyL :: forall era. ConwayEraOnwards era -> Lens' (TxBody era) Coin
treasuryDonationTxBodyL ConwayEraOnwards era
w = ConwayEraOnwards era
-> (ConwayEraOnwardsConstraints era =>
    (Coin -> f Coin) -> TxBody era -> f (TxBody era))
-> (Coin -> f Coin)
-> TxBody era
-> f (TxBody era)
forall era a.
ConwayEraOnwards era -> (ConwayEraOnwardsConstraints era => a) -> a
conwayEraOnwardsConstraints ConwayEraOnwards era
w ((ConwayEraOnwardsConstraints era =>
  (Coin -> f Coin) -> TxBody era -> f (TxBody era))
 -> (Coin -> f Coin) -> TxBody era -> f (TxBody era))
-> (ConwayEraOnwardsConstraints era =>
    (Coin -> f Coin) -> TxBody era -> f (TxBody era))
-> (Coin -> f Coin)
-> TxBody era
-> f (TxBody era)
forall a b. (a -> b) -> a -> b
$ (TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
forall era (f :: * -> *).
Functor f =>
(TxBody (ShelleyLedgerEra era)
 -> f (TxBody (ShelleyLedgerEra era)))
-> TxBody era -> f (TxBody era)
txBodyL ((TxBody (ShelleyLedgerEra era)
  -> f (TxBody (ShelleyLedgerEra era)))
 -> TxBody era -> f (TxBody era))
-> ((Coin -> f Coin)
    -> TxBody (ShelleyLedgerEra era)
    -> f (TxBody (ShelleyLedgerEra era)))
-> (Coin -> f Coin)
-> TxBody era
-> f (TxBody era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> f Coin)
-> TxBody (ShelleyLedgerEra era)
-> f (TxBody (ShelleyLedgerEra era))
forall era. ConwayEraTxBody era => Lens' (TxBody era) Coin
Lens' (TxBody (ShelleyLedgerEra era)) Coin
L.treasuryDonationTxBodyL

mkAdaOnlyTxOut
  :: ShelleyBasedEra era
  -> L.Addr (L.EraCrypto (ShelleyLedgerEra era))
  -> L.Coin
  -> L.TxOut (ShelleyLedgerEra era)
mkAdaOnlyTxOut :: forall era.
ShelleyBasedEra era
-> Addr (EraCrypto (ShelleyLedgerEra era))
-> Coin
-> TxOut (ShelleyLedgerEra era)
mkAdaOnlyTxOut ShelleyBasedEra era
sbe Addr (EraCrypto (ShelleyLedgerEra era))
addr Coin
coin =
  ShelleyBasedEra era
-> Addr (EraCrypto (ShelleyLedgerEra era))
-> Value (ShelleyLedgerEra era)
-> TxOut (ShelleyLedgerEra era)
forall era.
ShelleyBasedEra era
-> Addr (EraCrypto (ShelleyLedgerEra era))
-> Value (ShelleyLedgerEra era)
-> TxOut (ShelleyLedgerEra era)
mkBasicTxOut ShelleyBasedEra era
sbe Addr (EraCrypto (ShelleyLedgerEra era))
addr (ShelleyBasedEra era -> Coin -> Value (ShelleyLedgerEra era)
forall era.
ShelleyBasedEra era -> Coin -> Value (ShelleyLedgerEra era)
mkAdaValue ShelleyBasedEra era
sbe Coin
coin)

mkBasicTxOut
  :: ShelleyBasedEra era
  -> L.Addr (L.EraCrypto (ShelleyLedgerEra era))
  -> L.Value (ShelleyLedgerEra era)
  -> L.TxOut (ShelleyLedgerEra era)
mkBasicTxOut :: forall era.
ShelleyBasedEra era
-> Addr (EraCrypto (ShelleyLedgerEra era))
-> Value (ShelleyLedgerEra era)
-> TxOut (ShelleyLedgerEra era)
mkBasicTxOut ShelleyBasedEra era
sbe Addr (EraCrypto (ShelleyLedgerEra era))
addr Value (ShelleyLedgerEra era)
value =
  ShelleyBasedEra era
-> (ShelleyBasedEraConstraints era => TxOut (ShelleyLedgerEra era))
-> TxOut (ShelleyLedgerEra era)
forall era a.
ShelleyBasedEra era -> (ShelleyBasedEraConstraints era => a) -> a
shelleyBasedEraConstraints ShelleyBasedEra era
sbe ((ShelleyBasedEraConstraints era => TxOut (ShelleyLedgerEra era))
 -> TxOut (ShelleyLedgerEra era))
-> (ShelleyBasedEraConstraints era => TxOut (ShelleyLedgerEra era))
-> TxOut (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$ Addr (EraCrypto (ShelleyLedgerEra era))
-> Value (ShelleyLedgerEra era) -> TxOut (ShelleyLedgerEra era)
forall era.
(EraTxOut era, HasCallStack) =>
Addr (EraCrypto era) -> Value era -> TxOut era
L.mkBasicTxOut Addr (EraCrypto (ShelleyLedgerEra era))
addr Value (ShelleyLedgerEra era)
value

mkAdaValue :: ShelleyBasedEra era -> L.Coin -> L.Value (ShelleyLedgerEra era)
mkAdaValue :: forall era.
ShelleyBasedEra era -> Coin -> Value (ShelleyLedgerEra era)
mkAdaValue ShelleyBasedEra era
sbe Coin
coin =
  (ShelleyToAllegraEraConstraints era =>
 ShelleyToAllegraEra era -> Value (ShelleyLedgerEra era))
-> (MaryEraOnwardsConstraints era =>
    MaryEraOnwards era -> Value (ShelleyLedgerEra era))
-> ShelleyBasedEra era
-> Value (ShelleyLedgerEra era)
forall era a.
(ShelleyToAllegraEraConstraints era =>
 ShelleyToAllegraEra era -> a)
-> (MaryEraOnwardsConstraints era => MaryEraOnwards era -> a)
-> ShelleyBasedEra era
-> a
caseShelleyToAllegraOrMaryEraOnwards
    (Value (ShelleyLedgerEra era)
-> ShelleyToAllegraEra era -> Value (ShelleyLedgerEra era)
forall a b. a -> b -> a
const Value (ShelleyLedgerEra era)
Coin
coin)
    (Value (ShelleyLedgerEra era)
-> MaryEraOnwards era -> Value (ShelleyLedgerEra era)
forall a b. a -> b -> a
const (Coin -> MultiAsset StandardCrypto -> MaryValue StandardCrypto
forall c. Coin -> MultiAsset c -> MaryValue c
L.MaryValue Coin
coin MultiAsset StandardCrypto
forall a. Monoid a => a
mempty))
    ShelleyBasedEra era
sbe

adaAssetL :: ShelleyBasedEra era -> Lens' (L.Value (ShelleyLedgerEra era)) L.Coin
adaAssetL :: forall era.
ShelleyBasedEra era -> Lens' (Value (ShelleyLedgerEra era)) Coin
adaAssetL ShelleyBasedEra era
sbe =
  (ShelleyToAllegraEraConstraints era =>
 ShelleyToAllegraEra era
 -> (Coin -> f Coin)
 -> Value (ShelleyLedgerEra era)
 -> f (Value (ShelleyLedgerEra era)))
-> (MaryEraOnwardsConstraints era =>
    MaryEraOnwards era
    -> (Coin -> f Coin)
    -> Value (ShelleyLedgerEra era)
    -> f (Value (ShelleyLedgerEra era)))
-> ShelleyBasedEra era
-> (Coin -> f Coin)
-> Value (ShelleyLedgerEra era)
-> f (Value (ShelleyLedgerEra era))
forall era a.
(ShelleyToAllegraEraConstraints era =>
 ShelleyToAllegraEra era -> a)
-> (MaryEraOnwardsConstraints era => MaryEraOnwards era -> a)
-> ShelleyBasedEra era
-> a
caseShelleyToAllegraOrMaryEraOnwards
    ShelleyToAllegraEraConstraints era =>
ShelleyToAllegraEra era
-> (Coin -> f Coin)
-> Value (ShelleyLedgerEra era)
-> f (Value (ShelleyLedgerEra era))
ShelleyToAllegraEra era
-> (Coin -> f Coin)
-> Value (ShelleyLedgerEra era)
-> f (Value (ShelleyLedgerEra era))
ShelleyToAllegraEra era
-> Lens' (Value (ShelleyLedgerEra era)) Coin
forall era.
ShelleyToAllegraEra era
-> Lens' (Value (ShelleyLedgerEra era)) Coin
adaAssetShelleyToAllegraEraL
    MaryEraOnwardsConstraints era =>
MaryEraOnwards era
-> (Coin -> f Coin)
-> Value (ShelleyLedgerEra era)
-> f (Value (ShelleyLedgerEra era))
MaryEraOnwards era
-> (Coin -> f Coin)
-> Value (ShelleyLedgerEra era)
-> f (Value (ShelleyLedgerEra era))
MaryEraOnwards era -> Lens' (MaryValue StandardCrypto) Coin
forall era.
MaryEraOnwards era -> Lens' (MaryValue StandardCrypto) Coin
adaAssetMaryEraOnwardsL
    ShelleyBasedEra era
sbe

adaAssetShelleyToAllegraEraL
  :: ShelleyToAllegraEra era -> Lens' (L.Value (ShelleyLedgerEra era)) L.Coin
adaAssetShelleyToAllegraEraL :: forall era.
ShelleyToAllegraEra era
-> Lens' (Value (ShelleyLedgerEra era)) Coin
adaAssetShelleyToAllegraEraL ShelleyToAllegraEra era
w =
  ShelleyToAllegraEra era
-> (ShelleyToAllegraEraConstraints era =>
    (Coin -> f Coin)
    -> Value (ShelleyLedgerEra era)
    -> f (Value (ShelleyLedgerEra era)))
-> (Coin -> f Coin)
-> Value (ShelleyLedgerEra era)
-> f (Value (ShelleyLedgerEra era))
forall era a.
ShelleyToAllegraEra era
-> (ShelleyToAllegraEraConstraints era => a) -> a
shelleyToAllegraEraConstraints ShelleyToAllegraEra era
w ((ShelleyToAllegraEraConstraints era =>
  (Coin -> f Coin)
  -> Value (ShelleyLedgerEra era)
  -> f (Value (ShelleyLedgerEra era)))
 -> (Coin -> f Coin)
 -> Value (ShelleyLedgerEra era)
 -> f (Value (ShelleyLedgerEra era)))
-> (ShelleyToAllegraEraConstraints era =>
    (Coin -> f Coin)
    -> Value (ShelleyLedgerEra era)
    -> f (Value (ShelleyLedgerEra era)))
-> (Coin -> f Coin)
-> Value (ShelleyLedgerEra era)
-> f (Value (ShelleyLedgerEra era))
forall a b. (a -> b) -> a -> b
$ (Coin -> Coin)
-> (Coin -> Coin -> Coin) -> Lens Coin Coin Coin Coin
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Coin -> Coin
forall a. a -> a
id Coin -> Coin -> Coin
forall a b. a -> b -> a
const

adaAssetMaryEraOnwardsL :: MaryEraOnwards era -> Lens' (L.MaryValue L.StandardCrypto) L.Coin
adaAssetMaryEraOnwardsL :: forall era.
MaryEraOnwards era -> Lens' (MaryValue StandardCrypto) Coin
adaAssetMaryEraOnwardsL MaryEraOnwards era
w =
  MaryEraOnwards era
-> (MaryEraOnwardsConstraints era =>
    (Coin -> f Coin)
    -> MaryValue StandardCrypto -> f (MaryValue StandardCrypto))
-> (Coin -> f Coin)
-> MaryValue StandardCrypto
-> f (MaryValue StandardCrypto)
forall era a.
MaryEraOnwards era -> (MaryEraOnwardsConstraints era => a) -> a
maryEraOnwardsConstraints MaryEraOnwards era
w ((MaryEraOnwardsConstraints era =>
  (Coin -> f Coin)
  -> MaryValue StandardCrypto -> f (MaryValue StandardCrypto))
 -> (Coin -> f Coin)
 -> MaryValue StandardCrypto
 -> f (MaryValue StandardCrypto))
-> (MaryEraOnwardsConstraints era =>
    (Coin -> f Coin)
    -> MaryValue StandardCrypto -> f (MaryValue StandardCrypto))
-> (Coin -> f Coin)
-> MaryValue StandardCrypto
-> f (MaryValue StandardCrypto)
forall a b. (a -> b) -> a -> b
$
    (MaryValue StandardCrypto -> Coin)
-> (MaryValue StandardCrypto -> Coin -> MaryValue StandardCrypto)
-> Lens' (MaryValue StandardCrypto) Coin
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens
      (\(L.MaryValue Coin
c MultiAsset StandardCrypto
_) -> Coin
c)
      (\(L.MaryValue Coin
_ MultiAsset StandardCrypto
ma) Coin
c -> Coin -> MultiAsset StandardCrypto -> MaryValue StandardCrypto
forall c. Coin -> MultiAsset c -> MaryValue c
L.MaryValue Coin
c MultiAsset StandardCrypto
ma)

multiAssetL
  :: MaryEraOnwards era -> Lens' (L.MaryValue L.StandardCrypto) (L.MultiAsset L.StandardCrypto)
multiAssetL :: forall era.
MaryEraOnwards era
-> Lens' (MaryValue StandardCrypto) (MultiAsset StandardCrypto)
multiAssetL MaryEraOnwards era
w =
  MaryEraOnwards era
-> (MaryEraOnwardsConstraints era =>
    (MultiAsset StandardCrypto -> f (MultiAsset StandardCrypto))
    -> MaryValue StandardCrypto -> f (MaryValue StandardCrypto))
-> (MultiAsset StandardCrypto -> f (MultiAsset StandardCrypto))
-> MaryValue StandardCrypto
-> f (MaryValue StandardCrypto)
forall era a.
MaryEraOnwards era -> (MaryEraOnwardsConstraints era => a) -> a
maryEraOnwardsConstraints MaryEraOnwards era
w ((MaryEraOnwardsConstraints era =>
  (MultiAsset StandardCrypto -> f (MultiAsset StandardCrypto))
  -> MaryValue StandardCrypto -> f (MaryValue StandardCrypto))
 -> (MultiAsset StandardCrypto -> f (MultiAsset StandardCrypto))
 -> MaryValue StandardCrypto
 -> f (MaryValue StandardCrypto))
-> (MaryEraOnwardsConstraints era =>
    (MultiAsset StandardCrypto -> f (MultiAsset StandardCrypto))
    -> MaryValue StandardCrypto -> f (MaryValue StandardCrypto))
-> (MultiAsset StandardCrypto -> f (MultiAsset StandardCrypto))
-> MaryValue StandardCrypto
-> f (MaryValue StandardCrypto)
forall a b. (a -> b) -> a -> b
$
    (MaryValue StandardCrypto -> MultiAsset StandardCrypto)
-> (MaryValue StandardCrypto
    -> MultiAsset StandardCrypto -> MaryValue StandardCrypto)
-> Lens' (MaryValue StandardCrypto) (MultiAsset StandardCrypto)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens
      (\(L.MaryValue Coin
_ MultiAsset StandardCrypto
ma) -> MultiAsset StandardCrypto
ma)
      (\(L.MaryValue Coin
c MultiAsset StandardCrypto
_) MultiAsset StandardCrypto
ma -> Coin -> MultiAsset StandardCrypto -> MaryValue StandardCrypto
forall c. Coin -> MultiAsset c -> MaryValue c
L.MaryValue Coin
c MultiAsset StandardCrypto
ma)

valueTxOutL
  :: ShelleyBasedEra era -> Lens' (L.TxOut (ShelleyLedgerEra era)) (L.Value (ShelleyLedgerEra era))
valueTxOutL :: forall era.
ShelleyBasedEra era
-> Lens'
     (TxOut (ShelleyLedgerEra era)) (Value (ShelleyLedgerEra era))
valueTxOutL ShelleyBasedEra era
sbe = ShelleyBasedEra era
-> (ShelleyBasedEraConstraints era =>
    (Value (ShelleyLedgerEra era) -> f (Value (ShelleyLedgerEra era)))
    -> TxOut (ShelleyLedgerEra era)
    -> f (TxOut (ShelleyLedgerEra era)))
-> (Value (ShelleyLedgerEra era)
    -> f (Value (ShelleyLedgerEra era)))
-> TxOut (ShelleyLedgerEra era)
-> f (TxOut (ShelleyLedgerEra era))
forall era a.
ShelleyBasedEra era -> (ShelleyBasedEraConstraints era => a) -> a
shelleyBasedEraConstraints ShelleyBasedEra era
sbe ShelleyBasedEraConstraints era =>
(Value (ShelleyLedgerEra era) -> f (Value (ShelleyLedgerEra era)))
-> TxOut (ShelleyLedgerEra era) -> f (TxOut (ShelleyLedgerEra era))
(Value (ShelleyLedgerEra era) -> f (Value (ShelleyLedgerEra era)))
-> TxOut (ShelleyLedgerEra era) -> f (TxOut (ShelleyLedgerEra era))
forall era. EraTxOut era => Lens' (TxOut era) (Value era)
Lens' (TxOut (ShelleyLedgerEra era)) (Value (ShelleyLedgerEra era))
L.valueTxOutL

valueTxOutAdaAssetL :: ShelleyBasedEra era -> Lens' (L.TxOut (ShelleyLedgerEra era)) L.Coin
valueTxOutAdaAssetL :: forall era.
ShelleyBasedEra era -> Lens' (TxOut (ShelleyLedgerEra era)) Coin
valueTxOutAdaAssetL ShelleyBasedEra era
sbe = ShelleyBasedEra era
-> Lens'
     (TxOut (ShelleyLedgerEra era)) (Value (ShelleyLedgerEra era))
forall era.
ShelleyBasedEra era
-> Lens'
     (TxOut (ShelleyLedgerEra era)) (Value (ShelleyLedgerEra era))
valueTxOutL ShelleyBasedEra era
sbe ((Value (ShelleyLedgerEra era) -> f (Value (ShelleyLedgerEra era)))
 -> TxOut (ShelleyLedgerEra era)
 -> f (TxOut (ShelleyLedgerEra era)))
-> ((Coin -> f Coin)
    -> Value (ShelleyLedgerEra era)
    -> f (Value (ShelleyLedgerEra era)))
-> (Coin -> f Coin)
-> TxOut (ShelleyLedgerEra era)
-> f (TxOut (ShelleyLedgerEra era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShelleyBasedEra era -> Lens' (Value (ShelleyLedgerEra era)) Coin
forall era.
ShelleyBasedEra era -> Lens' (Value (ShelleyLedgerEra era)) Coin
adaAssetL ShelleyBasedEra era
sbe