Skip to content

Commit

Permalink
Use Write.Tx in modifyLedgerBody.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed Nov 15, 2023
1 parent 4c211b3 commit 90dc281
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 8 additions & 6 deletions lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ import Internal.Cardano.Write.Tx
, TxOut
, UTxO (..)
, Value
, asCardanoApiTx
, computeMinimumCoinForTxOut
, evaluateMinimumFee
, evaluateTransactionBalance
Expand Down Expand Up @@ -658,8 +657,7 @@ assignMinimalAdaQuantitiesToOutputsWithoutAda
-> Tx (CardanoApi.ShelleyLedgerEra era)
assignMinimalAdaQuantitiesToOutputsWithoutAda era pp =
withConstraints era
$ asCardanoApiTx @era
$ modifyLedgerBody
$ modifyLedgerBody @era
$ over outputsTxBodyL
$ fmap modifyTxOut
where
Expand Down

0 comments on commit 90dc281

Please sign in to comment.