Trait MidnightClientTrait

Source
pub trait MidnightClientTrait {
    // Required methods
    fn get_events<'life0, 'async_trait>(
        &'life0 self,
        start_block: u64,
        end_block: Option<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<MidnightEvent>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_chain_type<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Extended functionality specific to Midnight blockchain

This trait provides additional methods specific to the Midnight blockchain, such as event retrieval and chain type information.

Required Methods§

Source

fn get_events<'life0, 'async_trait>( &'life0 self, start_block: u64, end_block: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<MidnightEvent>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves events within a block range

Fetches and decodes events from the specified block range. The events are retrieved in parallel for better performance.

§Arguments
  • start_block - Starting block number
  • end_block - Optional ending block number. If None, only fetches start_block
§Returns
  • Result<Vec<MidnightEvent>, anyhow::Error> - Collection of events or error
Source

fn get_chain_type<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves the chain type

Gets the chain type information from the Midnight blockchain. This is specific for Polkadot-based chains.

§Returns
  • Result<String, anyhow::Error> - Chain type

Implementors§