File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1515from scalecodec .type_registry import load_type_registry_preset
1616
1717from bittensor .core .types import SubtensorMixin
18+ from bittensor .core .subtensor_plugins .subtensor_module import SubtensorModule
1819from bittensor .core .chain_data import (
1920 DelegateInfo ,
2021 StakeInfo ,
@@ -131,6 +132,7 @@ def __init__(
131132 logging .info (
132133 f"Connected to { self .network } network and { self .chain_endpoint } ."
133134 )
135+ self .subtensor_module = SubtensorModule (self )
134136
135137 async def close (self ):
136138 """Close the connection."""
Original file line number Diff line number Diff line change 1313from scalecodec .type_registry import load_type_registry_preset
1414
1515from bittensor .core .types import SubtensorMixin
16+ from bittensor .core .subtensor_plugins .subtensor_module import SubtensorModule
1617from bittensor .core .chain_data import (
1718 custom_rpc_type_registry ,
1819 decode_account_id ,
@@ -130,6 +131,7 @@ def __init__(
130131 logging .info (
131132 f"Connected to { self .network } network and { self .chain_endpoint } ."
132133 )
134+ self .subtensor_module = SubtensorModule (self )
133135
134136 def close (self ):
135137 """
Original file line number Diff line number Diff line change 1+
2+ from typing import Union , TYPE_CHECKING
3+
4+
5+ if TYPE_CHECKING :
6+ from bittensor .core .subtensor import Subtensor
7+ from bittensor .core .async_subtensor import AsyncSubtensor
8+
9+
10+ class SubtensorModule :
11+ def __init__ (self , subtensor : Union ["Subtensor" , "AsyncSubtensor" ]):
12+ self ._subtensor = subtensor
13+
14+ def tempo (self , netuid : int ):
15+ return self ._subtensor .substrate .query (
16+ module = "SubtensorModule" ,
17+ storage_function = "Tempo" ,
18+ params = [netuid ]
19+ )
20+
21+ def tempos (self ):
22+ return self ._subtensor .substrate .query_map (
23+ module = "SubtensorModule" ,
24+ storage_function = "Tempo" ,
25+ )
You can’t perform that action at this time.
0 commit comments