Files
pezkuwi-sdk/vendor/pezkuwi-subxt/subxt/examples/runtime_apis_dynamic.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

28 lines
1012 B
Rust

#![allow(missing_docs)]
use pezkuwi_subxt::{config::PezkuwiConfig, utils::AccountId32, OnlineClient};
use pezkuwi_subxt_signer::sr25519::dev;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client to use:
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Create a "dynamic" runtime API payload that calls the
// `AccountNonceApi_account_nonce` function. We could use the
// `scale_value::Value` type as output, and a vec of those as inputs,
// but since we know the input + return types we can pass them directly.
// There is one input argument, so the inputs are a tuple of one element.
let account = AccountId32(dev::alice().public_key().0);
let runtime_api_call = pezkuwi_subxt::dynamic::runtime_api_call::<_, u64>(
"AccountNonceApi",
"account_nonce",
(account,),
);
// Submit the call to get back a result.
let nonce = api.runtime_api().at_latest().await?.call(runtime_api_call).await?;
println!("Account nonce: {:#?}", nonce);
Ok(())
}