hydra-cardano-api-0.20.0: A Haskell API for Cardano, tailored to the Hydra project.
Safe HaskellSafe-Inferred
LanguageGHC2021

Cardano.Api.UTxO

Description

NOTE (1): This module is meant to be imported qualified as UTxO.

NOTE (2): This module is name-spaces slightly different from the rest because it is meant to be used as a replacement of the UTxO type of the cardano-api which is not convenient enough to work with. Having it as UTxO causes cyclic imports with other modules also relying on this newtype. So instead, we do 'as if' it was part of the cardano-api in the first palce.

Synopsis

Documentation

newtype UTxO' out Source #

Newtype with phantom types mostly required to work around the poor interface of UTXO and provide Monoid and Foldable instances to make utxo manipulation bareable.

Constructors

UTxO 

Fields

Instances

Instances details
Foldable UTxO' Source # 
Instance details

Defined in Cardano.Api.UTxO

Methods

fold :: Monoid m => UTxO' m -> m Source #

foldMap :: Monoid m => (a -> m) -> UTxO' a -> m Source #

foldMap' :: Monoid m => (a -> m) -> UTxO' a -> m Source #

foldr :: (a -> b -> b) -> b -> UTxO' a -> b Source #

foldr' :: (a -> b -> b) -> b -> UTxO' a -> b Source #

foldl :: (b -> a -> b) -> b -> UTxO' a -> b Source #

foldl' :: (b -> a -> b) -> b -> UTxO' a -> b Source #

foldr1 :: (a -> a -> a) -> UTxO' a -> a Source #

foldl1 :: (a -> a -> a) -> UTxO' a -> a Source #

toList :: UTxO' a -> [a] Source #

null :: UTxO' a -> Bool Source #

length :: UTxO' a -> Int Source #

elem :: Eq a => a -> UTxO' a -> Bool Source #

maximum :: Ord a => UTxO' a -> a Source #

minimum :: Ord a => UTxO' a -> a Source #

sum :: Num a => UTxO' a -> a Source #

product :: Num a => UTxO' a -> a Source #

Traversable UTxO' Source # 
Instance details

Defined in Cardano.Api.UTxO

Methods

traverse :: Applicative f => (a -> f b) -> UTxO' a -> f (UTxO' b) Source #

sequenceA :: Applicative f => UTxO' (f a) -> f (UTxO' a) Source #

mapM :: Monad m => (a -> m b) -> UTxO' a -> m (UTxO' b) Source #

sequence :: Monad m => UTxO' (m a) -> m (UTxO' a) Source #

Functor UTxO' Source # 
Instance details

Defined in Cardano.Api.UTxO

Methods

fmap :: (a -> b) -> UTxO' a -> UTxO' b Source #

(<$) :: a -> UTxO' b -> UTxO' a Source #

FromJSON out => FromJSON (UTxO' out) Source # 
Instance details

Defined in Cardano.Api.UTxO

Methods

parseJSON :: Value -> Parser (UTxO' out) #

parseJSONList :: Value -> Parser [UTxO' out] #

omittedField :: Maybe (UTxO' out) #

ToJSON out => ToJSON (UTxO' out) Source # 
Instance details

Defined in Cardano.Api.UTxO

Methods

toJSON :: UTxO' out -> Value #

toEncoding :: UTxO' out -> Encoding #

toJSONList :: [UTxO' out] -> Value #

toEncodingList :: [UTxO' out] -> Encoding #

omitField :: UTxO' out -> Bool #

Monoid (UTxO' out) Source # 
Instance details

Defined in Cardano.Api.UTxO

Methods

mempty :: UTxO' out Source #

mappend :: UTxO' out -> UTxO' out -> UTxO' out Source #

mconcat :: [UTxO' out] -> UTxO' out Source #

Semigroup (UTxO' out) Source # 
Instance details

Defined in Cardano.Api.UTxO

Methods

(<>) :: UTxO' out -> UTxO' out -> UTxO' out Source #

sconcat :: NonEmpty (UTxO' out) -> UTxO' out Source #

stimes :: Integral b => b -> UTxO' out -> UTxO' out Source #

Show out => Show (UTxO' out) Source # 
Instance details

Defined in Cardano.Api.UTxO

Methods

showsPrec :: Int -> UTxO' out -> ShowS Source #

show :: UTxO' out -> String Source #

showList :: [UTxO' out] -> ShowS Source #

Eq out => Eq (UTxO' out) Source # 
Instance details

Defined in Cardano.Api.UTxO

Methods

(==) :: UTxO' out -> UTxO' out -> Bool Source #

(/=) :: UTxO' out -> UTxO' out -> Bool Source #

fromPairs :: [(TxIn, out)] -> UTxO' out Source #

Create a UTxO from a list of TxIn and out pairs.

singleton :: (TxIn, out) -> UTxO' out Source #

Create a UTxO from a single unspent transaction output.

resolve :: TxIn -> UTxO' out -> Maybe out Source #

Find an out for a given TxIn.

pairs :: UTxO' out -> [(TxIn, out)] Source #

Turn a UTxO into a list of pairs.

find :: (out -> Bool) -> UTxO' out -> Maybe (TxIn, out) Source #

Find first UTxO using the output in predicate.

findBy :: ((TxIn, out) -> Bool) -> UTxO' out -> Maybe (TxIn, out) Source #

Find first UTxO using both input and output in predicate.

filter :: (out -> Bool) -> UTxO' out -> UTxO' out Source #

Filter UTxO to only include outs satisfying given predicate.

inputSet :: UTxO' out -> Set TxIn Source #

Get the UTxO domain input's set

render :: (TxIn, TxOut ctx era) -> Text Source #

Get a human-readable pretty text representation of a UTxO.

min :: UTxO -> UTxO Source #

Select the minimum (by TxIn) utxo entry from the UTxO map.

This function is partial.

difference :: UTxO' out -> UTxO' out -> UTxO' out Source #

Remove the right hand side from the left hand side.

(\\) :: UTxO' out -> UTxO' out -> UTxO' out Source #

Infix version of difference.

Type Conversions

fromApi :: UTxO era -> UTxO Source #

Transforms a UTxO containing tx outs from any era into Babbage era.

toApi :: UTxO -> UTxO Era Source #