Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Marconi.Cardano.Indexers.Utxo
Synopsis
- data Utxo = Utxo !AddressAny TxIndexInBlock !TxIn !(Maybe (Hash ScriptData)) !Value !(Maybe ScriptInAnyLang) !(Maybe ScriptHash)
- type UtxoEvent = NonEmpty Utxo
- address :: Lens' Utxo AddressAny
- txIndex :: Lens' Utxo TxIndexInBlock
- txIn :: Lens' Utxo TxIn
- datumHash :: Lens' Utxo (Maybe (Hash ScriptData))
- value :: Lens' Utxo Value
- inlineScript :: Lens' Utxo (Maybe ScriptInAnyLang)
- inlineScriptHash :: Lens' Utxo (Maybe ScriptHash)
- type UtxoIndexer = SQLiteIndexer UtxoEvent
- mkUtxoIndexer :: (MonadIO m, MonadError IndexerError m) => SQLiteDBLocation -> m UtxoIndexer
- data UtxoIndexerConfig = UtxoIndexerConfig [AddressAny] Bool
- type StandardUtxoIndexer m = StandardSQLiteIndexer m UtxoEvent
- utxoWorker :: (MonadIO n, MonadError IndexerError n, MonadIO m) => StandardWorkerConfig m input UtxoEvent -> UtxoIndexerConfig -> SQLiteDBLocation -> n (StandardWorker m input UtxoEvent SQLiteIndexer)
- utxoBuilder :: (MonadIO n, MonadError IndexerError n) => SecurityParam -> CatchupConfig -> UtxoIndexerConfig -> Trace IO Text -> FilePath -> n (StandardWorker IO [AnyTxBody] UtxoEvent SQLiteIndexer)
- catchupConfigEventHook :: Trace IO Text -> FilePath -> CatchupEvent -> IO ()
- trackedAddresses :: Lens' UtxoIndexerConfig [AddressAny]
- includeScript :: Lens' UtxoIndexerConfig Bool
- getUtxoEventsFromBlock :: IsCardanoEra era => Block era -> [Utxo]
- getUtxosFromTx :: IsCardanoEra era => TxIndexInBlock -> Tx era -> [Utxo]
- getUtxosFromTxBody :: IsCardanoEra era => TxIndexInBlock -> TxBody era -> [Utxo]
Event
Indexer representation of an UTxO
Constructors
Utxo !AddressAny TxIndexInBlock !TxIn !(Maybe (Hash ScriptData)) !Value !(Maybe ScriptInAnyLang) !(Maybe ScriptHash) |
Instances
type UtxoEvent = NonEmpty Utxo #
An alias for a non-empty list of Utxo
, it's the event potentially produced on each block
address :: Lens' Utxo AddressAny #
txIndex :: Lens' Utxo TxIndexInBlock #
inlineScript :: Lens' Utxo (Maybe ScriptInAnyLang) #
inlineScriptHash :: Lens' Utxo (Maybe ScriptHash) #
Indexer and runner
type UtxoIndexer = SQLiteIndexer UtxoEvent #
Arguments
:: (MonadIO m, MonadError IndexerError m) | |
=> SQLiteDBLocation | SQL connection to database |
-> m UtxoIndexer |
Make a SQLiteIndexer for Utxos
data UtxoIndexerConfig #
Constructors
UtxoIndexerConfig [AddressAny] Bool |
type StandardUtxoIndexer m = StandardSQLiteIndexer m UtxoEvent #
Arguments
:: (MonadIO n, MonadError IndexerError n, MonadIO m) | |
=> StandardWorkerConfig m input UtxoEvent | General configuration of the indexer (mostly for logging purpose) |
-> UtxoIndexerConfig | Specific configuration of the indexer (mostly for logging purpose) |
-> SQLiteDBLocation | SQLite database location |
-> n (StandardWorker m input UtxoEvent SQLiteIndexer) |
A minimal worker for the UTXO indexer, with catchup and filtering.
utxoBuilder :: (MonadIO n, MonadError IndexerError n) => SecurityParam -> CatchupConfig -> UtxoIndexerConfig -> Trace IO Text -> FilePath -> n (StandardWorker IO [AnyTxBody] UtxoEvent SQLiteIndexer) #
Convenience wrapper around utxoWorker
with some defaults for
creating StandardWorkerConfig
, including a preprocessor.
catchupConfigEventHook :: Trace IO Text -> FilePath -> CatchupEvent -> IO () #
trackedAddresses :: Lens' UtxoIndexerConfig [AddressAny] #
includeScript :: Lens' UtxoIndexerConfig Bool #
Extractors
Arguments
:: IsCardanoEra era | |
=> Block era | |
-> [Utxo] | UtxoEvents are stored in storage after conversion to UtxoRow |
Extract UtxoEvents from Cardano Block
Returns Nothing
if the block doesn't consume or spend any utxo
getUtxosFromTx :: IsCardanoEra era => TxIndexInBlock -> Tx era -> [Utxo] #
getUtxosFromTxBody :: IsCardanoEra era => TxIndexInBlock -> TxBody era -> [Utxo] #
Extract Utxos from Cardano TxBody