File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -177,9 +177,9 @@ impl Transition {
177
177
}
178
178
179
179
/// Get the transition view key of the transition.
180
- pub fn tvk ( & self , view_key : ViewKey ) -> Field {
180
+ pub fn tvk ( & self , view_key : & ViewKey ) -> Field {
181
181
let tpk = self . tpk ( ) ;
182
- let tvk = tpk. scalar_multiply ( & view_key. to_scalar ( ) ) . to_x_coordinate ( ) ;
182
+ let tvk = tpk. scalar_multiply ( view_key. to_scalar ( ) ) . to_x_coordinate ( ) ;
183
183
tvk
184
184
}
185
185
@@ -263,6 +263,10 @@ mod tests {
263
263
264
264
#[ test]
265
265
fn test_transition_helpers ( ) {
266
+ // Create a random private key and view key.
267
+ let private_key = PrivateKey :: new ( ) ;
268
+ let view_key = ViewKey :: from_private_key ( & private_key) ;
269
+
266
270
let transition = Transition :: from_string ( TRANSITION ) . unwrap ( ) ;
267
271
assert_eq ! ( transition. program_id( ) , "token_registry.aleo" ) ;
268
272
assert_eq ! ( transition. function_name( ) , "burn_private" ) ;
@@ -281,6 +285,11 @@ mod tests {
281
285
Field :: from_string( "6845182532650964173356391969005331370591444046632036068754797772530920467754field" )
282
286
. unwrap( )
283
287
) ;
288
+ assert_eq ! (
289
+ transition. tvk( & view_key) ,
290
+ Field :: from_string( "_placeholder_" ) // Placeholder for the view key, will replace with manually computed value.
291
+ . unwrap( )
292
+ )
284
293
}
285
294
286
295
#[ wasm_bindgen_test]
You can’t perform that action at this time.
0 commit comments