@@ -87,93 +87,92 @@ def __init__(
8787 def __str__ (self ):
8888 return f"Runtime: { self .chain } | { self .config } "
8989
90- @property
91- def implements_scaleinfo (self ) -> bool :
92- """
93- Returns True if current runtime implementation a `PortableRegistry` (`MetadataV14` and higher)
94- """
95- if self .metadata :
96- return self .metadata .portable_registry is not None
97- else :
98- return False
99-
100- def reload_type_registry (
101- self , use_remote_preset : bool = True , auto_discover : bool = True
102- ):
103- """
104- Reload type registry and preset used to instantiate the SubstrateInterface object. Useful to periodically apply
105- changes in type definitions when a runtime upgrade occurred
106-
107- Args:
108- use_remote_preset: When True preset is downloaded from Github master, otherwise use files from local
109- installed scalecodec package
110- auto_discover: Whether to automatically discover the type registry presets based on the chain name and the
111- type registry
112- """
113- self .runtime_config .clear_type_registry ()
114-
115- self .runtime_config .implements_scale_info = self .implements_scaleinfo
116-
117- # Load metadata types in runtime configuration
118- self .runtime_config .update_type_registry (load_type_registry_preset (name = "core" ))
119- self .apply_type_registry_presets (
120- use_remote_preset = use_remote_preset , auto_discover = auto_discover
121- )
122-
123- def apply_type_registry_presets (
124- self ,
125- use_remote_preset : bool = True ,
126- auto_discover : bool = True ,
127- ):
128- """
129- Applies type registry presets to the runtime
130-
131- Args:
132- use_remote_preset: whether to use presets from remote
133- auto_discover: whether to use presets from local installed scalecodec package
134- """
135- if self .type_registry_preset is not None :
136- # Load type registry according to preset
137- type_registry_preset_dict = load_type_registry_preset (
138- name = self .type_registry_preset , use_remote_preset = use_remote_preset
139- )
140-
141- if not type_registry_preset_dict :
142- raise ValueError (
143- f"Type registry preset '{ self .type_registry_preset } ' not found"
144- )
145-
146- elif auto_discover :
147- # Try to auto discover type registry preset by chain name
148- type_registry_name = self .chain .lower ().replace (" " , "-" )
149- try :
150- type_registry_preset_dict = load_type_registry_preset (
151- type_registry_name
152- )
153- self .type_registry_preset = type_registry_name
154- except ValueError :
155- type_registry_preset_dict = None
156-
157- else :
158- type_registry_preset_dict = None
159-
160- if type_registry_preset_dict :
161- # Load type registries in runtime configuration
162- if self .implements_scaleinfo is False :
163- # Only runtime with no embedded types in metadata need the default set of explicit defined types
164- self .runtime_config .update_type_registry (
165- load_type_registry_preset (
166- "legacy" , use_remote_preset = use_remote_preset
167- )
168- )
169-
170- if self .type_registry_preset != "legacy" :
171- self .runtime_config .update_type_registry (type_registry_preset_dict )
172-
173- if self .type_registry :
174- # Load type registries in runtime configuration
175- self .runtime_config .update_type_registry (self .type_registry )
176-
90+ # @property
91+ # def implements_scaleinfo(self) -> bool:
92+ # """
93+ # Returns True if current runtime implementation a `PortableRegistry` (`MetadataV14` and higher)
94+ # """
95+ # if self.metadata:
96+ # return self.metadata.portable_registry is not None
97+ # else:
98+ # return False
99+ #
100+ # def reload_type_registry(
101+ # self, use_remote_preset: bool = True, auto_discover: bool = True
102+ # ):
103+ # """
104+ # Reload type registry and preset used to instantiate the SubstrateInterface object. Useful to periodically apply
105+ # changes in type definitions when a runtime upgrade occurred
106+ #
107+ # Args:
108+ # use_remote_preset: When True preset is downloaded from Github master, otherwise use files from local
109+ # installed scalecodec package
110+ # auto_discover: Whether to automatically discover the type registry presets based on the chain name and the
111+ # type registry
112+ # """
113+ # self.runtime_config.clear_type_registry()
114+ #
115+ # self.runtime_config.implements_scale_info = self.implements_scaleinfo
116+ #
117+ # # Load metadata types in runtime configuration
118+ # self.runtime_config.update_type_registry(load_type_registry_preset(name="core"))
119+ # self.apply_type_registry_presets(
120+ # use_remote_preset=use_remote_preset, auto_discover=auto_discover
121+ # )
122+ #
123+ # def apply_type_registry_presets(
124+ # self,
125+ # use_remote_preset: bool = True,
126+ # auto_discover: bool = True,
127+ # ):
128+ # """
129+ # Applies type registry presets to the runtime
130+ #
131+ # Args:
132+ # use_remote_preset: whether to use presets from remote
133+ # auto_discover: whether to use presets from local installed scalecodec package
134+ # """
135+ # if self.type_registry_preset is not None:
136+ # # Load type registry according to preset
137+ # type_registry_preset_dict = load_type_registry_preset(
138+ # name=self.type_registry_preset, use_remote_preset=use_remote_preset
139+ # )
140+ #
141+ # if not type_registry_preset_dict:
142+ # raise ValueError(
143+ # f"Type registry preset '{self.type_registry_preset}' not found"
144+ # )
145+ #
146+ # elif auto_discover:
147+ # # Try to auto discover type registry preset by chain name
148+ # type_registry_name = self.chain.lower().replace(" ", "-")
149+ # try:
150+ # type_registry_preset_dict = load_type_registry_preset(
151+ # type_registry_name
152+ # )
153+ # self.type_registry_preset = type_registry_name
154+ # except ValueError:
155+ # type_registry_preset_dict = None
156+ #
157+ # else:
158+ # type_registry_preset_dict = None
159+ #
160+ # if type_registry_preset_dict:
161+ # # Load type registries in runtime configuration
162+ # if self.implements_scaleinfo is False:
163+ # # Only runtime with no embedded types in metadata need the default set of explicit defined types
164+ # self.runtime_config.update_type_registry(
165+ # load_type_registry_preset(
166+ # "legacy", use_remote_preset=use_remote_preset
167+ # )
168+ # )
169+ #
170+ # if self.type_registry_preset != "legacy":
171+ # self.runtime_config.update_type_registry(type_registry_preset_dict)
172+ #
173+ # if self.type_registry:
174+ # # Load type registries in runtime configuration
175+ # self.runtime_config.update_type_registry(self.type_registry)
177176
178177class RequestManager :
179178 RequestResults = dict [Union [str , int ], list [Union [ScaleType , dict ]]]
0 commit comments