mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-23 00:18:00 +00:00
02eda40bba
* docs: fix typos in docs * up * up
19 lines
563 B
Rust
19 lines
563 B
Rust
#![allow(missing_docs)]
|
|
use subxt::{OnlineClient, PolkadotConfig};
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
// Create a client to use:
|
|
let api = OnlineClient::<PolkadotConfig>::new().await?;
|
|
|
|
// A dynamic query to obtain some constant:
|
|
let constant_query = subxt::dynamic::constant("System", "BlockLength");
|
|
|
|
// Obtain the value:
|
|
let value = api.constants().at(&constant_query)?;
|
|
|
|
println!("Constant bytes: {:?}", value.encoded());
|
|
println!("Constant value: {}", value.to_value()?);
|
|
Ok(())
|
|
}
|