From ec4707ae2b3602a66246a0050b8dcd74e29e019e Mon Sep 17 00:00:00 2001 From: wigy Date: Fri, 4 Sep 2020 16:17:20 +0200 Subject: [PATCH] Exposed network of HydraPrivate and HydraPublic to WASM --- morpheus-core-wasm/src/hydra/private.rs | 5 +++++ morpheus-core-wasm/src/hydra/public.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/morpheus-core-wasm/src/hydra/private.rs b/morpheus-core-wasm/src/hydra/private.rs index dbe2e18..5ad7368 100644 --- a/morpheus-core-wasm/src/hydra/private.rs +++ b/morpheus-core-wasm/src/hydra/private.rs @@ -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 { let inner = self.inner.key(idx).map_err_to_js()?; Ok(JsBip44Key::from(inner)) diff --git a/morpheus-core-wasm/src/hydra/public.rs b/morpheus-core-wasm/src/hydra/public.rs index 37cd8cf..5b135fa 100644 --- a/morpheus-core-wasm/src/hydra/public.rs +++ b/morpheus-core-wasm/src/hydra/public.rs @@ -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 { let inner = self.inner.key(idx).map_err_to_js()?; Ok(JsBip44PublicKey::from(inner))