Skip to content

Commit

Permalink
fix: Fix FromStr not found error on AccountId20
Browse files Browse the repository at this point in the history
  • Loading branch information
conr2d committed Aug 22, 2024
1 parent 2e219e1 commit 54b2aa9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion primitives/account/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl core::str::FromStr for AccountId20 {
type Err = &'static str;

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

0 comments on commit 54b2aa9

Please sign in to comment.