Skip to content

Commit aa7ad25

Browse files
committed
Ruff + _metadata_cache fix
1 parent 8890e47 commit aa7ad25

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

async_substrate_interface/async_substrate.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
encode as encode_by_type_string,
3232
)
3333
from scalecodec.base import ScaleBytes, ScaleType, RuntimeConfigurationObject
34-
from scalecodec.types import (
34+
from scalecodec.types import (
3535
GenericCall,
3636
GenericExtrinsic,
3737
GenericRuntimeCallDefinition,
@@ -710,7 +710,7 @@ def __init__(
710710
self.runtime_config = RuntimeConfigurationObject(
711711
ss58_format=self.ss58_format, implements_scale_info=True
712712
)
713-
self.__metadata_cache = {}
713+
self._metadata_cache = {}
714714
self._nonces = {}
715715
self.metadata_version_hex = "0x0f000000" # v15
716716
self.reload_type_registry()
@@ -2614,7 +2614,7 @@ async def get_account_next_index(self, account_address: str) -> int:
26142614
"""
26152615
This method maintains a cache of nonces for each account ss58address.
26162616
Upon subsequent calls, it will return the cached nonce + 1 instead of fetching from the chain.
2617-
This allows for correct nonce management in-case of async context when gathering co-routines.
2617+
This allows for correct nonce management in-case of async context when gathering co-routines.
26182618
26192619
Args:
26202620
account_address: SS58 formatted address
@@ -2628,7 +2628,9 @@ async def get_account_next_index(self, account_address: str) -> int:
26282628

26292629
async with self._lock:
26302630
if self._nonces.get(account_address) is None:
2631-
nonce_obj = await self.rpc_request("account_nextIndex", [account_address])
2631+
nonce_obj = await self.rpc_request(
2632+
"account_nextIndex", [account_address]
2633+
)
26322634
self._nonces[account_address] = nonce_obj["result"]
26332635
else:
26342636
self._nonces[account_address] += 1

0 commit comments

Comments
 (0)