Module

Contract.Backend.Ogmios.Mempool

A module for interacting with Ogmios' Local TX Monitor These functions only work with Ogmios backend (not Blockfrost!). https://ogmios.dev/mini-protocols/local-tx-monitor/

#acquireMempoolSnapshot

acquireMempoolSnapshot :: Contract MempoolSnapshotAcquired

Establish a connection with the Local TX Monitor. Instantly accquires the current mempool snapshot, and will wait for the next mempool snapshot if used again before using releaseMempool.

#fetchMempoolTxs

fetchMempoolTxs :: MempoolSnapshotAcquired -> Contract (Array Transaction)

Recursively request the next TX in the mempool until Ogmios does not respond with a new TX.

#mempoolSnapshotHasTx

mempoolSnapshotHasTx :: MempoolSnapshotAcquired -> TransactionHash -> Contract Boolean

Check to see if a TxHash is present in the current mempool snapshot.

#mempoolSnapshotNextTx

mempoolSnapshotNextTx :: MempoolSnapshotAcquired -> Contract (Maybe Transaction)

Get the first received TX in the current mempool snapshot. This function can be recursively called to traverse the finger-tree of the mempool data set. This will return Nothing once it has reached the end of the current mempool.

#mempoolSnapshotSizeAndCapacity

mempoolSnapshotSizeAndCapacity :: MempoolSnapshotAcquired -> Contract MempoolSizeAndCapacity

The acquired snapshot’s size (in bytes), number of transactions, and capacity (in bytes).

#releaseMempool

releaseMempool :: MempoolSnapshotAcquired -> Contract Unit

Release the connection to the Local TX Monitor.

#withMempoolSnapshot

withMempoolSnapshot :: forall a. (MempoolSnapshotAcquired -> Contract a) -> Contract a

A bracket-style function for working with mempool snapshots - ensures release in the presence of exceptions

Re-exports from Ctl.Internal.QueryM.Ogmios

#MempoolTransaction

#MempoolSizeAndCapacity

newtype MempoolSizeAndCapacity

The acquired snapshot’s size (in bytes), number of transactions, and capacity (in bytes).

Constructors

Instances

Modules