Skip to content

Commit 32cfefc

Browse files
authored
Merge pull request #41 from opentensor/release/1.0.0rc14
Release/1.0.0rc14
2 parents 636d501 + bd27600 commit 32cfefc

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 1.0.0rc14 /2025-02-11
4+
* Improves the error-handling of initialisation of the object @thewhaleking in https://github.com/opentensor/async-substrate-interface/pull/39
5+
* Backmerge main to staging rc12 by @ibraheem-opentensor in https://github.com/opentensor/async-substrate-interface/pull/40
6+
37
## 1.0.0rc13 /2025-02-10
48
* Improve logging by @roman-opentensor and @thewhaleking in https://github.com/opentensor/async-substrate-interface/pull/36
59
* Backmerge main to staging rc12 by @ibraheem-opentensor in https://github.com/opentensor/async-substrate-interface/pull/37

async_substrate_interface/async_substrate.py

+11-2
Original file line numberDiff line numberDiff 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

async_substrate_interface/types.py

+1
Original file line numberDiff line numberDiff 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]

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "async-substrate-interface"
3-
version = "1.0.0rc13"
3+
version = "1.0.0rc14"
44
description = "Asyncio library for interacting with substrate. Mostly API-compatible with py-substrate-interface"
55
readme = "README.md"
66
license = { file = "LICENSE" }

0 commit comments

Comments
 (0)