File tree 2 files changed +10
-0
lines changed
cardano-api/src/Cardano/Api
2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,10 @@ singleton i o = UTxO $ Map.singleton i o
67
67
lookup :: TxIn -> UTxO era -> Maybe (TxOut CtxUTxO era )
68
68
lookup k = Map. lookup k . unUTxO
69
69
70
+ -- | Synonym for `lookup`.
71
+ resolveTxIn :: TxIn -> UTxO era -> Maybe (TxOut CtxUTxO era )
72
+ resolveTxIn = Cardano.Api.Internal.Tx.UTxO. lookup
73
+
70
74
-- | Filter all `TxOut` that satisfy the predicate.
71
75
filter :: (TxOut CtxUTxO era -> Bool ) -> UTxO era -> UTxO era
72
76
filter fn = UTxO . Map. filter fn . unUTxO
@@ -95,6 +99,10 @@ fromList = UTxO . Map.fromList
95
99
toList :: UTxO era -> [(TxIn , TxOut CtxUTxO era )]
96
100
toList (UTxO xs) = Map. toList xs
97
101
102
+ -- | Convert to a Map of TxIn/TxOut.
103
+ toMap :: UTxO era -> Map TxIn (TxOut CtxUTxO era )
104
+ toMap = unUTxO
105
+
98
106
-- | Convert from a `cardano-api` `UTxO` to a `cardano-ledger` UTxO.
99
107
toShelleyUTxO :: ShelleyBasedEra era -> UTxO era -> Ledger. UTxO (ShelleyLedgerEra era )
100
108
toShelleyUTxO sbe =
Original file line number Diff line number Diff line change @@ -3,13 +3,15 @@ module Cardano.Api.Tx.UTxO
3
3
, UTxO. empty
4
4
, UTxO. singleton
5
5
, UTxO. lookup
6
+ , UTxO. resolveTxIn
6
7
, UTxO. filter
7
8
, UTxO. filterWithKey
8
9
, UTxO. inputSet
9
10
, UTxO. txOutputs
10
11
, UTxO. difference
11
12
, UTxO. fromList
12
13
, UTxO. toList
14
+ , UTxO. toMap
13
15
, UTxO. fromShelleyUTxO
14
16
, UTxO. toShelleyUTxO
15
17
)
You can’t perform that action at this time.
0 commit comments