bittensor-cli 9.11.0__tar.gz → 9.11.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/PKG-INFO +1 -1
  2. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/__init__.py +1 -1
  3. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/chain_data.py +17 -0
  4. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/extrinsics/transfer.py +3 -1
  5. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/subtensor_interface.py +67 -46
  6. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/utils.py +2 -1
  7. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/stake/add.py +8 -13
  8. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/stake/move.py +15 -21
  9. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/stake/remove.py +8 -27
  10. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/wallets.py +4 -0
  11. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli.egg-info/PKG-INFO +1 -1
  12. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/pyproject.toml +1 -1
  13. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/MANIFEST.in +0 -0
  14. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/README.md +0 -0
  15. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/__init__.py +0 -0
  16. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/cli.py +0 -0
  17. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/doc_generation_helper.py +0 -0
  18. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/__init__.py +0 -0
  19. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/balances.py +0 -0
  20. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/extrinsics/__init__.py +0 -0
  21. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/extrinsics/registration.py +0 -0
  22. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/extrinsics/root.py +0 -0
  23. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/minigraph.py +0 -0
  24. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/networking.py +0 -0
  25. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/templates/main-filters.j2 +0 -0
  26. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/templates/main-header.j2 +0 -0
  27. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/templates/neuron-details.j2 +0 -0
  28. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/templates/price-multi.j2 +0 -0
  29. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/templates/price-single.j2 +0 -0
  30. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/templates/subnet-details-header.j2 +0 -0
  31. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/templates/subnet-details.j2 +0 -0
  32. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/templates/subnet-metrics.j2 +0 -0
  33. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/templates/subnets-table.j2 +0 -0
  34. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/templates/table.j2 +0 -0
  35. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/templates/view.css +0 -0
  36. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/templates/view.j2 +0 -0
  37. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/bittensor/templates/view.js +0 -0
  38. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/__init__.py +0 -0
  39. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/liquidity/__init__.py +0 -0
  40. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/liquidity/liquidity.py +0 -0
  41. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/liquidity/utils.py +0 -0
  42. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/stake/__init__.py +0 -0
  43. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/stake/children_hotkeys.py +0 -0
  44. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/stake/list.py +0 -0
  45. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/subnets/__init__.py +0 -0
  46. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/subnets/price.py +0 -0
  47. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/subnets/subnets.py +0 -0
  48. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/sudo.py +0 -0
  49. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/view.py +0 -0
  50. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/src/commands/weights.py +0 -0
  51. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli/version.py +0 -0
  52. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli.egg-info/SOURCES.txt +0 -0
  53. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli.egg-info/dependency_links.txt +0 -0
  54. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli.egg-info/entry_points.txt +0 -0
  55. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli.egg-info/requires.txt +0 -0
  56. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/bittensor_cli.egg-info/top_level.txt +0 -0
  57. {bittensor_cli-9.11.0 → bittensor_cli-9.11.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bittensor-cli
3
- Version: 9.11.0
3
+ Version: 9.11.1
4
4
  Summary: Bittensor CLI
5
5
  Author: bittensor.com
6
6
  Project-URL: homepage, https://github.com/opentensor/btcli
@@ -641,7 +641,7 @@ HYPERPARAMS = {
641
641
  "adjustment_interval": ("sudo_set_adjustment_interval", True),
642
642
  "activity_cutoff": ("sudo_set_activity_cutoff", False),
643
643
  "target_regs_per_interval": ("sudo_set_target_registrations_per_interval", True),
644
- "min_burn": ("sudo_set_min_burn", True),
644
+ "min_burn": ("sudo_set_min_burn", False),
645
645
  "max_burn": ("sudo_set_max_burn", True),
646
646
  "bonds_moving_avg": ("sudo_set_bonds_moving_average", False),
647
647
  "max_regs_per_block": ("sudo_set_max_registrations_per_block", True),
@@ -1193,3 +1193,20 @@ class MetagraphInfo(InfoBase):
1193
1193
  for adphk in decoded["alpha_dividends_per_hotkey"]
1194
1194
  ],
1195
1195
  )
