File tree 2 files changed +6
-0
lines changed
cardano-api/src/Cardano/Api
2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import Cardano.Api.Internal.Tx.Body
21
21
, toShelleyTxOut
22
22
)
23
23
import Cardano.Api.Internal.TxIn (TxIn (.. ))
24
+ import Cardano.Api.Internal.Value (Value (.. ))
24
25
25
26
import Cardano.Ledger.Babbage ()
26
27
import Cardano.Ledger.Shelley.UTxO qualified as Ledger
@@ -110,6 +111,10 @@ toList (UTxO xs) = Map.toList xs
110
111
toMap :: UTxO era -> Map TxIn (TxOut CtxUTxO era )
111
112
toMap = unUTxO
112
113
114
+ -- | Sum the total value of the UTxO.
115
+ totalValue :: UTxO era -> Value
116
+ totalValue = foldMap txOutValue . unUTxO
117
+
113
118
-- | Convert from a `cardano-api` `UTxO` to a `cardano-ledger` UTxO.
114
119
toShelleyUTxO :: ShelleyBasedEra era -> UTxO era -> Ledger. UTxO (ShelleyLedgerEra era )
115
120
toShelleyUTxO sbe =
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ module Cardano.Api.Tx.UTxO
12
12
, UTxO. fromList
13
13
, UTxO. toList
14
14
, UTxO. toMap
15
+ , UTxO. totalValue
15
16
, UTxO. fromShelleyUTxO
16
17
, UTxO. toShelleyUTxO
17
18
)
You can’t perform that action at this time.
0 commit comments