diff --git a/src/pcd.rs b/src/pcd.rs index 2b7b965..a91f32a 100644 --- a/src/pcd.rs +++ b/src/pcd.rs @@ -170,26 +170,9 @@ impl Pcd { } } -#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] -pub struct PcdCommitments(#[serde(with = "hex_array_btree")] BTreeMap); - -impl Tsify for PcdCommitments { - type JsType = JsValue; - const DECL: &'static str = "Record"; - - fn from_js>(js: T) -> serde_json::Result - where - Self: DeserializeOwned, { - serde_wasm_bindgen::from_value(js.into()).map_err(|e| serde_json::Error::custom(e.to_string())) - } - - fn into_js(&self) -> serde_json::Result - where - Self: Serialize, { - serde_wasm_bindgen::to_value(self) - .map_err(|e| serde_json::Error::custom(e.to_string())) - } -} +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize, Tsify)] +#[tsify(into_wasm_abi)] +pub struct PcdCommitments(#[serde(with = "hex_array_btree")] #[tsify(type = "Record")] BTreeMap); impl PcdCommitments { /// Creates a new commitments map with both permissioned and public data, + roles diff --git a/src/serialization.rs b/src/serialization.rs index 1f517e4..daa5b46 100644 --- a/src/serialization.rs +++ b/src/serialization.rs @@ -10,7 +10,8 @@ use crate::{pcd::Member, process::Process}; #[tsify(from_wasm_abi)] pub struct OutPointMemberMap(#[serde(with = "members_map")] pub HashMap); -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize, Tsify)] +#[tsify(into_wasm_abi, from_wasm_abi)] pub struct OutPointProcessMap(#[serde(with = "outpoint_map")] pub HashMap); // These helper functions convert a [u8; 32] to/from a hex string.