Skip to main content

BlockDataProvider

Trait BlockDataProvider 

Source
pub trait BlockDataProvider: Send + Sync {
    // Required methods
    fn get_events<'life0, 'life1, 'async_trait>(
        &'life0 self,
        from: u64,
        to: u64,
        filter: &'life1 EventFilter,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<DecodedEvent>, IndexerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_block<'life0, 'async_trait>(
        &'life0 self,
        number: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Option<BlockSummary>, IndexerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Abstraction over an RPC provider for backfill purposes.

Implementations should wrap an actual JSON-RPC client (e.g. via chainrpc) and translate network errors into IndexerError::Rpc.

Required Methods§

Source

fn get_events<'life0, 'life1, 'async_trait>( &'life0 self, from: u64, to: u64, filter: &'life1 EventFilter, ) -> Pin<Box<dyn Future<Output = Result<Vec<DecodedEvent>, IndexerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch decoded events within [from, to] matching filter.

Source

fn get_block<'life0, 'async_trait>( &'life0 self, number: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<BlockSummary>, IndexerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetch a single block summary by number. Returns None if the block does not exist on the node (e.g. beyond the chain head).

Implementors§