Skip to content

Commit

Permalink
Revert "Address.validate with network (prefix)"
Browse files Browse the repository at this point in the history
  • Loading branch information
KaffinPX committed Oct 19, 2024
1 parent ea230c5 commit fb61ea9
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions crypto/addresses/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,18 +230,8 @@ impl Address {
}

#[wasm_bindgen(js_name=validate)]
pub fn validate(address: &str, prefix: Option<String>) -> bool {
let address = Self::try_from(address).ok();

if let Some(address) = address {
if let Some(prefix) = prefix {
let prefix = Prefix::try_from(prefix.as_str()).expect("Address::verify() - invalid network prefix");
return address.prefix == prefix;
}
return true;
}

false
pub fn validate(address: &str) -> bool {
Self::try_from(address).is_ok()
}

/// Convert an address to a string.
Expand Down

0 comments on commit fb61ea9

Please sign in to comment.