mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 11:17:56 +00:00
Companion PR for ss58 crate (#3953)
* Companion PR for ss58 crate * cargo fmt * Rename * into() * into() * updating substrate (ideally use bot merge)
This commit is contained in:
Generated
+228
-279
File diff suppressed because it is too large
Load Diff
@@ -19,6 +19,7 @@ use futures::future::TryFutureExt;
|
||||
use log::info;
|
||||
use sc_cli::{Role, RuntimeVersion, SubstrateCli};
|
||||
use service::{self, IdentifyVariant};
|
||||
use sp_core::crypto::Ss58AddressFormatRegistry;
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
@@ -191,15 +192,14 @@ impl SubstrateCli for Cli {
|
||||
}
|
||||
|
||||
fn set_default_ss58_version(spec: &Box<dyn service::ChainSpec>) {
|
||||
use sp_core::crypto::Ss58AddressFormat;
|
||||
|
||||
let ss58_version = if spec.is_kusama() {
|
||||
Ss58AddressFormat::KusamaAccount
|
||||
Ss58AddressFormatRegistry::KusamaAccount
|
||||
} else if spec.is_westend() {
|
||||
Ss58AddressFormat::SubstrateAccount
|
||||
Ss58AddressFormatRegistry::SubstrateAccount
|
||||
} else {
|
||||
Ss58AddressFormat::PolkadotAccount
|
||||
};
|
||||
Ss58AddressFormatRegistry::PolkadotAccount
|
||||
}
|
||||
.into();
|
||||
|
||||
sp_core::crypto::set_default_ss58_version(ss58_version);
|
||||
}
|
||||
|
||||
@@ -534,7 +534,7 @@ async fn main() {
|
||||
match chain.to_lowercase().as_str() {
|
||||
"polkadot" | "development" => {
|
||||
sp_core::crypto::set_default_ss58_version(
|
||||
sp_core::crypto::Ss58AddressFormat::PolkadotAccount,
|
||||
sp_core::crypto::Ss58AddressFormatRegistry::PolkadotAccount.into(),
|
||||
);
|
||||
sub_tokens::dynamic::set_name("DOT");
|
||||
sub_tokens::dynamic::set_decimal_points(10_000_000_000);
|
||||
@@ -546,7 +546,7 @@ async fn main() {
|
||||
},
|
||||
"kusama" | "kusama-dev" => {
|
||||
sp_core::crypto::set_default_ss58_version(
|
||||
sp_core::crypto::Ss58AddressFormat::KusamaAccount,
|
||||
sp_core::crypto::Ss58AddressFormatRegistry::KusamaAccount.into(),
|
||||
);
|
||||
sub_tokens::dynamic::set_name("KSM");
|
||||
sub_tokens::dynamic::set_decimal_points(1_000_000_000_000);
|
||||
@@ -558,7 +558,7 @@ async fn main() {
|
||||
},
|
||||
"westend" => {
|
||||
sp_core::crypto::set_default_ss58_version(
|
||||
sp_core::crypto::Ss58AddressFormat::PolkadotAccount,
|
||||
sp_core::crypto::Ss58AddressFormatRegistry::PolkadotAccount.into(),
|
||||
);
|
||||
sub_tokens::dynamic::set_name("WND");
|
||||
sub_tokens::dynamic::set_decimal_points(1_000_000_000_000);
|
||||
|
||||
Reference in New Issue
Block a user