1196
+
1197
+
1198
+ @dataclass
1199
+ class SimSwapResult:
1200
+ tao_amount: Balance
1201
+ alpha_amount: Balance
1202
+ tao_fee: Balance
1203
+ alpha_fee: Balance
1204
+
1205
+ @classmethod
1206
+ def from_dict(cls, d: dict, netuid: int) -> "SimSwapResult":
1207
+ return cls(
1208
+ tao_amount=Balance.from_rao(d["tao_amount"]).set_unit(0),
1209
+ alpha_amount=Balance.from_rao(d["alpha_amount"]).set_unit(netuid),
1210
+ tao_fee=Balance.from_rao(d["tao_fee"]).set_unit(0),
1211
+ alpha_fee=Balance.from_rao(d["alpha_fee"]).set_unit(netuid),
1212
+ )
@@ -175,7 +175,9 @@ async def transfer_extrinsic(
175
175
  f" amount: [bright_cyan]{amount if not transfer_all else account_balance}[/bright_cyan]\n"
176
176
  f" from: [light_goldenrod2]{wallet.name}[/light_goldenrod2] : "
177
177
  f"[bright_magenta]{wallet.coldkey.ss58_address}\n[/bright_magenta]"
178
- f" to: [bright_magenta]{destination}[/bright_magenta]\n for fee: [bright_cyan]{fee}[/bright_cyan]"
178
+ f" to: [bright_magenta]{destination}[/bright_magenta]\n for fee: [bright_cyan]{fee}[/bright_cyan]\n"
179
+ f":warning:[bright_yellow]Transferring is not the same as staking. To instead stake, use "
180
+ f"[dark_orange]btcli stake add[/dark_orange] instead[/bright_yellow]:warning:"
179
181
  ):
180
182
  return False
181
183
 
@@ -28,6 +28,7 @@ from bittensor_cli.src.bittensor.chain_data import (
28
28
  DynamicInfo,
29
29
  SubnetState,
30
30
  MetagraphInfo,
31
+ SimSwapResult,
31
32
  )
32
33
  from bittensor_cli.src import DelegatesDetails
33
34
  from bittensor_cli.src.bittensor.balances import Balance, fixed_to_float
@@ -1502,59 +1503,79 @@ class SubtensorInterface:
1502
1503
  fee_dict = await self.substrate.get_payment_info(call, keypair)
1503
1504
  return Balance.from_rao(fee_dict["partial_fee"])
1504
1505
 
1505
- async def get_stake_fee(
1506
+ async def sim_swap(
1506
1507
  self,
1507
- origin_hotkey_ss58: Optional[str],
1508
- origin_netuid: Optional[int],
1509
- origin_coldkey_ss58: str,
1510
- destination_hotkey_ss58: Optional[str],
1511
- destination_netuid: Optional[int],
1512
- destination_coldkey_ss58: str,
1508
+ origin_netuid: int,
1509
+ destination_netuid: int,
1513
1510
  amount: int,
1514
1511
  block_hash: Optional[str] = None,
1515
- ) -> Balance:
1512
+ ) -> SimSwapResult:
1516
1513
  """
1517
- Calculates the fee for a staking operation.
1518
-
1519
- :param origin_hotkey_ss58: SS58 address of source hotkey (None for new stake)
1520
- :param origin_netuid: Netuid of source subnet (None for new stake)
1521
- :param origin_coldkey_ss58: SS58 address of source coldkey
1522
- :param destination_hotkey_ss58: SS58 address of destination hotkey (None for removing stake)
1523
- :param destination_netuid: Netuid of destination subnet (None for removing stake)
1524
- :param destination_coldkey_ss58: SS58 address of destination coldkey
1525
- :param amount: Amount of stake to transfer in RAO
1526
- :param block_hash: Optional block hash at which to perform the calculation
1527
-
1528
- :return: The calculated stake fee as a Balance object
1529
-
1530
- When to use None:
1514
+ Hits the SimSwap Runtime API to calculate the fee and result for a given transaction. This should be used
1515
+ instead of get_stake_fee for staking fee calculations. The SimSwapResult contains the staking fees and expected
1516
+ returned amounts of a given transaction. This does not include the transaction (extrinsic) fee.
1531
1517
 
1532
- 1. Adding new stake (default fee):
1533
- - origin_hotkey_ss58 = None
1534
- - origin_netuid = None
1535
- - All other fields required
1536
-
1537
- 2. Removing stake (default fee):
1538
- - destination_hotkey_ss58 = None
1539
- - destination_netuid = None
1540
- - All other fields required
1518
+ Args:
1519
+ origin_netuid: Netuid of the source subnet (0 if new stake)
1520
+ destination_netuid: Netuid of the destination subnet
1521
+ amount: Amount to transfer in Rao
1522
+ block_hash: The hash of the blockchain block number for the query.
1541
1523
 
1542
- For all other operations, no None values - provide all parameters:
1543
- 3. Moving between subnets
1544
- 4. Moving between hotkeys
1545
- 5. Moving between coldkeys
1524
+ Returns:
1525
+ SimSwapResult object representing the result
1546
1526
  """
