diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index dadf57eb..fef38971 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -4909,12 +4909,21 @@ def stake_add( # TODO: Ask amount for each subnet explicitly if more than one if not stake_all and not amount: - free_balance = self._run_command( - wallets.wallet_balance( - wallet, self.initialize_chain(network), False, None - ), - exit_early=False, - ) + staker_ss58 = proxy or wallet.coldkeypub.ss58_address + if proxy: + free_balance = self._run_command( + wallets.wallet_balance( + None, self.initialize_chain(network), False, [staker_ss58] + ), + exit_early=False, + ) + else: + free_balance = self._run_command( + wallets.wallet_balance( + wallet, self.initialize_chain(network), False, None + ), + exit_early=False, + ) logger.debug(f"Free balance: {free_balance}") if free_balance == Balance.from_tao(0): print_error("You dont have any balance to stake.") diff --git a/bittensor_cli/src/commands/stake/add.py b/bittensor_cli/src/commands/stake/add.py index b9bff970..424c4485 100644 --- a/bittensor_cli/src/commands/stake/add.py +++ b/bittensor_cli/src/commands/stake/add.py @@ -131,7 +131,7 @@ async def safe_stake_extrinsic( ) current_balance, next_nonce, call = await asyncio.gather( subtensor.get_balance(coldkey_ss58), - subtensor.substrate.get_account_next_index(coldkey_ss58), + subtensor.substrate.get_account_next_index(signer_ss58), subtensor.substrate.compose_call( call_module="SubtensorModule", call_function="add_stake_limit", @@ -229,7 +229,7 @@ async def stake_extrinsic( block_hash = await subtensor.substrate.get_chain_head() current_balance, next_nonce, call = await asyncio.gather( subtensor.get_balance(coldkey_ss58, block_hash=block_hash), - subtensor.substrate.get_account_next_index(coldkey_ss58), + subtensor.substrate.get_account_next_index(signer_ss58), subtensor.substrate.compose_call( call_module="SubtensorModule", call_function="add_stake", @@ -309,6 +309,7 @@ async def stake_extrinsic( netuids if netuids is not None else await subtensor.get_all_subnet_netuids() ) coldkey_ss58 = proxy or wallet.coldkeypub.ss58_address + signer_ss58 = wallet.coldkeypub.ss58_address hotkeys_to_stake_to = _get_hotkeys_to_stake_to( wallet=wallet, diff --git a/bittensor_cli/src/commands/stake/move.py b/bittensor_cli/src/commands/stake/move.py index 69934f53..2e83e78c 100644 --- a/bittensor_cli/src/commands/stake/move.py +++ b/bittensor_cli/src/commands/stake/move.py @@ -864,9 +864,7 @@ async def transfer_stake( amount=amount_to_transfer.rao, ), subtensor.get_extrinsic_fee(call, wallet.coldkeypub, proxy=proxy), - subtensor.substrate.get_account_next_index( - proxy or wallet.coldkeypub.ss58_address - ), + subtensor.substrate.get_account_next_index(wallet.coldkeypub.ss58_address), ) # Display stake movement details @@ -1094,9 +1092,7 @@ async def swap_stake( amount=amount_to_swap.rao, ), subtensor.get_extrinsic_fee(call, wallet.coldkeypub, proxy=proxy), - subtensor.substrate.get_account_next_index( - proxy or wallet.coldkeypub.ss58_address - ), + subtensor.substrate.get_account_next_index(wallet.coldkeypub.ss58_address), ) # Display stake movement details diff --git a/bittensor_cli/src/commands/stake/remove.py b/bittensor_cli/src/commands/stake/remove.py index 608f627c..a06dbf8b 100644 --- a/bittensor_cli/src/commands/stake/remove.py +++ b/bittensor_cli/src/commands/stake/remove.py @@ -609,6 +609,7 @@ async def _unstake_extrinsic( f":cross_mark: [red]Failed[/red] to unstake {amount} on Netuid {netuid}" ) coldkey_ss58 = proxy or wallet.coldkeypub.ss58_address + signer_ss58 = wallet.coldkeypub.ss58_address if status: status.update( @@ -617,7 +618,7 @@ async def _unstake_extrinsic( current_balance, next_nonce, call = await asyncio.gather( subtensor.get_balance(coldkey_ss58), - subtensor.substrate.get_account_next_index(coldkey_ss58), + subtensor.substrate.get_account_next_index(signer_ss58), subtensor.substrate.compose_call( call_module="SubtensorModule", call_function="remove_stake", @@ -714,6 +715,7 @@ async def _safe_unstake_extrinsic( f":cross_mark: [red]Failed[/red] to unstake {amount} on Netuid {netuid}" ) coldkey_ss58 = proxy or wallet.coldkeypub.ss58_address + signer_ss58 = wallet.coldkeypub.ss58_address if status: status.update( @@ -724,7 +726,7 @@ async def _safe_unstake_extrinsic( current_balance, next_nonce, current_stake, call = await asyncio.gather( subtensor.get_balance(coldkey_ss58, block_hash), - subtensor.substrate.get_account_next_index(coldkey_ss58), + subtensor.substrate.get_account_next_index(signer_ss58), subtensor.get_stake( hotkey_ss58=hotkey_ss58, coldkey_ss58=coldkey_ss58, @@ -836,6 +838,7 @@ async def _unstake_all_extrinsic( f":cross_mark: [red]Failed[/red] to unstake all from {hotkey_name}" ) coldkey_ss58 = proxy or wallet.coldkeypub.ss58_address + signer_ss58 = wallet.coldkeypub.ss58_address if status: status.update( @@ -866,7 +869,7 @@ async def _unstake_all_extrinsic( call_function=call_function, call_params={"hotkey": hotkey_ss58}, ), - subtensor.substrate.get_account_next_index(coldkey_ss58), + subtensor.substrate.get_account_next_index(signer_ss58), ) try: success_, err_msg, response = await subtensor.sign_and_send_extrinsic(