Copyright | © 2018-2020 IOHK |
---|---|
License | Apache-2.0 |
Safe Haskell | None |
Language | Haskell2010 |
This module provides the main
UTxO
data type used by the wallet.
Synopsis
- newtype UTxO = UTxO { }
- dom :: UTxO -> Set TxIn
- null :: UTxO -> Bool
- size :: UTxO -> Int
- balance :: UTxO -> TokenBundle
- isSubsetOf :: UTxO -> UTxO -> Bool
- empty :: UTxO
- disjoint :: UTxO -> UTxO -> Bool
- excluding :: UTxO -> Set TxIn -> UTxO
- restrictedBy :: UTxO -> Set TxIn -> UTxO
- restrictedTo :: UTxO -> Set TxOut -> UTxO
- difference :: UTxO -> UTxO -> UTxO
- partition :: ( TxIn -> Bool ) -> UTxO -> ( UTxO , UTxO )
- lookup :: TxIn -> UTxO -> Maybe TxOut
- filter :: ( TxIn -> Bool ) -> UTxO -> UTxO
- filterByAddressM :: forall f. Monad f => ( Address -> f Bool ) -> UTxO -> f UTxO
- filterByAddress :: ( Address -> Bool ) -> UTxO -> UTxO
- toList :: UTxO -> [( TxIn , TxOut )]
- data DeltaUTxO
- excluded :: DeltaUTxO -> Set TxIn
- received :: DeltaUTxO -> UTxO
- excludingD :: UTxO -> Set TxIn -> ( DeltaUTxO , UTxO )
- receiveD :: UTxO -> UTxO -> ( DeltaUTxO , UTxO )
- assetIds :: UTxO -> Set AssetId
- txIds :: UTxO -> Set ( Hash "Tx")
- mapAssetIds :: ( AssetId -> AssetId ) -> UTxO -> UTxO
- mapTxIds :: ( Hash "Tx" -> Hash "Tx") -> UTxO -> UTxO
- removeAssetId :: UTxO -> AssetId -> UTxO
- data UTxOStatistics = UTxOStatistics { }
- data BoundType
-
data
HistogramBar
=
HistogramBar
{
- bucketUpperBound :: ! Word64
- bucketCount :: ! Word64
- computeStatistics :: (a -> [ Word64 ]) -> BoundType -> [a] -> UTxOStatistics
- computeUtxoStatistics :: BoundType -> UTxO -> UTxOStatistics
- log10 :: BoundType
UTxO
Instances
Eq UTxO Source # | |
Ord UTxO Source # | |
Defined in Cardano.Wallet.Primitive.Types.UTxO |
|
Show UTxO Source # | |
Generic UTxO Source # | |
Semigroup UTxO Source # | |
Monoid UTxO Source # | |
NFData UTxO Source # | |
Defined in Cardano.Wallet.Primitive.Types.UTxO |
|
Buildable UTxO Source # | |
type Rep UTxO Source # | |
Defined in Cardano.Wallet.Primitive.Types.UTxO
type
Rep
UTxO
=
D1
('
MetaData
"UTxO" "Cardano.Wallet.Primitive.Types.UTxO" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" '
True
) (
C1
('
MetaCons
"UTxO" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"unUTxO") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
(
Map
TxIn
TxOut
))))
|
balance :: UTxO -> TokenBundle Source #
Compute the balance of a UTxO
partition :: ( TxIn -> Bool ) -> UTxO -> ( UTxO , UTxO ) Source #
Partitions a UTxO set according to a condition.
filter p a == a && filter (not . p) b == b where (a,b) = partition p utxo
filterByAddress :: ( Address -> Bool ) -> UTxO -> UTxO Source #
Filters a
UTxO
set with an indicator function on
Address
values.
Returns the subset of UTxO entries that have addresses for which the given
indicator function returns
True
.
filterByAddress f u = runIdentity $ filterByAddressM (pure . f) u
filterByAddress (const True) u = u
filterByAddress (const False) u = mempty
filterByAddress f mempty = mempty
filterByAddress f u
isSubsetOf
u
UTxO delta encoding
Efficient delta encoding for
UTxO
.
Instances
Eq DeltaUTxO Source # | |
Show DeltaUTxO Source # | |
Generic DeltaUTxO Source # | |
Semigroup DeltaUTxO Source # |
Left argument is applied after right argument. |
Monoid DeltaUTxO Source # | |
Delta DeltaUTxO Source # | |
type Rep DeltaUTxO Source # | |
Defined in Cardano.Wallet.Primitive.Types.UTxO
type
Rep
DeltaUTxO
=
D1
('
MetaData
"DeltaUTxO" "Cardano.Wallet.Primitive.Types.UTxO" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" '
False
) (
C1
('
MetaCons
"DeltaUTxO" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"excluded") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
(
Set
TxIn
))
:*:
S1
('
MetaSel
('
Just
"received") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
UTxO
)))
|
|
type Base DeltaUTxO Source # | |
Defined in Cardano.Wallet.Primitive.Types.UTxO |
excludingD :: UTxO -> Set TxIn -> ( DeltaUTxO , UTxO ) Source #
Exclude a set of transaction inputs, typically because we spend them.
Queries
Transformations
UTxO Statistics
data UTxOStatistics Source #
Instances
Instances
Eq BoundType Source # | |
Ord BoundType Source # | |
Defined in Cardano.Wallet.Primitive.Types.UTxO |
|
Show BoundType Source # | |
Generic BoundType Source # | |
NFData BoundType Source # | |
Defined in Cardano.Wallet.Primitive.Types.UTxO |
|
ToJSON ( ApiT BoundType ) Source # | |
FromJSON ( ApiT BoundType ) Source # | |
type Rep BoundType Source # | |
data HistogramBar Source #
HistogramBar | |
|
Instances
computeStatistics :: (a -> [ Word64 ]) -> BoundType -> [a] -> UTxOStatistics Source #
A more generic function for computing UTxO statistics on some other type of data that maps to UTxO's values.
computeUtxoStatistics :: BoundType -> UTxO -> UTxOStatistics Source #
Compute UtxoStatistics from UTxOs