@@ -14,25 +14,25 @@ wasm_bindgen_wrapper! {
14
14
#[ wasm_bindgen]
15
15
impl Witness {
16
16
#[ wasm_bindgen( constructor) ]
17
- pub fn new ( tree_size : usize , root_hash : Scalar , auth_path : Vec < WitnessNode > ) -> Self {
17
+ pub fn new ( tree_size : usize , root_hash : MerkleNoteHash , auth_path : Vec < WitnessNode > ) -> Self {
18
18
Self ( ironfish:: witness:: Witness {
19
19
tree_size,
20
- root_hash : root_hash. into ( ) ,
20
+ root_hash : root_hash. value ( ) . into ( ) ,
21
21
auth_path : auth_path. into_iter ( ) . map ( WitnessNode :: into) . collect ( ) ,
22
22
} )
23
23
}
24
24
25
- #[ wasm_bindgen( getter) ]
25
+ #[ wasm_bindgen( getter, js_name = treeSize ) ]
26
26
pub fn tree_size ( & self ) -> usize {
27
27
self . 0 . tree_size
28
28
}
29
29
30
- #[ wasm_bindgen( getter) ]
30
+ #[ wasm_bindgen( getter, js_name = rootHash ) ]
31
31
pub fn root_hash ( & self ) -> Scalar {
32
32
self . 0 . root_hash . into ( )
33
33
}
34
34
35
- #[ wasm_bindgen( getter) ]
35
+ #[ wasm_bindgen( getter, js_name = authPath ) ]
36
36
pub fn auth_path ( & self ) -> Vec < WitnessNode > {
37
37
self . 0
38
38
. auth_path
@@ -79,12 +79,13 @@ impl WitnessNode {
79
79
}
80
80
81
81
#[ wasm_bindgen( getter) ]
82
- pub fn hash ( & self ) -> Scalar {
83
- match self . 0 {
82
+ pub fn hash ( & self ) -> MerkleNoteHash {
83
+ let value = match self . 0 {
84
84
ironfish:: witness:: WitnessNode :: Left ( ref hash) => hash,
85
85
ironfish:: witness:: WitnessNode :: Right ( ref hash) => hash,
86
86
}
87
87
. to_owned ( )
88
- . into ( )
88
+ . into ( ) ;
89
+ MerkleNoteHash :: from_value ( value)
89
90
}
90
91
}
0 commit comments