Files
pezkuwi-subxt/subxt/examples/constants_static.rs
T
Donn Pawelek 02eda40bba docs: fix typos in docs (#2045)
* docs: fix typos in docs

* up

* up
2025-07-29 16:01:22 +01:00

21 lines
589 B
Rust

#![allow(missing_docs)]
use subxt::{OnlineClient, PolkadotConfig};
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client to use:
let api = OnlineClient::<PolkadotConfig>::new().await?;
// A query to obtain some constant:
let constant_query = polkadot::constants().system().block_length();
// Obtain the value:
let value = api.constants().at(&constant_query)?;
println!("Block length: {value:?}");
Ok(())
}