From 3372bcb1ede643e908d6d63f78ef2d0938585d0e Mon Sep 17 00:00:00 2001 From: NicolasCantu Date: Thu, 17 Oct 2024 14:28:58 +0200 Subject: [PATCH] Add is_linking() api --- src/api.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/api.rs b/src/api.rs index 1e0c518..d19d069 100644 --- a/src/api.rs +++ b/src/api.rs @@ -231,6 +231,17 @@ pub fn create_new_device(birthday: u32, network_str: String) -> ApiResult ApiResult { + let local_device = lock_local_device()?; + + if local_device.is_linked() || local_device.is_linking() { + Ok(true) + } else { + Ok(false) + } +} + #[wasm_bindgen] pub fn pair_device(commitment_tx: String, mut sp_addresses: Vec) -> ApiResult<()> { let mut local_device = lock_local_device()?;