| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Mantra.Chain
Description
Watching activity on the blockchain.
Synopsis
- type Processor = BlockInMode CardanoMode -> ChainTip -> IO ()
- type Reverter = ChainPoint -> ChainTip -> IO ()
- type IdleNotifier = IO Bool
- type ScriptHandler = BlockHeader -> TxId -> ScriptHash -> SimpleScript SimpleScriptV2 -> IO ()
- type TxInHandler = BlockHeader -> TxIn -> IO ()
- type TxOutHandler = forall era. IsCardanoEra era => BlockHeader -> [TxIn] -> TxIn -> TxOut era -> IO ()
- walkBlocks :: MonadIO m => FilePath -> ConsensusModeParams CardanoMode -> NetworkId -> IdleNotifier -> Maybe Reverter -> Processor -> MantraM m ()
- extractScripts :: MonadIO m => FilePath -> ConsensusModeParams CardanoMode -> NetworkId -> IdleNotifier -> ScriptHandler -> MantraM m ()
- watchTransactions :: MonadIO m => FilePath -> ConsensusModeParams CardanoMode -> NetworkId -> Maybe Reverter -> IdleNotifier -> BlockHandler -> TxInHandler -> TxOutHandler -> MantraM m ()
Handlers
Arguments
| = BlockInMode CardanoMode | The block. |
| -> ChainTip | The chain tip. |
| -> IO () | Action to process activity. |
Process a block.
Arguments
| = ChainPoint | The new chain point. |
| -> ChainTip | The chain tip. |
| -> IO () | Action to handle the rollback. |
Handle a rollback.
type IdleNotifier Source #
Arguments
| = IO Bool | Action that returns whether processing should terminate. |
Peform action when idle.
type ScriptHandler Source #
Arguments
| = BlockHeader | The block header. |
| -> TxId | The transaction identifier. |
| -> ScriptHash | The script's hash. |
| -> SimpleScript SimpleScriptV2 | The script. |
| -> IO () | Action to process the script. |
Process a script.
type TxInHandler Source #
Arguments
| = BlockHeader | The block header. |
| -> TxIn | The UTxO. |
| -> IO () | Action to process a spent UTxO. |
Process a spent UTxO.
type TxOutHandler Source #
Arguments
| = forall era. IsCardanoEra era | |
| => BlockHeader | The block header. |
| -> [TxIn] | The spent UTxOs. |
| -> TxIn | The output UTxO. |
| -> TxOut era | The transaction output. |
| -> IO () | Action to process a transaction's output. |
Process a transaction's output.
Activity
Arguments
| :: MonadIO m | |
| => FilePath | The path to the node's socket. |
| -> ConsensusModeParams CardanoMode | The consensus mode. |
| -> NetworkId | The network. |
| -> IdleNotifier | Handle idleness. |
| -> Maybe Reverter | Handle rollbacks. |
| -> Processor | Handle blocks. |
| -> MantraM m () | Action to walk the blockchain. |
Process activity on the blockchain.
Arguments
| :: MonadIO m | |
| => FilePath | Path to the node's socket. |
| -> ConsensusModeParams CardanoMode | Consensus mode. |
| -> NetworkId | The network. |
| -> IdleNotifier | Handle idleness. |
| -> ScriptHandler | Handle a script. |
| -> MantraM m () | Action to extract scripts. |
Extract scripts from the blockchain.
Arguments
| :: MonadIO m | |
| => FilePath | Path to the node's socket. |
| -> ConsensusModeParams CardanoMode | The consensus mode. |
| -> NetworkId | The network. |
| -> Maybe Reverter | Handle rollbacks. |
| -> IdleNotifier | Handle idleness. |
| -> BlockHandler | Handle blocks. |
| -> TxInHandler | Handle spent UTxOs. |
| -> TxOutHandler | Handle transaction output. |
| -> MantraM m () | Action to watch transactions. |
Watch transactions on the blockchain. Note that transaction output is reported *before* spent UTxOs.