Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions bittensor_cli/src/bittensor/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,26 @@ def get_hotkey_wallets_for_wallet(
except FileNotFoundError:
hotkeys = []
for h_name in hotkeys:
hotkey_for_name = Wallet(path=str(wallet_path), name=wallet.name, hotkey=h_name)
if h_name.endswith("pub.txt"):
if h_name.split("pub.txt")[0] in hotkeys:
continue
else:
hotkey_for_name = Wallet(
path=str(wallet_path),
name=wallet.name,
hotkey=h_name.split("pub.txt")[0],
)
else:
hotkey_for_name = Wallet(
path=str(wallet_path), name=wallet.name, hotkey=h_name
)
try:
exists = (
hotkey_for_name.hotkey_file.exists_on_device()
or hotkey_for_name.hotkeypub_file.exists_on_device()
)
if (
(exists := hotkey_for_name.hotkey_file.exists_on_device())
exists
and not hotkey_for_name.hotkey_file.is_encrypted()
# and hotkey_for_name.coldkeypub.ss58_address
and get_hotkey_pub_ss58(hotkey_for_name)
Expand Down
13 changes: 11 additions & 2 deletions bittensor_cli/src/commands/wallets.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,12 +846,21 @@ async def wallet_list(wallet_path: str, json_output: bool):
data = f"[bold red]Hotkey[/bold red][green] {hkey}[/green] (?)"
hk_data = {"name": hkey.name, "ss58_address": "?"}
if hkey:
hkey_ss58 = get_hotkey_pub_ss58(hkey)
try:
hkey_ss58 = hkey.get_hotkey().ss58_address
pub_only = False
except KeyFileError:
hkey_ss58 = hkey.get_hotkeypub().ss58_address
pub_only = True
try:
data = (
f"[bold red]Hotkey[/bold red] [green]{hkey.hotkey_str}[/green] "
f"ss58_address [green]{hkey_ss58}[/green]\n"
f"ss58_address [green]{hkey_ss58}[/green]"
)
if pub_only:
data += " [blue](hotkeypub only)[/blue]\n"
else:
data += "\n"
hk_data["name"] = hkey.hotkey_str
hk_data["ss58_address"] = hkey_ss58
except UnicodeDecodeError:
Expand Down
Loading