bittensor-cli 9.9.0__py3-none-any.whl → 9.10.0__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.
@@ -37,6 +37,7 @@ from bittensor_cli.src.bittensor.utils import (
37
37
  print_verbose,
38
38
  format_error_message,
39
39
  unlock_key,
40
+ get_hotkey_pub_ss58,
40
41
  )
41
42
 
42
43
  if TYPE_CHECKING:
@@ -310,7 +311,7 @@ async def root_register_extrinsic(
310
311
 
311
312
  print_verbose(f"Checking if hotkey ({wallet.hotkey_str}) is registered on root")
312
313
  is_registered = await is_hotkey_registered(
313
- subtensor, netuid=0, hotkey_ss58=wallet.hotkey.ss58_address
314
+ subtensor, netuid=0, hotkey_ss58=get_hotkey_pub_ss58(wallet)
314
315
  )
315
316
  if is_registered:
316
317
  console.print(
@@ -322,7 +323,7 @@ async def root_register_extrinsic(
322
323
  call = await subtensor.substrate.compose_call(
323
324
  call_module="SubtensorModule",
324
325
  call_function="root_register",
325
- call_params={"hotkey": wallet.hotkey.ss58_address},
326
+ call_params={"hotkey": get_hotkey_pub_ss58(wallet)},
326
327
  )
327
328
  success, err_msg = await subtensor.sign_and_send_extrinsic(
328
329
  call,
@@ -341,7 +342,7 @@ async def root_register_extrinsic(
341
342
  uid = await subtensor.query(
342
343
  module="SubtensorModule",
343
344
  storage_function="Uids",
344
- params=[0, wallet.hotkey.ss58_address],
345
+ params=[0, get_hotkey_pub_ss58(wallet)],
345
346
  )
346
347
  if uid is not None:
347
348
  console.print(
@@ -391,7 +392,7 @@ async def set_root_weights_extrinsic(
391
392
  "weights": weight_vals,
392
393
  "netuid": 0,
393
394
  "version_key": version_key,
394
- "hotkey": wallet.hotkey.ss58_address,
395
+ "hotkey": get_hotkey_pub_ss58(wallet),
395
396
  },
396
397
  )
397
398
  # Period dictates how long the extrinsic will stay as part of waiting pool
@@ -415,7 +416,7 @@ async def set_root_weights_extrinsic(
415
416
  return False, await response.error_message
416
417
 
417
418
  my_uid = await subtensor.query(
418
- "SubtensorModule", "Uids", [0, wallet.hotkey.ss58_address]
419
+ "SubtensorModule", "Uids", [0, get_hotkey_pub_ss58(wallet)]
419
420
  )
420
421
 
421
422
  if my_uid is None:
@@ -172,7 +172,7 @@ async def transfer_extrinsic(
172
172
  if prompt:
173
173
  if not Confirm.ask(
174
174
  "Do you want to transfer:[bold white]\n"
175
- f" amount: [bright_cyan]{amount}[/bright_cyan]\n"
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
178
  f" to: [bright_magenta]{destination}[/bright_magenta]\n for fee: [bright_cyan]{fee}[/bright_cyan]"
@@ -39,6 +39,7 @@ from bittensor_cli.src.bittensor.utils import (
39
39
  validate_chain_endpoint,
40
40
  u16_normalized_float,
41
41
  U16_MAX,
42
+ get_hotkey_pub_ss58,
42
43
  )
43
44
 
44
45
  SubstrateClass = (
@@ -666,7 +667,7 @@ class SubtensorInterface:
666
667
  for sublist in await asyncio.gather(
667
668
  *[
668
669
  self.get_netuids_for_hotkey(
669
- wallet.hotkey.ss58_address,
670
+ get_hotkey_pub_ss58(wallet),
670
671
  reuse_block=reuse_block,
671
672
  block_hash=block_hash,
672
673
  )
@@ -275,7 +275,7 @@ def get_hotkey_wallets_for_wallet(
275
275
  (exists := hotkey_for_name.hotkey_file.exists_on_device())
276
276
  and not hotkey_for_name.hotkey_file.is_encrypted()
277
277
  # and hotkey_for_name.coldkeypub.ss58_address
278
- and hotkey_for_name.hotkey.ss58_address
278
+ and get_hotkey_pub_ss58(hotkey_for_name)
279
279
  ):
280
280
  hotkey_wallets.append(hotkey_for_name)
281
281
  elif (
@@ -1431,3 +1431,15 @@ def blocks_to_duration(blocks: int) -> str:
1431
1431
  results.append(f"{unit_count}{unit}")
1432
1432
  # Return only the first two non-zero units
1433
1433
  return " ".join(results[:2]) or "0s"
1434
+
1435
+
1436
+ def get_hotkey_pub_ss58(wallet: Wallet) -> str:
1437
+ """
1438
+ Helper fn to retrieve the hotkeypub ss58 of a wallet that may have been created before
1439
+ bt-wallet 3.1.1 and thus not have a wallet hotkeypub. In this case, it will return the hotkey
1440
+ SS58.
1441
+ """
1442
+ try:
1443
+ return wallet.hotkeypub.ss58_address
1444
+ except KeyFileError:
1445
+ return wallet.hotkey.ss58_address
@@ -20,6 +20,7 @@ from bittensor_cli.src.bittensor.utils import (
20
20
  print_verbose,
21
21
  unlock_key,
22
22
  json_console,
23
+ get_hotkey_pub_ss58,
23
24
  )
24
25
  from bittensor_wallet import Wallet
25
26
 
@@ -552,7 +553,7 @@ def _get_hotkeys_to_stake_to(
552
553
  # Stake to all hotkeys except excluded ones
553
554
  all_hotkeys_: list[Wallet] = get_hotkey_wallets_for_wallet(wallet=wallet)
554
555
  return [
555
- (wallet.hotkey_str, wallet.hotkey.ss58_address)
556
+ (wallet.hotkey_str, get_hotkey_pub_ss58(wallet))
556
557
  for wallet in all_hotkeys_
557
558
  if wallet.hotkey_str not in (exclude_hotkeys or [])
558
559
  ]
@@ -572,7 +573,7 @@ def _get_hotkeys_to_stake_to(
572
573
  name=wallet.name,
573
574
  hotkey=hotkey_ss58_or_hotkey_name,
574
575
  )
575
- hotkeys.append((wallet_.hotkey_str, wallet_.hotkey.ss58_address))
576
+ hotkeys.append((wallet_.hotkey_str, get_hotkey_pub_ss58(wallet_)))
576
577
 
577
578
  return hotkeys
578
579
 
@@ -581,7 +582,7 @@ def _get_hotkeys_to_stake_to(
581
582
  f"Staking to hotkey: ({wallet.hotkey_str}) in wallet: ({wallet.name})"
582
583
  )
583
584
  assert wallet.hotkey is not None
584
- return [(None, wallet.hotkey.ss58_address)]
585
+ return [(None, get_hotkey_pub_ss58(wallet))]
585
586
 
586
587
 
587
588
  def _define_stake_table(
@@ -21,6 +21,7 @@ from bittensor_cli.src.bittensor.utils import (
21
21
  format_error_message,
22
22
  unlock_key,
23
23
  json_console,
24
+ get_hotkey_pub_ss58,
24
25
  )
25
26
 
26
27
 
@@ -464,7 +465,7 @@ async def get_children(
464
465
  netuid_children_tuples = []
465
466
  for netuid_ in netuids:
466
467
  success, children, err_mg = await subtensor.get_children(
467
- wallet.hotkey.ss58_address, netuid_
468
+ get_hotkey_pub_ss58(wallet), netuid_
468
469
  )
469
470
  if children:
470
471
  netuid_children_tuples.append((netuid_, children))
@@ -472,16 +473,16 @@ async def get_children(
472
473
  err_console.print(
473
474
  f"Failed to get children from subtensor {netuid_}: {err_mg}"
474
475
  )
475
- await _render_table(wallet.hotkey.ss58_address, netuid_children_tuples)
476
+ await _render_table(get_hotkey_pub_ss58(wallet), netuid_children_tuples)
476
477
  else:
477
478
  success, children, err_mg = await subtensor.get_children(
478
- wallet.hotkey.ss58_address, netuid
479
+ get_hotkey_pub_ss58(wallet), netuid
479
480
  )
480
481
  if not success:
481
482
  err_console.print(f"Failed to get children from subtensor: {err_mg}")
482
483
  if children:
483
484
  netuid_children_tuples = [(netuid, children)]
484
- await _render_table(wallet.hotkey.ss58_address, netuid_children_tuples)
485
+ await _render_table(get_hotkey_pub_ss58(wallet), netuid_children_tuples)
485
486
 
486
487
  return children
487
488
 
@@ -500,12 +501,12 @@ async def set_children(
500
501
  """Set children hotkeys."""
501
502
  # Validate children SS58 addresses
502
503
  # TODO check to see if this should be allowed to be specified by user instead of pulling from wallet
503
- hotkey = wallet.hotkey.ss58_address
504
+ hotkey = get_hotkey_pub_ss58(wallet)
504
505
  for child in children:
505
506
  if not is_valid_ss58_address(child):
506
507
  err_console.print(f":cross_mark:[red] Invalid SS58 address: {child}[/red]")
507
508
  return
508
- if child == wallet.hotkey.ss58_address:
509
+ if child == hotkey:
509
510
  err_console.print(":cross_mark:[red] Cannot set yourself as a child.[/red]")
510
511
  return
511
512
 
@@ -608,7 +609,7 @@ async def revoke_children(
608
609
  subtensor=subtensor,
609
610
  wallet=wallet,
610
611
  netuid=netuid,
611
- hotkey=wallet.hotkey.ss58_address,
612
+ hotkey=get_hotkey_pub_ss58(wallet),
612
613
  children_with_proportions=[],
613
614
  prompt=prompt,
614
615
  wait_for_inclusion=wait_for_inclusion,
@@ -647,7 +648,7 @@ async def revoke_children(
647
648
  subtensor=subtensor,
648
649
  wallet=wallet,
649
650
  netuid=netuid,
650
- hotkey=wallet.hotkey.ss58_address,
651
+ hotkey=get_hotkey_pub_ss58(wallet),
651
652
  children_with_proportions=[],
652
653
  prompt=prompt,
653
654
  wait_for_inclusion=True,
@@ -746,7 +747,7 @@ async def childkey_take(
746
747
  subtensor=subtensor,
747
748
  wallet=wallet,
748
749
  netuid=subnet,
749
- hotkey=wallet.hotkey.ss58_address,
750
+ hotkey=get_hotkey_pub_ss58(wallet),
750
751
  take=chk_take,
751
752
  prompt=prompt,
752
753
  wait_for_inclusion=wait_for_inclusion,
@@ -756,7 +757,7 @@ async def childkey_take(
756
757
  if success:
757
758
  console.print(":white_heavy_check_mark: [green]Set childkey take.[/green]")
758
759
  console.print(
759
- f"The childkey take for {wallet.hotkey.ss58_address} is now set to {take * 100:.2f}%."
760
+ f"The childkey take for {get_hotkey_pub_ss58(wallet)} is now set to {take * 100:.2f}%."
760
761
  )
761
762
  return True
762
763
  else:
@@ -766,9 +767,10 @@ async def childkey_take(
766
767
  return False
767
768
 
768
769
  # Print childkey take for other user and return (dont offer to change take rate)
769
- if not hotkey or hotkey == wallet.hotkey.ss58_address:
770
- hotkey = wallet.hotkey.ss58_address
771
- if hotkey != wallet.hotkey.ss58_address or not take:
770
+ wallet_hk = get_hotkey_pub_ss58(wallet)
771
+ if not hotkey or hotkey == wallet_hk:
772
+ hotkey = wallet_hk
773
+ if hotkey != wallet_hk or not take:
772
774
  # display childkey take for other users
773
775
  if netuid:
774
776
  await display_chk_take(hotkey, netuid)
@@ -826,7 +828,7 @@ async def childkey_take(
826
828
  subtensor=subtensor,
827
829
  wallet=wallet,
828
830
  netuid=netuid_,
829
- hotkey=wallet.hotkey.ss58_address,
831
+ hotkey=wallet_hk,
830
832
  take=take,
831
833
  prompt=prompt,
832
834
  wait_for_inclusion=True,
@@ -16,6 +16,7 @@ from bittensor_cli.src.bittensor.utils import (
16
16
  group_subnets,
17
17
  get_subnet_name,
18
18
  unlock_key,
19
+ get_hotkey_pub_ss58,
19
20
  )
20
21
 
21
22
  if TYPE_CHECKING:
@@ -343,8 +344,9 @@ async def stake_swap_selection(
343
344
 
344
345
  # Filter stakes for this hotkey
345
346
  hotkey_stakes = {}
347
+ hotkey_ss58 = get_hotkey_pub_ss58(wallet)
346
348
  for stake in stakes:
347
- if stake.hotkey_ss58 == wallet.hotkey.ss58_address and stake.stake.tao > 0:
349
+ if stake.hotkey_ss58 == hotkey_ss58 and stake.stake.tao > 0:
348
350
  hotkey_stakes[stake.netuid] = {
349
351
  "stake": stake.stake,
350
352
  "is_registered": stake.is_registered,
@@ -357,12 +359,12 @@ async def stake_swap_selection(
357
359
  # Display available stakes
358
360
  table = Table(
359
361
  title=f"\n[{COLOR_PALETTE.G.HEADER}]Available Stakes for Hotkey\n[/{COLOR_PALETTE.G.HEADER}]"
360
- f"[{COLOR_PALETTE.G.HK}]{wallet.hotkey_str}: {wallet.hotkey.ss58_address}[/{COLOR_PALETTE.G.HK}]\n",
362
+ f"[{COLOR_PALETTE.G.HK}]{wallet.hotkey_str}: {hotkey_ss58}[/{COLOR_PALETTE.G.HK}]\n",
361
363
  show_edge=False,
362
364
  header_style="bold white",
363
365
  border_style="bright_black",
364
366
  title_justify="center",
365
- width=len(wallet.hotkey.ss58_address) + 20,
367
+ width=len(hotkey_ss58) + 20,
366
368
  )
367
369
 
368
370
  table.add_column("Index", justify="right", style="cyan")
@@ -817,7 +819,7 @@ async def swap_stake(
817
819
  Returns:
818
820
  bool: True if the swap was successful, False otherwise.
819
821
  """
820
- hotkey_ss58 = wallet.hotkey.ss58_address
822
+ hotkey_ss58 = get_hotkey_pub_ss58(wallet)
821
823
  if interactive_selection:
822
824
  try:
823
825
  selection = await stake_swap_selection(subtensor, wallet)
@@ -22,6 +22,7 @@ from bittensor_cli.src.bittensor.utils import (
22
22
  group_subnets,
23
23
  unlock_key,
24
24
  json_console,
25
+ get_hotkey_pub_ss58,
25
26
  )
26
27
 
27
28
  if TYPE_CHECKING:
@@ -407,7 +408,7 @@ async def unstake_all(
407
408
  old_identities=old_identities,
408
409
  )
409
410
  elif not hotkey_ss58_address:
410
- hotkeys = [(wallet.hotkey_str, wallet.hotkey.ss58_address, None)]
411
+ hotkeys = [(wallet.hotkey_str, get_hotkey_pub_ss58(wallet), None)]
411
412
  else:
412
413
  hotkeys = [(None, hotkey_ss58_address, None)]
413
414
 
@@ -1198,7 +1199,7 @@ def _get_hotkeys_to_unstake(
1198
1199
  print_verbose("Unstaking from all hotkeys")
1199
1200
  all_hotkeys_ = get_hotkey_wallets_for_wallet(wallet=wallet)
1200
1201
  wallet_hotkeys = [
1201
- (wallet.hotkey_str, wallet.hotkey.ss58_address, None)
1202
+ (wallet.hotkey_str, get_hotkey_pub_ss58(wallet), None)
1202
1203
  for wallet in all_hotkeys_
1203
1204
  if wallet.hotkey_str not in exclude_hotkeys
1204
1205
  ]
@@ -1230,7 +1231,7 @@ def _get_hotkeys_to_unstake(
1230
1231
  path=wallet.path,
1231
1232
  hotkey=hotkey_identifier,
1232
1233
  )
1233
- result.append((wallet_.hotkey_str, wallet_.hotkey.ss58_address, None))
1234
+ result.append((wallet_.hotkey_str, get_hotkey_pub_ss58(wallet_), None))
1234
1235
  return result
1235
1236
 
1236
1237
  # Only cli.config.wallet.hotkey is specified
@@ -1238,7 +1239,7 @@ def _get_hotkeys_to_unstake(
1238
1239
  f"Unstaking from wallet: ({wallet.name}) from hotkey: ({wallet.hotkey_str})"
1239
1240
  )
1240
1241
  assert wallet.hotkey is not None
1241
- return [(wallet.hotkey_str, wallet.hotkey.ss58_address, None)]
1242
+ return [(wallet.hotkey_str, get_hotkey_pub_ss58(wallet), None)]
1242
1243
 
1243
1244
 
1244
1245
  def _create_unstake_table(
@@ -10,6 +10,7 @@ import plotille
10
10
  import plotly.graph_objects as go
11
11
 
12
12
  from bittensor_cli.src import COLOR_PALETTE
13
+ from bittensor_cli.src.bittensor.chain_data import DynamicInfo
13
14
  from bittensor_cli.src.bittensor.utils import (
14
15
  console,
15
16
  err_console,
@@ -27,7 +28,8 @@ async def price(
27
28
  subtensor: "SubtensorInterface",
28
29
  netuids: list[int],
29
30
  all_netuids: bool = False,
30
- interval_hours: int = 24,
31
+ interval_hours: int = 4,
32
+ current_only: bool = False,
31
33
  html_output: bool = False,
32
34
  log_scale: bool = False,
33
35
  json_output: bool = False,
@@ -41,45 +43,96 @@ async def price(
41
43
  blocks_per_hour = int(3600 / 12) # ~300 blocks per hour
42
44
  total_blocks = blocks_per_hour * interval_hours
43
45
 
44
- with console.status(":chart_increasing: Fetching historical price data..."):
45
- current_block_hash = await subtensor.substrate.get_chain_head()
46
- current_block = await subtensor.substrate.get_block_number(current_block_hash)
46
+ if not current_only:
47
+ with console.status(":chart_increasing: Fetching historical price data..."):
48
+ current_block_hash = await subtensor.substrate.get_chain_head()
49
+ current_block = await subtensor.substrate.get_block_number(
50
+ current_block_hash
51
+ )
47
52
 
48
- step = 300
49
- start_block = max(0, current_block - total_blocks)
50
- block_numbers = list(range(start_block, current_block + 1, step))
53
+ step = 300
54
+ start_block = max(0, current_block - total_blocks)
55
+ block_numbers = list(range(start_block, current_block + 1, step))
51
56
 
52
- # Block hashes
53
- block_hash_cors = [
54
- subtensor.substrate.get_block_hash(bn) for bn in block_numbers
55
- ]
56
- block_hashes = await asyncio.gather(*block_hash_cors)
57
+ # Block hashes
58
+ block_hash_cors = [
59
+ subtensor.substrate.get_block_hash(bn) for bn in block_numbers
60
+ ]
61
+ block_hashes = await asyncio.gather(*block_hash_cors)
57
62
 
58
- # We fetch all subnets when there is more than one netuid
59
- if all_netuids or len(netuids) > 1:
60
- subnet_info_cors = [subtensor.all_subnets(bh) for bh in block_hashes]
61
- else:
62
- # If there is only one netuid, we fetch the subnet info for that netuid
63
- netuid = netuids[0]
64
- subnet_info_cors = [subtensor.subnet(netuid, bh) for bh in block_hashes]
65
- all_subnet_infos = await asyncio.gather(*subnet_info_cors)
63
+ # We fetch all subnets when there is more than one netuid
64
+ if all_netuids or len(netuids) > 1:
65
+ subnet_info_cors = [subtensor.all_subnets(bh) for bh in block_hashes]
66
+ else:
67
+ # If there is only one netuid, we fetch the subnet info for that netuid
68
+ netuid = netuids[0]
69
+ subnet_info_cors = [subtensor.subnet(netuid, bh) for bh in block_hashes]
70
+ all_subnet_infos = await asyncio.gather(*subnet_info_cors)
66
71
 
67
72
  subnet_data = _process_subnet_data(
68
73
  block_numbers, all_subnet_infos, netuids, all_netuids
69
74
  )
75
+ if not subnet_data:
76
+ err_console.print("[red]No valid price data found for any subnet[/red]")
77
+ return
70
78
 
71
- if not subnet_data:
72
- err_console.print("[red]No valid price data found for any subnet[/red]")
73
- return
74
-
75
- if html_output:
76
- await _generate_html_output(
77
- subnet_data, block_numbers, interval_hours, log_scale
79
+ if html_output:
80
+ await _generate_html_output(
81
+ subnet_data, block_numbers, interval_hours, log_scale
82
+ )
83
+ elif json_output:
84
+ json_console.print(json.dumps(_generate_json_output(subnet_data)))
85
+ else:
86
+ _generate_cli_output(subnet_data, block_numbers, interval_hours, log_scale)
87
+ else:
88
+ with console.status("Fetching current price data..."):
89
+ if all_netuids or len(netuids) > 1:
90
+ all_subnet_info = await subtensor.all_subnets()
91
+ else:
92
+ all_subnet_info = [await subtensor.subnet(netuid=netuids[0])]
93
+ subnet_data = _process_current_subnet_data(
94
+ all_subnet_info, netuids, all_netuids
78
95
  )
79
- elif json_output:
80
- json_console.print(json.dumps(_generate_json_output(subnet_data)))
96
+ if json_output:
97
+ json_console.print(json.dumps(_generate_json_output(subnet_data)))
98
+ else:
99
+ _generate_cli_output_current(subnet_data)
100
+
101
+
102
+ def _process_current_subnet_data(subnet_infos: list[DynamicInfo], netuids, all_netuids):
103
+ subnet_data = {}
104
+ if all_netuids or len(netuids) > 1:
105
+ # Most recent data for statistics
106
+ for subnet_info in subnet_infos:
107
+ stats = {
108
+ "current_price": subnet_info.price,
109
+ "supply": subnet_info.alpha_in.tao + subnet_info.alpha_out.tao,
110
+ "market_cap": subnet_info.price.tao
111
+ * (subnet_info.alpha_in.tao + subnet_info.alpha_out.tao),
112
+ "emission": subnet_info.emission.tao,
113
+ "stake": subnet_info.alpha_out.tao,
114
+ "symbol": subnet_info.symbol,
115
+ "name": get_subnet_name(subnet_info),
116
+ }
117
+ subnet_data[subnet_info.netuid] = {
118
+ "stats": stats,
119
+ }
81
120
  else:
82
- _generate_cli_output(subnet_data, block_numbers, interval_hours, log_scale)
121
+ subnet_info = subnet_infos[0]
122
+ stats = {
123
+ "current_price": subnet_info.price.tao,
124
+ "supply": subnet_info.alpha_in.tao + subnet_info.alpha_out.tao,
125
+ "market_cap": subnet_info.price.tao
126
+ * (subnet_info.alpha_in.tao + subnet_info.alpha_out.tao),
127
+ "emission": subnet_info.emission.tao,
128
+ "stake": subnet_info.alpha_out.tao,
129
+ "symbol": subnet_info.symbol,
130
+ "name": get_subnet_name(subnet_info),
131
+ }
132
+ subnet_data[subnet_info.netuid] = {
133
+ "stats": stats,
134
+ }
135
+ return subnet_data
83
136
 
84
137
 
85
138
  def _process_subnet_data(block_numbers, all_subnet_infos, netuids, all_netuids):
@@ -626,3 +679,46 @@ def _generate_cli_output(subnet_data, block_numbers, interval_hours, log_scale):
626
679
  )
627
680
 
628
681
  console.print(stats_text)
682
+
683
+
684
+ def _generate_cli_output_current(subnet_data):
685
+ for netuid, data in subnet_data.items():
686
+ stats = data["stats"]
687
+
688
+ if netuid != 0:
689
+ console.print(
690
+ f"\n[{COLOR_PALETTE.G.SYM}]Subnet {netuid} - {stats['symbol']} "
691
+ f"[cyan]{stats['name']}[/cyan][/{COLOR_PALETTE.G.SYM}]\n"
692
+ f"Current: [blue]{stats['current_price']:.6f}{stats['symbol']}[/blue]\n"
693
+ )
694
+ else:
695
+ console.print(
696
+ f"\n[{COLOR_PALETTE.G.SYM}]Subnet {netuid} - {stats['symbol']} "
697
+ f"[cyan]{stats['name']}[/cyan][/{COLOR_PALETTE.G.SYM}]\n"
698
+ f"Current: [blue]{stats['symbol']} {stats['current_price']:.6f}[/blue]\n"
699
+ )
700
+
701
+ if netuid != 0:
702
+ stats_text = (
703
+ "\nLatest stats:\n"
704
+ f"Supply: [{COLOR_PALETTE.P.ALPHA_IN}]"
705
+ f"{stats['supply']:,.2f} {stats['symbol']}[/{COLOR_PALETTE.P.ALPHA_IN}]\n"
706
+ f"Market Cap: [steel_blue3]{stats['market_cap']:,.2f} {stats['symbol']} / 21M[/steel_blue3]\n"
707
+ f"Emission: [{COLOR_PALETTE.P.EMISSION}]"
708
+ f"{stats['emission']:,.2f} {stats['symbol']}[/{COLOR_PALETTE.P.EMISSION}]\n"
709
+ f"Stake: [{COLOR_PALETTE.S.TAO}]"
710
+ f"{stats['stake']:,.2f} {stats['symbol']}[/{COLOR_PALETTE.S.TAO}]"
711
+ )
712
+ else:
713
+ stats_text = (
714
+ "\nLatest stats:\n"
715
+ f"Supply: [{COLOR_PALETTE.P.ALPHA_IN}]"
716
+ f"{stats['symbol']} {stats['supply']:,.2f}[/{COLOR_PALETTE.P.ALPHA_IN}]\n"
717
+ f"Market Cap: [steel_blue3]{stats['symbol']} {stats['market_cap']:,.2f} / 21M[/steel_blue3]\n"
718
+ f"Emission: [{COLOR_PALETTE.P.EMISSION}]"
719
+ f"{stats['symbol']} {stats['emission']:,.2f}[/{COLOR_PALETTE.P.EMISSION}]\n"
720
+ f"Stake: [{COLOR_PALETTE.S.TAO}]"
721
+ f"{stats['symbol']} {stats['stake']:,.2f}[/{COLOR_PALETTE.S.TAO}]"
722
+ )
723
+
724
+ console.print(stats_text)
@@ -36,6 +36,7 @@ from bittensor_cli.src.bittensor.utils import (
36
36
  unlock_key,
37
37
  blocks_to_duration,
38
38
  json_console,
39
+ get_hotkey_pub_ss58,
39
40
  )
40
41
 
41
42
  if TYPE_CHECKING:
@@ -114,7 +115,7 @@ async def register_subnetwork_extrinsic(
114
115
  return False, None
115
116
 
116
117
  call_params = {
117
- "hotkey": wallet.hotkey.ss58_address,
118
+ "hotkey": get_hotkey_pub_ss58(wallet),
118
119
  "mechid": 1,
119
120
  }
120
121
  call_function = "register_network"
@@ -1654,7 +1655,7 @@ async def register(
1654
1655
  str(netuid),
1655
1656
  f"{Balance.get_unit(netuid)}",
1656
1657
  f"τ {current_recycle.tao:.4f}",
1657
- f"{wallet.hotkey.ss58_address}",
1658
+ f"{get_hotkey_pub_ss58(wallet)}",
1658
1659
  f"{wallet.coldkeypub.ss58_address}",
1659
1660
  )
1660
1661
  console.print(table)
@@ -26,6 +26,7 @@ from bittensor_cli.src.bittensor.utils import (
26
26
  json_console,
27
27
  string_to_u16,
28
28
  string_to_u64,
29
+ get_hotkey_pub_ss58,
29
30
  )
30
31
 
31
32
  if TYPE_CHECKING:
@@ -497,7 +498,7 @@ async def vote_senate_extrinsic(
497
498
  call_module="SubtensorModule",
498
499
  call_function="vote",
499
500
  call_params={
500
- "hotkey": wallet.hotkey.ss58_address,
501
+ "hotkey": get_hotkey_pub_ss58(wallet),
501
502
  "proposal": proposal_hash,
502
503
  "index": proposal_idx,
503
504
  "approve": vote,
@@ -513,9 +514,10 @@ async def vote_senate_extrinsic(
513
514
  # Successful vote, final check for data
514
515
  else:
515
516
  if vote_data := await subtensor.get_vote_data(proposal_hash):
517
+ hotkey_ss58 = get_hotkey_pub_ss58(wallet)
516
518
  if (
517
- vote_data.ayes.count(wallet.hotkey.ss58_address) > 0
518
- or vote_data.nays.count(wallet.hotkey.ss58_address) > 0
519
+ vote_data.ayes.count(hotkey_ss58) > 0
520
+ or vote_data.nays.count(hotkey_ss58) > 0
519
521
  ):
520
522
  console.print(":white_heavy_check_mark: [green]Vote cast.[/green]")
521
523
  return True
@@ -859,10 +861,9 @@ async def senate_vote(
859
861
  return False
860
862
 
861
863
  print_verbose(f"Fetching senate status of {wallet.hotkey_str}")
862
- if not await _is_senate_member(subtensor, hotkey_ss58=wallet.hotkey.ss58_address):
863
- err_console.print(
864
- f"Aborting: Hotkey {wallet.hotkey.ss58_address} isn't a senate member."
865
- )
864
+ hotkey_ss58 = get_hotkey_pub_ss58(wallet)
865
+ if not await _is_senate_member(subtensor, hotkey_ss58=hotkey_ss58):
866
+ err_console.print(f"Aborting: Hotkey {hotkey_ss58} isn't a senate member.")
866
867
  return False
867
868
 
868
869
  # Unlock the wallet.
@@ -890,7 +891,7 @@ async def senate_vote(
890
891
 
891
892
 
892
893
  async def get_current_take(subtensor: "SubtensorInterface", wallet: Wallet):
893
- current_take = await subtensor.current_take(wallet.hotkey.ss58_address)
894
+ current_take = await subtensor.current_take(get_hotkey_pub_ss58(wallet))
894
895
  return current_take
895
896
 
896
897
 
@@ -912,12 +913,13 @@ async def set_take(
912
913
  return False
913
914
 
914
915
  block_hash = await subtensor.substrate.get_chain_head()
916
+ hotkey_ss58 = get_hotkey_pub_ss58(wallet)
915
917
  netuids_registered = await subtensor.get_netuids_for_hotkey(
916
- wallet.hotkey.ss58_address, block_hash=block_hash
918
+ hotkey_ss58, block_hash=block_hash
917
919
  )
918
920
  if not len(netuids_registered) > 0:
919
921
  err_console.print(
920
- f"Hotkey [{COLOR_PALETTE.G.HK}]{wallet.hotkey.ss58_address}[/{COLOR_PALETTE.G.HK}] is not registered to"
922
+ f"Hotkey [{COLOR_PALETTE.G.HK}]{hotkey_ss58}[/{COLOR_PALETTE.G.HK}] is not registered to"
921
923
  f" any subnet. Please register using [{COLOR_PALETTE.G.SUBHEAD}]`btcli subnets register`"
922
924
  f"[{COLOR_PALETTE.G.SUBHEAD}] and try again."
923
925
  )
@@ -926,7 +928,7 @@ async def set_take(
926
928
  result: bool = await set_take_extrinsic(
927
929
  subtensor=subtensor,
928
930
  wallet=wallet,
929
- delegate_ss58=wallet.hotkey.ss58_address,
931
+ delegate_ss58=hotkey_ss58,
930
932
  take=take,
931
933
  )
932
934