You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ async fn run_scanner(
70
70
) ->Result<(), Box<dynstd::error::Error>> {
71
71
// Configure scanner with custom batch size (optional)
72
72
letmutscanner=EventScanner::live()
73
-
.max_reads(500) // Process up to 500 blocks per batch
73
+
.block_read_limit(500) // Process up to 500 blocks per batch
74
74
.connect_ws::<Ethereum>(ws_url).await?;
75
75
76
76
letfilter=EventFilter::new()
@@ -101,22 +101,22 @@ async fn run_scanner(
101
101
```rust
102
102
// Live streaming mode
103
103
letscanner=EventScanner::live()
104
-
.max_reads(500) // Optional: set max blocks per read (default: 1000)
104
+
.block_read_limit(500) // Optional: set max blocks per read (default: 1000)
105
105
.connect_ws::<Ethereum>(ws_url).await?;
106
106
107
107
// Historical scanning mode
108
108
letscanner=EventScanner::historic()
109
-
.max_reads(500)
109
+
.block_read_limit(500)
110
110
.connect_ws::<Ethereum>(ws_url).await?;
111
111
112
112
// Sync mode (historical + live)
113
113
letscanner=EventScanner::sync()
114
-
.max_reads(500)
114
+
.block_read_limit(500)
115
115
.connect_ws::<Ethereum>(ws_url).await?;
116
116
117
117
// Latest mode (recent blocks only)
118
118
letscanner=EventScanner::latest()
119
-
.max_reads(500)
119
+
.block_read_limit(500)
120
120
.connect_ws::<Ethereum>(ws_url).await?;
121
121
```
122
122
@@ -127,7 +127,7 @@ let scanner = EventScanner::latest()
127
127
-`EventScanner::latest()` – Processes a specific number of events then optionally switches to live scanning mode
128
128
129
129
**Global Configuration Options:**
130
-
-`max_reads(usize)` – Sets the maximum number of blocks to process per read operation. This prevents RPC provider errors from overly large block range queries.
130
+
-`block_read_limit(usize)` – Sets the maximum number of blocks to process per read operation. This prevents RPC provider errors from overly large block range queries.
131
131
- Connect with `connect_ws::<Ethereum>(url)`, `connect_ipc::<Ethereum>(path)`, or `connect_provider(provider)`.
132
132
133
133
**Mode-specific APIs:**
@@ -177,7 +177,7 @@ The flexibility provided by `EventFilter` allows you to build sophisticated even
177
177
-**Latest mode** – `EventScanner::latest()` creates a scanner that processes a set number of events.
178
178
179
179
**Configuration Tips:**
180
-
- Set `max_reads` based on your RPC provider's limits (e.g., Alchemy, Infura may limit queries to 2000 blocks)
180
+
- Set `block_read_limit` based on your RPC provider's limits (e.g., Alchemy, Infura may limit queries to 2000 blocks)
181
181
- For live mode, if the WebSocket subscription lags significantly (e.g., >2000 blocks), ranges are automatically capped to prevent RPC errors
182
182
- Each mode has its own configuration options for start block, end block, confirmations, etc. where it makes sense
183
183
- The modes come with sensible defaults for example not specify a start block for historic mode automatically sets the start block to the earliest one
0 commit comments