bittensor-cli 9.0.0rc1__py3-none-any.whl → 9.0.0rc3__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.
@@ -810,16 +810,17 @@ async def show(
810
810
  prompt: bool = True,
811
811
  ) -> Optional[str]:
812
812
  async def show_root():
813
- all_subnets = await subtensor.all_subnets()
813
+ block_hash = await subtensor.substrate.get_chain_head()
814
+ all_subnets = await subtensor.all_subnets(block_hash=block_hash)
814
815
  root_info = next((s for s in all_subnets if s.netuid == 0), None)
815
816
  if root_info is None:
816
817
  print_error("The root subnet does not exist")
817
818
  raise typer.Exit()
818
819
 
819
820
  root_state, identities, old_identities = await asyncio.gather(
820
- subtensor.get_subnet_state(netuid=0),
821
- subtensor.query_all_identities(),
822
- subtensor.get_delegate_identities(),
821
+ subtensor.get_subnet_state(netuid=0, block_hash=block_hash),
822
+ subtensor.query_all_identities(block_hash=block_hash),
823
+ subtensor.get_delegate_identities(block_hash=block_hash),
823
824
  )
824
825
 
825
826
  if root_state is None:
@@ -1031,16 +1032,21 @@ async def show(
1031
1032
  if not await subtensor.subnet_exists(netuid=netuid):
1032
1033
  err_console.print(f"[red]Subnet {netuid} does not exist[/red]")
1033
1034
  raise typer.Exit()
1035
+ block_hash = await subtensor.substrate.get_chain_head()
1034
1036
  (
1035
1037
  subnet_info,
1036
1038
  subnet_state,
1037
1039
  identities,
1038
1040
  old_identities,
1041
+ current_burn_cost,
1039
1042
  ) = await asyncio.gather(
1040
- subtensor.subnet(netuid=netuid_),
1041
- subtensor.get_subnet_state(netuid=netuid_),
1042
- subtensor.query_all_identities(),
1043
- subtensor.get_delegate_identities(),
1043
+ subtensor.subnet(netuid=netuid_, block_hash=block_hash),
1044
+ subtensor.get_subnet_state(netuid=netuid_, block_hash=block_hash),
1045
+ subtensor.query_all_identities(block_hash=block_hash),
1046
+ subtensor.get_delegate_identities(block_hash=block_hash),
1047
+ subtensor.get_hyperparameter(
1048
+ param_name="Burn", netuid=netuid_, block_hash=block_hash
1049
+ ),
1044
1050
  )
1045
1051
  if subnet_state is None:
1046
1052
  print_error(f"Subnet {netuid_} does not exist")
@@ -1281,6 +1287,11 @@ async def show(
1281
1287
  if not verbose
1282
1288
  else f"{subnet_info.alpha_in.tao:,.4f}"
1283
1289
  )
1290
+ current_registration_burn = (
1291
+ Balance.from_rao(int(current_burn_cost))
1292
+ if current_burn_cost
1293
+ else Balance(0)
1294
+ )
1284
1295
 
1285
1296
  console.print(
1286
1297
  f"[{COLOR_PALETTE['GENERAL']['SUBHEADING']}]Subnet {netuid_}{subnet_name_display}[/{COLOR_PALETTE['GENERAL']['SUBHEADING']}]"
@@ -1291,6 +1302,7 @@ async def show(
1291
1302
  f"\n Alpha Pool: [{COLOR_PALETTE['POOLS']['ALPHA_IN']}]{alpha_pool} {subnet_info.symbol}[/{COLOR_PALETTE['POOLS']['ALPHA_IN']}]"
1292
1303
  # f"\n Stake: [{COLOR_PALETTE['STAKE']['STAKE_ALPHA']}]{subnet_info.alpha_out.tao:,.5f} {subnet_info.symbol}[/{COLOR_PALETTE['STAKE']['STAKE_ALPHA']}]"
1293
1304
  f"\n Tempo: [{COLOR_PALETTE['STAKE']['STAKE_ALPHA']}]{subnet_info.blocks_since_last_step}/{subnet_info.tempo}[/{COLOR_PALETTE['STAKE']['STAKE_ALPHA']}]"
1305
+ f"\n Registration cost (recycled): [{COLOR_PALETTE['STAKE']['STAKE_ALPHA']}]τ {current_registration_burn.tao:.4f}[/{COLOR_PALETTE['STAKE']['STAKE_ALPHA']}]"
1294
1306
  )
1295
1307
  # console.print(
1296
1308
  # """
@@ -6,7 +6,7 @@ from typing import Generator, Optional
6
6
 
7
7
  import aiohttp
8
8
  from bittensor_wallet import Wallet, Keypair
9
- from bittensor_wallet.errors import KeyFileError
9
+ from bittensor_wallet.errors import KeyFileError, PasswordError
10
10
  from bittensor_wallet.keyfile import Keyfile
11
11
  from fuzzywuzzy import fuzz
12
12
  from rich import box
@@ -286,16 +286,12 @@ async def wallet_balance(
286
286
  wallet_names = [wallet.name]
287
287
 
288
288
  block_hash = await subtensor.substrate.get_chain_head()
289
- free_balances, staked_balances = await asyncio.gather(
290
- subtensor.get_balances(*coldkeys, block_hash=block_hash),
291
- subtensor.get_total_stake_for_coldkey(*coldkeys, block_hash=block_hash),
292
- )
289
+ free_balances = await subtensor.get_balances(*coldkeys, block_hash=block_hash)
293
290
 
294
291
  total_free_balance = sum(free_balances.values())
295
- total_staked_balance = sum(staked_balances.values())
296
292
 
297
293
  balances = {
298
- name: (coldkey, free_balances[coldkey], staked_balances[coldkey])
294
+ name: (coldkey, free_balances[coldkey])
299
295
  for (name, coldkey) in zip(wallet_names, coldkeys)
300
296
  }
301
297
 
@@ -316,18 +312,6 @@ async def wallet_balance(
316
312
  style=COLOR_PALETTE["GENERAL"]["BALANCE"],
317
313
  no_wrap=True,
318
314
  ),
319
- Column(
320
- "[white]Staked Balance",
321
- justify="right",
322
- style=COLOR_PALETTE["STAKE"]["STAKE_AMOUNT"],
323
- no_wrap=True,
324
- ),
325
- Column(
326
- "[white]Total Balance",
327
- justify="right",
328
- style=COLOR_PALETTE["GENERAL"]["BALANCE"],
329
- no_wrap=True,
330
- ),
331
315
  title=f"\n [{COLOR_PALETTE['GENERAL']['HEADER']}]Wallet Coldkey Balance\nNetwork: {subtensor.network}",
332
316
  show_footer=True,
333
317
  show_edge=False,
@@ -338,25 +322,21 @@ async def wallet_balance(
338
322
  leading=True,
339
323
  )
340
324
 
341
- for name, (coldkey, free, staked) in balances.items():
325
+ for name, (coldkey, free) in balances.items():
342
326
  table.add_row(
343
327
  name,
344
328
  coldkey,
345
329
  str(free),
346
- str(staked),
347
- str(free + staked),
348
330
  )
349
331
  table.add_row()
350
332
  table.add_row(
351
333
  "Total Balance",
352
334
  "",
353
335
  str(total_free_balance),
354
- str(total_staked_balance),
355
- str(total_free_balance + total_staked_balance),
356
336
  )
357
337
  console.print(Padding(table, (0, 0, 0, 4)))
358
338
  await subtensor.substrate.close()
359
- return total_free_balance, total_staked_balance
339
+ return total_free_balance
360
340
 
361
341
 
362
342
  async def get_wallet_transfers(wallet_address: str) -> list[dict]:
@@ -1418,19 +1398,31 @@ async def check_coldkey_swap(wallet: Wallet, subtensor: SubtensorInterface):
1418
1398
  async def sign(wallet: Wallet, message: str, use_hotkey: str):
1419
1399
  """Sign a message using the provided wallet or hotkey."""
1420
1400
 
1421
- try:
1422
- wallet.unlock_coldkey()
1423
- except KeyFileError:
1424
- err_console.print(
1425
- ":cross_mark: [red]Keyfile is corrupt, non-writable, non-readable or the password used to decrypt is "
1426
- "invalid[/red]:[bold white]\n [/bold white]"
1427
- )
1401
+ def _unlock(key: str):
1402
+ try:
1403
+ getattr(wallet, f"unlock_{key}")()
1404
+ return True
1405
+ except PasswordError:
1406
+ err_console.print(
1407
+ ":cross_mark: [red]The password used to decrypt your keyfile is invalid[/red]"
1408
+ )
1409
+ return False
1410
+ except KeyFileError:
1411
+ err_console.print(
1412
+ ":cross_mark: [red]Keyfile is corrupt, non-writable, or non-readable[/red]:"
1413
+ )
1414
+ return False
1415
+
1428
1416
  if not use_hotkey:
1417
+ if not _unlock("coldkey"):
1418
+ return False
1429
1419
  keypair = wallet.coldkey
1430
1420
  print_verbose(
1431
1421
  f"Signing using [{COLOR_PALETTE['GENERAL']['COLDKEY']}]coldkey: {wallet.name}"
1432
1422
  )
1433
1423
  else:
1424
+ if not _unlock("hotkey"):
1425
+ return False
1434
1426
  keypair = wallet.hotkey
1435
1427
  print_verbose(
1436
1428
  f"Signing using [{COLOR_PALETTE['GENERAL']['HOTKEY']}]hotkey: {wallet.hotkey_str}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bittensor-cli
3
- Version: 9.0.0rc1
3
+ Version: 9.0.0rc3
4
4
  Summary: Bittensor CLI
5
5
  Home-page: https://github.com/opentensor/btcli
6
6
  Author: bittensor.com
@@ -25,7 +25,7 @@ Requires-Python: >=3.9
25
25
  Description-Content-Type: text/markdown
26
26
  Requires-Dist: wheel
27
27
  Requires-Dist: async-property==0.2.2
28
- Requires-Dist: async-substrate-interface>=1.0.0rc10
28
+ Requires-Dist: async-substrate-interface>=1.0.0rc12
29
29
  Requires-Dist: aiohttp~=3.10.2
30
30
  Requires-Dist: backoff~=2.2.1
31
31
  Requires-Dist: GitPython>=3.0.0
@@ -1,14 +1,14 @@
1
- bittensor_cli/__init__.py,sha256=_wu53H9cImHNd2OosHWZFOfBvwei1MrAXYcHKWt97Oc,1216
2
- bittensor_cli/cli.py,sha256=fPZXlch1DdsLsRgoIFrRUSrC-nTYoTrRFtAtH0cA4GQ,174067
1
+ bittensor_cli/__init__.py,sha256=YX8OskQfG3JniPn1PBQiNGwKoaZdWQq6dZzuKf-AEiU,1216
2
+ bittensor_cli/cli.py,sha256=7iJeZaaWrNDkxDCfxBnQDPnNo00kkvFNvjqfOsyloYU,186413
3
3
  bittensor_cli/doc_generation_helper.py,sha256=GexqjEIKulWg84hpNBEchJ840oOgOi7DWpt447nsdNI,91
4
- bittensor_cli/src/__init__.py,sha256=lrffEuuv097_afKj12obl841l4CWYm1ijnshq2CSj_4,25382
4
+ bittensor_cli/src/__init__.py,sha256=CBUMVER1JwPi2bWXhpPJ4xtZqPZyvekExOS7Fv6HtAE,25531
5
5
  bittensor_cli/src/bittensor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  bittensor_cli/src/bittensor/balances.py,sha256=E-niENvR7lAaoS5ZyCmwl_9M-nspnkcuIxf_dHiJIDg,11078
7
7
  bittensor_cli/src/bittensor/chain_data.py,sha256=6VyuoDLaJz2QC9NJz9x2Ampi2fdqXumg6cCFfN-Vpq4,30642
8
8
  bittensor_cli/src/bittensor/minigraph.py,sha256=BIzmSVLfBYiRAeGD_i1LAC8Cw7zxp38a91SIFEPMqYc,10479
9
9
  bittensor_cli/src/bittensor/networking.py,sha256=pZLMs8YXpZzDMLXWMBb_Bj6TVkm_q9khyY-lnbwVMuE,462
10
- bittensor_cli/src/bittensor/subtensor_interface.py,sha256=koqbGIUhqHBpY4ckDF--kmwXjXb9hRK0ye5uFDUBL-g,53072
11
- bittensor_cli/src/bittensor/utils.py,sha256=oFr_gKcKOSi1nR6hFA2lKpnnLcOZTg5dGbKlyZE3LnU,42353
10
+ bittensor_cli/src/bittensor/subtensor_interface.py,sha256=rwB-P0rw_h-ynO9KUNK4ODooboHpQ54RoNBKSVU9BxA,53074
11
+ bittensor_cli/src/bittensor/utils.py,sha256=q_uSvTDpgQOqWhvwi3gi7xoROSlBJ0K1ErwUenqURag,42962
12
12
  bittensor_cli/src/bittensor/extrinsics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  bittensor_cli/src/bittensor/extrinsics/registration.py,sha256=OYRq6hjKzKpZuMjsVK-3O6xeV3TCOZch3VEt8hGITjo,64169
14
14
  bittensor_cli/src/bittensor/extrinsics/root.py,sha256=PvAPkLqfcCRLAR_d1qu3YfKhywFZuHuUyy5h_XZzfR8,19359
@@ -16,17 +16,19 @@ bittensor_cli/src/bittensor/extrinsics/transfer.py,sha256=mg7hyvQX2IGVh4hkTd1u_o
16
16
  bittensor_cli/src/bittensor/templates/table.j2,sha256=P2EFiksnO1cQsB8zjK6hVJwUryHTsLslzRE0YtobAV8,10601
17
17
  bittensor_cli/src/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  bittensor_cli/src/commands/sudo.py,sha256=PTOTp0_OmWksi29k4d33qmNWZAOKAcjZyU7G3wNIdjs,26343
19
- bittensor_cli/src/commands/wallets.py,sha256=VgTIgA9L-Ugf6n2ut3b9cmAeRKbfNznB0_mYKoeR6IA,49197
19
+ bittensor_cli/src/commands/wallets.py,sha256=qH0TkeSQqvowZ8uGF8qeQOgyBS-KxyegD4VK0S0BG4Q,48802
20
20
  bittensor_cli/src/commands/weights.py,sha256=icJpHGLBxMUYvVUFkmPxMYuKAgBx4ELjY7f1WvX3rqg,16433
21
21
  bittensor_cli/src/commands/stake/__init__.py,sha256=uxomMv_QrYt5Qn3_X5UWFFh45ISjB0JmDmCFxVyX8nQ,6495
22
- bittensor_cli/src/commands/stake/children_hotkeys.py,sha256=HiiX8UaNdJHkDI7dfH7gNMrJuJmEdqZ6MmN3196-3nY,29977
23
- bittensor_cli/src/commands/stake/move.py,sha256=yXpBiOZJy1L3-N8t5ezerGTMeaiQpsdqjxOA7EE1iXs,37467
24
- bittensor_cli/src/commands/stake/stake.py,sha256=_0zUeEXm0iRQtqWAvk6qq9Y44GcItiyb2g9Ee9bdxYY,77686
22
+ bittensor_cli/src/commands/stake/add.py,sha256=57Dhu8B6EGlEBrsqtHJ4k_en5p_oZ1b0L1YbB0dEspw,25226
23
+ bittensor_cli/src/commands/stake/children_hotkeys.py,sha256=k8XxWuoUVTaDi6PtrHwnVqc0gs9sGbrogP5XpCVbK7E,29745
24
+ bittensor_cli/src/commands/stake/list.py,sha256=Z5pB5YlSLfY0QWR4ZWd-IWXbQRWy09FBK6iHsodWntk,29797
25
+ bittensor_cli/src/commands/stake/move.py,sha256=YEXz5BfhAaQUJYyG11qnhXvFsSmz6ZJ6U4CWLHey4AE,37466
26
+ bittensor_cli/src/commands/stake/remove.py,sha256=T8poiXia_9hexiVXdi7YG6SzicoEt2sIybN2SIFDyP4,43393
25
27
  bittensor_cli/src/commands/subnets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
28
  bittensor_cli/src/commands/subnets/price.py,sha256=TWcRXUFeS_Q-pfyv0YIluAL8SE7d2gzTODK-9M2J5pw,29878
27
- bittensor_cli/src/commands/subnets/subnets.py,sha256=I-k_DEC2QMaNX1MR03-Nf6zhtmKkhcGnKoKmrEBSVYg,80062
28
- bittensor_cli-9.0.0rc1.dist-info/METADATA,sha256=rpTXPB_DIPSF6tyijpkBxaOINsJ0DkBh8hyCow254lA,6862
29
- bittensor_cli-9.0.0rc1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
30
- bittensor_cli-9.0.0rc1.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
31
- bittensor_cli-9.0.0rc1.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
32
- bittensor_cli-9.0.0rc1.dist-info/RECORD,,
29
+ bittensor_cli/src/commands/subnets/subnets.py,sha256=a4g5Dcx28Jzrlh2HE2VQ7iEpRSnx9XUFyy1gGGPM0v0,80882
30
+ bittensor_cli-9.0.0rc3.dist-info/METADATA,sha256=1_1g0nfhxebpyTfBUV5Td8HtosC3TkHrlhfK4U7njH4,6862
31
+ bittensor_cli-9.0.0rc3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
32
+ bittensor_cli-9.0.0rc3.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
33
+ bittensor_cli-9.0.0rc3.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
34
+ bittensor_cli-9.0.0rc3.dist-info/RECORD,,