Skip to content

Commit 14aad33

Browse files
committed
Improve error message
1 parent da29bd8 commit 14aad33

File tree

1 file changed

+11
-5
lines changed
  • bittensor_cli/src/commands/stake

1 file changed

+11
-5
lines changed

bittensor_cli/src/commands/stake/move.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,15 @@ async def display_stake_movement_cross_subnets(
3939
if origin_netuid == destination_netuid:
4040
subnet = await subtensor.subnet(origin_netuid)
4141
received_amount_tao = subnet.alpha_to_tao(amount_to_move - stake_fee)
42+
received_amount = subnet.tao_to_alpha(received_amount_tao)
4243

43-
if received_amount_tao < Balance.from_tao(0):
44-
print_error("Not enough Alpha to pay the transaction fee.")
44+
if received_amount < Balance.from_tao(0).set_unit(destination_netuid):
45+
print_error(
46+
f"Not enough Alpha to pay the transaction fee. The fee is {stake_fee}, "
47+
f"which would set the total received to {received_amount}."
48+
)
4549
raise ValueError
4650

47-
received_amount = subnet.tao_to_alpha(received_amount_tao)
4851
price = subnet.price.tao
4952
price_str = (
5053
str(float(price))
@@ -63,8 +66,11 @@ async def display_stake_movement_cross_subnets(
6366
received_amount = dynamic_destination.tao_to_alpha(received_amount_tao)
6467
received_amount.set_unit(destination_netuid)
6568

66-
if received_amount < Balance.from_tao(0):
67-
print_error("Not enough Alpha to pay the transaction fee.")
69+
if received_amount < Balance.from_tao(0).set_unit(destination_netuid):
70+
print_error(
71+
f"Not enough Alpha to pay the transaction fee. The fee is {stake_fee}, "
72+
f"which would set the total received to {received_amount}."
73+
)
6874
raise ValueError
6975

7076
price_str = (

0 commit comments

Comments
 (0)