Skip to content

Commit

Permalink
Update primitives/account/src/lib.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Bear Wang <[email protected]>
  • Loading branch information
conr2d and boundless-forest committed Aug 23, 2024
1 parent 54b2aa9 commit f7721ea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion primitives/account/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ impl core::str::FromStr for AccountId20 {
type Err = &'static str;

fn from_str(s: &str) -> Result<Self, Self::Err> {
<[u8; 20] as hex::FromHex>::from_hex(s.strip_prefix("0x").unwrap_or(s))
#[cfg(feature = "std")]
impl std::str::FromStr for AccountId20 {
.map(Into::into)
.map_err(|_| "invalid hex address.")
}
Expand Down

0 comments on commit f7721ea

Please sign in to comment.