Skip to content
Closed
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
17 changes: 9 additions & 8 deletions gittensor/cli/issue_commands/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
confirm_or_abort,
err_console,
format_alpha,
loading_context,
print_error,
print_network_header,
print_success,
Expand Down Expand Up @@ -72,7 +73,7 @@ def admin_cancel(
print_network_header(network_name, contract_addr)

try:
with err_console.status('[bold cyan]Connecting and reading issue...', spinner='dots'):
with loading_context('Connecting and reading issue...', as_json=False):
wallet, client = _make_contract_client(contract_addr, ws_endpoint, wallet_name, wallet_hotkey)
issue = client.get_issue(issue_id)

Expand All @@ -93,7 +94,7 @@ def admin_cancel(
if not confirm_or_abort(f'Cancel issue {issue_id}? This returns the bounty to the alpha pool.', yes):
return

with err_console.status('[bold cyan]Submitting cancellation...', spinner='dots'):
with loading_context('Submitting cancellation...', as_json=False):
result = client.cancel_issue(issue_id, wallet)

if result:
Expand Down Expand Up @@ -134,7 +135,7 @@ def admin_payout(
print_network_header(network_name, contract_addr)

try:
with err_console.status('[bold cyan]Connecting and reading issue...', spinner='dots'):
with loading_context('Connecting and reading issue...', as_json=False):
wallet, client = _make_contract_client(contract_addr, ws_endpoint, wallet_name, wallet_hotkey)
issue = client.get_issue(issue_id)

Expand All @@ -155,7 +156,7 @@ def admin_payout(
if not confirm_or_abort(f'Pay out issue {issue_id}?', yes):
return

with err_console.status('[bold cyan]Submitting payout...', spinner='dots'):
with loading_context('Submitting payout...', as_json=False):
result = client.payout_bounty(issue_id, wallet)

if result:
Expand Down Expand Up @@ -204,7 +205,7 @@ def admin_set_owner(
return

try:
with err_console.status('[bold cyan]Transferring ownership...', spinner='dots'):
with loading_context('Transferring ownership...', as_json=False):
wallet, client = _make_contract_client(contract_addr, ws_endpoint, wallet_name, wallet_hotkey)
result = client.set_owner(new_owner, wallet)

Expand Down Expand Up @@ -258,7 +259,7 @@ def admin_set_treasury(
return

try:
with err_console.status('[bold cyan]Updating treasury hotkey...', spinner='dots'):
with loading_context('Updating treasury hotkey...', as_json=False):
wallet, client = _make_contract_client(contract_addr, ws_endpoint, wallet_name, wallet_hotkey)
result = client.set_treasury_hotkey(new_treasury, wallet)

Expand Down Expand Up @@ -313,7 +314,7 @@ def admin_add_validator(
return

try:
with err_console.status('[bold cyan]Adding validator...', spinner='dots'):
with loading_context('Adding validator...', as_json=False):
wallet, client = _make_contract_client(contract_addr, ws_endpoint, wallet_name, wallet_hotkey)
result = client.add_validator(hotkey, wallet)

Expand Down Expand Up @@ -367,7 +368,7 @@ def admin_remove_validator(
return

try:
with err_console.status('[bold cyan]Removing validator...', spinner='dots'):
with loading_context('Removing validator...', as_json=False):
wallet, client = _make_contract_client(contract_addr, ws_endpoint, wallet_name, wallet_hotkey)
result = client.remove_validator(hotkey, wallet)

Expand Down
11 changes: 6 additions & 5 deletions gittensor/cli/issue_commands/mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
err_console,
format_alpha,
load_config,
loading_context,
print_error,
print_network_header,
print_success,
Expand Down Expand Up @@ -179,7 +180,7 @@ def issue_register(
from substrateinterface import Keypair, SubstrateInterface
from substrateinterface.contracts import ContractInstance

with err_console.status('[bold cyan]Connecting to network...', spinner='dots'):
with loading_context('Connecting to network...', as_json=False):
substrate = SubstrateInterface(url=ws_endpoint)

# CLI flags override config; fall back to config if not explicitly supplied
Expand Down Expand Up @@ -327,12 +328,12 @@ def issue_harvest(wallet_name: str, wallet_hotkey: str, network: str, rpc_url: s
IssueCompetitionContractClient,
)

with err_console.status('[bold cyan]Loading wallet...', spinner='dots'):
with loading_context('Loading wallet...', as_json=False):
wallet = bt.Wallet(name=wallet_name, hotkey=wallet_hotkey)
hotkey_addr = wallet.hotkey.ss58_address
err_console.print(f'[green]Hotkey address:[/green] {hotkey_addr}')

with err_console.status('[bold cyan]Connecting to network...', spinner='dots'):
with loading_context('Connecting to network...', as_json=False):
subtensor = bt.Subtensor(network=ws_endpoint)

# Show wallet balance (informational only)
Expand All @@ -343,7 +344,7 @@ def issue_harvest(wallet_name: str, wallet_hotkey: str, network: str, rpc_url: s
except Exception as e:
err_console.print(f'[dim]Could not fetch balance: {e}[/dim]')

with err_console.status('[bold cyan]Initializing contract client...', spinner='dots'):
with loading_context('Initializing contract client...', as_json=False):
client = IssueCompetitionContractClient(
contract_address=contract_addr,
subtensor=subtensor,
Expand All @@ -367,7 +368,7 @@ def issue_harvest(wallet_name: str, wallet_hotkey: str, network: str, rpc_url: s
except Exception as e:
err_console.print(f'[yellow]Warning: Could not read contract state: {e}[/yellow]')

with err_console.status('[bold cyan]Calling harvest_emissions()...', spinner='dots'):
with loading_context('Calling harvest_emissions()...', as_json=False):
result = client.harvest_emissions(wallet)

if result:
Expand Down
4 changes: 2 additions & 2 deletions gittensor/cli/issue_commands/vote.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def val_vote_solution(
return

try:
with err_console.status('[bold cyan]Submitting vote...', spinner='dots'):
with loading_context('Submitting vote...', as_json=False):
wallet, client = _make_contract_client(contract_addr, ws_endpoint, wallet_name, wallet_hotkey)
result = client.vote_solution(issue_id, solver_hotkey, solver_coldkey, pr_number, wallet)

Expand Down Expand Up @@ -202,7 +202,7 @@ def val_vote_cancel_issue(
return

try:
with err_console.status('[bold cyan]Submitting cancel vote...', spinner='dots'):
with loading_context('Submitting cancel vote...', as_json=False):
wallet, client = _make_contract_client(contract_addr, ws_endpoint, wallet_name, wallet_hotkey)
result = client.vote_cancel_issue(issue_id, reason, wallet)

Expand Down
3 changes: 2 additions & 1 deletion gittensor/cli/miner_commands/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from rich.console import Console
from rich.table import Table

from gittensor.cli.issue_commands.helpers import loading_context
from gittensor.cli.json_output import emit_json
from gittensor.cli.miner_commands.helpers import _error

Expand Down Expand Up @@ -269,7 +270,7 @@ def score_command(pat: Optional[str], log_level: str, json_mode: bool) -> None:
programming_languages = load_programming_language_weights()
token_config = load_token_config()
else:
with console.status('[bold cyan]Loading weights', spinner='dots'):
with loading_context('Loading weights', as_json=True):
master_repositories = load_master_repo_weights()
programming_languages = load_programming_language_weights()
token_config = load_token_config()
Expand Down
Loading