1547
-
1548
- if origin_netuid is None:
1549
- origin_netuid = 0
1550
-
1551
- fee_rate = await self.query("Swap", "FeeRate", [origin_netuid])
1552
- fee = amount * (fee_rate / U16_MAX)
1553
-
1554
- result = Balance.from_rao(fee)
1555
- result.set_unit(origin_netuid)
1556
-
1557
- return result
1527
+ block_hash = block_hash or await self.substrate.get_chain_head()
1528
+ if origin_netuid > 0 and destination_netuid > 0:
1529
+ # for cross-subnet moves where neither origin nor destination is root
1530
+ intermediate_result_, sn_price = await asyncio.gather(
1531
+ self.query_runtime_api(
1532
+ "SwapRuntimeApi",
1533
+ "sim_swap_alpha_for_tao",
1534
+ params={"netuid": origin_netuid, "alpha": amount},
1535
+ block_hash=block_hash,
1536
+ ),
1537
+ self.get_subnet_price(origin_netuid, block_hash=block_hash),
1538
+ )
1539
+ intermediate_result = SimSwapResult.from_dict(
1540
+ intermediate_result_, origin_netuid
1541
+ )
1542
+ result = SimSwapResult.from_dict(
1543
+ await self.query_runtime_api(
1544
+ "SwapRuntimeApi",
1545
+ "sim_swap_tao_for_alpha",
1546
+ params={
1547
+ "netuid": destination_netuid,
1548
+ "tao": intermediate_result.tao_amount,
1549
+ },
1550
+ block_hash=block_hash,
1551
+ ),
1552
+ destination_netuid,
1553
+ )
1554
+ secondary_fee = (result.tao_fee * sn_price).set_unit(origin_netuid)
1555
+ result.alpha_fee = result.alpha_fee + secondary_fee
1556
+ return result
1557
+ elif origin_netuid > 0:
1558
+ # dynamic to tao
1559
+ return SimSwapResult.from_dict(
1560
+ await self.query_runtime_api(
1561
+ "SwapRuntimeApi",
1562
+ "sim_swap_alpha_for_tao",
1563
+ params={"netuid": origin_netuid, "alpha": amount},
1564
+ block_hash=block_hash,
1565
+ ),
1566
+ origin_netuid,
1567
+ )
1568
+ else:
1569
+ # tao to dynamic or unstaked to staked tao (SN0)
1570
+ return SimSwapResult.from_dict(
1571
+ await self.query_runtime_api(
1572
+ "SwapRuntimeApi",
1573
+ "sim_swap_tao_for_alpha",
1574
+ params={"netuid": destination_netuid, "tao": amount},
1575
+ block_hash=block_hash,
1576
+ ),
1577
+ destination_netuid,
1578
+ )
1558
1579
 
