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
6 changes: 2 additions & 4 deletions bittensor_cli/src/commands/stake/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
is_valid_ss58_address,
print_error,
print_verbose,
unlock_key,
)
from bittensor_wallet import Wallet
from bittensor_wallet.errors import KeyFileError
Expand Down Expand Up @@ -338,10 +339,7 @@ async def stake_extrinsic(
if prompt:
if not Confirm.ask("Would you like to continue?"):
raise typer.Exit()
try:
wallet.unlock_coldkey()
except KeyFileError:
err_console.print("Error decrypting coldkey (possibly incorrect password)")
if not unlock_key(wallet).success:
return False

if safe_staking:
Expand Down
16 changes: 4 additions & 12 deletions bittensor_cli/src/commands/stake/move.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
format_error_message,
group_subnets,
get_subnet_name,
unlock_key,
)

if TYPE_CHECKING:
Expand Down Expand Up @@ -621,10 +622,7 @@ async def move_stake(
raise typer.Exit()

# Perform moving operation.
try:
wallet.unlock_coldkey()
except KeyFileError:
err_console.print("Error decrypting coldkey (possibly incorrect password)")
if not unlock_key(wallet).success:
return False
with console.status(
f"\n:satellite: Moving [blue]{amount_to_move_as_balance}[/blue] from [blue]{origin_hotkey}[/blue] on netuid: [blue]{origin_netuid}[/blue] \nto "
Expand Down Expand Up @@ -777,10 +775,7 @@ async def transfer_stake(
raise typer.Exit()

# Perform transfer operation
try:
wallet.unlock_coldkey()
except KeyFileError:
err_console.print("Error decrypting coldkey (possibly incorrect password)")
if not unlock_key(wallet).success:
return False

with console.status("\n:satellite: Transferring stake ..."):
Expand Down Expand Up @@ -933,10 +928,7 @@ async def swap_stake(
raise typer.Exit()

# Perform swap operation
try:
wallet.unlock_coldkey()
except KeyFileError:
err_console.print("Error decrypting coldkey (possibly incorrect password)")
if not unlock_key(wallet).success:
return False

with console.status(
Expand Down
11 changes: 3 additions & 8 deletions bittensor_cli/src/commands/stake/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
is_valid_ss58_address,
format_error_message,
group_subnets,
unlock_key,
)

if TYPE_CHECKING:
Expand Down Expand Up @@ -268,10 +269,7 @@ async def unstake(
raise typer.Exit()

# Execute extrinsics
try:
wallet.unlock_coldkey()
except KeyFileError:
err_console.print("Error decrypting coldkey (possibly incorrect password)")
if not unlock_key(wallet).success:
return False

with console.status("\n:satellite: Performing unstaking operations...") as status:
Expand Down Expand Up @@ -465,10 +463,7 @@ async def unstake_all(
):
return False

try:
wallet.unlock_coldkey()
except KeyFileError:
err_console.print("Error decrypting coldkey (possibly incorrect password)")
if not unlock_key(wallet).success:
return False

with console.status("Unstaking all stakes...") as status:
Expand Down
5 changes: 1 addition & 4 deletions bittensor_cli/src/commands/subnets/subnets.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,7 @@ async def _find_event_attributes_in_extrinsic_receipt(
)
return False

try:
wallet.unlock_coldkey()
except KeyFileError:
err_console.print("Error decrypting coldkey (possibly incorrect password)")
if not unlock_key(wallet).success:
return False

with console.status(":satellite: Registering subnet...", spinner="earth"):
Expand Down
Loading