@@ -338,6 +338,57 @@ impl Deserialize for Vkey {
338338 }
339339}
340340
341+ #[ wasm_bindgen]
342+ #[ derive( Clone ) ]
343+ pub struct Vkeys ( Vec < Vkey > ) ;
344+
345+ #[ wasm_bindgen]
346+ impl Vkeys {
347+ pub fn new ( ) -> Self {
348+ Self ( Vec :: new ( ) )
349+ }
350+
351+ pub fn len ( & self ) -> usize {
352+ self . 0 . len ( )
353+ }
354+
355+ pub fn get ( & self , index : usize ) -> Vkey {
356+ self . 0 [ index] . clone ( )
357+ }
358+
359+ pub fn add ( & mut self , elem : & Vkey ) {
360+ self . 0 . push ( elem. clone ( ) ) ;
361+ }
362+ }
363+
364+ impl cbor_event:: se:: Serialize for Vkeys {
365+ fn serialize < ' se , W : Write > ( & self , serializer : & ' se mut Serializer < W > ) -> cbor_event:: Result < & ' se mut Serializer < W > > {
366+ serializer. write_array ( cbor_event:: Len :: Len ( self . 0 . len ( ) as u64 ) ) ?;
367+ for element in & self . 0 {
368+ element. serialize ( serializer) ?;
369+ }
370+ Ok ( serializer)
371+ }
372+ }
373+
374+ impl Deserialize for Vkeys {
375+ fn deserialize < R : BufRead + Seek > ( raw : & mut Deserializer < R > ) -> Result < Self , DeserializeError > {
376+ let mut arr = Vec :: new ( ) ;
377+ ( || -> Result < _ , DeserializeError > {
378+ let len = raw. array ( ) ?;
379+ while match len { cbor_event:: Len :: Len ( n) => arr. len ( ) < n as usize , cbor_event:: Len :: Indefinite => true , } {
380+ if raw. cbor_type ( ) ? == CBORType :: Special {
381+ assert_eq ! ( raw. special( ) ?, CBORSpecial :: Break ) ;
382+ break ;
383+ }
384+ arr. push ( Vkey :: deserialize ( raw) ?) ;
385+ }
386+ Ok ( ( ) )
387+ } ) ( ) . map_err ( |e| e. annotate ( "Vkeys" ) ) ?;
388+ Ok ( Self ( arr) )
389+ }
390+ }
391+
341392#[ wasm_bindgen]
342393#[ derive( Clone ) ]
343394pub struct Vkeywitness {
@@ -769,9 +820,12 @@ impl_hash_type!(ScriptHash, 28);
769820impl_hash_type ! ( TransactionHash , 32 ) ;
770821impl_hash_type ! ( GenesisDelegateHash , 28 ) ;
771822impl_hash_type ! ( GenesisHash , 28 ) ;
772- impl_hash_type ! ( MetadataHash , 32 ) ;
823+ impl_hash_type ! ( AuxiliaryDataHash , 32 ) ;
824+ impl_hash_type ! ( PoolMetadataHash , 32 ) ;
773825impl_hash_type ! ( VRFKeyHash , 32 ) ;
774826impl_hash_type ! ( BlockHash , 32 ) ;
827+ impl_hash_type ! ( DataHash , 32 ) ;
828+ impl_hash_type ! ( ScriptDataHash , 32 ) ;
775829// We might want to make these two vkeys normal classes later but for now it's just arbitrary bytes for us (used in block parsing)
776830impl_hash_type ! ( VRFVKey , 32 ) ;
777831impl_hash_type ! ( KESVKey , 32 ) ;
0 commit comments