use ethers::prelude::*; use std::time::Duration; #[tokio::main] async fn main() -> anyhow::Result<()> { let ws = Ws::connect("ws://localhost:8546").await?; let provider = Provider::new(ws).interval(Duration::from_millis(2000)); let mut stream = provider.watch_blocks().await?.stream(); while let Some(block) = stream.next().await { dbg!(block); } Ok(()) }