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§
Sourcefn on_tx_rollbacked(
_address: String,
_txid: Txid,
_reason: String,
_rollbacked_states: Vec<Self::PoolState>,
)
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.
Sourcefn on_tx_confirmed(_address: String, _txid: Txid, _block: Block)
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.
Sourcefn on_block_confirmed(_block: Block)
fn on_block_confirmed(_block: Block)
This function is called when a block is received.
Sourcefn pre_block_confirmed(_height: u32)
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.