File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
async_substrate_interface Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -734,9 +734,13 @@ async def initialize(self):
734734 if not self ._chain :
735735 chain = await self .rpc_request ("system_chain" , [])
736736 self ._chain = chain .get ("result" )
737- await asyncio .gather (
738- self .load_registry (), self ._first_initialize_runtime ()
737+ init_load = await asyncio .gather (
738+ self .load_registry (), self ._first_initialize_runtime (),
739+ return_exceptions = True
739740 )
741+ for potential_exception in init_load :
742+ if isinstance (potential_exception , Exception ):
743+ raise potential_exception
740744 self .initialized = True
741745 self ._initializing = False
742746
@@ -1107,6 +1111,11 @@ async def get_runtime(block_hash, block_id) -> Runtime:
11071111 if block_id and block_hash :
11081112 raise ValueError ("Cannot provide block_hash and block_id at the same time" )
11091113
1114+ if not self .metadata_v15 :
1115+ raise SubstrateRequestException (
1116+ "Metadata V15 was not loaded. This usually indicates that you did not correctly initialize"
1117+ " the AsyncSubstrateInterface class with `async with` or by calling `initialize()`"
1118+ )
11101119 if (
11111120 not (runtime := self .runtime_cache .retrieve (block_id , block_hash ))
11121121 or runtime .metadata is None
Original file line number Diff line number Diff line change @@ -343,6 +343,7 @@ class SubstrateMixin(ABC):
343343 _token_decimals = None
344344 _token_symbol = None
345345 _metadata = None
346+ metadata_v15 = None
346347 _chain : str
347348 runtime_config : RuntimeConfigurationObject
348349 type_registry : Optional [dict ]
You can’t perform that action at this time.
0 commit comments