cardano-wallet-core-2022.7.1: The Wallet Backend for a Cardano node.
Copyright © 2018-2020 IOHK
License Apache-2.0
Safe Haskell None
Language Haskell2010

Cardano.Wallet.Primitive.Types.UTxO

Description

This module provides the main UTxO data type used by the wallet.

Synopsis

UTxO

newtype UTxO Source #

Instances

Instances details
Eq UTxO Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Ord UTxO Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Show UTxO Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Generic UTxO Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Associated Types

type Rep UTxO :: Type -> Type Source #

Semigroup UTxO Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Monoid UTxO Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

NFData UTxO Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Buildable UTxO Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

type Rep UTxO Source #
Instance details

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 ))))

dom :: UTxO -> Set TxIn Source #

Domain of a UTxO = the set of inputs of the utxo .

balance :: UTxO -> TokenBundle Source #

Compute the balance of a UTxO

disjoint :: UTxO -> UTxO -> Bool Source #

Indicates whether a pair of UTxO sets are disjoint.

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

lookup :: TxIn -> UTxO -> Maybe TxOut Source #

Lookup an input in the UTXO

filter :: ( TxIn -> Bool ) -> UTxO -> UTxO Source #

Filters a UTxO set according to a condition.

filterByAddressM :: forall f. Monad f => ( Address -> f Bool ) -> UTxO -> f 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 :: ( 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

toList :: UTxO -> [( TxIn , TxOut )] Source #

Converts a UTxO set into a list of UTxO elements.

UTxO delta encoding

data DeltaUTxO Source #

Efficient delta encoding for UTxO .

Instances

Instances details
Eq DeltaUTxO Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Show DeltaUTxO Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Generic DeltaUTxO Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Semigroup DeltaUTxO Source #

Left argument is applied after right argument.

Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Monoid DeltaUTxO Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Delta DeltaUTxO Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Associated Types

type Base DeltaUTxO Source #

type Rep DeltaUTxO Source #
Instance details

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 #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

received :: DeltaUTxO -> UTxO Source #

Then receive these additional outputs.

excludingD :: UTxO -> Set TxIn -> ( DeltaUTxO , UTxO ) Source #

Exclude a set of transaction inputs, typically because we spend them.

Queries

Transformations

mapTxIds :: ( Hash "Tx" -> Hash "Tx") -> UTxO -> UTxO Source #

Applies a mapping on transaction identifiers to a UTxO set.

If the provided mapping gives rise to a collision within the TxIn key set, then only the smallest TxOut is retained, according to the Ord instance for TxOut .

UTxO Statistics

data UTxOStatistics Source #

Instances

Instances details
Eq UTxOStatistics Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Ord UTxOStatistics Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Show UTxOStatistics Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Generic UTxOStatistics Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

NFData UTxOStatistics Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Buildable UTxOStatistics Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

type Rep UTxOStatistics Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

data BoundType Source #

Instances

Instances details
Eq BoundType Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Ord BoundType Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Show BoundType Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Generic BoundType Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

NFData BoundType Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

ToJSON ( ApiT BoundType ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

FromJSON ( ApiT BoundType ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

type Rep BoundType Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

type Rep BoundType = D1 (' MetaData "BoundType" "Cardano.Wallet.Primitive.Types.UTxO" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "Log10" ' PrefixI ' False ) ( U1 :: Type -> Type ))

data HistogramBar Source #

Instances

Instances details
Eq HistogramBar Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Ord HistogramBar Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Show HistogramBar Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Generic HistogramBar Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

NFData HistogramBar Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

Buildable HistogramBar Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

type Rep HistogramBar Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.UTxO

type Rep HistogramBar = D1 (' MetaData "HistogramBar" "Cardano.Wallet.Primitive.Types.UTxO" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "HistogramBar" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "bucketUpperBound") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Word64 ) :*: S1 (' MetaSel (' Just "bucketCount") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Word64 )))

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.

log10 :: BoundType Source #

Smart-constructor to create bounds using a log-10 scale