pub async fn fetch_logs_chunked_range<P, R>(
provider: &P,
filter_template: Filter,
range: R,
chunk_size: u64,
) -> Result<Vec<Log>, EventProcessingError>Expand description
Fetch logs in chunks over a finite block range.
This is the range-first counterpart to fetch_logs_chunked. The supplied
filter_template should contain addresses and topics, while range
supplies the numeric block bounds used for chunking. Any existing block
selector on filter_template is overwritten by range.
Open-ended ranges such as start.. and ..=end are rejected because
chunked scans require concrete numeric bounds.
ยงExample
use semioscan::fetch_logs_chunked_range;
use alloy_primitives::Address;
use alloy_provider::ProviderBuilder;
use alloy_rpc_types::Filter;
let provider = ProviderBuilder::new()
.connect_http("https://eth.llamarpc.com".parse()?);
let contract_address: Address = "0xdAC17F958D2ee523a2206206994597C13D831ec7".parse()?;
let filter = Filter::new().address(contract_address);
let logs = fetch_logs_chunked_range(&provider, filter, 20_000_000..=20_000_100, 50).await?;