XXX: Include return type for decoding

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2023-02-14 16:36:45 +02:00
parent 90bf22a1fb
commit a491858ddd
6 changed files with 20 additions and 87 deletions
-28
View File
@@ -40,26 +40,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let bytes = api.runtime_api().at(None).await?.call(api_tx).await?;
println!("Result: {:?}", bytes);
let result: polkadot::runtime_api::Core::version_target =
Decode::decode(&mut &bytes[..])?;
println!(
"Result for polkadot::runtime_api::Core::version(): {:?}\n\n",
result
);
let api_tx = polkadot::runtime_api::Metadata::metadata_versions();
println!("RuntimeApi payload: {:?}", api_tx);
let bytes = api.runtime_api().at(None).await?.call(api_tx).await?;
println!("Result: {:?}", bytes);
let result: polkadot::runtime_api::Metadata::metadata_versions_target =
Decode::decode(&mut &bytes[..])?;
println!(
"Result for polkadot::runtime_api::Metadata::metadata_versions(): {:?}\n\n",
result
);
let alice = AccountKeyring::Alice.to_account_id().into();
let api_tx = polkadot::runtime_api::AccountNonceApi::account_nonce(alice);
println!("RuntimeApi payload: {:?}", api_tx);
@@ -67,13 +53,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let bytes = api.runtime_api().at(None).await?.call(api_tx).await?;
println!("Result: {:?}", bytes);
let result: polkadot::runtime_api::AccountNonceApi::account_nonce_target =
Decode::decode(&mut &bytes[..])?;
println!(
"Result for polkadot::runtime_api::AccountNonceApi::account_nonce: {:?}\n\n",
result
);
// Send from Alice to Bob.
let signer = PairSigner::new(AccountKeyring::Alice.pair());
let dest = AccountKeyring::Bob.to_account_id().into();
@@ -95,12 +74,5 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let bytes = api.runtime_api().at(None).await?.call(api_tx).await?;
println!("Result: {:?}", bytes);
let result: polkadot::runtime_api::AccountNonceApi::account_nonce_target =
Decode::decode(&mut &bytes[..])?;
println!(
"Result for polkadot::runtime_api::AccountNonceApi::account_nonce: {:?}\n\n",
result
);
Ok(())
}