Skip to content

Commit

Permalink
[cli] ParsedAddress support Bitcoin address (#1807)
Browse files Browse the repository at this point in the history
  • Loading branch information
vegetabledogdog authored Jun 4, 2024
1 parent 7c7d034 commit 3f5b057
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/rooch-types/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,10 @@ impl ParsedAddress {
} else if s.starts_with(ROOCH_HRP.as_str()) && s.len() == RoochAddress::LENGTH_BECH32 {
Ok(Self::Numerical(RoochAddress::from_bech32(s)?))
} else {
Ok(Self::Named(s.to_string()))
match BitcoinAddress::from_str(s) {
Ok(a) => Ok(Self::Numerical(a.to_rooch_address())),
Err(_) => Ok(Self::Named(s.to_string())),
}
}
}
}
Expand Down

0 comments on commit 3f5b057

Please sign in to comment.