File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -306,15 +306,26 @@ class MetadataV15:
306306
307307 @staticmethod
308308 def decode_from_metadata_option (encoded_metadata_v15 : bytes ) -> "MetadataV15" :
309+ """
310+ Decodes to Option<Vec<u8>>, then decodes to MetadataPrefixed and returns MetadataV15.
311+ """
309312 pass
313+
310314 def to_json (self ) -> str :
311315 """
312316 Returns a JSON representation of the metadata.
313317 """
314318 pass
319+
315320 def value (self ) -> Dict [str , Any ]:
316321 pass
317322
323+ def encode_to_metadata_option (self ) -> bytes :
324+ """
325+ MetadataV15 -> MetadataPrefixed -> encoded bytes as an Option<Vec<u8>>
326+ """
327+ pass
328+
318329class PortableRegistry :
319330 """
320331 PortableRegistry is a portable for of the chains registry that
Original file line number Diff line number Diff line change @@ -319,6 +319,12 @@ mod bt_decode {
319319 serde_json:: to_string ( & self . metadata ) . unwrap ( )
320320 }
321321
322+ fn encode_to_metadata_option ( & self ) -> Vec < u8 > {
323+ let as_prefixed = RuntimeMetadataPrefixed :: from ( self . metadata . clone ( ) ) ;
324+ let as_option = Some ( as_prefixed. encode ( ) ) ;
325+ as_option. encode ( )
326+ }
327+
322328 #[ staticmethod]
323329 fn decode_from_metadata_option ( encoded_metadata_v15 : & [ u8 ] ) -> Self {
324330 let option_vec = Option :: < Vec < u8 > > :: decode ( & mut & encoded_metadata_v15[ ..] )
You can’t perform that action at this time.
0 commit comments