Copyright | (c) 2023 GYELD GMBH |
---|---|
License | Apache 2.0 |
Maintainer | [email protected] |
Stability | develop |
Safe Haskell | None |
Language | GHC2021 |
GeniusYield.Types.UTxO
Description
Synopsis
- data GYUTxO = GYUTxO {
- utxoRef :: !GYTxOutRef
- utxoAddress :: !GYAddress
- utxoValue :: !GYValue
- utxoOutDatum :: !GYOutDatum
- utxoRefScript :: !(Maybe GYAnyScript)
- utxoFromApi :: TxIn -> TxOut CtxTx ApiEra -> GYUTxO
- utxoFromApiWithDatum :: TxIn -> TxOut CtxTx ApiEra -> (GYUTxO, Maybe GYDatum)
- utxoFromApi' :: TxIn -> TxOut CtxUTxO era -> GYUTxO
- utxoToApi :: GYUTxO -> TxOut ctx ApiEra
- utxoToPlutus :: GYUTxO -> TxOut
- utxoHasInlineDatum :: GYUTxO -> Bool
- utxoHasReferenceScript :: GYUTxO -> Bool
- utxoTranslatableToV1 :: GYUTxO -> Bool
- data GYUTxOs
- utxosSize :: GYUTxOs -> Int
- utxosFromApi :: UTxO era -> GYUTxOs
- utxosToApi :: GYUTxOs -> UTxO ApiEra
- utxosRemoveTxOutRef :: GYTxOutRef -> GYUTxOs -> GYUTxOs
- utxosRemoveTxOutRefs :: Set GYTxOutRef -> GYUTxOs -> GYUTxOs
- utxosRemoveRefScripts :: GYUTxOs -> GYUTxOs
- utxosRemoveUTxO :: GYUTxO -> GYUTxOs -> GYUTxOs
- utxosRemoveUTxOs :: GYUTxOs -> GYUTxOs -> GYUTxOs
- utxosLookup :: GYTxOutRef -> GYUTxOs -> Maybe GYUTxO
- someTxOutRef :: GYUTxOs -> Maybe (GYTxOutRef, GYUTxOs)
- randomTxOutRef :: MonadRandom m => GYUTxOs -> m (Maybe (GYTxOutRef, GYUTxOs))
- data GYOutDatum
- isInlineDatum :: GYOutDatum -> Bool
- outDatumToApi :: GYOutDatum -> TxOutDatum ctx ApiEra
- outDatumToPlutus :: GYOutDatum -> OutputDatum
- filterUTxOs :: (GYUTxO -> Bool) -> GYUTxOs -> GYUTxOs
- mapMaybeUTxOs :: (GYUTxO -> Maybe a) -> GYUTxOs -> Map GYTxOutRef a
- mapUTxOs :: (GYUTxO -> a) -> GYUTxOs -> Map GYTxOutRef a
- witherUTxOs :: Applicative f => (GYUTxO -> f (Maybe a)) -> GYUTxOs -> f (Map GYTxOutRef a)
- utxosFromList :: [GYUTxO] -> GYUTxOs
- utxosFromUTxO :: GYUTxO -> GYUTxOs
- utxosToList :: GYUTxOs -> [GYUTxO]
- foldlUTxOs' :: (a -> GYUTxO -> a) -> a -> GYUTxOs -> a
- foldMapUTxOs :: Monoid m => (GYUTxO -> m) -> GYUTxOs -> m
- forUTxOs_ :: Applicative f => GYUTxOs -> (GYUTxO -> f a) -> f ()
- foldMUTxOs :: Monad m => (a -> GYUTxO -> m a) -> a -> GYUTxOs -> m a
- utxosRefs :: GYUTxOs -> [GYTxOutRef]
- utxosRefs' :: GYUTxOs -> Set GYTxOutRef
Documentation
An unspent transaction output.
Constructors
GYUTxO | |
Fields
|
utxoToPlutus :: GYUTxO -> TxOut #
utxoHasInlineDatum :: GYUTxO -> Bool #
Whether the UTxO has it's datum inlined?
utxoHasReferenceScript :: GYUTxO -> Bool #
Whether the UTxO has script to refer?
utxoTranslatableToV1 :: GYUTxO -> Bool #
Is a UTxO translatable to language PlutusV1 output?
A set of unspent transaction outputs.
Actually a map from unspent transaction outputs to address, value and datum hash.
utxosFromApi :: UTxO era -> GYUTxOs #
utxosToApi :: GYUTxOs -> UTxO ApiEra #
utxosRemoveTxOutRef :: GYTxOutRef -> GYUTxOs -> GYUTxOs #
Remove particular GYTxOutRef
from GYUTxOs
.
Used to remove collateral, so we don't use it in transactions.
utxosRemoveTxOutRefs :: Set GYTxOutRef -> GYUTxOs -> GYUTxOs #
Remove several GYTxOutRef
s from GYUTxOs
.
utxosRemoveRefScripts :: GYUTxOs -> GYUTxOs #
Remove UTxOs containing reference scripts inside them from GYUTxOs
.
utxosRemoveUTxOs :: GYUTxOs -> GYUTxOs -> GYUTxOs #
Given two GYUTxOs
, returns elements from the first one, not present in the second one.
utxosLookup :: GYTxOutRef -> GYUTxOs -> Maybe GYUTxO #
Lookup a UTxO given a ref.
someTxOutRef :: GYUTxOs -> Maybe (GYTxOutRef, GYUTxOs) #
Get some output reference from GYUTxOs
.
Used to pick an input for minting, or selecting collateral (in tests).
randomTxOutRef :: MonadRandom m => GYUTxOs -> m (Maybe (GYTxOutRef, GYUTxOs)) #
Get a random output reference from GYUTxOs
.
UTxO datums
data GYOutDatum #
The datum contained within a transaction output.
Constructors
GYOutDatumNone | The output has no datum. |
GYOutDatumHash !GYDatumHash | The output contains a datum hash, the associated datum may or may not be included in the tx. |
GYOutDatumInline !GYDatum | The output contains an inline datum (i.e datum within the output itself). |
Instances
Show GYOutDatum # | |
Defined in GeniusYield.Types.UTxO Methods showsPrec :: Int -> GYOutDatum -> ShowS # show :: GYOutDatum -> String # showList :: [GYOutDatum] -> ShowS # | |
Eq GYOutDatum # | |
Defined in GeniusYield.Types.UTxO |
isInlineDatum :: GYOutDatum -> Bool #
outDatumToApi :: GYOutDatum -> TxOutDatum ctx ApiEra #
Filter and map
mapMaybeUTxOs :: (GYUTxO -> Maybe a) -> GYUTxOs -> Map GYTxOutRef a #
Map & filter GYUTxOs
contents.
witherUTxOs :: Applicative f => (GYUTxO -> f (Maybe a)) -> GYUTxOs -> f (Map GYTxOutRef a) #
Applicative version of mapMaybeUTxOs
.
List conversions
Folds
foldlUTxOs' :: (a -> GYUTxO -> a) -> a -> GYUTxOs -> a #
Fold operation over a GYUTxOs
.
forUTxOs_ :: Applicative f => GYUTxOs -> (GYUTxO -> f a) -> f () #
foldMUTxOs :: Monad m => (a -> GYUTxO -> m a) -> a -> GYUTxOs -> m a #
Extract refs
utxosRefs :: GYUTxOs -> [GYTxOutRef] #
Returns a list of all GYTxOutRef
s inside a given GYUTxOs
.
utxosRefs' :: GYUTxOs -> Set GYTxOutRef #
Returns a set of all GYTxOutRef
s inside a given GYUTxOs
.