@@ -86,7 +86,7 @@ function injectEvents (registry: TypeRegistry, { lookup, pallets }: MetadataLate
8686
8787 lazyMethod ( result , version >= 12 ? index . toNumber ( ) : i , ( ) =>
8888 lazyVariants ( lookup , events . unwrap ( ) , getVariantStringIdx , ( variant : SiVariant ) : CodecClass < GenericEventData > => {
89- const meta = ( registry as Registry ) . createType < EventMetadataLatest > ( 'EventMetadataLatest' , objectSpread ( { } , variant , { args : getFieldArgs ( lookup , variant . fields ) } ) ) ;
89+ const meta = registry . createType < EventMetadataLatest > ( 'EventMetadataLatest' , objectSpread ( { } , variant , { args : getFieldArgs ( lookup , variant . fields ) } ) ) ;
9090
9191 return class extends GenericEventData {
9292 constructor ( registry : Registry , value : Uint8Array ) {
@@ -118,7 +118,7 @@ function injectExtrinsics (registry: TypeRegistry, { lookup, pallets }: Metadata
118118
119119// extract additional properties from the metadata
120120function extractProperties ( registry : TypeRegistry , metadata : Metadata ) : ChainProperties | undefined {
121- const original = ( registry as Registry ) . getChainProperties ( ) ;
121+ const original = registry . getChainProperties ( ) ;
122122 const constants = decorateConstants ( registry , metadata . asLatest , metadata . version ) ;
123123 const ss58Format = constants . system && ( constants . system . sS58Prefix || constants . system . ss58Prefix ) ;
124124
@@ -170,20 +170,6 @@ export class TypeRegistry implements Registry {
170170 this . #knownDefaults = objectSpread ( { Json, Metadata, PortableRegistry, Raw } , baseTypes ) ;
171171 this . #knownDefinitions = definitions ;
172172
173- this . init ( ) ;
174-
175- if ( createdAtHash ) {
176- this . createdAtHash = this . createType ( 'Hash' , createdAtHash ) ;
177- }
178- }
179-
180- public init ( ) : this {
181- // start clean
182- this . #classes = new Map < string , CodecClass > ( ) ;
183- this . #definitions = new Map < string , string > ( ) ;
184- this . #unknownTypes = new Map < string , boolean > ( ) ;
185- this . #knownTypes = { } ;
186-
187173 // register know, first classes then on-demand-created definitions
188174 this . register ( this . #knownDefaults) ;
189175
@@ -193,7 +179,9 @@ export class TypeRegistry implements Registry {
193179 this . register ( allKnown [ i ] . types as unknown as RegistryTypes ) ;
194180 }
195181
196- return this ;
182+ if ( createdAtHash ) {
183+ this . createdAtHash = this . createType ( 'Hash' , createdAtHash ) ;
184+ }
197185 }
198186
199187 public get chainDecimals ( ) : number [ ] {
0 commit comments