2020-06-17 18:01:20 +00:00
|
|
|
use ethers::prelude::*;
|
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> anyhow::Result<()> {
|
2020-06-21 07:17:11 +00:00
|
|
|
let ws = Ws::connect("ws://localhost:8546").await?;
|
|
|
|
let provider = Provider::new(ws);
|
2020-06-17 18:01:20 +00:00
|
|
|
let mut stream = provider.watch_blocks().await?.interval(2000u64).stream();
|
|
|
|
while let Some(block) = stream.next().await {
|
|
|
|
dbg!(block);
|
|
|
|
}
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|