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 get_hopr_allowance<'life0, 'async_trait>(
&'life0 self,
owner: Address,
spender: Address,
) -> Pin<Box<dyn Future<Output = Result<HoprBalance>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_xdai_balance<'life0, 'async_trait>(
&'life0 self,
address: Address,
) -> Pin<Box<dyn Future<Output = Result<XDaiBalance>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_hopr_balance<'life0, 'async_trait>(
&'life0 self,
address: Address,
) -> Pin<Box<dyn Future<Output = Result<HoprBalance>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn try_stream_logs<'a>(
&'a self,
start_block_number: u64,
filters: FilterSet,
is_synced: bool,
) -> Result<Pin<Box<dyn Stream<Item = BlockWithLogs> + Send + 'a>>>;
}
Expand description
Trait with RPC provider functionality required by the Indexer.
Required Methods§
Sourcefn 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 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.
Sourcefn get_hopr_allowance<'life0, 'async_trait>(
&'life0 self,
owner: Address,
spender: Address,
) -> Pin<Box<dyn Future<Output = Result<HoprBalance>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_hopr_allowance<'life0, 'async_trait>(
&'life0 self,
owner: Address,
spender: Address,
) -> Pin<Box<dyn Future<Output = Result<HoprBalance>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Queries the HOPR token allowance between owner and spender addresses.
This method queries the HOPR token contract to determine how many tokens the owner has approved the spender to transfer on their behalf.
§Arguments
owner
- The address that owns the tokens and grants the allowancespender
- The address that is approved to spend the tokens
§Returns
Result<HoprBalance>
- The current allowance amount
Sourcefn get_xdai_balance<'life0, 'async_trait>(
&'life0 self,
address: Address,
) -> Pin<Box<dyn Future<Output = Result<XDaiBalance>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_xdai_balance<'life0, 'async_trait>(
&'life0 self,
address: Address,
) -> Pin<Box<dyn Future<Output = Result<XDaiBalance>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn get_hopr_balance<'life0, 'async_trait>(
&'life0 self,
address: Address,
) -> Pin<Box<dyn Future<Output = Result<HoprBalance>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_hopr_balance<'life0, 'async_trait>(
&'life0 self,
address: Address,
) -> Pin<Box<dyn Future<Output = Result<HoprBalance>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn try_stream_logs<'a>(
&'a self,
start_block_number: u64,
filters: FilterSet,
is_synced: bool,
) -> Result<Pin<Box<dyn Stream<Item = BlockWithLogs> + Send + 'a>>>
fn try_stream_logs<'a>( &'a self, start_block_number: u64, filters: FilterSet, is_synced: bool, ) -> Result<Pin<Box<dyn Stream<Item = BlockWithLogs> + Send + 'a>>>
Streams blockchain logs using selective filtering based on synchronization state.
This method intelligently selects which log filters to use based on whether
the indexer is currently syncing historical data or processing live events.
During initial sync, it uses no_token
filters to exclude irrelevant token
events. When synced, it uses all filters to capture complete event data.
§Arguments
start_block_number
- Starting block number for log retrievalfilters
- Set of categorized filters (all, token, no_token)is_synced
- Whether the indexer has completed initial synchronization
§Returns
impl Stream<Item = Result<Log>>
- Stream of blockchain logs
§Behavior
- When
is_synced
isfalse
: Usesfilter_set.no_token
to reduce log volume - When
is_synced
istrue
: Usesfilter_set.all
for complete coverage