{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeOperators #-}

-- | This module provides a way to construct a simple transaction over all eras.
-- It is exposed for testing purposes only.
module Cardano.Api.Tx.Compatible
  ( AnyProtocolUpdate (..)
  , AnyVote (..)
  , createCompatibleSignedTx
  )
where

import           Cardano.Api.Eon.Convert
import           Cardano.Api.Eon.ConwayEraOnwards
import           Cardano.Api.Eon.ShelleyBasedEra
import           Cardano.Api.Eon.ShelleyToBabbageEra
import           Cardano.Api.ProtocolParameters
import           Cardano.Api.Script
import           Cardano.Api.Tx.Body
import           Cardano.Api.Tx.Sign
import           Cardano.Api.Value

import qualified Cardano.Ledger.Api as L

import           Control.Error (catMaybes)
import qualified Data.Map.Strict as Map
import           Data.Maybe.Strict
import qualified Data.Sequence.Strict as Seq
import           Data.Set (fromList)
import           Lens.Micro

data AnyProtocolUpdate era where
  ProtocolUpdate
    :: ShelleyToBabbageEra era
    -> UpdateProposal
    -> AnyProtocolUpdate era
  ProposalProcedures
    :: ConwayEraOnwards era
    -> TxProposalProcedures BuildTx era
    -> AnyProtocolUpdate era
  NoPParamsUpdate
    :: ShelleyBasedEra era
    -> AnyProtocolUpdate era

data AnyVote era where
  VotingProcedures
    :: ConwayEraOnwards era
    -> TxVotingProcedures BuildTx era
    -> AnyVote era
  NoVotes :: AnyVote era

createCompatibleSignedTx
  :: forall era
   . ShelleyBasedEra era
  -> [TxIn]
  -> [TxOut CtxTx era]
  -> [KeyWitness era]
  -> Lovelace
  -- ^ Fee
  -> AnyProtocolUpdate era
  -> AnyVote era
  -> Either ProtocolParametersConversionError (Tx era)
createCompatibleSignedTx :: forall era.
ShelleyBasedEra era
-> [TxIn]
-> [TxOut CtxTx era]
-> [KeyWitness era]
-> Lovelace
-> AnyProtocolUpdate era
-> AnyVote era
-> Either ProtocolParametersConversionError (Tx era)
createCompatibleSignedTx ShelleyBasedEra era
sbeF [TxIn]
ins [TxOut CtxTx era]
outs [KeyWitness era]
witnesses Lovelace
txFee' AnyProtocolUpdate era
anyProtocolUpdate AnyVote era
anyVote =
  ShelleyBasedEra era
-> (ShelleyBasedEraConstraints era =>
    Either ProtocolParametersConversionError (Tx era))
-> Either ProtocolParametersConversionError (Tx era)
forall era a.
ShelleyBasedEra era -> (ShelleyBasedEraConstraints era => a) -> a
shelleyBasedEraConstraints ShelleyBasedEra era
sbeF ((ShelleyBasedEraConstraints era =>
  Either ProtocolParametersConversionError (Tx era))
 -> Either ProtocolParametersConversionError (Tx era))
-> (ShelleyBasedEraConstraints era =>
    Either ProtocolParametersConversionError (Tx era))
-> Either ProtocolParametersConversionError (Tx era)
forall a b. (a -> b) -> a -> b
$ do
    Tx era
tx <- case AnyProtocolUpdate era
anyProtocolUpdate of
      ProtocolUpdate ShelleyToBabbageEra era
shelleyToBabbageEra UpdateProposal
updateProposal -> do
        let sbe :: ShelleyBasedEra era
sbe = ShelleyToBabbageEra era -> ShelleyBasedEra era
forall era. ShelleyToBabbageEra era -> ShelleyBasedEra era
forall a (f :: a -> *) (g :: a -> *) (era :: a).
Convert f g =>
f era -> g era
convert ShelleyToBabbageEra era
shelleyToBabbageEra

        Update (ShelleyLedgerEra era)
ledgerPParamsUpdate <- ShelleyBasedEra era
-> UpdateProposal
-> Either
     ProtocolParametersConversionError (Update (ShelleyLedgerEra era))
forall era.
ShelleyBasedEra era
-> UpdateProposal
-> Either
     ProtocolParametersConversionError (Update (ShelleyLedgerEra era))
toLedgerUpdate ShelleyBasedEra era
sbe UpdateProposal
updateProposal

        let txbody :: TxBody (ShelleyLedgerEra era)
txbody = ShelleyBasedEra era
-> [TxIn]
-> [TxOut CtxTx era]
-> Lovelace
-> TxBody (ShelleyLedgerEra era)
forall era ctx.
ShelleyBasedEra era
-> [TxIn]
-> [TxOut ctx era]
-> Lovelace
-> TxBody (ShelleyLedgerEra era)
createCommonTxBody ShelleyBasedEra era
sbe [TxIn]
ins [TxOut CtxTx era]
outs Lovelace
txFee'
            bodyWithProtocolUpdate :: TxBody (ShelleyLedgerEra era)
bodyWithProtocolUpdate =
              ShelleyToBabbageEra era
-> (ShelleyToBabbageEraConstraints era =>
    TxBody (ShelleyLedgerEra era))
-> TxBody (ShelleyLedgerEra era)
forall era a.
ShelleyToBabbageEra era
-> (ShelleyToBabbageEraConstraints era => a) -> a
shelleyToBabbageEraConstraints ShelleyToBabbageEra era
shelleyToBabbageEra ((ShelleyToBabbageEraConstraints era =>
  TxBody (ShelleyLedgerEra era))
 -> TxBody (ShelleyLedgerEra era))
-> (ShelleyToBabbageEraConstraints era =>
    TxBody (ShelleyLedgerEra era))
-> TxBody (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
                TxBody (ShelleyLedgerEra era)
txbody TxBody (ShelleyLedgerEra era)
-> (TxBody (ShelleyLedgerEra era) -> TxBody (ShelleyLedgerEra era))
-> TxBody (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (StrictMaybe (Update (ShelleyLedgerEra era))
 -> Identity (StrictMaybe (Update (ShelleyLedgerEra era))))
-> TxBody (ShelleyLedgerEra era)
-> Identity (TxBody (ShelleyLedgerEra era))
forall era.
ShelleyEraTxBody era =>
Lens' (TxBody era) (StrictMaybe (Update era))
Lens'
  (TxBody (ShelleyLedgerEra era))
  (StrictMaybe (Update (ShelleyLedgerEra era)))
L.updateTxBodyL ((StrictMaybe (Update (ShelleyLedgerEra era))
  -> Identity (StrictMaybe (Update (ShelleyLedgerEra era))))
 -> TxBody (ShelleyLedgerEra era)
 -> Identity (TxBody (ShelleyLedgerEra era)))
-> StrictMaybe (Update (ShelleyLedgerEra era))
-> TxBody (ShelleyLedgerEra era)
-> TxBody (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Update (ShelleyLedgerEra era)
-> StrictMaybe (Update (ShelleyLedgerEra era))
forall a. a -> StrictMaybe a
SJust Update (ShelleyLedgerEra era)
ledgerPParamsUpdate
            finalTx :: Tx (ShelleyLedgerEra era)
finalTx =
              TxBody (ShelleyLedgerEra era) -> Tx (ShelleyLedgerEra era)
forall era. EraTx era => TxBody era -> Tx era
L.mkBasicTx TxBody (ShelleyLedgerEra era)
bodyWithProtocolUpdate
                Tx (ShelleyLedgerEra era)
-> (Tx (ShelleyLedgerEra era) -> Tx (ShelleyLedgerEra era))
-> Tx (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (TxWits (ShelleyLedgerEra era)
 -> Identity (TxWits (ShelleyLedgerEra era)))
-> Tx (ShelleyLedgerEra era)
-> Identity (Tx (ShelleyLedgerEra era))
forall era. EraTx era => Lens' (Tx era) (TxWits era)
Lens' (Tx (ShelleyLedgerEra era)) (TxWits (ShelleyLedgerEra era))
L.witsTxL ((TxWits (ShelleyLedgerEra era)
  -> Identity (TxWits (ShelleyLedgerEra era)))
 -> Tx (ShelleyLedgerEra era)
 -> Identity (Tx (ShelleyLedgerEra era)))
-> TxWits (ShelleyLedgerEra era)
-> Tx (ShelleyLedgerEra era)
-> Tx (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ShelleyToBabbageEra era
-> (ShelleyToBabbageEraConstraints era =>
    TxWits (ShelleyLedgerEra era))
-> TxWits (ShelleyLedgerEra era)
forall era a.
ShelleyToBabbageEra era
-> (ShelleyToBabbageEraConstraints era => a) -> a
shelleyToBabbageEraConstraints ShelleyToBabbageEra era
shelleyToBabbageEra TxWits (ShelleyLedgerEra era)
ShelleyToBabbageEraConstraints era => TxWits (ShelleyLedgerEra era)
forall era.
(EraTxWits (ShelleyLedgerEra era),
 EraCrypto (ShelleyLedgerEra era) ~ StandardCrypto) =>
TxWits (ShelleyLedgerEra era)
allShelleyToBabbageWitnesses

        Tx era -> Either ProtocolParametersConversionError (Tx era)
forall a. a -> Either ProtocolParametersConversionError a
forall (m :: * -> *) a. Monad m => a -> m a
return (Tx era -> Either ProtocolParametersConversionError (Tx era))
-> Tx era -> Either ProtocolParametersConversionError (Tx era)
forall a b. (a -> b) -> a -> b
$ ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
forall era.
ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
ShelleyTx ShelleyBasedEra era
sbe Tx (ShelleyLedgerEra era)
finalTx
      NoPParamsUpdate ShelleyBasedEra era
sbe -> do
        let txbody :: TxBody (ShelleyLedgerEra era)
txbody = ShelleyBasedEra era
-> [TxIn]
-> [TxOut CtxTx era]
-> Lovelace
-> TxBody (ShelleyLedgerEra era)
forall era ctx.
ShelleyBasedEra era
-> [TxIn]
-> [TxOut ctx era]
-> Lovelace
-> TxBody (ShelleyLedgerEra era)
createCommonTxBody ShelleyBasedEra era
sbe [TxIn]
ins [TxOut CtxTx era]
outs Lovelace
txFee'
            finalTx :: Tx (ShelleyLedgerEra era)
finalTx = TxBody (ShelleyLedgerEra era) -> Tx (ShelleyLedgerEra era)
forall era. EraTx era => TxBody era -> Tx era
L.mkBasicTx TxBody (ShelleyLedgerEra era)
txbody Tx (ShelleyLedgerEra era)
-> (Tx (ShelleyLedgerEra era) -> Tx (ShelleyLedgerEra era))
-> Tx (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (TxWits (ShelleyLedgerEra era)
 -> Identity (TxWits (ShelleyLedgerEra era)))
-> Tx (ShelleyLedgerEra era)
-> Identity (Tx (ShelleyLedgerEra era))
forall era. EraTx era => Lens' (Tx era) (TxWits era)
Lens' (Tx (ShelleyLedgerEra era)) (TxWits (ShelleyLedgerEra era))
L.witsTxL ((TxWits (ShelleyLedgerEra era)
  -> Identity (TxWits (ShelleyLedgerEra era)))
 -> Tx (ShelleyLedgerEra era)
 -> Identity (Tx (ShelleyLedgerEra era)))
-> TxWits (ShelleyLedgerEra era)
-> Tx (ShelleyLedgerEra era)
-> Tx (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ShelleyBasedEra era
-> (ShelleyBasedEraConstraints era =>
    TxWits (ShelleyLedgerEra era))
-> TxWits (ShelleyLedgerEra era)
forall era a.
ShelleyBasedEra era -> (ShelleyBasedEraConstraints era => a) -> a
shelleyBasedEraConstraints ShelleyBasedEra era
sbe TxWits (ShelleyLedgerEra era)
ShelleyBasedEraConstraints era => TxWits (ShelleyLedgerEra era)
forall era.
(EraTxWits (ShelleyLedgerEra era),
 EraCrypto (ShelleyLedgerEra era) ~ StandardCrypto) =>
TxWits (ShelleyLedgerEra era)
allShelleyToBabbageWitnesses

        Tx era -> Either ProtocolParametersConversionError (Tx era)
forall a. a -> Either ProtocolParametersConversionError a
forall (m :: * -> *) a. Monad m => a -> m a
return (Tx era -> Either ProtocolParametersConversionError (Tx era))
-> Tx era -> Either ProtocolParametersConversionError (Tx era)
forall a b. (a -> b) -> a -> b
$ ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
forall era.
ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
ShelleyTx ShelleyBasedEra era
sbe Tx (ShelleyLedgerEra era)
finalTx
      ProposalProcedures ConwayEraOnwards era
conwayOnwards TxProposalProcedures BuildTx era
proposalProcedures -> do
        let sbe :: ShelleyBasedEra era
sbe = ConwayEraOnwards era -> ShelleyBasedEra era
forall era. ConwayEraOnwards era -> ShelleyBasedEra era
forall a (f :: a -> *) (g :: a -> *) (era :: a).
Convert f g =>
f era -> g era
convert ConwayEraOnwards era
conwayOnwards
            proposals :: OSet (ProposalProcedure (ShelleyLedgerEra era))
proposals = TxProposalProcedures BuildTx era
-> OSet (ProposalProcedure (ShelleyLedgerEra era))
forall build era.
TxProposalProcedures build era
-> OSet (ProposalProcedure (ShelleyLedgerEra era))
convProposalProcedures TxProposalProcedures BuildTx era
proposalProcedures
            apiScriptWitnesses :: [(ScriptWitnessIndex, AnyScriptWitness era)]
apiScriptWitnesses = TxProposalProcedures BuildTx era
-> [(ScriptWitnessIndex, AnyScriptWitness era)]
forall era.
TxProposalProcedures BuildTx era
-> [(ScriptWitnessIndex, AnyScriptWitness era)]
scriptWitnessesProposing TxProposalProcedures BuildTx era
proposalProcedures
            ledgerScripts :: [Script (ShelleyLedgerEra era)]
ledgerScripts = [(ScriptWitnessIndex, AnyScriptWitness era)]
-> [Script (ShelleyLedgerEra era)]
forall era ledgerera.
(ShelleyLedgerEra era ~ ledgerera) =>
[(ScriptWitnessIndex, AnyScriptWitness era)] -> [Script ledgerera]
convScripts [(ScriptWitnessIndex, AnyScriptWitness era)]
apiScriptWitnesses
            referenceInputs :: [TxIn StandardCrypto]
referenceInputs =
              (TxIn -> TxIn StandardCrypto) -> [TxIn] -> [TxIn StandardCrypto]
forall a b. (a -> b) -> [a] -> [b]
map TxIn -> TxIn StandardCrypto
toShelleyTxIn ([TxIn] -> [TxIn StandardCrypto])
-> [TxIn] -> [TxIn StandardCrypto]
forall a b. (a -> b) -> a -> b
$
                [Maybe TxIn] -> [TxIn]
forall a. [Maybe a] -> [a]
catMaybes [ScriptWitness witctx era -> Maybe TxIn
forall witctx era. ScriptWitness witctx era -> Maybe TxIn
getScriptWitnessReferenceInput ScriptWitness witctx era
sWit | (ScriptWitnessIndex
_, AnyScriptWitness ScriptWitness witctx era
sWit) <- [(ScriptWitnessIndex, AnyScriptWitness era)]
apiScriptWitnesses]
            sData :: TxBodyScriptData era
sData = ShelleyBasedEra era
-> [TxOut CtxTx era]
-> [(ScriptWitnessIndex, AnyScriptWitness era)]
-> TxBodyScriptData era
forall era.
ShelleyBasedEra era
-> [TxOut CtxTx era]
-> [(ScriptWitnessIndex, AnyScriptWitness era)]
-> TxBodyScriptData era
convScriptData ShelleyBasedEra era
sbe [TxOut CtxTx era]
outs [(ScriptWitnessIndex, AnyScriptWitness era)]
apiScriptWitnesses
            txbody :: TxBody (ShelleyLedgerEra era)
txbody =
              ConwayEraOnwards era
-> (ConwayEraOnwardsConstraints era =>
    TxBody (ShelleyLedgerEra era))
-> TxBody (ShelleyLedgerEra era)
forall era a.
ConwayEraOnwards era -> (ConwayEraOnwardsConstraints era => a) -> a
conwayEraOnwardsConstraints ConwayEraOnwards era
conwayOnwards ((ConwayEraOnwardsConstraints era => TxBody (ShelleyLedgerEra era))
 -> TxBody (ShelleyLedgerEra era))
-> (ConwayEraOnwardsConstraints era =>
    TxBody (ShelleyLedgerEra era))
-> TxBody (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
                ShelleyBasedEra era
-> [TxIn]
-> [TxOut CtxTx era]
-> Lovelace
-> TxBody (ShelleyLedgerEra era)
forall era ctx.
ShelleyBasedEra era
-> [TxIn]
-> [TxOut ctx era]
-> Lovelace
-> TxBody (ShelleyLedgerEra era)
createCommonTxBody ShelleyBasedEra era
sbe [TxIn]
ins [TxOut CtxTx era]
outs Lovelace
txFee'
                  TxBody (ShelleyLedgerEra era)
-> (TxBody (ShelleyLedgerEra era) -> TxBody (ShelleyLedgerEra era))
-> TxBody (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (Set (TxIn (EraCrypto (ShelleyLedgerEra era)))
 -> Identity (Set (TxIn (EraCrypto (ShelleyLedgerEra era)))))
-> TxBody (ShelleyLedgerEra era)
-> Identity (TxBody (ShelleyLedgerEra era))
(Set (TxIn (EraCrypto (ShelleyLedgerEra era)))
 -> Identity (Set (TxIn StandardCrypto)))
-> TxBody (ShelleyLedgerEra era)
-> Identity (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 ((Set (TxIn (EraCrypto (ShelleyLedgerEra era)))
  -> Identity (Set (TxIn StandardCrypto)))
 -> TxBody (ShelleyLedgerEra era)
 -> Identity (TxBody (ShelleyLedgerEra era)))
-> Set (TxIn StandardCrypto)
-> TxBody (ShelleyLedgerEra era)
-> TxBody (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ [TxIn StandardCrypto] -> Set (TxIn StandardCrypto)
forall a. Ord a => [a] -> Set a
fromList [TxIn StandardCrypto]
referenceInputs
                  TxBody (ShelleyLedgerEra era)
-> (TxBody (ShelleyLedgerEra era) -> TxBody (ShelleyLedgerEra era))
-> TxBody (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (OSet (ProposalProcedure (ShelleyLedgerEra era))
 -> Identity (OSet (ProposalProcedure (ShelleyLedgerEra era))))
-> TxBody (ShelleyLedgerEra era)
-> Identity (TxBody (ShelleyLedgerEra era))
forall era.
ConwayEraTxBody era =>
Lens' (TxBody era) (OSet (ProposalProcedure era))
Lens'
  (TxBody (ShelleyLedgerEra era))
  (OSet (ProposalProcedure (ShelleyLedgerEra era)))
L.proposalProceduresTxBodyL
                    ((OSet (ProposalProcedure (ShelleyLedgerEra era))
  -> Identity (OSet (ProposalProcedure (ShelleyLedgerEra era))))
 -> TxBody (ShelleyLedgerEra era)
 -> Identity (TxBody (ShelleyLedgerEra era)))
-> OSet (ProposalProcedure (ShelleyLedgerEra era))
-> TxBody (ShelleyLedgerEra era)
-> TxBody (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ OSet (ProposalProcedure (ShelleyLedgerEra era))
proposals

            finalTx :: Tx (ShelleyLedgerEra era)
finalTx =
              TxBody (ShelleyLedgerEra era) -> Tx (ShelleyLedgerEra era)
forall era. EraTx era => TxBody era -> Tx era
L.mkBasicTx TxBody (ShelleyLedgerEra era)
txbody
                Tx (ShelleyLedgerEra era)
-> (Tx (ShelleyLedgerEra era) -> Tx (ShelleyLedgerEra era))
-> Tx (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (TxWits (ShelleyLedgerEra era)
 -> Identity (TxWits (ShelleyLedgerEra era)))
-> Tx (ShelleyLedgerEra era)
-> Identity (Tx (ShelleyLedgerEra era))
forall era. EraTx era => Lens' (Tx era) (TxWits era)
Lens' (Tx (ShelleyLedgerEra era)) (TxWits (ShelleyLedgerEra era))
L.witsTxL
                  ((TxWits (ShelleyLedgerEra era)
  -> Identity (TxWits (ShelleyLedgerEra era)))
 -> Tx (ShelleyLedgerEra era)
 -> Identity (Tx (ShelleyLedgerEra era)))
-> TxWits (ShelleyLedgerEra era)
-> Tx (ShelleyLedgerEra era)
-> Tx (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ConwayEraOnwards era
-> (ConwayEraOnwardsConstraints era =>
    TxWits (ShelleyLedgerEra era))
-> TxWits (ShelleyLedgerEra era)
forall era a.
ConwayEraOnwards era -> (ConwayEraOnwardsConstraints era => a) -> a
conwayEraOnwardsConstraints ConwayEraOnwards era
conwayOnwards (TxBodyScriptData era
-> [Script (ShelleyLedgerEra era)] -> TxWits (ShelleyLedgerEra era)
forall era.
(AlonzoEraTxWits (ShelleyLedgerEra era),
 EraCrypto (ShelleyLedgerEra era) ~ StandardCrypto) =>
TxBodyScriptData era
-> [Script (ShelleyLedgerEra era)] -> TxWits (ShelleyLedgerEra era)
allConwayEraOnwardsWitnesses TxBodyScriptData era
sData [Script (ShelleyLedgerEra era)]
ledgerScripts)

        Tx era -> Either ProtocolParametersConversionError (Tx era)
forall a. a -> Either ProtocolParametersConversionError a
forall (m :: * -> *) a. Monad m => a -> m a
return (Tx era -> Either ProtocolParametersConversionError (Tx era))
-> Tx era -> Either ProtocolParametersConversionError (Tx era)
forall a b. (a -> b) -> a -> b
$ ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
forall era.
ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
ShelleyTx ShelleyBasedEra era
sbe Tx (ShelleyLedgerEra era)
finalTx

    case AnyVote era
anyVote of
      AnyVote era
NoVotes -> Tx era -> Either ProtocolParametersConversionError (Tx era)
forall a. a -> Either ProtocolParametersConversionError a
forall (m :: * -> *) a. Monad m => a -> m a
return Tx era
tx
      VotingProcedures ConwayEraOnwards era
conwayOnwards TxVotingProcedures BuildTx era
procedures -> do
        let ledgerVotingProcedures :: VotingProcedures (ShelleyLedgerEra era)
ledgerVotingProcedures = TxVotingProcedures BuildTx era
-> VotingProcedures (ShelleyLedgerEra era)
forall build era.
TxVotingProcedures build era
-> VotingProcedures (ShelleyLedgerEra era)
convVotingProcedures TxVotingProcedures BuildTx era
procedures
            ShelleyTx ShelleyBasedEra era
sbe' Tx (ShelleyLedgerEra era)
fTx = Tx era
tx
            updatedTx :: Tx (ShelleyLedgerEra era)
updatedTx =
              ConwayEraOnwards era
-> (ConwayEraOnwardsConstraints era => Tx (ShelleyLedgerEra era))
-> Tx (ShelleyLedgerEra era)
forall era a.
ConwayEraOnwards era -> (ConwayEraOnwardsConstraints era => a) -> a
conwayEraOnwardsConstraints ConwayEraOnwards era
conwayOnwards ((ConwayEraOnwardsConstraints era => Tx (ShelleyLedgerEra era))
 -> Tx (ShelleyLedgerEra era))
-> (ConwayEraOnwardsConstraints era => Tx (ShelleyLedgerEra era))
-> Tx (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
                Tx (ShelleyLedgerEra era)
-> VotingProcedures (ShelleyLedgerEra era)
-> Tx (ShelleyLedgerEra era)
forall ledgerera.
(ConwayEraTxBody ledgerera, EraTx ledgerera) =>
Tx ledgerera -> VotingProcedures ledgerera -> Tx ledgerera
overwriteVotingProcedures Tx (ShelleyLedgerEra era)
fTx VotingProcedures (ShelleyLedgerEra era)
ledgerVotingProcedures
        Tx era -> Either ProtocolParametersConversionError (Tx era)
forall a. a -> Either ProtocolParametersConversionError a
forall (m :: * -> *) a. Monad m => a -> m a
return (Tx era -> Either ProtocolParametersConversionError (Tx era))
-> Tx era -> Either ProtocolParametersConversionError (Tx era)
forall a b. (a -> b) -> a -> b
$ ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
forall era.
ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
ShelleyTx ShelleyBasedEra era
sbe' Tx (ShelleyLedgerEra era)
updatedTx
 where
  overwriteVotingProcedures
    :: L.ConwayEraTxBody ledgerera
    => L.EraTx ledgerera
    => L.Tx ledgerera -> L.VotingProcedures ledgerera -> L.Tx ledgerera
  overwriteVotingProcedures :: forall ledgerera.
(ConwayEraTxBody ledgerera, EraTx ledgerera) =>
Tx ledgerera -> VotingProcedures ledgerera -> Tx ledgerera
overwriteVotingProcedures Tx ledgerera
lTx VotingProcedures ledgerera
vProcedures =
    Tx ledgerera
lTx Tx ledgerera -> (Tx ledgerera -> Tx ledgerera) -> Tx ledgerera
forall a b. a -> (a -> b) -> b
& ((TxBody ledgerera -> Identity (TxBody ledgerera))
-> Tx ledgerera -> Identity (Tx ledgerera)
forall era. EraTx era => Lens' (Tx era) (TxBody era)
Lens' (Tx ledgerera) (TxBody ledgerera)
L.bodyTxL ((TxBody ledgerera -> Identity (TxBody ledgerera))
 -> Tx ledgerera -> Identity (Tx ledgerera))
-> ((VotingProcedures ledgerera
     -> Identity (VotingProcedures ledgerera))
    -> TxBody ledgerera -> Identity (TxBody ledgerera))
-> (VotingProcedures ledgerera
    -> Identity (VotingProcedures ledgerera))
-> Tx ledgerera
-> Identity (Tx ledgerera)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (VotingProcedures ledgerera
 -> Identity (VotingProcedures ledgerera))
-> TxBody ledgerera -> Identity (TxBody ledgerera)
forall era.
ConwayEraTxBody era =>
Lens' (TxBody era) (VotingProcedures era)
Lens' (TxBody ledgerera) (VotingProcedures ledgerera)
L.votingProceduresTxBodyL) ((VotingProcedures ledgerera
  -> Identity (VotingProcedures ledgerera))
 -> Tx ledgerera -> Identity (Tx ledgerera))
-> VotingProcedures ledgerera -> Tx ledgerera -> Tx ledgerera
forall s t a b. ASetter s t a b -> b -> s -> t
.~ VotingProcedures ledgerera
vProcedures

  shelleyKeywitnesses :: Set (WitVKey 'Witness StandardCrypto)
shelleyKeywitnesses =
    [WitVKey 'Witness StandardCrypto]
-> Set (WitVKey 'Witness StandardCrypto)
forall a. Ord a => [a] -> Set a
fromList [WitVKey 'Witness StandardCrypto
w | ShelleyKeyWitness ShelleyBasedEra era
_ WitVKey 'Witness StandardCrypto
w <- [KeyWitness era]
witnesses]

  shelleyBootstrapWitnesses :: Set (BootstrapWitness StandardCrypto)
shelleyBootstrapWitnesses =
    [BootstrapWitness StandardCrypto]
-> Set (BootstrapWitness StandardCrypto)
forall a. Ord a => [a] -> Set a
fromList [BootstrapWitness StandardCrypto
w | ShelleyBootstrapWitness ShelleyBasedEra era
_ BootstrapWitness StandardCrypto
w <- [KeyWitness era]
witnesses]

  allConwayEraOnwardsWitnesses
    :: L.AlonzoEraTxWits (ShelleyLedgerEra era)
    => L.EraCrypto (ShelleyLedgerEra era) ~ L.StandardCrypto
    => TxBodyScriptData era -> [L.Script (ShelleyLedgerEra era)] -> L.TxWits (ShelleyLedgerEra era)
  allConwayEraOnwardsWitnesses :: forall era.
(AlonzoEraTxWits (ShelleyLedgerEra era),
 EraCrypto (ShelleyLedgerEra era) ~ StandardCrypto) =>
TxBodyScriptData era
-> [Script (ShelleyLedgerEra era)] -> TxWits (ShelleyLedgerEra era)
allConwayEraOnwardsWitnesses TxBodyScriptData era
sData [Script (ShelleyLedgerEra era)]
ledgerScripts =
    let (TxDats (ShelleyLedgerEra era)
datums, Redeemers (ShelleyLedgerEra era)
redeemers) = case TxBodyScriptData era
sData of
          TxBodyScriptData AlonzoEraOnwards era
_ TxDats (ShelleyLedgerEra era)
ds Redeemers (ShelleyLedgerEra era)
rs -> (TxDats (ShelleyLedgerEra era)
ds, Redeemers (ShelleyLedgerEra era)
rs)
          TxBodyScriptData era
TxBodyNoScriptData -> (TxDats (ShelleyLedgerEra era)
forall a. Monoid a => a
mempty, Map
  (PlutusPurpose AsIx (ShelleyLedgerEra era))
  (Data (ShelleyLedgerEra era), ExUnits)
-> Redeemers (ShelleyLedgerEra era)
forall era.
AlonzoEraScript era =>
Map (PlutusPurpose AsIx era) (Data era, ExUnits) -> Redeemers era
L.Redeemers Map
  (PlutusPurpose AsIx (ShelleyLedgerEra era))
  (Data (ShelleyLedgerEra era), ExUnits)
forall a. Monoid a => a
mempty)
     in TxWits (ShelleyLedgerEra era)
forall era. EraTxWits era => TxWits era
L.mkBasicTxWits
          TxWits (ShelleyLedgerEra era)
-> (TxWits (ShelleyLedgerEra era) -> TxWits (ShelleyLedgerEra era))
-> TxWits (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (Set (WitVKey 'Witness (EraCrypto (ShelleyLedgerEra era)))
 -> Identity
      (Set (WitVKey 'Witness (EraCrypto (ShelleyLedgerEra era)))))
-> TxWits (ShelleyLedgerEra era)
-> Identity (TxWits (ShelleyLedgerEra era))
(Set (WitVKey 'Witness (EraCrypto (ShelleyLedgerEra era)))
 -> Identity (Set (WitVKey 'Witness StandardCrypto)))
-> TxWits (ShelleyLedgerEra era)
-> Identity (TxWits (ShelleyLedgerEra era))
forall era.
EraTxWits era =>
Lens' (TxWits era) (Set (WitVKey 'Witness (EraCrypto era)))
Lens'
  (TxWits (ShelleyLedgerEra era))
  (Set (WitVKey 'Witness (EraCrypto (ShelleyLedgerEra era))))
L.addrTxWitsL
            ((Set (WitVKey 'Witness (EraCrypto (ShelleyLedgerEra era)))
  -> Identity (Set (WitVKey 'Witness StandardCrypto)))
 -> TxWits (ShelleyLedgerEra era)
 -> Identity (TxWits (ShelleyLedgerEra era)))
-> Set (WitVKey 'Witness StandardCrypto)
-> TxWits (ShelleyLedgerEra era)
-> TxWits (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Set (WitVKey 'Witness StandardCrypto)
shelleyKeywitnesses
          TxWits (ShelleyLedgerEra era)
-> (TxWits (ShelleyLedgerEra era) -> TxWits (ShelleyLedgerEra era))
-> TxWits (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (Set (BootstrapWitness (EraCrypto (ShelleyLedgerEra era)))
 -> Identity
      (Set (BootstrapWitness (EraCrypto (ShelleyLedgerEra era)))))
-> TxWits (ShelleyLedgerEra era)
-> Identity (TxWits (ShelleyLedgerEra era))
(Set (BootstrapWitness (EraCrypto (ShelleyLedgerEra era)))
 -> Identity (Set (BootstrapWitness StandardCrypto)))
-> TxWits (ShelleyLedgerEra era)
-> Identity (TxWits (ShelleyLedgerEra era))
forall era.
EraTxWits era =>
Lens' (TxWits era) (Set (BootstrapWitness (EraCrypto era)))
Lens'
  (TxWits (ShelleyLedgerEra era))
  (Set (BootstrapWitness (EraCrypto (ShelleyLedgerEra era))))
L.bootAddrTxWitsL
            ((Set (BootstrapWitness (EraCrypto (ShelleyLedgerEra era)))
  -> Identity (Set (BootstrapWitness StandardCrypto)))
 -> TxWits (ShelleyLedgerEra era)
 -> Identity (TxWits (ShelleyLedgerEra era)))
-> Set (BootstrapWitness StandardCrypto)
-> TxWits (ShelleyLedgerEra era)
-> TxWits (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Set (BootstrapWitness StandardCrypto)
shelleyBootstrapWitnesses
          TxWits (ShelleyLedgerEra era)
-> (TxWits (ShelleyLedgerEra era) -> TxWits (ShelleyLedgerEra era))
-> TxWits (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (TxDats (ShelleyLedgerEra era)
 -> Identity (TxDats (ShelleyLedgerEra era)))
-> TxWits (ShelleyLedgerEra era)
-> Identity (TxWits (ShelleyLedgerEra era))
forall era. AlonzoEraTxWits era => Lens' (TxWits era) (TxDats era)
Lens'
  (TxWits (ShelleyLedgerEra era)) (TxDats (ShelleyLedgerEra era))
L.datsTxWitsL ((TxDats (ShelleyLedgerEra era)
  -> Identity (TxDats (ShelleyLedgerEra era)))
 -> TxWits (ShelleyLedgerEra era)
 -> Identity (TxWits (ShelleyLedgerEra era)))
-> TxDats (ShelleyLedgerEra era)
-> TxWits (ShelleyLedgerEra era)
-> TxWits (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ TxDats (ShelleyLedgerEra era)
datums
          TxWits (ShelleyLedgerEra era)
-> (TxWits (ShelleyLedgerEra era) -> TxWits (ShelleyLedgerEra era))
-> TxWits (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (Redeemers (ShelleyLedgerEra era)
 -> Identity (Redeemers (ShelleyLedgerEra era)))
-> TxWits (ShelleyLedgerEra era)
-> Identity (TxWits (ShelleyLedgerEra era))
forall era.
AlonzoEraTxWits era =>
Lens' (TxWits era) (Redeemers era)
Lens'
  (TxWits (ShelleyLedgerEra era)) (Redeemers (ShelleyLedgerEra era))
L.rdmrsTxWitsL ((Redeemers (ShelleyLedgerEra era)
  -> Identity (Redeemers (ShelleyLedgerEra era)))
 -> TxWits (ShelleyLedgerEra era)
 -> Identity (TxWits (ShelleyLedgerEra era)))
-> Redeemers (ShelleyLedgerEra era)
-> TxWits (ShelleyLedgerEra era)
-> TxWits (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Redeemers (ShelleyLedgerEra era)
redeemers
          TxWits (ShelleyLedgerEra era)
-> (TxWits (ShelleyLedgerEra era) -> TxWits (ShelleyLedgerEra era))
-> TxWits (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (Map
   (ScriptHash (EraCrypto (ShelleyLedgerEra era)))
   (Script (ShelleyLedgerEra era))
 -> Identity
      (Map
         (ScriptHash (EraCrypto (ShelleyLedgerEra era)))
         (Script (ShelleyLedgerEra era))))
-> TxWits (ShelleyLedgerEra era)
-> Identity (TxWits (ShelleyLedgerEra era))
forall era.
EraTxWits era =>
Lens' (TxWits era) (Map (ScriptHash (EraCrypto era)) (Script era))
Lens'
  (TxWits (ShelleyLedgerEra era))
  (Map
     (ScriptHash (EraCrypto (ShelleyLedgerEra era)))
     (Script (ShelleyLedgerEra era)))
L.scriptTxWitsL
            ((Map
    (ScriptHash (EraCrypto (ShelleyLedgerEra era)))
    (Script (ShelleyLedgerEra era))
  -> Identity
       (Map
          (ScriptHash (EraCrypto (ShelleyLedgerEra era)))
          (Script (ShelleyLedgerEra era))))
 -> TxWits (ShelleyLedgerEra era)
 -> Identity (TxWits (ShelleyLedgerEra era)))
-> Map
     (ScriptHash (EraCrypto (ShelleyLedgerEra era)))
     (Script (ShelleyLedgerEra era))
-> TxWits (ShelleyLedgerEra era)
-> TxWits (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ [(ScriptHash (EraCrypto (ShelleyLedgerEra era)),
  Script (ShelleyLedgerEra era))]
-> Map
     (ScriptHash (EraCrypto (ShelleyLedgerEra era)))
     (Script (ShelleyLedgerEra era))
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
              [ (Script (ShelleyLedgerEra era)
-> ScriptHash (EraCrypto (ShelleyLedgerEra era))
forall era.
EraScript era =>
Script era -> ScriptHash (EraCrypto era)
L.hashScript Script (ShelleyLedgerEra era)
sw, Script (ShelleyLedgerEra era)
sw)
              | Script (ShelleyLedgerEra era)
sw <- [Script (ShelleyLedgerEra era)]
ledgerScripts
              ]

  allShelleyToBabbageWitnesses
    :: L.EraTxWits (ShelleyLedgerEra era)
    => L.EraCrypto (ShelleyLedgerEra era) ~ L.StandardCrypto
    => L.TxWits (ShelleyLedgerEra era)
  allShelleyToBabbageWitnesses :: forall era.
(EraTxWits (ShelleyLedgerEra era),
 EraCrypto (ShelleyLedgerEra era) ~ StandardCrypto) =>
TxWits (ShelleyLedgerEra era)
allShelleyToBabbageWitnesses =
    TxWits (ShelleyLedgerEra era)
forall era. EraTxWits era => TxWits era
L.mkBasicTxWits
      TxWits (ShelleyLedgerEra era)
-> (TxWits (ShelleyLedgerEra era) -> TxWits (ShelleyLedgerEra era))
-> TxWits (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (Set (WitVKey 'Witness (EraCrypto (ShelleyLedgerEra era)))
 -> Identity
      (Set (WitVKey 'Witness (EraCrypto (ShelleyLedgerEra era)))))
-> TxWits (ShelleyLedgerEra era)
-> Identity (TxWits (ShelleyLedgerEra era))
(Set (WitVKey 'Witness (EraCrypto (ShelleyLedgerEra era)))
 -> Identity (Set (WitVKey 'Witness StandardCrypto)))
-> TxWits (ShelleyLedgerEra era)
-> Identity (TxWits (ShelleyLedgerEra era))
forall era.
EraTxWits era =>
Lens' (TxWits era) (Set (WitVKey 'Witness (EraCrypto era)))
Lens'
  (TxWits (ShelleyLedgerEra era))
  (Set (WitVKey 'Witness (EraCrypto (ShelleyLedgerEra era))))
L.addrTxWitsL
        ((Set (WitVKey 'Witness (EraCrypto (ShelleyLedgerEra era)))
  -> Identity (Set (WitVKey 'Witness StandardCrypto)))
 -> TxWits (ShelleyLedgerEra era)
 -> Identity (TxWits (ShelleyLedgerEra era)))
-> Set (WitVKey 'Witness StandardCrypto)
-> TxWits (ShelleyLedgerEra era)
-> TxWits (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Set (WitVKey 'Witness StandardCrypto)
shelleyKeywitnesses
      TxWits (ShelleyLedgerEra era)
-> (TxWits (ShelleyLedgerEra era) -> TxWits (ShelleyLedgerEra era))
-> TxWits (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (Set (BootstrapWitness (EraCrypto (ShelleyLedgerEra era)))
 -> Identity
      (Set (BootstrapWitness (EraCrypto (ShelleyLedgerEra era)))))
-> TxWits (ShelleyLedgerEra era)
-> Identity (TxWits (ShelleyLedgerEra era))
(Set (BootstrapWitness (EraCrypto (ShelleyLedgerEra era)))
 -> Identity (Set (BootstrapWitness StandardCrypto)))
-> TxWits (ShelleyLedgerEra era)
-> Identity (TxWits (ShelleyLedgerEra era))
forall era.
EraTxWits era =>
Lens' (TxWits era) (Set (BootstrapWitness (EraCrypto era)))
Lens'
  (TxWits (ShelleyLedgerEra era))
  (Set (BootstrapWitness (EraCrypto (ShelleyLedgerEra era))))
L.bootAddrTxWitsL
        ((Set (BootstrapWitness (EraCrypto (ShelleyLedgerEra era)))
  -> Identity (Set (BootstrapWitness StandardCrypto)))
 -> TxWits (ShelleyLedgerEra era)
 -> Identity (TxWits (ShelleyLedgerEra era)))
-> Set (BootstrapWitness StandardCrypto)
-> TxWits (ShelleyLedgerEra era)
-> TxWits (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Set (BootstrapWitness StandardCrypto)
shelleyBootstrapWitnesses

createCommonTxBody
  :: ShelleyBasedEra era
  -> [TxIn]
  -> [TxOut ctx era]
  -> Lovelace
  -> L.TxBody (ShelleyLedgerEra era)
createCommonTxBody :: forall era ctx.
ShelleyBasedEra era
-> [TxIn]
-> [TxOut ctx era]
-> Lovelace
-> TxBody (ShelleyLedgerEra era)
createCommonTxBody ShelleyBasedEra era
era [TxIn]
ins [TxOut ctx era]
outs Lovelace
txFee' =
  let txIns' :: [TxIn StandardCrypto]
txIns' = (TxIn -> TxIn StandardCrypto) -> [TxIn] -> [TxIn StandardCrypto]
forall a b. (a -> b) -> [a] -> [b]
map TxIn -> TxIn StandardCrypto
toShelleyTxIn [TxIn]
ins
      txOuts' :: [TxOut (ShelleyLedgerEra era)]
txOuts' = (TxOut ctx era -> TxOut (ShelleyLedgerEra era))
-> [TxOut ctx era] -> [TxOut (ShelleyLedgerEra era)]
forall a b. (a -> b) -> [a] -> [b]
map (ShelleyBasedEra era
-> TxOut ctx era -> TxOut (ShelleyLedgerEra era)
forall ctx era ledgerera.
(HasCallStack, ShelleyLedgerEra era ~ ledgerera) =>
ShelleyBasedEra era -> TxOut ctx era -> TxOut ledgerera
toShelleyTxOutAny ShelleyBasedEra era
era) [TxOut ctx era]
outs
   in ShelleyBasedEra era
-> (ShelleyBasedEraConstraints era =>
    TxBody (ShelleyLedgerEra era))
-> TxBody (ShelleyLedgerEra era)
forall era a.
ShelleyBasedEra era -> (ShelleyBasedEraConstraints era => a) -> a
shelleyBasedEraConstraints ShelleyBasedEra era
era ((ShelleyBasedEraConstraints era => TxBody (ShelleyLedgerEra era))
 -> TxBody (ShelleyLedgerEra era))
-> (ShelleyBasedEraConstraints era =>
    TxBody (ShelleyLedgerEra era))
-> TxBody (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
        TxBody (ShelleyLedgerEra era)
forall era. EraTxBody era => TxBody era
L.mkBasicTxBody
          TxBody (ShelleyLedgerEra era)
-> (TxBody (ShelleyLedgerEra era) -> TxBody (ShelleyLedgerEra era))
-> TxBody (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (Set (TxIn (EraCrypto (ShelleyLedgerEra era)))
 -> Identity (Set (TxIn (EraCrypto (ShelleyLedgerEra era)))))
-> TxBody (ShelleyLedgerEra era)
-> Identity (TxBody (ShelleyLedgerEra era))
(Set (TxIn (EraCrypto (ShelleyLedgerEra era)))
 -> Identity (Set (TxIn StandardCrypto)))
-> TxBody (ShelleyLedgerEra era)
-> Identity (TxBody (ShelleyLedgerEra era))
forall era.
EraTxBody era =>
Lens' (TxBody era) (Set (TxIn (EraCrypto era)))
Lens'
  (TxBody (ShelleyLedgerEra era))
  (Set (TxIn (EraCrypto (ShelleyLedgerEra era))))
L.inputsTxBodyL
            ((Set (TxIn (EraCrypto (ShelleyLedgerEra era)))
  -> Identity (Set (TxIn StandardCrypto)))
 -> TxBody (ShelleyLedgerEra era)
 -> Identity (TxBody (ShelleyLedgerEra era)))
-> Set (TxIn StandardCrypto)
-> TxBody (ShelleyLedgerEra era)
-> TxBody (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ [TxIn StandardCrypto] -> Set (TxIn StandardCrypto)
forall a. Ord a => [a] -> Set a
fromList [TxIn StandardCrypto]
txIns'
          TxBody (ShelleyLedgerEra era)
-> (TxBody (ShelleyLedgerEra era) -> TxBody (ShelleyLedgerEra era))
-> TxBody (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (StrictSeq (TxOut (ShelleyLedgerEra era))
 -> Identity (StrictSeq (TxOut (ShelleyLedgerEra era))))
-> TxBody (ShelleyLedgerEra era)
-> Identity (TxBody (ShelleyLedgerEra era))
forall era.
EraTxBody era =>
Lens' (TxBody era) (StrictSeq (TxOut era))
Lens'
  (TxBody (ShelleyLedgerEra era))
  (StrictSeq (TxOut (ShelleyLedgerEra era)))
L.outputsTxBodyL
            ((StrictSeq (TxOut (ShelleyLedgerEra era))
  -> Identity (StrictSeq (TxOut (ShelleyLedgerEra era))))
 -> TxBody (ShelleyLedgerEra era)
 -> Identity (TxBody (ShelleyLedgerEra era)))
-> StrictSeq (TxOut (ShelleyLedgerEra era))
-> TxBody (ShelleyLedgerEra era)
-> TxBody (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ [TxOut (ShelleyLedgerEra era)]
-> StrictSeq (TxOut (ShelleyLedgerEra era))
forall a. [a] -> StrictSeq a
Seq.fromList [TxOut (ShelleyLedgerEra era)]
txOuts'
          TxBody (ShelleyLedgerEra era)
-> (TxBody (ShelleyLedgerEra era) -> TxBody (ShelleyLedgerEra era))
-> TxBody (ShelleyLedgerEra era)
forall a b. a -> (a -> b) -> b
& (Lovelace -> Identity Lovelace)
-> TxBody (ShelleyLedgerEra era)
-> Identity (TxBody (ShelleyLedgerEra era))
forall era. EraTxBody era => Lens' (TxBody era) Lovelace
Lens' (TxBody (ShelleyLedgerEra era)) Lovelace
L.feeTxBodyL
            ((Lovelace -> Identity Lovelace)
 -> TxBody (ShelleyLedgerEra era)
 -> Identity (TxBody (ShelleyLedgerEra era)))
-> Lovelace
-> TxBody (ShelleyLedgerEra era)
-> TxBody (ShelleyLedgerEra era)
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Lovelace
txFee'