Querying the Chain
Use the methods in the rpc
(opens in a new tab) SDK module
to directly query your full node's RPC endpoint.
Example
This code will attempt to query the chain's current epoch:
use namada_sdk::{rpc, Namada};
match rpc::query_epoch(sdk.client()).await {
Ok(current_epoch) => println!("Current epoch: {:?}", current_epoch),
Err(e) => println!("Query error: {:?}", e),
}