bittensor-cli 9.4.1__py3-none-any.whl → 9.4.3__py3-none-any.whl

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.
bittensor_cli/cli.py CHANGED
@@ -8,6 +8,7 @@ import re
8
8
  import ssl
9
9
  import sys
10
10
  import traceback
11
+ import warnings
11
12
  from pathlib import Path
12
13
  from typing import Coroutine, Optional
13
14
  from dataclasses import fields
@@ -1000,31 +1001,37 @@ class CLIManager:
1000
1001
  :param network: Network name (e.g. finney, test, etc.) or
1001
1002
  chain endpoint (e.g. ws://127.0.0.1:9945, wss://entrypoint-finney.opentensor.ai:443)
1002
1003
  """
1003
- if not self.subtensor:
1004
- if network:
1005
- network_ = None
1006
- for item in network:
1007
- if item.startswith("ws"):
1008
- network_ = item
1009
- break
1010
- else:
1011
- network_ = item
1004
+ with warnings.catch_warnings():
1005
+ warnings.filterwarnings(
1006
+ "ignore",
1007
+ "You are instantiating the AsyncSubstrateInterface Websocket outside of an event loop. "
1008
+ "Verify this is intended.",
1009
+ )
1010
+ if not self.subtensor:
1011
+ if network:
1012
+ network_ = None
1013
+ for item in network:
1014
+ if item.startswith("ws"):
1015
+ network_ = item
1016
+ break
1017
+ else:
1018
+ network_ = item
1019
+
1020
+ not_selected_networks = [net for net in network if net != network_]
1021
+ if not_selected_networks:
1022
+ console.print(
1023
+ f"Networks not selected: [dark_orange]{', '.join(not_selected_networks)}[/dark_orange]"
1024
+ )
1012
1025
 
1013
- not_selected_networks = [net for net in network if net != network_]
1014
- if not_selected_networks:
1026
+ self.subtensor = SubtensorInterface(network_)
1027
+ elif self.config["network"]:
1028
+ self.subtensor = SubtensorInterface(self.config["network"])
1015
1029
  console.print(
1016
- f"Networks not selected: [dark_orange]{', '.join(not_selected_networks)}[/dark_orange]"
1030
+ f"Using the specified network [{COLORS.G.LINKS}]{self.config['network']}"
1031
+ f"[/{COLORS.G.LINKS}] from config"
1017
1032
  )
1018
-
1019
- self.subtensor = SubtensorInterface(network_)
1020
- elif self.config["network"]:
1021
- self.subtensor = SubtensorInterface(self.config["network"])
1022
- console.print(
1023
- f"Using the specified network [{COLORS.G.LINKS}]{self.config['network']}"
1024
- f"[/{COLORS.G.LINKS}] from config"
1025
- )
1026
- else:
1027
- self.subtensor = SubtensorInterface(defaults.subtensor.network)
1033
+ else:
1034
+ self.subtensor = SubtensorInterface(defaults.subtensor.network)
1028
1035
  return self.subtensor
1029
1036
 
1030
1037
  def _run_command(self, cmd: Coroutine, exit_early: bool = True):
@@ -678,7 +678,6 @@ async def burned_register_extrinsic(
678
678
  wait_for_inclusion: bool = True,
679
679
  wait_for_finalization: bool = True,
680
680
  era: Optional[int] = None,
681
- prompt: bool = False,
682
681
  ) -> tuple[bool, str]:
683
682
  """Registers the wallet to chain by recycling TAO.
684
683
 
@@ -290,7 +290,6 @@ async def root_register_extrinsic(
290
290
  wallet: Wallet,
291
291
  wait_for_inclusion: bool = True,
292
292
  wait_for_finalization: bool = True,
293
- prompt: bool = False,
294
293
  ) -> tuple[bool, str]:
295
294
  r"""Registers the wallet to root network.
296
295
 
@@ -1028,7 +1028,7 @@ async def show(
1028
1028
  The table displays the root subnet participants and their metrics.
1029
1029
  The columns are as follows:
1030
1030
  - Position: The sorted position of the hotkey by total TAO.
1031
- - TAO: The sum of all TAO balances for this hotkey accross all subnets.
1031
+ - TAO: The sum of all TAO balances for this hotkey across all subnets.
1032
1032
  - Stake: The stake balance of this hotkey on root (measured in TAO).
1033
1033
  - Emission: The emission accrued to this hotkey across all subnets every block measured in TAO.
1034
1034
  - Hotkey: The hotkey ss58 address.
@@ -1374,7 +1374,7 @@ async def show(
1374
1374
  # The table displays the subnet participants and their metrics.
1375
1375
  # The columns are as follows:
1376
1376
  # - UID: The hotkey index in the subnet.
1377
- # - TAO: The sum of all TAO balances for this hotkey accross all subnets.
1377
+ # - TAO: The sum of all TAO balances for this hotkey across all subnets.
1378
1378
  # - Stake: The stake balance of this hotkey on this subnet.
1379
1379
  # - Weight: The stake-weight of this hotkey on this subnet. Computed as an average of the normalized TAO and Stake columns of this subnet.
1380
1380
  # - Dividends: Validating dividends earned by the hotkey.
@@ -1662,12 +1662,14 @@ async def register(
1662
1662
  subtensor,
1663
1663
  wallet=wallet,
1664
1664
  netuid=netuid,
1665
- prompt=False,
1666
1665
  old_balance=balance,
1667
1666
  era=era,
1668
1667
  )
1669
1668
  if json_output:
1670
1669
  json_console.print(json.dumps({"success": success, "msg": msg}))
1670
+ else:
1671
+ if not success:
1672
+ err_console.print(f"Failure: {msg}")
1671
1673
 
1672
1674
 
1673
1675
  # TODO: Confirm emissions, incentive, Dividends are to be fetched from subnet_state or keep NeuronInfo
@@ -5,7 +5,7 @@ import tempfile
5
5
  import webbrowser
6
6
  import netaddr
7
7
  from dataclasses import asdict, is_dataclass
8
- from typing import Any, Dict, List
8
+ from typing import Any
9
9
  from pywry import PyWry
10
10
 
11
11
  from bittensor_cli.src.bittensor.balances import Balance
@@ -149,7 +149,7 @@ def get_identity(
149
149
 
150
150
  async def fetch_subnet_data(
151
151
  wallet: Wallet, subtensor: "SubtensorInterface"
152
- ) -> Dict[str, Any]:
152
+ ) -> dict[str, Any]:
153
153
  """
154
154
  Fetch subnet data from the network.
155
155
  """
@@ -187,7 +187,7 @@ async def fetch_subnet_data(
187
187
  }
188
188
 
189
189
 
190
- def process_subnet_data(raw_data: Dict[str, Any]) -> Dict[str, Any]:
190
+ def process_subnet_data(raw_data: dict[str, Any]) -> dict[str, Any]:
191
191
  """
192
192
  Process and prepare subnet data.
193
193
  """
@@ -206,7 +206,7 @@ def process_subnet_data(raw_data: Dict[str, Any]) -> Dict[str, Any]:
206
206
  total_slippage_value = Balance.from_tao(0)
207
207
 
208
208
  # Process stake
209
- stake_dict: Dict[int, List[Dict[str, Any]]] = {}
209
+ stake_dict: dict[int, list[dict[str, Any]]] = {}
210
210
  for stake in stake_info:
211
211
  if stake.stake.tao > 0:
212
212
  slippage_value, _, slippage_percentage = pool_info[
@@ -367,7 +367,7 @@ def _has_exited(handler) -> bool:
367
367
  )
368
368
 
369
369
 
370
- def generate_full_page(data: Dict[str, Any]) -> str:
370
+ def generate_full_page(data: dict[str, Any]) -> str:
371
371
  """
372
372
  Generate full HTML content for the interface.
373
373
  """
@@ -673,7 +673,7 @@ def generate_neuron_details() -> str:
673
673
  """
674
674
 
675
675
 
676
- def generate_main_header(wallet_info: Dict[str, Any], block_number: int) -> str:
676
+ def generate_main_header(wallet_info: dict[str, Any], block_number: int) -> str:
677
677
  truncated_coldkey = f"{wallet_info['coldkey'][:6]}...{wallet_info['coldkey'][-6:]}"
678
678
 
679
679
  # Calculate slippage percentage
@@ -746,7 +746,7 @@ def generate_main_filters() -> str:
746
746
  """
747
747
 
748
748
 
749
- def generate_subnets_table(subnets: List[Dict[str, Any]]) -> str:
749
+ def generate_subnets_table(subnets: list[dict[str, Any]]) -> str:
750
750
  rows = []
751
751
  for subnet in subnets:
752
752
  total_your_stake = sum(stake["amount"] for stake in subnet["your_stakes"])
@@ -438,11 +438,10 @@ async def wallet_create(
438
438
  "name": wallet.name,
439
439
  "path": wallet.path,
440
440
  "hotkey": wallet.hotkey_str,
441
- "hotkey_ss58": wallet.hotkey.ss58_address,
442
441
  "coldkey_ss58": wallet.coldkeypub.ss58_address,
443
442
  }
444
- except KeyFileError:
445
- err = "KeyFileError: File is not writable"
443
+ except KeyFileError as error:
444
+ err = str(error)
446
445
  print_error(err)
447
446
  output_dict["error"] = err
448
447
  try:
@@ -458,10 +457,9 @@ async def wallet_create(
458
457
  "path": wallet.path,
459
458
  "hotkey": wallet.hotkey_str,
460
459
  "hotkey_ss58": wallet.hotkey.ss58_address,
461
- "coldkey_ss58": wallet.coldkeypub.ss58_address,
462
460
  }
463
- except KeyFileError:
464
- err = "KeyFileError: File is not writable"
461
+ except KeyFileError as error:
462
+ err = str(error)
465
463
  print_error(err)
466
464
  output_dict["error"] = err
467
465
  if json_output:
@@ -1261,8 +1259,8 @@ async def overview(
1261
1259
 
1262
1260
  grid.add_row(table)
1263
1261
 
1264
- caption = "\n[italic][dim][bright_cyan]Wallet balance: [dark_orange]\u03c4" + str(
1265
- total_balance.tao
1262
+ caption = (
1263
+ f"\n[italic][dim][bright_cyan]Wallet free balance: [dark_orange]{total_balance}"
1266
1264
  )
1267
1265
  data_dict["total_balance"] = total_balance.tao
1268
1266
  grid.add_row(Align(caption, vertical="middle", align="center"))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bittensor-cli
3
- Version: 9.4.1
3
+ Version: 9.4.3
4
4
  Summary: Bittensor CLI
5
5
  Author: bittensor.com
6
6
  Project-URL: homepage, https://github.com/opentensor/btcli
@@ -8,7 +8,6 @@ Project-URL: Repository, https://github.com/opentensor/btcli
8
8
  Requires-Python: <3.14,>=3.9
9
9
  Description-Content-Type: text/markdown
10
10
  Requires-Dist: wheel
11
- Requires-Dist: async-property==0.2.2
12
11
  Requires-Dist: async-substrate-interface>=1.1.0
13
12
  Requires-Dist: aiohttp~=3.10.2
14
13
  Requires-Dist: backoff~=2.2.1
@@ -1,5 +1,5 @@
1
1
  bittensor_cli/__init__.py,sha256=Lpv4NkbAQgwrfqFOnTMuR_S-fqGdaWCSLhxnFnGTHM0,1232
2
- bittensor_cli/cli.py,sha256=3tanMizgAIw0b8n-vgqw5GOZwcpEBDHhfarKOzMt4aM,217087
2
+ bittensor_cli/cli.py,sha256=U557QrHJQulSMdmNY_Wu-wc8ah3KtcqD0TxrHHFoN9w,217461
3
3
  bittensor_cli/doc_generation_helper.py,sha256=GexqjEIKulWg84hpNBEchJ840oOgOi7DWpt447nsdNI,91
4
4
  bittensor_cli/version.py,sha256=dU1xsa3mG5FPdhzvqlzDByNcCHmzcFQH3q1pQr4u76g,720
5
5
  bittensor_cli/src/__init__.py,sha256=dRBcdUWIqHTyusuvuhP4PrRc9MWmnmj76WDWLHxhjmA,33795
@@ -11,13 +11,13 @@ bittensor_cli/src/bittensor/networking.py,sha256=pZLMs8YXpZzDMLXWMBb_Bj6TVkm_q9k
11
11
  bittensor_cli/src/bittensor/subtensor_interface.py,sha256=StNlKxk348cq-nEU-5qye0yMTG5snLU_whw1dALRX2I,58976
12
12
  bittensor_cli/src/bittensor/utils.py,sha256=vetZCwy-LSJjYj58f_5wIuTi2A2sHyCMjrHR1DqT6bY,47729
13
13
  bittensor_cli/src/bittensor/extrinsics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- bittensor_cli/src/bittensor/extrinsics/registration.py,sha256=mZt6z8PRK5MaIczLygmVvAUnfl_dl5zDF7ysIFkwHvs,64511
15
- bittensor_cli/src/bittensor/extrinsics/root.py,sha256=rVogWhT28NJ1CrVXtbq_Pyi7etB_zTZicbjiHAHLdSs,19214
14
+ bittensor_cli/src/bittensor/extrinsics/registration.py,sha256=CQ6yQldaLWPdhTS4Ub3muSEhbmzj-PQa5JYR3ywrafs,64485
15
+ bittensor_cli/src/bittensor/extrinsics/root.py,sha256=C9WPssL2HpNK8u_IFPPr8TrdFgbLPTfkbAYzalfmbRM,19188
16
16
  bittensor_cli/src/bittensor/extrinsics/transfer.py,sha256=vxLzKQkTSsV-ark7WAJjEN4QasEJI_9MXt2Dg8eR2j4,8569
17
17
  bittensor_cli/src/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  bittensor_cli/src/commands/sudo.py,sha256=or_wkOMf4RAE64pp2SiX2ybeN0V89hlsEf86cyLPsV4,33062
19
- bittensor_cli/src/commands/view.py,sha256=2MdhWWbY9rwGqDilzs8r2ioa0l2GzrYxe8pKkavEVWs,109517
20
- bittensor_cli/src/commands/wallets.py,sha256=N3ERh4Iw0juJSy9-AUQaTC1SfZsklD-lxCcFfODfcGE,73142
19
+ bittensor_cli/src/commands/view.py,sha256=aogD_jLAmKgZ-pL93eTSVw0kubUJT2L2_43TXzAh8X8,109505
20
+ bittensor_cli/src/commands/wallets.py,sha256=YknqfibuH-5dsSYITlEtgv9zsqlmhsoS2NhenZPcq0E,72977
21
21
  bittensor_cli/src/commands/weights.py,sha256=BCJm_mlw0pVK4YEZuEMqQBpvvOoB7B1rzdvMeN3uTfM,16503
22
22
  bittensor_cli/src/commands/stake/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  bittensor_cli/src/commands/stake/add.py,sha256=Pe4N_I8DKlfN_Ks-X9yu2pMP5jBs__fa2TPLcb6oBKc,26935
@@ -27,9 +27,9 @@ bittensor_cli/src/commands/stake/move.py,sha256=AVeo0l4bvGAtjbdzx2Fn7_-jiI28B7LM
27
27
  bittensor_cli/src/commands/stake/remove.py,sha256=l7TtLK2Z6-TJ5-DEwUzm6HT2GQC-MhKZS9SONS9DKtA,49902
28
28
  bittensor_cli/src/commands/subnets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  bittensor_cli/src/commands/subnets/price.py,sha256=O8oK12hCtm1asQGx2MR1xtYA9ygkklhFtXvBON4DcGM,30069
30
- bittensor_cli/src/commands/subnets/subnets.py,sha256=QJuFm9UGG9EBeK9IjtBFpASV1qV6XEdz1L96Ka8zfB4,93692
31
- bittensor_cli-9.4.1.dist-info/METADATA,sha256=Jvz2rvjzoHPj2ygRVI9GGXmSY8-q4p2PJJusejKw9Z8,6482
32
- bittensor_cli-9.4.1.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
33
- bittensor_cli-9.4.1.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
34
- bittensor_cli-9.4.1.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
35
- bittensor_cli-9.4.1.dist-info/RECORD,,
30
+ bittensor_cli/src/commands/subnets/subnets.py,sha256=z2E4CkrqUNctBzBvjPWV34TWIPriEFDa2oUw9HWKJSc,93747
31
+ bittensor_cli-9.4.3.dist-info/METADATA,sha256=p0OCjKYSgLPmNRf-y1ncn5PBlH05VbukLzNW_Z7by68,6445
32
+ bittensor_cli-9.4.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
+ bittensor_cli-9.4.3.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
34
+ bittensor_cli-9.4.3.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
35
+ bittensor_cli-9.4.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.4.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5