From 33c22d87797abd33831649d27d04a01f62f0cfd5 Mon Sep 17 00:00:00 2001 From: Evgen Date: Fri, 26 Apr 2024 17:36:03 +0300 Subject: [PATCH] Attaching commitment to decrypted memo --- libzkbob-rs-wasm/src/client/tx_parser.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libzkbob-rs-wasm/src/client/tx_parser.rs b/libzkbob-rs-wasm/src/client/tx_parser.rs index 84bab45..282bfda 100644 --- a/libzkbob-rs-wasm/src/client/tx_parser.rs +++ b/libzkbob-rs-wasm/src/client/tx_parser.rs @@ -71,6 +71,7 @@ pub struct StateUpdate { #[derive(Serialize, Deserialize, Clone, Default, Debug)] pub struct DecMemo { pub index: u64, + pub commitment: Option>, pub acc: Option>, #[serde(rename = "inNotes")] pub in_notes: Vec, @@ -301,6 +302,7 @@ pub fn parse_tx( ParseResult { decrypted_memos: vec![DecMemo { index, + commitment: Some(Num::from_uint_reduced(NumRepr(Uint::from_big_endian(&commitment)))), in_notes: in_notes_indexed, tx_hash: match tx_hash { Some(bytes) => Some(format!("0x{}", hex::encode(bytes))), @@ -354,6 +356,7 @@ pub fn parse_tx( Ok(ParseResult { decrypted_memos: vec![DecMemo { index, + commitment: Some(Num::from_uint_reduced(NumRepr(Uint::from_big_endian(&commitment)))), acc: Some(account), in_notes: in_notes .iter() @@ -399,6 +402,7 @@ pub fn parse_tx( Ok(ParseResult { decrypted_memos: vec![DecMemo { index, + commitment: Some(Num::from_uint_reduced(NumRepr(Uint::from_big_endian(&commitment)))), in_notes: in_notes .iter() .map(|(index, note)| IndexedNote {