@@ -356,12 +356,12 @@ async def unstake_all(
356
356
old_identities = old_identities ,
357
357
)
358
358
elif not hotkey_ss58_address :
359
- hotkeys = [(wallet .hotkey_str , wallet .hotkey .ss58_address )]
359
+ hotkeys = [(wallet .hotkey_str , wallet .hotkey .ss58_address , None )]
360
360
else :
361
- hotkeys = [(None , hotkey_ss58_address )]
361
+ hotkeys = [(None , hotkey_ss58_address , None )]
362
362
363
- hotkey_names = {ss58 : name for name , ss58 in hotkeys if name is not None }
364
- hotkey_ss58s = [ss58 for _ , ss58 in hotkeys ]
363
+ hotkey_names = {ss58 : name for name , ss58 , _ in hotkeys if name is not None }
364
+ hotkey_ss58s = [item [ 1 ] for item in hotkeys ]
365
365
stake_info = [
366
366
stake for stake in stake_info if stake .hotkey_ss58 in hotkey_ss58s
367
367
]
@@ -1058,7 +1058,7 @@ def _get_hotkeys_to_unstake(
1058
1058
stake_infos : list ,
1059
1059
identities : dict ,
1060
1060
old_identities : dict ,
1061
- ) -> list [tuple [Optional [str ], str ]]:
1061
+ ) -> list [tuple [Optional [str ], str , None ]]:
1062
1062
"""Get list of hotkeys to unstake from based on input parameters.
1063
1063
1064
1064
Args:
@@ -1069,26 +1069,28 @@ def _get_hotkeys_to_unstake(
1069
1069
exclude_hotkeys: List of hotkey names to exclude
1070
1070
1071
1071
Returns:
1072
- List of tuples containing (hotkey_name, hotkey_ss58) pairs to unstake from
1072
+ List of tuples containing (hotkey_name, hotkey_ss58, None) pairs to unstake from. The final None is important
1073
+ for compatibility with the `_unstake_selection` function.
1073
1074
"""
1074
1075
if hotkey_ss58_address :
1075
1076
print_verbose (f"Unstaking from ss58 ({ hotkey_ss58_address } )" )
1076
- return [(None , hotkey_ss58_address )]
1077
+ return [(None , hotkey_ss58_address , None )]
1077
1078
1078
1079
if all_hotkeys :
1079
1080
print_verbose ("Unstaking from all hotkeys" )
1080
1081
all_hotkeys_ = get_hotkey_wallets_for_wallet (wallet = wallet )
1081
1082
wallet_hotkeys = [
1082
- (wallet .hotkey_str , wallet .hotkey .ss58_address )
1083
+ (wallet .hotkey_str , wallet .hotkey .ss58_address , None )
1083
1084
for wallet in all_hotkeys_
1084
1085
if wallet .hotkey_str not in exclude_hotkeys
1085
1086
]
1086
1087
1087
- wallet_hotkey_addresses = {addr for _ , addr in wallet_hotkeys }
1088
+ wallet_hotkey_addresses = {hk [ 1 ] for hk in wallet_hotkeys }
1088
1089
chain_hotkeys = [
1089
1090
(
1090
1091
get_hotkey_identity (stake_info .hotkey_ss58 , identities , old_identities ),
1091
1092
stake_info .hotkey_ss58 ,
1093
+ None ,
1092
1094
)
1093
1095
for stake_info in stake_infos
1094
1096
if (
@@ -1103,22 +1105,22 @@ def _get_hotkeys_to_unstake(
1103
1105
result = []
1104
1106
for hotkey_identifier in include_hotkeys :
1105
1107
if is_valid_ss58_address (hotkey_identifier ):
1106
- result .append ((None , hotkey_identifier ))
1108
+ result .append ((None , hotkey_identifier , None ))
1107
1109
else :
1108
1110
wallet_ = Wallet (
1109
1111
name = wallet .name ,
1110
1112
path = wallet .path ,
1111
1113
hotkey = hotkey_identifier ,
1112
1114
)
1113
- result .append ((wallet_ .hotkey_str , wallet_ .hotkey .ss58_address ))
1115
+ result .append ((wallet_ .hotkey_str , wallet_ .hotkey .ss58_address , None ))
1114
1116
return result
1115
1117
1116
1118
# Only cli.config.wallet.hotkey is specified
1117
1119
print_verbose (
1118
1120
f"Unstaking from wallet: ({ wallet .name } ) from hotkey: ({ wallet .hotkey_str } )"
1119
1121
)
1120
1122
assert wallet .hotkey is not None
1121
- return [(wallet .hotkey_str , wallet .hotkey .ss58_address )]
1123
+ return [(wallet .hotkey_str , wallet .hotkey .ss58_address , None )]
1122
1124
1123
1125
1124
1126
def _create_unstake_table (
0 commit comments