mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 01:41:09 +00:00
XXX: Backup v15 show md via metadata_at_version
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -21,8 +21,8 @@ use subxt::{
|
||||
PolkadotConfig,
|
||||
};
|
||||
|
||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata.scale")]
|
||||
pub mod polkadot {}
|
||||
// #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata.scale")]
|
||||
// pub mod polkadot {}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
@@ -31,35 +31,35 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Create a client to use:
|
||||
let api = OnlineClient::<PolkadotConfig>::new().await?;
|
||||
|
||||
let active_era_addr = polkadot::storage().staking().active_era();
|
||||
let era = api.storage().fetch(&active_era_addr, None).await?.unwrap();
|
||||
println!(
|
||||
"Staking active era: index: {:?}, start: {:?}",
|
||||
era.index, era.start
|
||||
);
|
||||
// let active_era_addr = polkadot::storage().staking().active_era();
|
||||
// let era = api.storage().fetch(&active_era_addr, None).await?.unwrap();
|
||||
// println!(
|
||||
// "Staking active era: index: {:?}, start: {:?}",
|
||||
// era.index, era.start
|
||||
// );
|
||||
|
||||
let alice_id = AccountKeyring::Alice.to_account_id();
|
||||
println!(" Alice account id: {:?}", alice_id);
|
||||
// let alice_id = AccountKeyring::Alice.to_account_id();
|
||||
// println!(" Alice account id: {:?}", alice_id);
|
||||
|
||||
// Get Alice' Stash account ID
|
||||
let alice_stash_id: AccountId32 = sr25519::Pair::from_string("//Alice//stash", None)
|
||||
.expect("Could not obtain stash signer pair")
|
||||
.public()
|
||||
.into();
|
||||
println!(" Alice//stash account id: {:?}", alice_stash_id);
|
||||
// // Get Alice' Stash account ID
|
||||
// let alice_stash_id: AccountId32 = sr25519::Pair::from_string("//Alice//stash", None)
|
||||
// .expect("Could not obtain stash signer pair")
|
||||
// .public()
|
||||
// .into();
|
||||
// println!(" Alice//stash account id: {:?}", alice_stash_id);
|
||||
|
||||
// Map from all locked "stash" accounts to the controller account.
|
||||
let controller_acc_addr = polkadot::storage().staking().bonded(&alice_stash_id);
|
||||
let controller_acc = api
|
||||
.storage()
|
||||
.fetch(&controller_acc_addr, None)
|
||||
.await?
|
||||
.unwrap();
|
||||
println!(" account controlled by: {:?}", controller_acc);
|
||||
// // Map from all locked "stash" accounts to the controller account.
|
||||
// let controller_acc_addr = polkadot::storage().staking().bonded(&alice_stash_id);
|
||||
// let controller_acc = api
|
||||
// .storage()
|
||||
// .fetch(&controller_acc_addr, None)
|
||||
// .await?
|
||||
// .unwrap();
|
||||
// println!(" account controlled by: {:?}", controller_acc);
|
||||
|
||||
let era_reward_addr = polkadot::storage().staking().eras_reward_points(era.index);
|
||||
let era_result = api.storage().fetch(&era_reward_addr, None).await?;
|
||||
println!("Era reward points: {:?}", era_result);
|
||||
// let era_reward_addr = polkadot::storage().staking().eras_reward_points(era.index);
|
||||
// let era_result = api.storage().fetch(&era_reward_addr, None).await?;
|
||||
// println!("Era reward points: {:?}", era_result);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user