4545 get_hotkey_pub_ss58 ,
4646)
4747
48+ GENESIS_ADDRESS = "5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM"
49+
4850
4951class ParamWithTypes (TypedDict ):
5052 name : str # Name of the parameter.
@@ -118,6 +120,7 @@ def __init__(self, network, use_disk_cache: bool = False):
118120 ss58_format = SS58_FORMAT ,
119121 type_registry = TYPE_REGISTRY ,
120122 chain_name = "Bittensor" ,
123+ ws_shutdown_timer = None ,
121124 )
122125
123126 def __str__ (self ):
@@ -1116,7 +1119,7 @@ async def does_hotkey_exist(
11161119 block_hash = block_hash ,
11171120 reuse_block_hash = reuse_block ,
11181121 )
1119- return_val = result != "5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM"
1122+ return_val = result != GENESIS_ADDRESS
11201123 return return_val
11211124
11221125 async def get_hotkey_owner (
@@ -2103,7 +2106,7 @@ async def get_claimable_stakes_for_coldkey(
21032106 if not stakes_info :
21042107 return {}
21052108
2106- root_stakes = {}
2109+ root_stakes : dict [ str , Balance ] = {}
21072110 for stake_info in stakes_info :
21082111 if stake_info .netuid == 0 and stake_info .stake .rao > 0 :
21092112 root_stakes [stake_info .hotkey_ss58 ] = stake_info .stake
@@ -2149,8 +2152,8 @@ async def get_claimable_stakes_for_coldkey(
21492152 self .substrate .query_multi (batch_claimed_calls , block_hash = block_hash ),
21502153 )
21512154
2152- claimable_rates = {}
2153- claimed_amounts = {}
2155+ claimable_rates : dict [ str , dict [ int , float ]] = {}
2156+ claimed_amounts : dict [ tuple [ str , int ], Balance ] = {}
21542157 for idx , (_ , result ) in enumerate (batch_claimable ):
21552158 hotkey = unique_hotkeys [idx ]
21562159 if result :
@@ -2166,12 +2169,17 @@ async def get_claimable_stakes_for_coldkey(
21662169
21672170 # Calculate the claimable stake for each pair
21682171 results = {}
2172+ already_claimed : Balance
2173+ net_claimable : Balance
2174+ rate : float
2175+ root_stake : Balance
2176+ claimable_stake : Balance
21692177 for hotkey , netuid in target_pairs :
21702178 root_stake = root_stakes [hotkey ]
2171- rate = claimable_rates [hotkey ].get (netuid , 0 )
2179+ rate = claimable_rates [hotkey ].get (netuid , 0.0 )
21722180 claimable_stake = rate * root_stake
2173- already_claimed = claimed_amounts .get ((hotkey , netuid ), 0 )
2174- net_claimable = max (claimable_stake - already_claimed , 0 )
2181+ already_claimed = claimed_amounts .get ((hotkey , netuid ), Balance ( 0 ) )
2182+ net_claimable = max (claimable_stake - already_claimed , Balance ( 0 ) )
21752183 if hotkey not in results :
21762184 results [hotkey ] = {}
21772185 results [hotkey ][netuid ] = net_claimable .set_unit (netuid )
0 commit comments