Swap 'base58' with 'bs58' (#13739)

* Swap base58 with bs58

* Removed unused clone

* std flag
This commit is contained in:
Davide Galassi
2023-03-29 15:46:05 +02:00
committed by GitHub
parent 86d638d08f
commit c32b240df0
3 changed files with 7 additions and 21 deletions
+2 -4
View File
@@ -21,8 +21,6 @@
use crate::{ed25519, sr25519};
#[cfg(feature = "std")]
use base58::{FromBase58, ToBase58};
#[cfg(feature = "std")]
use bip39::{Language, Mnemonic, MnemonicType};
use codec::{Decode, Encode, MaxEncodedLen};
#[cfg(feature = "std")]
@@ -276,7 +274,7 @@ pub trait Ss58Codec: Sized + AsMut<[u8]> + AsRef<[u8]> + ByteArray {
const CHECKSUM_LEN: usize = 2;
let body_len = Self::LEN;
let data = s.from_base58().map_err(|_| PublicError::BadBase58)?;
let data = bs58::decode(s).into_vec().map_err(|_| PublicError::BadBase58)?;
if data.len() < 2 {
return Err(PublicError::BadLength)
}
@@ -345,7 +343,7 @@ pub trait Ss58Codec: Sized + AsMut<[u8]> + AsRef<[u8]> + ByteArray {
v.extend(self.as_ref());
let r = ss58hash(&v);
v.extend(&r[0..2]);
v.to_base58()
bs58::encode(v).into_string()
}
/// Return the ss58-check string for this key.