mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 11:28:02 +00:00
ce0a82e322
* remove unneeded Config bounds and BlockNumber associated type * clippy and fmt
39 lines
1.1 KiB
Rust
39 lines
1.1 KiB
Rust
// Copyright 2019-2022 Parity Technologies (UK) Ltd.
|
|
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
|
// see LICENSE for license details.
|
|
|
|
//! To run this example, a local polkadot node should be running. Example verified against polkadot v0.9.28-9ffe6e9e3da.
|
|
//!
|
|
//! E.g.
|
|
//! ```bash
|
|
//! curl "https://github.com/paritytech/polkadot/releases/download/v0.9.28/polkadot" --output /usr/local/bin/polkadot --location
|
|
//! polkadot --dev --tmp
|
|
//! ```
|
|
|
|
use subxt::{
|
|
OnlineClient,
|
|
PolkadotConfig,
|
|
};
|
|
|
|
// Generate the API from a static metadata path.
|
|
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata.scale")]
|
|
pub mod polkadot {}
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
tracing_subscriber::fmt::init();
|
|
|
|
// Create a client to use:
|
|
let api = OnlineClient::<PolkadotConfig>::new().await?;
|
|
|
|
// Build a constant address to query:
|
|
let address = polkadot::constants().balances().existential_deposit();
|
|
|
|
// Look it up:
|
|
let existential_deposit = api.constants().at(&address)?;
|
|
|
|
println!("Existential Deposit: {existential_deposit}");
|
|
|
|
Ok(())
|
|
}
|