Files
pezkuwi-sdk/vendor/pezkuwi-subxt/subxt/examples/storage_fetch.rs
T
pezkuwichain 39a978acff fix: resolve cargo-clippy CI errors in vendor crates
- Fix rebrand issues in pezkuwi-subxt signer (sp_core -> pezsp_core,
  sp_keyring -> pezsp_keyring, sp_runtime -> pezsp_runtime)
- Fix pezkuwi-zombienet-sdk tests (subxt::PolkadotConfig ->
  pezkuwi_subxt::PezkuwiConfig)
- Correct artifact paths in subxt examples (polkadot_metadata_*.scale)
- Fix type conversion issues in subxt examples (explicit constructors
  instead of .into() for generated types)
- Add pezkuwi-subxt-utils-stripmetadata dev-dependency to metadata crate
- Use original polkadot module from external frame-decode crate
- Fix Display trait usage for generated AccountId32 types
2025-12-24 05:59:45 +03:00

29 lines
1.2 KiB
Rust

#![allow(missing_docs)]
use pezkuwi_subxt::{OnlineClient, PezkuwiConfig};
use pezkuwi_subxt_signer::sr25519::dev;
// Generate an interface that we can use from the node's metadata.
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new API client, configured to talk to Pezkuwi nodes.
let api = OnlineClient::<PezkuwiConfig>::new().await?;
let account = pezkuwi::runtime_types::sp_core::crypto::AccountId32(dev::alice().public_key().0);
// Build a storage query to access account information.
let storage_query = pezkuwi::storage().system().account();
// Use that query to access a storage entry, fetch a result and decode the value.
// The static address knows that fetching requires a tuple of one value, an
// AccountId32.
let client_at = api.storage().at_latest().await?;
let account_info = client_at.entry(storage_query)?.fetch((account,)).await?.decode()?;
// The static address that we got from the subxt macro knows the expected input
// and return types, so it is decoded into a static type for us.
println!("Alice: {account_info:?}");
Ok(())
}