From dff31ec6ca6b21dfcdec913cba9b3d6bab2140a1 Mon Sep 17 00:00:00 2001 From: NicolasCantu Date: Wed, 28 May 2025 15:20:15 +0200 Subject: [PATCH] init temp --- Cargo.toml | 4 ++-- src/api.rs | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4a33142..3646487 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,8 +16,8 @@ getrandom = { version="0.2.12", features = ["js"] } wasm-logger = "0.2.0" rand = "0.8.5" tsify = { git = "https://github.com/Sosthene00/tsify", branch = "next" } -# sdk_common = { path = "../sdk_common" } -sdk_common = { git = "https://git.4nkweb.com/4nk/sdk_common.git", branch = "dev" } +sdk_common = { path = "../sdk_common" } +# sdk_common = { git = "https://git.4nkweb.com/4nk/sdk_common.git", branch = "dev" } serde-wasm-bindgen = "0.6.5" [dev-dependencies] diff --git a/src/api.rs b/src/api.rs index f04c98c..13a3c72 100644 --- a/src/api.rs +++ b/src/api.rs @@ -675,8 +675,12 @@ fn create_diffs(device: &MutexGuard, process: &Process, new_state: &Proc let mut diffs = vec![]; for (field, hash) in new_state_commitments.iter() { let description_field = new_public_data.get(field); - let has_description = description_field.as_ref().is_some_and(|v| v.is_string()); - let description = if has_description { description_field.unwrap().as_str().map(|s| s.to_owned()) } else { None }; + let has_description = description_field.is_some(); + let description = if has_description { + String::from_utf8(description_field.unwrap().clone()).ok() + } else { + None + }; let need_validation = fields_to_validate.contains(field); diffs.push(UserDiff { process_id: process_id.clone(), @@ -1155,6 +1159,7 @@ pub fn create_new_process( fee_rate: u32, members_list: OutPointMemberMap, ) -> ApiResult { + // TODO basic sanity check: we can't have duplicate field name, or a "roles" field // We create a transaction that spends to the relay address let local_device = lock_local_device()?;