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 dd850fb83fd..31a985152fb 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx.hs @@ -792,14 +792,16 @@ outputs RecentEraBabbage = map sizedValue . toList . Babbage.btbOutputs -- -- TODO [ADP-2353] Move to @cardano-api@ related module modifyLedgerBody - :: (Core.TxBody (CardanoApi.ShelleyLedgerEra cardanoEra) -> + :: forall cardanoEra. IsRecentEra cardanoEra + => (Core.TxBody (CardanoApi.ShelleyLedgerEra cardanoEra) -> Core.TxBody (CardanoApi.ShelleyLedgerEra cardanoEra)) - -> CardanoApi.Tx cardanoEra - -> CardanoApi.Tx cardanoEra -modifyLedgerBody f (CardanoApi.Tx body keyWits) = CardanoApi.Tx body' keyWits + -> Core.Tx (CardanoApi.ShelleyLedgerEra cardanoEra) + -> Core.Tx (CardanoApi.ShelleyLedgerEra cardanoEra) +modifyLedgerBody f = asCardanoApiTx @cardanoEra modify where - body' = - case body of + modify (CardanoApi.Tx body keyWits) = CardanoApi.Tx body' keyWits + where + body' = case body of CardanoApi.ByronTxBody {} -> error "Impossible: ByronTxBody in CardanoApi.ShelleyLedgerEra" CardanoApi.ShelleyTxBody 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 314c1dec597..b84c5c6a1b7 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 @@ -229,7 +229,6 @@ import Internal.Cardano.Write.Tx , TxOut , UTxO (..) , Value - , asCardanoApiTx , computeMinimumCoinForTxOut , evaluateMinimumFee , evaluateTransactionBalance @@ -658,8 +657,7 @@ assignMinimalAdaQuantitiesToOutputsWithoutAda -> Tx (CardanoApi.ShelleyLedgerEra era) assignMinimalAdaQuantitiesToOutputsWithoutAda era pp = withConstraints era - $ asCardanoApiTx @era - $ modifyLedgerBody + $ modifyLedgerBody @era $ over outputsTxBodyL $ fmap modifyTxOut where