-
Notifications
You must be signed in to change notification settings - Fork 3
Retrieve a block by ID
MarshallBelles edited this page Oct 15, 2021
·
3 revisions
Example:
Make sure to replace 7bc42fe85d32ca513769a74f97f7e1a7bad6c9407f0d934c2aa645ef9cf613c7
with a hex-encoded block ID that exists in your emulator / environment.
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(Some("7bc42fe85d32ca513769a74f97f7e1a7bad6c9407f0d934c2aa645ef9cf613c7".to_string()), None, None).await?;
println!("Got Block: {:?}", hex::encode(result.block.unwrap().id));
Ok(())
}