Skip to content
Merged
19 changes: 12 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# Changelog

## 9.8.2/2025-07-09
## 9.8.3 /2025-07-10
* Updates stake move table with rate applied correctly. by @thewhaleking in https://github.com/opentensor/btcli/pull/538
* change stake fee calculation by @thewhaleking in https://github.com/opentensor/btcli/pull/539

**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.8.2...v9.8.3

## 9.8.2 /2025-07-09
* Ensure that the fees are shown in alpha, not Tao. by @thewhaleking in https://github.com/opentensor/btcli/pull/530
* remove unused subnet names mapping by @thewhaleking in https://github.com/opentensor/btcli/pull/531


**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.8.1...v9.8.2

## 9.8.1/2025-07-08
## 9.8.1 /2025-07-08

## What's Changed
* Fixed broken type annotation. by @thewhaleking in https://github.com/opentensor/btcli/pull/523
Expand All @@ -20,7 +25,7 @@

**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.8.0...v9.8.1

## 9.8.0/2025-07-07
## 9.8.0 /2025-07-07

## What's Changed
* Feat/logo urls in subnet identity by @ibraheem-abe in https://github.com/opentensor/btcli/pull/504
Expand All @@ -36,23 +41,23 @@

**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.7.1...v9.8.0

## 9.7.1/2025-06-26
## 9.7.1 /2025-06-26

## What's Changed
* Convert hyperparams from strings by @thewhaleking in https://github.com/opentensor/btcli/pull/510
* Ensure we parse strings for param names by @thewhaleking in https://github.com/opentensor/btcli/pull/511

**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.7.0...v9.7.1

## 9.7.0/2025-06-16
## 9.7.0 /2025-06-16

## What's Changed
* Add `SKIP_PULL` variable for conftest.py by @basfroman in https://github.com/opentensor/btcli/pull/502
* Feat: Adds netuid support in swap_hotkeys by @ibraheem-abe in https://github.com/opentensor/btcli/pull/505

**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.6.0...v9.7.0

## 9.6.0/2025-06-12
## 9.6.0 /2025-06-12

## What's Changed
* Allows for staking to multiple netuids in one btcli command by @thewhaleking in https://github.com/opentensor/btcli/pull/481
Expand Down
8 changes: 1 addition & 7 deletions bittensor_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,6 @@ def edit_help(cls, option_name: str, help_text: str):
)
rate_tolerance = typer.Option(
None,
"--slippage",
"--slippage-tolerance",
"--tolerance",
"--rate-tolerance",
help="Set the rate tolerance percentage for transactions (default: 0.05 for 5%).",
Expand Down Expand Up @@ -1257,8 +1255,6 @@ def set_config(
),
rate_tolerance: Optional[float] = typer.Option(
None,
"--slippage",
"--slippage-tolerance",
"--tolerance",
help="Set the rate tolerance percentage for transactions (e.g. 0.1 for 0.1%).",
),
Expand Down Expand Up @@ -1404,9 +1400,7 @@ def del_config(
wallet_hotkey: bool = typer.Option(False, *Options.wallet_hotkey.param_decls),
network: bool = typer.Option(False, *Options.network.param_decls),
use_cache: bool = typer.Option(False, "--cache"),
rate_tolerance: bool = typer.Option(
False, "--slippage", "--slippage-tolerance", "--tolerance"
),
rate_tolerance: bool = typer.Option(False, "--tolerance"),
safe_staking: bool = typer.Option(
False, "--safe-staking/--no-safe-staking", "--safe/--unsafe"
),
Expand Down
27 changes: 8 additions & 19 deletions bittensor_cli/src/bittensor/subtensor_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
decode_hex_identity_dict,
validate_chain_endpoint,
u16_normalized_float,
U16_MAX,
)

SubstrateClass = (
Expand Down Expand Up @@ -1526,28 +1527,16 @@ async def get_stake_fee(
5. Moving between coldkeys
"""

origin = None
if origin_hotkey_ss58 is not None and origin_netuid is not None:
origin = (origin_hotkey_ss58, origin_netuid)
if origin_netuid is None:
origin_netuid = 0

destination = None
if destination_hotkey_ss58 is not None and destination_netuid is not None:
destination = (destination_hotkey_ss58, destination_netuid)
fee_rate = await self.query("Swap", "FeeRate", [origin_netuid])
fee = amount * (fee_rate / U16_MAX)

result = await self.query_runtime_api(
runtime_api="StakeInfoRuntimeApi",
method="get_stake_fee",
params=[
origin,
origin_coldkey_ss58,
destination,
destination_coldkey_ss58,
amount,
],
block_hash=block_hash,
)
result = Balance.from_tao(fee)
result.set_unit(origin_netuid)

return Balance.from_rao(result)
return result

async def get_scheduled_coldkey_swap(
self,
Expand Down
22 changes: 13 additions & 9 deletions bittensor_cli/src/commands/stake/move.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ async def display_stake_movement_cross_subnets(

if origin_netuid == destination_netuid:
subnet = await subtensor.subnet(origin_netuid)
received_amount_tao = subnet.alpha_to_tao(amount_to_move)
received_amount_tao -= stake_fee
received_amount_tao = subnet.alpha_to_tao(amount_to_move - stake_fee)
received_amount = subnet.tao_to_alpha(received_amount_tao)

if received_amount_tao < Balance.from_tao(0):
print_error("Not enough Alpha to pay the transaction fee.")
if received_amount < Balance.from_tao(0).set_unit(destination_netuid):
print_error(
f"Not enough Alpha to pay the transaction fee. The fee is {stake_fee}, "
f"which would set the total received to {received_amount}."
)
raise ValueError

received_amount = subnet.tao_to_alpha(received_amount_tao)
price = subnet.price.tao
price_str = (
str(float(price))
Expand All @@ -60,13 +62,15 @@ async def display_stake_movement_cross_subnets(
price_destination = dynamic_destination.price.tao
rate = price_origin / (price_destination or 1)

received_amount_tao = dynamic_origin.alpha_to_tao(amount_to_move)
received_amount_tao -= stake_fee
received_amount_tao = dynamic_origin.alpha_to_tao(amount_to_move - stake_fee)
received_amount = dynamic_destination.tao_to_alpha(received_amount_tao)
received_amount.set_unit(destination_netuid)

if received_amount < Balance.from_tao(0):
print_error("Not enough Alpha to pay the transaction fee.")
if received_amount < Balance.from_tao(0).set_unit(destination_netuid):
print_error(
f"Not enough Alpha to pay the transaction fee. The fee is {stake_fee}, "
f"which would set the total received to {received_amount}."
)
raise ValueError

price_str = (
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "bittensor-cli"
version = "9.8.2"
version = "9.8.3"
description = "Bittensor CLI"
readme = "README.md"
authors = [
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e_tests/test_unstaking.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def test_unstaking(local_chain, wallet_setup):
"144",
],
)
assert "✅ Finalized" in stake_result.stdout
assert "✅ Finalized" in stake_result.stdout, stake_result.stderr

stake_list = exec_command_bob(
command="stake",
Expand Down
Loading