1559
1580
  async def get_scheduled_coldkey_swap(
1560
1581
  self,
@@ -266,7 +266,7 @@ def get_hotkey_wallets_for_wallet(
266
266
  hotkeys_path = wallet_path / wallet.name / "hotkeys"
267
267
  try:
268
268
  hotkeys = [entry.name for entry in hotkeys_path.iterdir()]
269
- except FileNotFoundError:
269
+ except (FileNotFoundError, NotADirectoryError):
270
270
  hotkeys = []
271
271
  for h_name in hotkeys:
272
272
  if h_name.endswith("pub.txt"):
@@ -307,6 +307,7 @@ def get_hotkey_wallets_for_wallet(
307
307
  AttributeError,
308
308
  TypeError,
309
309
  KeyFileError,
310
+ ValueError,
310
311
  ): # usually an unrelated file like .DS_Store
311
312
  continue
312
313
 
@@ -347,17 +347,6 @@ async def stake_add(
347
347
  return False
348
348
  remaining_wallet_balance -= amount_to_stake
349
349
 
350
- # TODO this should be asyncio gathered before the for loop
351
- stake_fee = await subtensor.get_stake_fee(
352
- origin_hotkey_ss58=None,
353
- origin_netuid=None,
354
- origin_coldkey_ss58=wallet.coldkeypub.ss58_address,
355
- destination_hotkey_ss58=hotkey[1],
356
- destination_netuid=netuid,
357
- destination_coldkey_ss58=wallet.coldkeypub.ss58_address,
358
- amount=amount_to_stake.rao,
359
- )
360
-
361
350
  # Calculate slippage
362
351
  # TODO: Update for V3, slippage calculation is significantly different in v3
363
352
  # try:
@@ -409,7 +398,13 @@ async def stake_add(
409
398
  safe_staking_=safe_staking,
410
399
  )
411
400
  row_extension = []
412
- received_amount = rate * (amount_to_stake - stake_fee - extrinsic_fee)
401
+ # TODO this should be asyncio gathered before the for loop
402
+ sim_swap = await subtensor.sim_swap(
403
+ origin_netuid=0,
404
+ destination_netuid=netuid,
405
+ amount=(amount_to_stake - extrinsic_fee).rao,
406
+ )
407
+ received_amount = sim_swap.alpha_amount
413
408
  # Add rows for the table
414
409
  base_row = [
415
410
  str(netuid), # netuid
@@ -418,7 +413,7 @@ async def stake_add(
418
413
  str(rate)
419
414
  + f" {Balance.get_unit(netuid)}/{Balance.get_unit(0)} ", # rate
420
415
  str(received_amount.set_unit(netuid)), # received
421
- str(stake_fee), # fee
416
+ str(sim_swap.tao_fee), # fee
422
417
  str(extrinsic_fee),
423
418
  # str(slippage_pct), # slippage
424
419
  ] + row_extension
@@ -520,14 +520,10 @@ async def move_stake(
520
520
  "alpha_amount": amount_to_move_as_balance.rao,
521
521
  },
522
522
  )
523
- stake_fee, extrinsic_fee = await asyncio.gather(
524
- subtensor.get_stake_fee(
525
- origin_hotkey_ss58=origin_hotkey,
523
+ sim_swap, extrinsic_fee = await asyncio.gather(
524
+ subtensor.sim_swap(
526
525
  origin_netuid=origin_netuid,
527
- origin_coldkey_ss58=wallet.coldkeypub.ss58_address,
528
- destination_hotkey_ss58=destination_hotkey,
529
526
  destination_netuid=destination_netuid,
530
- destination_coldkey_ss58=wallet.coldkeypub.ss58_address,
531
527
  amount=amount_to_move_as_balance.rao,
532
528
  ),
533
529
  subtensor.get_extrinsic_fee(call, wallet.coldkeypub),
@@ -543,7 +539,9 @@ async def move_stake(
543
539
  origin_hotkey=origin_hotkey,
544
540
  destination_hotkey=destination_hotkey,
545
541
  amount_to_move=amount_to_move_as_balance,
546
- stake_fee=stake_fee,
542
+ stake_fee=sim_swap.alpha_fee
543
+ if origin_netuid != 0
544
+ else sim_swap.tao_fee,
547
545
  extrinsic_fee=extrinsic_fee,
548
546
  )
549
547
  except ValueError:
@@ -709,14 +707,10 @@ async def transfer_stake(
709
707
  "alpha_amount": amount_to_transfer.rao,
710
708
  },
711
709
  )
712
- stake_fee, extrinsic_fee = await asyncio.gather(
713
- subtensor.get_stake_fee(
714
- origin_hotkey_ss58=origin_hotkey,
710
+ sim_swap, extrinsic_fee = await asyncio.gather(
711
+ subtensor.sim_swap(
715
712
  origin_netuid=origin_netuid,
716
- origin_coldkey_ss58=wallet.coldkeypub.ss58_address,
717
- destination_hotkey_ss58=origin_hotkey,
718
713
  destination_netuid=dest_netuid,
719
- destination_coldkey_ss58=dest_coldkey_ss58,
720
714
  amount=amount_to_transfer.rao,
721
715
  ),
722
716
  subtensor.get_extrinsic_fee(call, wallet.coldkeypub),
@@ -732,7 +726,9 @@ async def transfer_stake(
732
726
  origin_hotkey=origin_hotkey,
733
727
  destination_hotkey=origin_hotkey,
734
728
  amount_to_move=amount_to_transfer,
735
- stake_fee=stake_fee,
729
+ stake_fee=sim_swap.alpha_fee
730
+ if origin_netuid != 0
731
+ else sim_swap.tao_fee,
736
732
  extrinsic_fee=extrinsic_fee,
737
733
  )
738
734
  except ValueError:
@@ -880,14 +876,10 @@ async def swap_stake(
880
876
  "alpha_amount": amount_to_swap.rao,
881
877
  },
882
878
  )
883
- stake_fee, extrinsic_fee = await asyncio.gather(
884
- subtensor.get_stake_fee(
885
- origin_hotkey_ss58=hotkey_ss58,
879
+ sim_swap, extrinsic_fee = await asyncio.gather(
880
+ subtensor.sim_swap(
886
881
  origin_netuid=origin_netuid,
887
- origin_coldkey_ss58=wallet.coldkeypub.ss58_address,
888
- destination_hotkey_ss58=hotkey_ss58,
889
882
  destination_netuid=destination_netuid,
890
- destination_coldkey_ss58=wallet.coldkeypub.ss58_address,
891
883
  amount=amount_to_swap.rao,
892
884
  ),
893
885
  subtensor.get_extrinsic_fee(call, wallet.coldkeypub),
@@ -903,7 +895,9 @@ async def swap_stake(
903
895
  origin_hotkey=hotkey_ss58,
904
896
  destination_hotkey=hotkey_ss58,
905
897
  amount_to_move=amount_to_swap,
906
- stake_fee=stake_fee,
898
+ stake_fee=sim_swap.alpha_fee
899
+ if origin_netuid != 0
900
+ else sim_swap.tao_fee,
907
901
  extrinsic_fee=extrinsic_fee,
908
902
  )
909
903
  except ValueError:
@@ -200,16 +200,6 @@ async def unstake(
200
200
  )
201
201
  continue # Skip to the next subnet - useful when single amount is specified for all subnets
202
202
 
203
- stake_fee = await subtensor.get_stake_fee(
204
- origin_hotkey_ss58=staking_address_ss58,
205
- origin_netuid=netuid,
206
- origin_coldkey_ss58=wallet.coldkeypub.ss58_address,
207
- destination_hotkey_ss58=None,
208
- destination_netuid=None,
209
- destination_coldkey_ss58=wallet.coldkeypub.ss58_address,
210
- amount=amount_to_unstake_as_balance.rao,
211
- )
212
-
213
203
  try:
214
204
  current_price = subnet_info.price.tao
215
205
  if safe_staking:
@@ -240,10 +230,10 @@ async def unstake(
240
230
  netuid=netuid,
241
231
  amount=amount_to_unstake_as_balance,
242
232
  )
243
- rate = current_price
244
- received_amount = (
245
- (amount_to_unstake_as_balance - stake_fee) * rate
246
- ) - extrinsic_fee
233
+ sim_swap = await subtensor.sim_swap(
234
+ netuid, 0, amount_to_unstake_as_balance.rao
235
+ )
236
+ received_amount = sim_swap.tao_amount - extrinsic_fee
247
237
  except ValueError:
248
238
  continue
249
239
  total_received_amount += received_amount
@@ -266,7 +256,7 @@ async def unstake(
266
256
  str(amount_to_unstake_as_balance), # Amount to Unstake
267
257
  f"{subnet_info.price.tao:.6f}"
268
258
  + f"(τ/{Balance.get_unit(netuid)})", # Rate
269
- str(stake_fee.set_unit(netuid)), # Fee
259
+ str(sim_swap.alpha_fee), # Fee
270
260
  str(extrinsic_fee), # Extrinsic fee
271
261
  str(received_amount), # Received Amount
272
262
  # slippage_pct, # Slippage Percent
@@ -494,15 +484,6 @@ async def unstake_all(
494
484
  hotkey_display = hotkey_names.get(stake.hotkey_ss58, stake.hotkey_ss58)
495
485
  subnet_info = all_sn_dynamic_info.get(stake.netuid)
496
486
  stake_amount = stake.stake
497
- stake_fee = await subtensor.get_stake_fee(
498
- origin_hotkey_ss58=stake.hotkey_ss58,
499
- origin_netuid=stake.netuid,
500
- origin_coldkey_ss58=wallet.coldkeypub.ss58_address,
501
- destination_hotkey_ss58=None,
502
- destination_netuid=None,
503
- destination_coldkey_ss58=wallet.coldkeypub.ss58_address,
504
- amount=stake_amount.rao,
505
- )
506
487
 
507
488
  try:
508
489
  current_price = subnet_info.price.tao
@@ -515,8 +496,8 @@ async def unstake_all(
515
496
  subtensor,
516
497
  hotkey_ss58=stake.hotkey_ss58,
517
498
  )
518
- rate = current_price
519
- received_amount = ((stake_amount - stake_fee) * rate) - extrinsic_fee
499
+ sim_swap = await subtensor.sim_swap(stake.netuid, 0, stake_amount.rao)
500
+ received_amount = sim_swap.tao_amount - extrinsic_fee
520
501
 
521
502
  if received_amount < Balance.from_tao(0):
522
503
  print_error("Not enough Alpha to pay the transaction fee.")
@@ -532,7 +513,7 @@ async def unstake_all(
532
513
  str(stake_amount),
533
514
  f"{float(subnet_info.price):.6f}"
534
515
  + f"({Balance.get_unit(0)}/{Balance.get_unit(stake.netuid)})",
535
- str(stake_fee),
516
+ str(sim_swap.alpha_fee),
536
517
  str(extrinsic_fee),
537
518
  str(received_amount),
538
519
  )
@@ -823,6 +823,7 @@ async def wallet_list(wallet_path: str, json_output: bool):
823
823
  for wallet in wallets:
824
824
  if (
825
825
  wallet.coldkeypub_file.exists_on_device()
826
+ and os.path.isfile(wallet.coldkeypub_file.path)
826
827
  and not wallet.coldkeypub_file.is_encrypted()
827
828
  ):
828
829
  coldkeypub_str = wallet.coldkeypub.ss58_address
@@ -852,6 +853,9 @@ async def wallet_list(wallet_path: str, json_output: bool):
852
853
  except KeyFileError:
853
854
  hkey_ss58 = hkey.get_hotkeypub().ss58_address
854
855
  pub_only = True
856
+ except AttributeError:
857
+ hkey_ss58 = hkey.hotkey.ss58_address
858
+ pub_only = False
855
859
  try:
856
860
  data = (
857
861
  f"[bold red]Hotkey[/bold red] [green]{hkey.hotkey_str}[/green] "
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bittensor-cli
3
- Version: 9.11.0
3
+ Version: 9.11.1
4
4
  Summary: Bittensor CLI
5
5
  Author: bittensor.com
6
6
  Project-URL: homepage, https://github.com/opentensor/btcli
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "bittensor-cli"
7
- version = "9.11.0"
7
+ version = "9.11.1"
8
8
  description = "Bittensor CLI"
9
9
  readme = "README.md"
10
10
  authors = [
File without changes
File without changes