File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ pub struct DecryptedOutput {
2121 pub memo : String ,
2222 pub amount : f64 , // Amount in ZEC
2323 pub transfer_type : String ,
24+ pub from : String ,
25+ pub to : String ,
2426}
2527
2628#[ derive( Serialize , Deserialize ) ]
@@ -62,6 +64,25 @@ impl DecryptedOutput {
6264 fn decode_note_value ( zatoshis : Zatoshis ) -> f64 {
6365 zatoshis. into_u64 ( ) as f64 / 100_000_000.0
6466 }
67+
68+ fn decode_address ( address : & str ) -> String {
69+ let address_bytes = address. as_bytes ( ) ;
70+ let address_len = address_bytes. iter ( ) . position ( |& b| b == 0 ) . unwrap_or ( address_bytes. len ( ) ) ;
71+
72+ if address_len == 0 {
73+ return String :: from ( "" ) ;
74+ }
75+
76+ String :: from_utf8 ( address_bytes[ ..address_len] . to_vec ( ) ) . unwrap_or_default ( )
77+ }
78+
79+ fn decode_from ( from : & str ) -> String {
80+ DecryptedOutput :: decode_address ( from)
81+ }
82+
83+ fn decode_to ( to : & str ) -> String {
84+ DecryptedOutput :: decode_address ( to)
85+ }
6586}
6687
6788#[ wasm_bindgen]
You can’t perform that action at this time.
0 commit comments