bittensor-cli 9.0.0rc2__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.
@@ -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.0rc2
3
+ Version: 9.0.0rc3
4
4
  Summary: Bittensor CLI
5
5
  Home-page: https://github.com/opentensor/btcli
6
6
  Author: bittensor.com
@@ -1,14 +1,14 @@
1
- bittensor_cli/__init__.py,sha256=ahR14ZNIE6lpjK1vEC4NA8XjHQuOaQYjySuRNJTgpno,1216
2
- bittensor_cli/cli.py,sha256=4o-3gpKQ9dQHLS4O4uX-rFBgIRaKH_51hgJYNqgAo1I,174144
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=ybFc_B-cHvxjtpAbfwHaufuQFCkW9tz4Fab7F8nuvCw,25504
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/add.py,sha256=57Dhu8B6EGlEBrsqtHJ4k_en5p_oZ1b0L1YbB0dEspw,25226
22
23
  bittensor_cli/src/commands/stake/children_hotkeys.py,sha256=k8XxWuoUVTaDi6PtrHwnVqc0gs9sGbrogP5XpCVbK7E,29745
23
- bittensor_cli/src/commands/stake/move.py,sha256=yXpBiOZJy1L3-N8t5ezerGTMeaiQpsdqjxOA7EE1iXs,37467
24
- bittensor_cli/src/commands/stake/stake.py,sha256=_0zUeEXm0iRQtqWAvk6qq9Y44GcItiyb2g9Ee9bdxYY,77686
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
29
  bittensor_cli/src/commands/subnets/subnets.py,sha256=a4g5Dcx28Jzrlh2HE2VQ7iEpRSnx9XUFyy1gGGPM0v0,80882
28
- bittensor_cli-9.0.0rc2.dist-info/METADATA,sha256=XScNNV2UmDogTn35NdwmJNrdSUGpwNFVSBvxwp1TrGw,6862
29
- bittensor_cli-9.0.0rc2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
30
- bittensor_cli-9.0.0rc2.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
31
- bittensor_cli-9.0.0rc2.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
32
- bittensor_cli-9.0.0rc2.dist-info/RECORD,,
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,,