Skip to content

Commit

Permalink
WASM: change the PublicAddress.hex getter to PublicAddress.toHex()
Browse files Browse the repository at this point in the history
This is for consistency with other structs.
  • Loading branch information
andiflabs committed Feb 12, 2025
1 parent f0a55f6 commit 0e14e10
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ironfish-rust-wasm/src/keys/public_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ impl PublicAddress {
self.0.public_address().to_vec()
}

#[wasm_bindgen(js_name = "fromHex")]
#[wasm_bindgen(js_name = fromHex)]
pub fn from_hex(hex: &str) -> Result<Self, IronfishError> {
Ok(Self(ironfish::PublicAddress::from_hex(hex)?))
}

#[wasm_bindgen(getter)]
pub fn hex(&self) -> String {
#[wasm_bindgen(js_name = toHex)]
pub fn to_hex(&self) -> String {
self.0.hex_public_address()
}

#[wasm_bindgen(js_name = "isValid")]
#[wasm_bindgen(js_name = isValid)]
pub fn is_valid(hex: &str) -> bool {
Self::from_hex(hex).is_ok()
}
Expand Down

0 comments on commit 0e14e10

Please sign in to comment.