mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 17:28:00 +00:00
Run cargo fmt on the whole code base (#9394)
* Run cargo fmt on the whole code base * Second run * Add CI check * Fix compilation * More unnecessary braces * Handle weights * Use --all * Use correct attributes... * Fix UI tests * AHHHHHHHHH * 🤦 * Docs * Fix compilation * 🤷 * Please stop * 🤦 x 2 * More * make rustfmt.toml consistent with polkadot Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
@@ -22,9 +22,8 @@ use crate::{
|
||||
OutputType,
|
||||
};
|
||||
use serde_json::json;
|
||||
use sp_core::crypto::{ExposeSecret, SecretString, Zeroize};
|
||||
use sp_core::{
|
||||
crypto::{Ss58AddressFormat, Ss58Codec},
|
||||
crypto::{ExposeSecret, SecretString, Ss58AddressFormat, Ss58Codec, Zeroize},
|
||||
hexdisplay::HexDisplay,
|
||||
Pair,
|
||||
};
|
||||
@@ -88,7 +87,7 @@ pub fn print_from_uri<Pair>(
|
||||
"{}",
|
||||
serde_json::to_string_pretty(&json).expect("Json pretty print failed")
|
||||
);
|
||||
}
|
||||
},
|
||||
OutputType::Text => {
|
||||
println!(
|
||||
"Secret phrase `{}` is account:\n \
|
||||
@@ -102,12 +101,9 @@ pub fn print_from_uri<Pair>(
|
||||
format_public_key::<Pair>(public_key.clone()),
|
||||
public_key.to_ss58check_with_version(network_override),
|
||||
format_account_id::<Pair>(public_key),
|
||||
pair.public()
|
||||
.into()
|
||||
.into_account()
|
||||
.to_ss58check_with_version(network_override),
|
||||
pair.public().into().into_account().to_ss58check_with_version(network_override),
|
||||
);
|
||||
}
|
||||
},
|
||||
}
|
||||
} else if let Ok((pair, seed)) = Pair::from_string_with_seed(uri, password.clone()) {
|
||||
let public_key = pair.public();
|
||||
@@ -127,7 +123,7 @@ pub fn print_from_uri<Pair>(
|
||||
"{}",
|
||||
serde_json::to_string_pretty(&json).expect("Json pretty print failed")
|
||||
);
|
||||
}
|
||||
},
|
||||
OutputType::Text => {
|
||||
println!(
|
||||
"Secret Key URI `{}` is account:\n \
|
||||
@@ -137,20 +133,13 @@ pub fn print_from_uri<Pair>(
|
||||
Account ID: {}\n \
|
||||
SS58 Address: {}",
|
||||
uri,
|
||||
if let Some(seed) = seed {
|
||||
format_seed::<Pair>(seed)
|
||||
} else {
|
||||
"n/a".into()
|
||||
},
|
||||
if let Some(seed) = seed { format_seed::<Pair>(seed) } else { "n/a".into() },
|
||||
format_public_key::<Pair>(public_key.clone()),
|
||||
public_key.to_ss58check_with_version(network_override),
|
||||
format_account_id::<Pair>(public_key),
|
||||
pair.public()
|
||||
.into()
|
||||
.into_account()
|
||||
.to_ss58check_with_version(network_override),
|
||||
pair.public().into().into_account().to_ss58check_with_version(network_override),
|
||||
);
|
||||
}
|
||||
},
|
||||
}
|
||||
} else if let Ok((public_key, network)) = Pair::Public::from_string_with_version(uri) {
|
||||
let network_override = network_override.unwrap_or(network);
|
||||
@@ -170,7 +159,7 @@ pub fn print_from_uri<Pair>(
|
||||
"{}",
|
||||
serde_json::to_string_pretty(&json).expect("Json pretty print failed")
|
||||
);
|
||||
}
|
||||
},
|
||||
OutputType::Text => {
|
||||
println!(
|
||||
"Public Key URI `{}` is account:\n \
|
||||
@@ -186,7 +175,7 @@ pub fn print_from_uri<Pair>(
|
||||
format_account_id::<Pair>(public_key.clone()),
|
||||
public_key.to_ss58check_with_version(network_override),
|
||||
);
|
||||
}
|
||||
},
|
||||
}
|
||||
} else {
|
||||
println!("Invalid phrase/URI given");
|
||||
@@ -220,11 +209,8 @@ where
|
||||
"ss58Address": public_key.to_ss58check_with_version(network_override),
|
||||
});
|
||||
|
||||
println!(
|
||||
"{}",
|
||||
serde_json::to_string_pretty(&json).expect("Json pretty print failed")
|
||||
);
|
||||
}
|
||||
println!("{}", serde_json::to_string_pretty(&json).expect("Json pretty print failed"));
|
||||
},
|
||||
OutputType::Text => {
|
||||
println!(
|
||||
"Network ID/version: {}\n \
|
||||
@@ -238,7 +224,7 @@ where
|
||||
format_account_id::<Pair>(public_key.clone()),
|
||||
public_key.to_ss58check_with_version(network_override),
|
||||
);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -273,10 +259,7 @@ fn format_account_id<P: sp_core::Pair>(public_key: PublicFor<P>) -> String
|
||||
where
|
||||
PublicFor<P>: Into<MultiSigner>,
|
||||
{
|
||||
format!(
|
||||
"0x{}",
|
||||
HexDisplay::from(&public_key.into().into_account().as_ref())
|
||||
)
|
||||
format!("0x{}", HexDisplay::from(&public_key.into().into_account().as_ref()))
|
||||
}
|
||||
|
||||
/// helper method for decoding hex
|
||||
@@ -294,13 +277,13 @@ pub fn read_message(msg: Option<&String>, should_decode: bool) -> Result<Vec<u8>
|
||||
match msg {
|
||||
Some(m) => {
|
||||
message = decode_hex(m)?;
|
||||
}
|
||||
},
|
||||
None => {
|
||||
std::io::stdin().lock().read_to_end(&mut message)?;
|
||||
if should_decode {
|
||||
message = decode_hex(&message)?;
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
Ok(message)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user