Skip to content

Commit

Permalink
Fixes wallet fetching default wallets (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibraheem-opentensor authored Sep 5, 2024
1 parent ce6a71a commit fb3d675
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
28 changes: 16 additions & 12 deletions bittensor_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,9 @@ def wallet_overview(
wallet_path = Prompt.ask(
"Enter the path of the wallets", default=defaults.wallet.path
)
wallet = self.wallet_ask(wallet_name, wallet_path, wallet_hotkey)
wallet = self.wallet_ask(
wallet_name, wallet_path, wallet_hotkey, validate=False
)
return self._run_command(
wallets.overview(
wallet,
Expand Down Expand Up @@ -1128,7 +1130,9 @@ def wallet_inspect(
wallet_path = Prompt.ask(
"Enter the path of the wallets", default=defaults.wallet.path
)
wallet = self.wallet_ask(wallet_name, wallet_path, wallet_hotkey)
wallet = self.wallet_ask(
wallet_name, wallet_path, wallet_hotkey, validate=False
)
self.initialize_chain(network, chain)
return self._run_command(
wallets.inspect(
Expand Down Expand Up @@ -1515,10 +1519,10 @@ def wallet_balance(
# Example usages:
- To display the balance of a single wallet, use the command with the `--wallet.name` argument to specify
- To display the balance of a single wallet, use the command with the `--wallet-name` argument to specify
the wallet name:
[green]$[/green] btcli w balance --wallet.name WALLET
[green]$[/green] btcli w balance --wallet-name WALLET
[green]$[/green] btcli w balance
Expand All @@ -1532,7 +1536,9 @@ def wallet_balance(
"Enter the path of the wallets", default=defaults.wallet.path
)
subtensor = self.initialize_chain(network, chain)
wallet = self.wallet_ask(wallet_name, wallet_path, wallet_hotkey)
wallet = self.wallet_ask(
wallet_name, wallet_path, wallet_hotkey, validate=False
)
return self._run_command(
wallets.wallet_balance(wallet, subtensor, all_balances)
)
Expand Down Expand Up @@ -1750,7 +1756,7 @@ def wallet_sign(
[green]$[/green] btcli wallet sign --wallet-name default --message '{"something": "here", "timestamp": 1719908486}'
[green]$[/green] btcli wallet sign --wallet.name default --wallet-hotkey hotkey --message
[green]$[/green] btcli wallet sign --wallet-name default --wallet-hotkey hotkey --message
'{"something": "here", "timestamp": 1719908486}'
[italic]Note[/italic]: When using `btcli`, `w` is used interchangeably with `wallet`. You may use either based
Expand Down Expand Up @@ -2148,7 +2154,7 @@ def root_set_take(
# Example usage:
[green]$[/green] btcli root set_take --wallet.name my_wallet --wallet.hotkey my_hotkey
[green]$[/green] btcli root set_take --wallet-name my_wallet --wallet-hotkey my_hotkey
[italic]Note[/italic]: This function can be used to update the takes individually for every subnet
"""
Expand Down Expand Up @@ -2438,7 +2444,7 @@ def root_list_delegates(
[green]$[/green] btcli root list_delegates
[green]$[/green] btcli root list_delegates --wallet.name my_wallet
[green]$[/green] btcli root list_delegates --wallet-name my_wallet
[green]$[/green] btcli root list_delegates --subtensor.network finney # can also be `test` or `local`
Expand Down Expand Up @@ -2488,7 +2494,7 @@ def root_nominate(
[green]$[/green] btcli root nominate
[green]$[/green] btcli root nominate --wallet.name my_wallet --wallet.hotkey my_hotkey
[green]$[/green] btcli root nominate --wallet-name my_wallet --wallet-hotkey my_hotkey
[italic]Note[/italic]: This function is intended to be used as a CLI command. It prints the outcome directly to the console
and does not return any value. It should not be called programmatically in user code due to its interactive nature and
Expand Down Expand Up @@ -2668,9 +2674,7 @@ def stake_add(

if not wallet_hotkey and not all_hotkeys and not include_hotkeys:
_hotkey_str = typer.style("hotkey", fg="red")
hotkey = typer.prompt(
f"Enter {_hotkey_str} name to stake or ss58_address"
)
hotkey = typer.prompt(f"Enter {_hotkey_str} name to stake or ss58_address")
if not is_valid_ss58_address(hotkey):
wallet_hotkey = hotkey
wallet = self.wallet_ask(
Expand Down
2 changes: 1 addition & 1 deletion bittensor_cli/src/commands/wallets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ def neuron_row_maker(
else:
wallets = [wallet]
all_hotkeys = get_hotkey_wallets_for_wallet(wallet)
with console.status("synchronising with chain"):
with console.status("Synchronising with chain...", spinner="aesthetic"):
block_hash = await subtensor.substrate.get_chain_head()
await subtensor.substrate.init_runtime(block_hash=block_hash)
all_netuids = await subtensor.filter_netuids_by_registered_hotkeys(
Expand Down

0 comments on commit fb3d675

Please sign in to comment.