mantra-0.4.0.0
Safe HaskellNone
LanguageHaskell2010

Mantra.Chain

Description

Watching activity on the blockchain.

Synopsis

Handlers

type Processor Source #

Arguments

 = BlockInMode CardanoMode

The block.

-> ChainTip

The chain tip.

-> IO ()

Action to process activity.

Process a block.

type Reverter Source #

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

walkBlocks Source #

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.

extractScripts Source #

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.

watchTransactions Source #

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.