From 0327d92810246f2bd63464bfd0cca0c29a349cac Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 6 Mar 2025 11:06:22 -0800 Subject: [PATCH 1/5] Checks for tx fee inter-subnet movement --- bittensor_cli/src/commands/stake/move.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bittensor_cli/src/commands/stake/move.py b/bittensor_cli/src/commands/stake/move.py index 371f3ccaf..f9f1de0f6 100644 --- a/bittensor_cli/src/commands/stake/move.py +++ b/bittensor_cli/src/commands/stake/move.py @@ -40,6 +40,11 @@ async def display_stake_movement_cross_subnets( received_amount_tao = subnet.alpha_to_tao(amount_to_move) received_amount_tao -= MIN_STAKE_FEE received_amount = subnet.tao_to_alpha(received_amount_tao) + + if received_amount < Balance.from_tao(0): + print_error("Not enough Alpha to pay the transaction fee.") + raise ValueError + slippage_pct_float = ( 100 * float(MIN_STAKE_FEE) / float(MIN_STAKE_FEE + received_amount_tao) if received_amount_tao != 0 @@ -440,7 +445,7 @@ async def move_stake( ): if interactive_selection: try: - selection = stake_move_transfer_selection(subtensor, wallet) + selection = await stake_move_transfer_selection(subtensor, wallet) except ValueError: return False origin_hotkey = selection["origin_hotkey"] From dbb0570e08bf3cd20a6bc830a8b25ac026107055 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 6 Mar 2025 11:07:10 -0800 Subject: [PATCH 2/5] Adds verbosity handler to stake_move --- bittensor_cli/cli.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index 7b165bbb4..e8b6d0b12 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -3369,6 +3369,8 @@ def stake_move( False, "--stake-all", "--all", help="Stake all", prompt=False ), prompt: bool = Options.prompt, + quiet: bool = Options.quiet, + verbose: bool = Options.verbose, ): """ Move staked TAO between hotkeys while keeping the same coldkey ownership. @@ -3390,6 +3392,7 @@ def stake_move( [green]$[/green] btcli stake move """ + self.verbosity_handler(quiet, verbose) console.print( "[dim]This command moves stake from one hotkey to another hotkey while keeping the same coldkey.[/dim]" ) From a3ba80ba9ba5ef9294a1cbd2617454cf2a95e700 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 6 Mar 2025 11:17:17 -0800 Subject: [PATCH 3/5] Adds help for hotkey ss58 + tao_check --- bittensor_cli/cli.py | 16 ++++++++++++++-- bittensor_cli/src/commands/stake/move.py | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index e8b6d0b12..0bfe00f16 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -109,6 +109,18 @@ class Options: "--wallet.hotkey", help="Hotkey of the wallet", ) + wallet_hotkey_ss58 = typer.Option( + None, + "--hotkey", + "--hotkey-ss58", + "-H", + "--wallet_hotkey", + "--wallet_hotkey_ss58", + "--wallet-hotkey", + "--wallet-hotkey-ss58", + "--wallet.hotkey", + help="Hotkey or SS58 address of the wallet", + ) mnemonic = typer.Option( None, help='Mnemonic used to regenerate your key. For example: "horse cart dog ..."', @@ -3349,7 +3361,7 @@ def stake_move( network: Optional[list[str]] = Options.network, wallet_name: Optional[str] = Options.wallet_name, wallet_path: Optional[str] = Options.wallet_path, - wallet_hotkey: Optional[str] = Options.wallet_hotkey, + wallet_hotkey: Optional[str] = Options.wallet_hotkey_ss58, origin_netuid: Optional[int] = typer.Option( None, "--origin-netuid", help="Origin netuid" ), @@ -3505,7 +3517,7 @@ def stake_transfer( network: Optional[list[str]] = Options.network, wallet_name: Optional[str] = Options.wallet_name, wallet_path: Optional[str] = Options.wallet_path, - wallet_hotkey: Optional[str] = Options.wallet_hotkey, + wallet_hotkey: Optional[str] = Options.wallet_hotkey_ss58, origin_netuid: Optional[int] = typer.Option( None, "--origin-netuid", diff --git a/bittensor_cli/src/commands/stake/move.py b/bittensor_cli/src/commands/stake/move.py index f9f1de0f6..0aa23278d 100644 --- a/bittensor_cli/src/commands/stake/move.py +++ b/bittensor_cli/src/commands/stake/move.py @@ -39,12 +39,12 @@ async def display_stake_movement_cross_subnets( subnet = await subtensor.subnet(origin_netuid) received_amount_tao = subnet.alpha_to_tao(amount_to_move) received_amount_tao -= MIN_STAKE_FEE - received_amount = subnet.tao_to_alpha(received_amount_tao) - if received_amount < Balance.from_tao(0): + if received_amount_tao < Balance.from_tao(0): print_error("Not enough Alpha to pay the transaction fee.") raise ValueError + received_amount = subnet.tao_to_alpha(received_amount_tao) slippage_pct_float = ( 100 * float(MIN_STAKE_FEE) / float(MIN_STAKE_FEE + received_amount_tao) if received_amount_tao != 0 From 1fe850cb31397614a5ca78915c4f19e1d22d207b Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor <165814940+ibraheem-opentensor@users.noreply.github.com> Date: Thu, 6 Mar 2025 11:21:56 -0800 Subject: [PATCH 4/5] Update bittensor_cli/cli.py Co-authored-by: BD Himes <37844818+thewhaleking@users.noreply.github.com> --- bittensor_cli/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index 0bfe00f16..bc16de280 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -119,7 +119,7 @@ class Options: "--wallet-hotkey", "--wallet-hotkey-ss58", "--wallet.hotkey", - help="Hotkey or SS58 address of the wallet", + help="Hotkey name or SS58 address of the wallet", ) mnemonic = typer.Option( None, From 5ffa39e487959409f7f69f3ba4d2f6c214a2ef74 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 6 Mar 2025 11:24:14 -0800 Subject: [PATCH 5/5] Updates help --- bittensor_cli/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index bc16de280..79f4d2fef 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -119,7 +119,7 @@ class Options: "--wallet-hotkey", "--wallet-hotkey-ss58", "--wallet.hotkey", - help="Hotkey name or SS58 address of the wallet", + help="Hotkey name or SS58 address of the hotkey", ) mnemonic = typer.Option( None,