Skip to content

Retrieve the latest block

MarshallBelles edited this page Oct 15, 2021 · 1 revision

Example:

use flow_rust_sdk::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut connection = FlowConnection::new("grpc://localhost:3569").await?;

    let result = connection.get_block(None, None, None).await?;

    println!("Current Block: {:?}", hex::encode(result.block.unwrap().id));
    Ok(())
}