bittensor-cli 9.9.0__py3-none-any.whl → 9.10.1__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.
@@ -39,6 +39,7 @@ from bittensor_cli.src.bittensor.utils import (
39
39
  print_error,
40
40
  unlock_key,
41
41
  hex_to_bytes,
42
+ get_hotkey_pub_ss58,
42
43
  )
43
44
 
44
45
  if typing.TYPE_CHECKING:
@@ -490,7 +491,7 @@ async def register_extrinsic(
490
491
 
491
492
  async def get_neuron_for_pubkey_and_subnet():
492
493
  uid = await subtensor.query(
493
- "SubtensorModule", "Uids", [netuid, wallet.hotkey.ss58_address]
494
+ "SubtensorModule", "Uids", [netuid, get_hotkey_pub_ss58(wallet)]
494
495
  )
495
496
  if uid is None:
496
497
  return NeuronInfo.get_null_neuron()
@@ -525,7 +526,7 @@ async def register_extrinsic(
525
526
  if not Confirm.ask(
526
527
  f"Continue Registration?\n"
527
528
  f" hotkey [{COLOR_PALETTE.G.HK}]({wallet.hotkey_str})[/{COLOR_PALETTE.G.HK}]:"
528
- f"\t[{COLOR_PALETTE.G.HK}]{wallet.hotkey.ss58_address}[/{COLOR_PALETTE.G.HK}]\n"
529
+ f"\t[{COLOR_PALETTE.G.HK}]{get_hotkey_pub_ss58(wallet)}[/{COLOR_PALETTE.G.HK}]\n"
529
530
  f" coldkey [{COLOR_PALETTE.G.CK}]({wallet.name})[/{COLOR_PALETTE.G.CK}]:"
530
531
  f"\t[{COLOR_PALETTE.G.CK}]{wallet.coldkeypub.ss58_address}[/{COLOR_PALETTE.G.CK}]\n"
531
532
  f" network:\t\t[{COLOR_PALETTE.G.LINKS}]{subtensor.network}[/{COLOR_PALETTE.G.LINKS}]\n"
@@ -577,7 +578,7 @@ async def register_extrinsic(
577
578
  if not pow_result:
578
579
  # might be registered already on this subnet
579
580
  is_registered = await is_hotkey_registered(
580
- subtensor, netuid=netuid, hotkey_ss58=wallet.hotkey.ss58_address
581
+ subtensor, netuid=netuid, hotkey_ss58=get_hotkey_pub_ss58(wallet)
581
582
  )
582
583
  if is_registered:
583
584
  err_console.print(
@@ -598,7 +599,7 @@ async def register_extrinsic(
598
599
  "block_number": pow_result.block_number,
599
600
  "nonce": pow_result.nonce,
600
601
  "work": [int(byte_) for byte_ in pow_result.seal],
601
- "hotkey": wallet.hotkey.ss58_address,
602
+ "hotkey": get_hotkey_pub_ss58(wallet),
602
603
  "coldkey": wallet.coldkeypub.ss58_address,
603
604
  },
604
605
  )
@@ -639,7 +640,7 @@ async def register_extrinsic(
639
640
  is_registered = await is_hotkey_registered(
640
641
  subtensor,
641
642
  netuid=netuid,
642
- hotkey_ss58=wallet.hotkey.ss58_address,
643
+ hotkey_ss58=get_hotkey_pub_ss58(wallet),
643
644
  )
644
645
  if is_registered:
645
646
  console.print(
@@ -704,7 +705,7 @@ async def burned_register_extrinsic(
704
705
  spinner="aesthetic",
705
706
  ) as status:
706
707
  my_uid = await subtensor.query(
707
- "SubtensorModule", "Uids", [netuid, wallet.hotkey.ss58_address]
708
+ "SubtensorModule", "Uids", [netuid, get_hotkey_pub_ss58(wallet)]
708
709
  )
709
710
  block_hash = await subtensor.substrate.get_chain_head()
710
711
 
@@ -751,7 +752,7 @@ async def burned_register_extrinsic(
751
752
  call_function="burned_register",
752
753
  call_params={
753
754
  "netuid": netuid,
754
- "hotkey": wallet.hotkey.ss58_address,
755
+ "hotkey": get_hotkey_pub_ss58(wallet),
755
756
  },
756
757
  )
757
758
  success, err_msg = await subtensor.sign_and_send_extrinsic(
@@ -773,10 +774,10 @@ async def burned_register_extrinsic(
773
774
  reuse_block=False,
774
775
  ),
775
776
  subtensor.get_netuids_for_hotkey(
776
- wallet.hotkey.ss58_address, block_hash=block_hash
777
+ get_hotkey_pub_ss58(wallet), block_hash=block_hash
777
778
  ),
778
779
  subtensor.query(
779
- "SubtensorModule", "Uids", [netuid, wallet.hotkey.ss58_address]
780
+ "SubtensorModule", "Uids", [netuid, get_hotkey_pub_ss58(wallet)]
780
781
  ),
781
782
  )
782
783
 
@@ -1146,7 +1147,7 @@ async def _block_solver(
1146
1147
 
1147
1148
  timeout = 0.15 if cuda else 0.15
1148
1149
  while netuid == -1 or not await is_hotkey_registered(
1149
- subtensor, netuid, wallet.hotkey.ss58_address
1150
+ subtensor, netuid, get_hotkey_pub_ss58(wallet)
1150
1151
  ):
1151
1152
  # Wait until a solver finds a solution
1152
1153
  try:
@@ -1755,37 +1756,39 @@ async def swap_hotkey_extrinsic(
1755
1756
  :return: Success
1756
1757
  """
1757
1758
  block_hash = await subtensor.substrate.get_chain_head()
1759
+ hk_ss58 = get_hotkey_pub_ss58(wallet)
1758
1760
  netuids_registered = await subtensor.get_netuids_for_hotkey(
1759
- wallet.hotkey.ss58_address, block_hash=block_hash
1761
+ hk_ss58, block_hash=block_hash
1760
1762
  )
1761
1763
  netuids_registered_new_hotkey = await subtensor.get_netuids_for_hotkey(
1762
- new_wallet.hotkey.ss58_address, block_hash=block_hash
1764
+ hk_ss58, block_hash=block_hash
1763
1765
  )
1764
1766
 
1765
1767
  if netuid is not None and netuid not in netuids_registered:
1766
1768
  err_console.print(
1767
- f":cross_mark: [red]Failed[/red]: Original hotkey {wallet.hotkey.ss58_address} is not registered on subnet {netuid}"
1769
+ f":cross_mark: [red]Failed[/red]: Original hotkey {hk_ss58} is not registered on subnet {netuid}"
1768
1770
  )
1769
1771
  return False
1770
1772
 
1771
1773
  elif not len(netuids_registered) > 0:
1772
1774
  err_console.print(
1773
- f"Original hotkey [dark_orange]{wallet.hotkey.ss58_address}[/dark_orange] is not registered on any subnet. "
1775
+ f"Original hotkey [dark_orange]{hk_ss58}[/dark_orange] is not registered on any subnet. "
1774
1776
  f"Please register and try again"
1775
1777
  )
1776
1778
  return False
1777
1779
 
1780
+ new_hk_ss58 = get_hotkey_pub_ss58(new_wallet)
1778
1781
  if netuid is not None:
1779
1782
  if netuid in netuids_registered_new_hotkey:
1780
1783
  err_console.print(
1781
- f":cross_mark: [red]Failed[/red]: New hotkey {new_wallet.hotkey.ss58_address} "
1784
+ f":cross_mark: [red]Failed[/red]: New hotkey {new_hk_ss58} "
1782
1785
  f"is already registered on subnet {netuid}"
1783
1786
  )
1784
1787
  return False
1785
1788
  else:
1786
1789
  if len(netuids_registered_new_hotkey) > 0:
1787
1790
  err_console.print(
1788
- f":cross_mark: [red]Failed[/red]: New hotkey {new_wallet.hotkey.ss58_address} "
1791
+ f":cross_mark: [red]Failed[/red]: New hotkey {new_hk_ss58} "
1789
1792
  f"is already registered on subnet(s) {netuids_registered_new_hotkey}"
1790
1793
  )
1791
1794
  return False
@@ -1798,28 +1801,28 @@ async def swap_hotkey_extrinsic(
1798
1801
  if netuid is not None:
1799
1802
  confirm_message = (
1800
1803
  f"Do you want to swap [dark_orange]{wallet.name}[/dark_orange] hotkey \n\t"
1801
- f"[dark_orange]{wallet.hotkey.ss58_address} ({wallet.hotkey_str})[/dark_orange] with hotkey \n\t"
1802
- f"[dark_orange]{new_wallet.hotkey.ss58_address} ({new_wallet.hotkey_str})[/dark_orange] on subnet {netuid}\n"
1804
+ f"[dark_orange]{hk_ss58} ({wallet.hotkey_str})[/dark_orange] with hotkey \n\t"
1805
+ f"[dark_orange]{new_hk_ss58} ({new_wallet.hotkey_str})[/dark_orange] on subnet {netuid}\n"
1803
1806
  "This operation will cost [bold cyan]1 TAO (recycled)[/bold cyan]"
1804
1807
  )
1805
1808
  else:
1806
1809
  confirm_message = (
1807
1810
  f"Do you want to swap [dark_orange]{wallet.name}[/dark_orange] hotkey \n\t"
1808
- f"[dark_orange]{wallet.hotkey.ss58_address} ({wallet.hotkey_str})[/dark_orange] with hotkey \n\t"
1809
- f"[dark_orange]{new_wallet.hotkey.ss58_address} ({new_wallet.hotkey_str})[/dark_orange] on all subnets\n"
1811
+ f"[dark_orange]{hk_ss58} ({wallet.hotkey_str})[/dark_orange] with hotkey \n\t"
1812
+ f"[dark_orange]{new_hk_ss58} ({new_wallet.hotkey_str})[/dark_orange] on all subnets\n"
1810
1813
  "This operation will cost [bold cyan]1 TAO (recycled)[/bold cyan]"
1811
1814
  )
1812
1815
 
1813
1816
  if not Confirm.ask(confirm_message):
1814
1817
  return False
1815
1818
  print_verbose(
1816
- f"Swapping {wallet.name}'s hotkey ({wallet.hotkey.ss58_address} - {wallet.hotkey_str}) with "
1817
- f"{new_wallet.name}'s hotkey ({new_wallet.hotkey.ss58_address} - {new_wallet.hotkey_str})"
1819
+ f"Swapping {wallet.name}'s hotkey ({hk_ss58} - {wallet.hotkey_str}) with "
1820
+ f"{new_wallet.name}'s hotkey ({new_hk_ss58} - {new_wallet.hotkey_str})"
1818
1821
  )
1819
1822
  with console.status(":satellite: Swapping hotkeys...", spinner="aesthetic"):
1820
1823
  call_params = {
1821
- "hotkey": wallet.hotkey.ss58_address,
1822
- "new_hotkey": new_wallet.hotkey.ss58_address,
1824
+ "hotkey": hk_ss58,
1825
+ "new_hotkey": new_hk_ss58,
1823
1826
  "netuid": netuid,
1824
1827
  }
1825
1828
 
@@ -1832,7 +1835,8 @@ async def swap_hotkey_extrinsic(
1832
1835
 
1833
1836
  if success:
1834
1837
  console.print(
1835
- f"Hotkey {wallet.hotkey.ss58_address} ({wallet.hotkey_str}) swapped for new hotkey: {new_wallet.hotkey.ss58_address} ({new_wallet.hotkey_str})"
1838
+ f"Hotkey {hk_ss58} ({wallet.hotkey_str}) swapped for new hotkey: "
1839
+ f"{new_hk_ss58} ({new_wallet.hotkey_str})"
1836
1840
  )
1837
1841
  return True
1838
1842
  else:
@@ -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 (
@@ -575,7 +575,9 @@ def format_error_message(error_message: Union[dict, Exception]) -> str:
575
575
  err_type = error_message.get("type", err_type)
576
576
  err_name = error_message.get("name", err_name)
577
577
  err_docs = error_message.get("docs", [err_description])
578
- err_description = " ".join(err_docs)
578
+ err_description = (
579
+ " ".join(err_docs) if not isinstance(err_docs, str) else err_docs
580
+ )
579
581
  err_description += (
580
582
  f" | Please consult {BT_DOCS_LINK}/errors/subtensor#{err_name.lower()}"
581
583
  )
@@ -1431,3 +1433,15 @@ def blocks_to_duration(blocks: int) -> str:
1431
1433
  results.append(f"{unit_count}{unit}")
1432
1434
  # Return only the first two non-zero units
1433
1435
  return " ".join(results[:2]) or "0s"
1436
+
1437
+
1438
+ def get_hotkey_pub_ss58(wallet: Wallet) -> str:
1439
+ """
1440
+ Helper fn to retrieve the hotkeypub ss58 of a wallet that may have been created before
1441
+ bt-wallet 3.1.1 and thus not have a wallet hotkeypub. In this case, it will return the hotkey
1442
+ SS58.
1443
+ """
1444
+ try:
1445
+ return wallet.hotkeypub.ss58_address
1446
+ except (KeyFileError, AttributeError):
1447
+ 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(