mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 04:07:57 +00:00
f48a5df2ca
* testing/staking: `history_depth` storage is now a constant Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * artifacts: Update metadata from `9ffe6e9e3da` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * testing: Update `polkadot.rs` from `9ffe6e9e3da` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * examples: Update comment wrt polkadot version Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * codegen: Fix clippy Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
37 lines
1.3 KiB
Rust
37 lines
1.3 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,
|
|
};
|
|
|
|
#[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();
|
|
|
|
let api = OnlineClient::<PolkadotConfig>::new().await?;
|
|
|
|
// Each individual request will be validated against the static code that was
|
|
// used to construct it, if possible. We can also validate the entirety of the
|
|
// statically generated code against some client at a given point in time using
|
|
// this check. If it fails, then there is some breaking change between the metadata
|
|
// used to generate this static code, and the runtime metadata from a node that the
|
|
// client is using.
|
|
polkadot::validate_codegen(&api)?;
|
|
|
|
Ok(())
|
|
}
|