Skip to content
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
12 changes: 12 additions & 0 deletions bittensor/_cli/commands/stake.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ def run( cli ):
final_amounts: List[Union[float, Balance]] = []
for hotkey in tqdm(hotkeys_to_stake_to):
hotkey: Tuple[Optional[str], str] # (hotkey_name (or None), hotkey_ss58)
if not subtensor.is_hotkey_registered_any( hotkey_ss58 = hotkey ):
# Hotkey is not registered.
if (len(hotkeys_to_stake_to) == 1):
# Only one hotkey, error
bittensor.__console__.print(f"[red]Hotkey [bold]{hotkey}[/bold] is not registered. Aborting.[/red]")
return None
else:
# Otherwise, print warning and skip
bittensor.__console__.print(f"[yellow]Hotkey [bold]{hotkey}[/bold] is not registered. Skipping.[/yellow]")
continue


stake_amount_tao: float = config.get('amount')
if config.get('max_stake'):
# Get the current stake of the hotkey from this coldkey.
Expand Down
11 changes: 11 additions & 0 deletions bittensor/_cli/commands/unstake.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,17 @@ def run( cli ):
final_amounts: List[Union[float, Balance]] = []
for hotkey in tqdm(hotkeys_to_unstake_from):
hotkey: Tuple[Optional[str], str] # (hotkey_name (or None), hotkey_ss58)
if not subtensor.is_hotkey_registered_any( hotkey_ss58 = hotkey ):
# Hotkey is not registered.
if (len(hotkeys_to_unstake_from) == 1):
# Only one hotkey, error
bittensor.__console__.print(f"[red]Hotkey [bold]{hotkey}[/bold] is not registered. Aborting.[/red]")
return None
else:
# Otherwise, print warning and skip
bittensor.__console__.print(f"[yellow]Hotkey [bold]{hotkey}[/bold] is not registered. Skipping.[/yellow]")
continue

unstake_amount_tao: float = cli.config.get('amount') # The amount specified to unstake.
hotkey_stake: Balance = subtensor.get_stake_for_coldkey_and_hotkey( hotkey_ss58 = hotkey[1], coldkey_ss58 = wallet.coldkey.ss58_address )
if unstake_amount_tao == None:
Expand Down