diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx.hs index 31a985152fb..d754ed79e25 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx.hs @@ -52,7 +52,6 @@ module Internal.Cardano.Write.Tx , CardanoApi.ShelleyLedgerEra , cardanoEraFromRecentEra , shelleyBasedEraFromRecentEra - , asCardanoApiTx , fromCardanoApiTx , toCardanoApiUTxO , fromCardanoApiUTxO @@ -89,7 +88,6 @@ module Internal.Cardano.Write.Tx , Core.TxBody , txBody , outputs - , modifyLedgerBody , emptyTx , serializeTx @@ -786,39 +784,6 @@ outputs outputs RecentEraConway = map sizedValue . toList . Conway.ctbOutputs outputs RecentEraBabbage = map sizedValue . toList . Babbage.btbOutputs --- NOTE: To reduce the need for the caller to deal with --- @CardanoApiEra (CardanoApi.ShelleyLedgerEra era) ~ era@, we quantify this --- function over @cardanoEra@ instead of @era@. --- --- TODO [ADP-2353] Move to @cardano-api@ related module -modifyLedgerBody - :: forall cardanoEra. IsRecentEra cardanoEra - => (Core.TxBody (CardanoApi.ShelleyLedgerEra cardanoEra) -> - Core.TxBody (CardanoApi.ShelleyLedgerEra cardanoEra)) - -> Core.Tx (CardanoApi.ShelleyLedgerEra cardanoEra) - -> Core.Tx (CardanoApi.ShelleyLedgerEra cardanoEra) -modifyLedgerBody f = asCardanoApiTx @cardanoEra modify - where - modify (CardanoApi.Tx body keyWits) = CardanoApi.Tx body' keyWits - where - body' = case body of - CardanoApi.ByronTxBody {} -> - error "Impossible: ByronTxBody in CardanoApi.ShelleyLedgerEra" - CardanoApi.ShelleyTxBody - shelleyEra - ledgerBody - scripts - scriptData - auxData - validity -> - CardanoApi.ShelleyTxBody - shelleyEra - (f ledgerBody) - scripts - scriptData - auxData - validity - emptyTx :: RecentEra era -> Core.Tx (CardanoApi.ShelleyLedgerEra era) emptyTx era = withConstraints era $ Core.mkBasicTx Core.mkBasicTxBody @@ -826,16 +791,6 @@ emptyTx era = withConstraints era $ Core.mkBasicTx Core.mkBasicTxBody -- Compatibility -------------------------------------------------------------------------------- -asCardanoApiTx - :: forall era. IsRecentEra era - => (CardanoApi.Tx era -> CardanoApi.Tx era) - -> Core.Tx (CardanoApi.ShelleyLedgerEra era) - -> Core.Tx (CardanoApi.ShelleyLedgerEra era) -asCardanoApiTx f - = fromCardanoApiTx - . f - . toCardanoApiTx - fromCardanoApiTx :: forall era. IsRecentEra era => CardanoApi.Tx era diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs index b84c5c6a1b7..225adf80c2a 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs @@ -236,7 +236,6 @@ import Internal.Cardano.Write.Tx , getFeePerByte , isBelowMinimumCoinForTxOut , maxScriptExecutionCost - , modifyLedgerBody , modifyTxOutCoin , outputs , toCardanoApiTx @@ -657,8 +656,7 @@ assignMinimalAdaQuantitiesToOutputsWithoutAda -> Tx (CardanoApi.ShelleyLedgerEra era) assignMinimalAdaQuantitiesToOutputsWithoutAda era pp = withConstraints era - $ modifyLedgerBody @era - $ over outputsTxBodyL + $ over (bodyTxL . outputsTxBodyL) $ fmap modifyTxOut where modifyTxOut out = flip (modifyTxOutCoin era) out $ \c ->