Skip to content

Commit

Permalink
Update cosmrs/src/base/account_id.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Tony Arcieri (iqlusion) <[email protected]>
  • Loading branch information
penso and tony-iqlusion authored Oct 30, 2023
1 parent ee36ca2 commit 97d924d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cosmrs/src/base/account_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,11 @@ impl FromStr for AccountId {
type Err = ErrorReport;

fn from_str(s: &str) -> Result<Self> {
if s.starts_with(|c: char| c.is_uppercase()) {
let (hrp, bytes) =
bech32::decode_upper(s).wrap_err(format!("invalid uppercase bech32: '{}'", s))?;
return Self::new(&hrp, &bytes);
}
let (hrp, bytes) = bech32::decode(s).wrap_err(format!("invalid bech32: '{}'", s))?;
let (hrp, bytes) = if s.starts_with(|c: char| c.is_uppercase()) {
bech32::decode_upper(s)
} else
bech32::decode(s)
}.wrap_err(format!("invalid uppercase bech32: '{}'", s))?;
Self::new(&hrp, &bytes)
}
}
Expand Down

0 comments on commit 97d924d

Please sign in to comment.