hopr_chain_rpc

Trait HoprIndexerRpcOperations

Source
pub trait HoprIndexerRpcOperations {
    // Required methods
    fn block_number<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn try_stream_logs<'a>(
        &'a self,
        start_block_number: u64,
        filter: LogFilter,
    ) -> Result<Pin<Box<dyn Stream<Item = BlockWithLogs> + Send + 'a>>>;
}
Expand description

Trait with RPC provider functionality required by the Indexer.

Required Methods§

Source

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

Retrieves the latest block number.

Source

fn try_stream_logs<'a>( &'a self, start_block_number: u64, filter: LogFilter, ) -> Result<Pin<Box<dyn Stream<Item = BlockWithLogs> + Send + 'a>>>

Starts streaming logs from the given start_block_number. If no start_block_number is given, the stream starts from the latest block. The given filter are applied to retrieve the logs, the function fails if the filter is empty. The streaming stops only when the corresponding channel is closed by the returned receiver.

Implementors§

Source§

impl<P: JsonRpcClient + 'static> HoprIndexerRpcOperations for RpcOperations<P>