From 086dda51325a7a6ff954b83076c2cdb2d24f9d48 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Mon, 25 Nov 2024 15:10:19 -0800 Subject: [PATCH] Fixed overview message descripancy --- bittensor_cli/src/commands/wallets.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/bittensor_cli/src/commands/wallets.py b/bittensor_cli/src/commands/wallets.py index 322b9538..9a8b0bfa 100644 --- a/bittensor_cli/src/commands/wallets.py +++ b/bittensor_cli/src/commands/wallets.py @@ -656,8 +656,13 @@ async def overview( neurons ) + has_alerts = False alerts_table = Table(show_header=True, header_style="bold magenta") alerts_table.add_column("🥩 alert!") + alerts_table.add_row( + "[bold]Detected the following stake(s) associated with coldkey(s) that are not linked to any local hotkeys:[/bold]" + ) + alerts_table.add_row("") coldkeys_to_check = [] ck_stakes = await subtensor.get_total_stake_for_coldkey( @@ -680,12 +685,23 @@ async def overview( if difference == 0: continue # We have all our stake registered. + has_alerts = True coldkeys_to_check.append(coldkey_wallet) alerts_table.add_row( - "Found [light_goldenrod2]{}[/light_goldenrod2] stake with coldkey [bright_magenta]{}[/bright_magenta] that is not registered.".format( - abs(difference), coldkey_wallet.coldkeypub.ss58_address + "[light_goldenrod2]{}[/light_goldenrod2] stake associated with coldkey [bright_magenta]{}[/bright_magenta] (ss58: [bright_magenta]{}[/bright_magenta])".format( + abs(difference), + coldkey_wallet.name, + coldkey_wallet.coldkeypub.ss58_address, ) ) + if has_alerts: + alerts_table.add_row("") + alerts_table.add_row( + "[bold yellow]Note:[/bold yellow] This stake might be delegated, staked to another user's hotkey, or associated with a hotkey not present in your wallet." + ) + alerts_table.add_row( + "You can find out more by executing `[bold]btcli wallet inspect[/bold]` command." + ) if coldkeys_to_check: # We have some stake that is not with a registered hotkey. @@ -739,7 +755,7 @@ async def overview( grid = Table.grid(pad_edge=True) # If there are any alerts, add them to the grid - if len(alerts_table.rows) > 0: + if has_alerts: grid.add_row(alerts_table) # Add title