1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use std::error::Error;
use std::io::{stdin, BufRead};
use ::cadence_json::AddressOwned;
use flow_sdk::prelude::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
let stdin = stdin();
let mut stdin = stdin.lock();
let mut buf = String::new();
println!("Enter the account's address:");
stdin.read_line(&mut buf)?;
let addr = buf.trim();
let address: AddressOwned = addr.parse()?;
let mut net = TonicHyperFlowClient::mainnet().await?;
let account = net.account_at_latest_block(&address.data).await?;
let latest_block_height = net.latest_block_header(Seal::Sealed).await?.height;
let account1 = net
.account_at_block_height(&address.data, latest_block_height)
.await?;
println!("{:#?}", account);
assert_eq!(account, account1);
Ok(())
}