Skip to content

Commit 68e5afc

Browse files
committed
More commands.
1 parent b6c5876 commit 68e5afc

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

bittensor_cli/cli.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
validate_uri,
5959
prompt_for_subnet_identity,
6060
validate_rate_tolerance,
61+
get_hotkey_pub_ss58,
6162
)
6263
from bittensor_cli.src.commands import sudo, wallets, view
6364
from bittensor_cli.src.commands import weights as weights_cmds
@@ -1734,7 +1735,7 @@ def wallet_ask(
17341735
if return_wallet_and_hotkey:
17351736
valid = utils.is_valid_wallet(wallet)
17361737
if valid[1]:
1737-
return wallet, wallet.hotkey.ss58_address
1738+
return wallet, get_hotkey_pub_ss58(wallet)
17381739
else:
17391740
if wallet_hotkey and is_valid_ss58_address(wallet_hotkey):
17401741
return wallet, wallet_hotkey
@@ -2572,7 +2573,7 @@ def wallet_associate_hotkey(
25722573
ask_for=[WO.NAME, WO.PATH, WO.HOTKEY],
25732574
validate=WV.WALLET_AND_HOTKEY,
25742575
)
2575-
hotkey_ss58 = wallet.hotkey.ss58_address
2576+
hotkey_ss58 = get_hotkey_pub_ss58(wallet)
25762577
hotkey_display = (
25772578
f"hotkey [blue]{wallet_hotkey}[/blue] "
25782579
f"[{COLORS.GENERAL.HK}]({hotkey_ss58})[/{COLORS.GENERAL.HK}]"
@@ -3588,7 +3589,7 @@ def stake_add(
35883589
ask_for=[WO.NAME, WO.HOTKEY, WO.PATH],
35893590
validate=WV.WALLET_AND_HOTKEY,
35903591
)
3591-
include_hotkeys = wallet.hotkey.ss58_address
3592+
include_hotkeys = get_hotkey_pub_ss58(wallet)
35923593

35933594
elif all_hotkeys or include_hotkeys or exclude_hotkeys:
35943595
wallet = self.wallet_ask(
@@ -4052,7 +4053,7 @@ def stake_move(
40524053
ask_for=[WO.NAME, WO.PATH, WO.HOTKEY],
40534054
validate=WV.WALLET_AND_HOTKEY,
40544055
)
4055-
destination_hotkey = destination_wallet.hotkey.ss58_address
4056+
destination_hotkey = get_hotkey_pub_ss58(destination_wallet)
40564057
else:
40574058
if is_valid_ss58_address(destination_hotkey):
40584059
destination_hotkey = destination_hotkey
@@ -4091,7 +4092,7 @@ def stake_move(
40914092
ask_for=[WO.NAME, WO.PATH, WO.HOTKEY],
40924093
validate=WV.WALLET_AND_HOTKEY,
40934094
)
4094-
origin_hotkey = wallet.hotkey.ss58_address
4095+
origin_hotkey = get_hotkey_pub_ss58(wallet)
40954096
else:
40964097
if is_valid_ss58_address(wallet_hotkey):
40974098
origin_hotkey = wallet_hotkey
@@ -4103,7 +4104,7 @@ def stake_move(
41034104
ask_for=[],
41044105
validate=WV.WALLET_AND_HOTKEY,
41054106
)
4106-
origin_hotkey = wallet.hotkey.ss58_address
4107+
origin_hotkey = get_hotkey_pub_ss58(wallet)
41074108

41084109
if not interactive_selection:
41094110
if origin_netuid is None:
@@ -4256,7 +4257,7 @@ def stake_transfer(
42564257
ask_for=[WO.NAME, WO.PATH, WO.HOTKEY],
42574258
validate=WV.WALLET_AND_HOTKEY,
42584259
)
4259-
origin_hotkey = wallet.hotkey.ss58_address
4260+
origin_hotkey = get_hotkey_pub_ss58(wallet)
42604261
else:
42614262
if is_valid_ss58_address(wallet_hotkey):
42624263
origin_hotkey = wallet_hotkey
@@ -4268,7 +4269,7 @@ def stake_transfer(
42684269
ask_for=[],
42694270
validate=WV.WALLET_AND_HOTKEY,
42704271
)
4271-
origin_hotkey = wallet.hotkey.ss58_address
4272+
origin_hotkey = get_hotkey_pub_ss58(wallet)
42724273

42734274
if not interactive_selection:
42744275
if origin_netuid is None:

bittensor_cli/src/bittensor/subtensor_interface.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
validate_chain_endpoint,
4040
u16_normalized_float,
4141
U16_MAX,
42+
get_hotkey_pub_ss58,
4243
)
4344

4445
SubstrateClass = (
@@ -666,7 +667,7 @@ async def filter_netuids_by_registered_hotkeys(
666667
for sublist in await asyncio.gather(
667668
*[
668669
self.get_netuids_for_hotkey(
669-
wallet.hotkey.ss58_address,
670+
get_hotkey_pub_ss58(wallet),
670671
reuse_block=reuse_block,
671672
block_hash=block_hash,
672673
)

bittensor_cli/src/bittensor/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def get_hotkey_wallets_for_wallet(
275275
(exists := hotkey_for_name.hotkey_file.exists_on_device())
276276
and not hotkey_for_name.hotkey_file.is_encrypted()
277277
# and hotkey_for_name.coldkeypub.ss58_address
278-
and hotkey_for_name.hotkey.ss58_address
278+
and get_hotkey_pub_ss58(hotkey_for_name)
279279
):
280280
hotkey_wallets.append(hotkey_for_name)
281281
elif (

0 commit comments

Comments
 (0)