mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +00:00
XXX: Generate Runtime API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -24,14 +24,22 @@ use subxt::{
|
||||
OnlineClient,
|
||||
};
|
||||
|
||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata.scale")]
|
||||
use codec::Encode;
|
||||
|
||||
#[subxt::subxt(runtime_metadata_url = "http://localhost:9933")]
|
||||
pub mod polkadot {}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
polkadot::runtime_api::Metadata_metadata();
|
||||
let api_tx = polkadot::runtime_api::Core::version();
|
||||
println!("RuntimeApi payload: {:?}", api_tx);
|
||||
|
||||
let api = OnlineClient::<PolkadotConfig>::new().await?;
|
||||
let bytes = api.runtime_api().at(None).await?.call(api_tx).await?;
|
||||
|
||||
println!("Result: {:?}", bytes);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user