Skip to content

Commit

Permalink
Exposed network of HydraPrivate and HydraPublic to WASM
Browse files Browse the repository at this point in the history
  • Loading branch information
wigy-opensource-developer committed Sep 4, 2020
1 parent b0a2c9e commit ec4707a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions morpheus-core-wasm/src/hydra/private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ impl JsHydraPrivate {
JsHydraPublic::from(inner)
}

#[wasm_bindgen(getter)]
pub fn network(&self) -> String {
self.inner.network().subtree().name().to_owned()
}

pub fn key(&mut self, idx: i32) -> Result<JsBip44Key, JsValue> {
let inner = self.inner.key(idx).map_err_to_js()?;
Ok(JsBip44Key::from(inner))
Expand Down
5 changes: 5 additions & 0 deletions morpheus-core-wasm/src/hydra/public.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ pub struct JsHydraPublic {

#[wasm_bindgen(js_class = HydraPublic)]
impl JsHydraPublic {
#[wasm_bindgen(getter)]
pub fn network(&self) -> String {
self.inner.network().subtree().name().to_owned()
}

pub fn key(&mut self, idx: i32) -> Result<JsBip44PublicKey, JsValue> {
let inner = self.inner.key(idx).map_err_to_js()?;
Ok(JsBip44PublicKey::from(inner))
Expand Down

0 comments on commit ec4707a

Please sign in to comment.