Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed overview message discrepancy #251

Merged
merged 1 commit into from
Nov 26, 2024
Merged
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
22 changes: 19 additions & 3 deletions bittensor_cli/src/commands/wallets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
Loading