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-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,10 +85,13 @@ async fn run_scanner(
85
85
.contract_address(contract)
86
86
.event(MyContract::SomeEvent::SIGNATURE);
87
87
88
-
letmutstream=scanner.subscribe(filter);
88
+
letsubscription=scanner.subscribe(filter);
89
89
90
-
// Start the scanner
91
-
scanner.start().await?;
90
+
// Start the scanner and get the proof
91
+
letproof=scanner.start().await?;
92
+
93
+
// Access the stream using the proof
94
+
letmutstream=subscription.stream(&proof);
92
95
93
96
// Process messages from the stream
94
97
whileletSome(message) =stream.next().await {
@@ -174,7 +177,7 @@ let scanner = EventScannerBuilder::sync()
174
177
.await?;
175
178
```
176
179
177
-
Invoking `scanner.start()` starts the scanner in the specified mode.
180
+
Invoking `scanner.start()` starts the scanner in the specified mode and returns a `StartProof` that must be passed to `subscription.stream()` to access the event stream. This compile-time guarantee ensures the scanner is started before attempting to read events.
0 commit comments