22// This software may be modified and distributed under the terms
33// of the Apache-2.0 license. See the LICENSE file for details.
44
5+ import { OuterDispatchMetadataV0 , OuterDispatchCallV0 } from '../../interfaces/metadata/types' ;
56import { MetadataInterface } from '../types' ;
67
78import { hexToU8a , isHex , isU8a } from '@plugnet/util' ;
@@ -10,9 +11,8 @@ import Compact from '../../codec/Compact';
1011import Struct from '../../codec/Struct' ;
1112import Vec from '../../codec/Vec' ;
1213import { flattenUniq , validateTypes } from '../util' ;
13- import { OuterDispatchMetadata , OuterDispatchCall } from './Calls' ;
1414import { OuterEventMetadata , OuterEventEventMetadata } from './Events' ;
15- import { RuntimeModuleMetadata } from './Modules' ;
15+ import { RuntimeModuleMetadataV0 } from './Modules' ;
1616
1717// Decodes the runtime metadata as passed through from the `state_getMetadata` call.
1818
@@ -21,12 +21,12 @@ import { RuntimeModuleMetadata } from './Modules';
2121 * @description
2222 * The runtime metadata as a decoded structure
2323 */
24- export default class MetadataV0 extends Struct implements MetadataInterface < RuntimeModuleMetadata > {
24+ export default class MetadataV0 extends Struct implements MetadataInterface < RuntimeModuleMetadataV0 > {
2525 public constructor ( value ?: any ) {
2626 super ( {
2727 outerEvent : OuterEventMetadata ,
28- modules : Vec . with ( RuntimeModuleMetadata ) ,
29- outerDispatch : OuterDispatchMetadata
28+ modules : Vec . with ( RuntimeModuleMetadataV0 ) ,
29+ outerDispatch : 'OuterDispatchMetadataV0'
3030 } , MetadataV0 . decodeMetadata ( value ) ) ;
3131 }
3232
@@ -55,8 +55,8 @@ export default class MetadataV0 extends Struct implements MetadataInterface<Runt
5555 /**
5656 * @description Wrapped [[OuterDispatchCall]]
5757 */
58- public get calls ( ) : Vec < OuterDispatchCall > {
59- return ( this . get ( 'outerDispatch' ) as OuterDispatchMetadata ) . calls ;
58+ public get calls ( ) : Vec < OuterDispatchCallV0 > {
59+ return ( this . get ( 'outerDispatch' ) as OuterDispatchMetadataV0 ) . calls ;
6060 }
6161
6262 /**
@@ -69,14 +69,14 @@ export default class MetadataV0 extends Struct implements MetadataInterface<Runt
6969 /**
7070 * @description Wrapped [[RuntimeModuleMetadata]]
7171 */
72- public get modules ( ) : Vec < RuntimeModuleMetadata > {
73- return this . get ( 'modules' ) as Vec < RuntimeModuleMetadata > ;
72+ public get modules ( ) : Vec < RuntimeModuleMetadataV0 > {
73+ return this . get ( 'modules' ) as Vec < RuntimeModuleMetadataV0 > ;
7474 }
7575
7676 private get argNames ( ) : string [ ] [ ] [ ] {
77- return this . modules . map ( ( modul ) : string [ ] [ ] =>
78- modul . module . call . functions . map ( ( fn ) : string [ ] =>
79- fn . args . map ( ( argument ) : string => argument . type . toString ( ) )
77+ return this . modules . map ( ( { module : { call : { functions } } } ) : string [ ] [ ] =>
78+ functions . map ( ( { args } ) : string [ ] =>
79+ args . map ( ( arg ) : string => arg . type . toString ( ) )
8080 )
8181 ) ;
8282 }
@@ -92,10 +92,10 @@ export default class MetadataV0 extends Struct implements MetadataInterface<Runt
9292 private get storageNames ( ) : string [ ] [ ] [ ] {
9393 return this . modules . map ( ( modul ) : string [ ] [ ] =>
9494 modul . storage . isSome
95- ? modul . storage . unwrap ( ) . functions . map ( ( fn ) : string [ ] =>
96- fn . type . isMap
97- ? [ fn . type . asMap . key . toString ( ) , fn . type . asMap . value . toString ( ) ]
98- : [ fn . type . asType . toString ( ) ]
95+ ? modul . storage . unwrap ( ) . functions . map ( ( { type } ) : string [ ] =>
96+ type . isMap
97+ ? [ type . asMap . key . toString ( ) , type . asMap . value . toString ( ) ]
98+ : [ type . asType . toString ( ) ]
9999 )
100100 : [ ]
101101 ) ;
0 commit comments