mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 00:01:09 +00:00
Remove unneeded Config bounds and BlockNumber associated type (#804)
* remove unneeded Config bounds and BlockNumber associated type * clippy and fmt
This commit is contained in:
@@ -38,7 +38,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Submit the transaction with default params:
|
||||
let hash = api.tx().sign_and_submit_default(&tx, &signer).await?;
|
||||
|
||||
println!("Balance transfer extrinsic submitted: {}", hash);
|
||||
println!("Balance transfer extrinsic submitted: {hash}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// submit the transaction:
|
||||
let hash = api.tx().sign_and_submit(&tx, &signer, tx_params).await?;
|
||||
|
||||
println!("Balance transfer extrinsic submitted: {}", hash);
|
||||
println!("Balance transfer extrinsic submitted: {hash}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ impl Config for MyConfig {
|
||||
// polkadot runtime used, so some operations will fail. Normally when using a custom `Config`
|
||||
// impl types MUST match exactly those used in the actual runtime.
|
||||
type Index = u64;
|
||||
type BlockNumber = <SubstrateConfig as Config>::BlockNumber;
|
||||
type Hash = <SubstrateConfig as Config>::Hash;
|
||||
type Hasher = <SubstrateConfig as Config>::Hasher;
|
||||
type Header = <SubstrateConfig as Config>::Header;
|
||||
@@ -58,7 +57,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// submit the transaction with default params:
|
||||
let hash = api.tx().sign_and_submit_default(&tx, &signer).await?;
|
||||
|
||||
println!("Balance transfer extrinsic submitted: {}", hash);
|
||||
println!("Balance transfer extrinsic submitted: {hash}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -46,13 +46,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
// submit the transaction with default params:
|
||||
let hash = api.tx().sign_and_submit_default(&tx, &signer).await?;
|
||||
println!("Balance transfer extrinsic submitted: {}", hash);
|
||||
println!("Balance transfer extrinsic submitted: {hash}");
|
||||
|
||||
// 2. Dynamic constant access (the dynamic equivalent to the fetch_constants example).
|
||||
|
||||
let constant_address = subxt::dynamic::constant("Balances", "ExistentialDeposit");
|
||||
let existential_deposit = api.constants().at(&constant_address)?.to_value()?;
|
||||
println!("Existential Deposit: {}", existential_deposit);
|
||||
println!("Existential Deposit: {existential_deposit}");
|
||||
|
||||
// 3. Dynamic storage access
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Look it up:
|
||||
let existential_deposit = api.constants().at(&address)?;
|
||||
|
||||
println!("Existential Deposit: {}", existential_deposit);
|
||||
println!("Existential Deposit: {existential_deposit}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -45,14 +45,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
);
|
||||
|
||||
let alice_id = AccountKeyring::Alice.to_account_id();
|
||||
println!(" Alice account id: {:?}", alice_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);
|
||||
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);
|
||||
@@ -63,7 +63,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.fetch(&controller_acc_addr)
|
||||
.await?
|
||||
.unwrap();
|
||||
println!(" account controlled by: {:?}", controller_acc);
|
||||
println!(" account controlled by: {controller_acc:?}");
|
||||
|
||||
let era_reward_addr = polkadot::storage().staking().eras_reward_points(era.index);
|
||||
let era_result = api
|
||||
@@ -72,7 +72,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.await?
|
||||
.fetch(&era_reward_addr)
|
||||
.await?;
|
||||
println!("Era reward points: {:?}", era_result);
|
||||
println!("Era reward points: {era_result:?}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
println!("\nExample 1. Obtained keys:");
|
||||
while let Some((key, value)) = iter.next().await? {
|
||||
println!("Key: 0x{}", hex::encode(key));
|
||||
println!(" Value: {}", value);
|
||||
println!(" Value: {value}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// - polkadot.rs generated file under `version_notifiers()` fn
|
||||
// - metadata in json format
|
||||
let value = u64::decode(&mut &*storage_data)?;
|
||||
println!(" Value: {}", value);
|
||||
println!(" Value: {value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// - polkadot.rs generated file under `version_notifiers()` fn
|
||||
// - metadata in json format
|
||||
let value = u64::decode(&mut &storage_data[..])?;
|
||||
println!(" Value: {}", value);
|
||||
println!(" Value: {value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ async fn handle_transfer_events() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
// Report other statuses we see.
|
||||
else {
|
||||
println!("Current transaction status: {:?}", ev);
|
||||
println!("Current transaction status: {ev:?}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let update_client = api.updater();
|
||||
tokio::spawn(async move {
|
||||
let result = update_client.perform_runtime_updates().await;
|
||||
println!("Runtime update failed with result={:?}", result);
|
||||
println!("Runtime update failed with result={result:?}");
|
||||
});
|
||||
|
||||
// If this client is kept in use a while, it'll update its metadata and such
|
||||
|
||||
Reference in New Issue
Block a user