mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 23:21:06 +00:00
move examples to main repo so we can include_str them for publishing (#993)
* move exampels to main repo so we can include_str them for publishing * update CI to not break examples
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
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 contant:
|
||||
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(())
|
||||
}
|
||||
Reference in New Issue
Block a user