Hook

Trait Hook 

Source
pub trait Hook: Pools {
    // Provided methods
    fn on_tx_rollbacked(
        _address: String,
        _txid: Txid,
        _reason: String,
        _rollbacked_states: Vec<Self::PoolState>,
    ) { ... }
    fn on_tx_confirmed(_address: String, _txid: Txid, _block: Block) { ... }
    fn on_block_confirmed(_block: Block) { ... }
    fn pre_block_confirmed(_height: u32) { ... }
}
Expand description

A hook that can be implemented to respond to block event in the exchange lifecycle. It must be implemented over the BlockState type and marked as #[ree_exchange_sdk::hook].

Provided Methods§

Source

fn on_tx_rollbacked( _address: String, _txid: Txid, _reason: String, _rollbacked_states: Vec<Self::PoolState>, )

This function is called when a transaction is rejected and never confirmed.

Source

fn on_tx_confirmed(_address: String, _txid: Txid, _block: Block)

This function is called when a transaction is placed in a new block, before the on_block_confirmed.

Source

fn on_block_confirmed(_block: Block)

This function is called when a block is received.

Source

fn pre_block_confirmed(_height: u32)

This function is called when a block is received but before any other hooks.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§