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
+30-28Lines changed: 30 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,6 @@
11
11
Event Scanner is a Rust library for streaming EVM-based smart contract events. It is built on top of the [`alloy`](https://github.com/alloy-rs/alloy) ecosystem and focuses on in-memory scanning without a backing database. Applications provide event filters; the scanner takes care of fetching historical ranges, bridging into live streaming mode, all whilst delivering the events as streams of data.
12
12
13
13
---
14
-
15
14
16
15
## Table of Contents
17
16
@@ -76,8 +75,8 @@ async fn run_scanner(
76
75
.connect_ws::<Ethereum>(ws_url).await?;
77
76
78
77
letfilter=EventFilter::new()
79
-
.with_contract_address(contract)
80
-
.with_event(MyContract::SomeEvent::SIGNATURE);
78
+
.contract_address(contract)
79
+
.event(MyContract::SomeEvent::SIGNATURE);
81
80
82
81
letmutstream=scanner.subscribe(filter);
83
82
@@ -118,6 +117,7 @@ let scanner = EventScanner::sync()
118
117
119
118
// Latest mode (recent blocks only)
120
119
letscanner=EventScanner::latest()
120
+
.count(100)
121
121
.block_read_limit(500)
122
122
.connect_ws::<Ethereum>(ws_url).await?;
123
123
```
@@ -142,23 +142,23 @@ Create an `EventFilter` for each event stream you wish to process. The filter sp
142
142
```rust
143
143
// Track a SPECIFIC event from a SPECIFIC contract
The scanner periodically checks the tip to detect reorgs. On reorg, the scanner emits `ScannerStatus::ReorgDetected`, resets to the updated tip, and restarts the scan. Final delivery to log listeners is in chronological order.
230
232
231
233
Notes:
232
234
233
-
- Ensure you create streams via `subscribe()` before calling `scan_latest*` so listeners are registered.
235
+
- Ensure you create streams via `subscribe()` before calling `start` so listeners are registered.
234
236
<!-- TODO: uncomment once implemented - The function returns after delivering the messages; to continuously stream new blocks, use `scan_latest_then_live`. -->
235
237
236
238
---
237
239
238
240
## Examples
239
241
240
-
-`examples/simple_counter` – minimal live-mode scanner using `EventScanner::live()`
242
+
-`examples/live_scanning` – minimal live-mode scanner using `EventScanner::live()`
241
243
-`examples/historical_scanning` – demonstrates replaying historical data using `EventScanner::historic()`
242
244
-`examples/latest_events_scanning` – demonstrates scanning the latest events using `EventScanner::latest()`
0 commit comments