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

UI enhancements, fixes #116

Merged
merged 1 commit into from
Sep 25, 2024
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
2 changes: 1 addition & 1 deletion bittensor_cli/src/bittensor/templates/table.j2
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
paginationSizeSelector: [50, 100, 150, 200],
movableColumns: true,
paginationCounter: "rows",
layout: "fitColumns",
layout: "fitDataFill",
{% if tree %} dataTree: true, {% endif %}
}
)
Expand Down
20 changes: 14 additions & 6 deletions bittensor_cli/src/commands/wallets.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from rich.prompt import Confirm, Prompt
from rich.table import Column, Table
from rich.tree import Tree
from rich.padding import Padding
from scalecodec import ScaleBytes
import scalecodec
import typer
Expand Down Expand Up @@ -48,6 +49,7 @@
get_all_wallets_for_path,
get_hotkey_wallets_for_wallet,
is_valid_ss58_address,
validate_coldkey_presence,
)


Expand Down Expand Up @@ -280,6 +282,7 @@ async def wallet_balance(
box=box.SIMPLE_HEAVY,
pad_edge=False,
width=None,
leading=True,
)

for name, (coldkey, free, staked) in balances.items():
Expand All @@ -298,7 +301,7 @@ async def wallet_balance(
str(total_staked_balance),
str(total_free_balance + total_staked_balance),
)
console.print(table)
console.print(Padding(table, (0, 0, 0, 4)))
await subtensor.substrate.close()


Expand Down Expand Up @@ -353,15 +356,15 @@ async def get_wallet_transfers(wallet_address: str) -> list[dict]:
def create_transfer_history_table(transfers: list[dict]) -> Table:
"""Get output transfer table"""

taostats_url_base = "https://x.taostats.io/extrinsic"
taostats_url_base = "https://taostats.io/extrinsic"

table_width = console.width - 5
# Create a table
table = Table(
show_footer=True,
box=box.SIMPLE,
pad_edge=False,
width=table_width,
leading=True,
expand=False,
title="[underline dark_orange]Wallet Transfers[/underline dark_orange]\n\n[dark_orange]Network: finney",
)

Expand Down Expand Up @@ -415,7 +418,7 @@ def create_transfer_history_table(transfers: list[dict]) -> Table:
f"{tao_amount:.3f}",
str(item["extrinsicId"]),
item["blockNumber"],
f"{taostats_url_base}/{item['blockNumber']}-{item['extrinsicId']}",
f"{taostats_url_base}/{item['blockNumber']}-{item['extrinsicId']:04}",
)
table.add_row()
return table
Expand Down Expand Up @@ -592,6 +595,11 @@ async def overview(
for wallet_name, wallet_path in all_wallet_data
]

all_coldkey_wallets, invalid_wallets = validate_coldkey_presence(all_coldkey_wallets)
for invalid_wallet in invalid_wallets:
print_error(f"No coldkeypub found for wallet: ({invalid_wallet.name})", status)
all_hotkeys, _ = validate_coldkey_presence(all_hotkeys)

print_verbose("Fetching key addresses", status)
all_hotkey_addresses, hotkey_coldkey_to_hotkey_wallet = _get_key_address(
all_hotkeys
Expand Down Expand Up @@ -1326,7 +1334,7 @@ def neuron_row_maker(
title=f"[underline dark_orange]Wallets[/underline dark_orange]\n\n[dark_orange]Network: {subtensor.network}\n",
show_edge=False,
expand=True,
box=box.ASCII,
box=box.MINIMAL,
border_style="bright_black",
)
rows = []
Expand Down
Loading