Skip to content

Commit

Permalink
Merge pull request #41 from opentensor/release/1.0.0rc14
Browse files Browse the repository at this point in the history
Release/1.0.0rc14
  • Loading branch information
ibraheem-opentensor authored Feb 12, 2025
2 parents 636d501 + bd27600 commit 32cfefc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.0.0rc14 /2025-02-11
* Improves the error-handling of initialisation of the object @thewhaleking in https://github.com/opentensor/async-substrate-interface/pull/39
* Backmerge main to staging rc12 by @ibraheem-opentensor in https://github.com/opentensor/async-substrate-interface/pull/40

## 1.0.0rc13 /2025-02-10
* Improve logging by @roman-opentensor and @thewhaleking in https://github.com/opentensor/async-substrate-interface/pull/36
* Backmerge main to staging rc12 by @ibraheem-opentensor in https://github.com/opentensor/async-substrate-interface/pull/37
Expand Down
13 changes: 11 additions & 2 deletions async_substrate_interface/async_substrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,13 @@ async def initialize(self):
if not self._chain:
chain = await self.rpc_request("system_chain", [])
self._chain = chain.get("result")
await asyncio.gather(
self.load_registry(), self._first_initialize_runtime()
init_load = await asyncio.gather(
self.load_registry(), self._first_initialize_runtime(),
return_exceptions=True
)
for potential_exception in init_load:
if isinstance(potential_exception, Exception):
raise potential_exception
self.initialized = True
self._initializing = False

Expand Down Expand Up @@ -1107,6 +1111,11 @@ async def get_runtime(block_hash, block_id) -> Runtime:
if block_id and block_hash:
raise ValueError("Cannot provide block_hash and block_id at the same time")

if not self.metadata_v15:
raise SubstrateRequestException(
"Metadata V15 was not loaded. This usually indicates that you did not correctly initialize"
" the AsyncSubstrateInterface class with `async with` or by calling `initialize()`"
)
if (
not (runtime := self.runtime_cache.retrieve(block_id, block_hash))
or runtime.metadata is None
Expand Down
1 change: 1 addition & 0 deletions async_substrate_interface/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ class SubstrateMixin(ABC):
_token_decimals = None
_token_symbol = None
_metadata = None
metadata_v15 = None
_chain: str
runtime_config: RuntimeConfigurationObject
type_registry: Optional[dict]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "async-substrate-interface"
version = "1.0.0rc13"
version = "1.0.0rc14"
description = "Asyncio library for interacting with substrate. Mostly API-compatible with py-substrate-interface"
readme = "README.md"
license = { file = "LICENSE" }
Expand Down

0 comments on commit 32cfefc

Please sign in to comment.