20
20
is_valid_ss58_address ,
21
21
format_error_message ,
22
22
unlock_key ,
23
- json_console ,
23
+ json_console , get_hotkey_pub_ss58 ,
24
24
)
25
25
26
26
@@ -464,24 +464,24 @@ async def _render_table(
464
464
netuid_children_tuples = []
465
465
for netuid_ in netuids :
466
466
success , children , err_mg = await subtensor .get_children (
467
- wallet . hotkey . ss58_address , netuid_
467
+ get_hotkey_pub_ss58 ( wallet ) , netuid_
468
468
)
469
469
if children :
470
470
netuid_children_tuples .append ((netuid_ , children ))
471
471
if not success :
472
472
err_console .print (
473
473
f"Failed to get children from subtensor { netuid_ } : { err_mg } "
474
474
)
475
- await _render_table (wallet . hotkey . ss58_address , netuid_children_tuples )
475
+ await _render_table (get_hotkey_pub_ss58 ( wallet ) , netuid_children_tuples )
476
476
else :
477
477
success , children , err_mg = await subtensor .get_children (
478
- wallet . hotkey . ss58_address , netuid
478
+ get_hotkey_pub_ss58 ( wallet ) , netuid
479
479
)
480
480
if not success :
481
481
err_console .print (f"Failed to get children from subtensor: { err_mg } " )
482
482
if children :
483
483
netuid_children_tuples = [(netuid , children )]
484
- await _render_table (wallet . hotkey . ss58_address , netuid_children_tuples )
484
+ await _render_table (get_hotkey_pub_ss58 ( wallet ) , netuid_children_tuples )
485
485
486
486
return children
487
487
@@ -500,12 +500,12 @@ async def set_children(
500
500
"""Set children hotkeys."""
501
501
# Validate children SS58 addresses
502
502
# 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
503
+ hotkey = get_hotkey_pub_ss58 ( wallet )
504
504
for child in children :
505
505
if not is_valid_ss58_address (child ):
506
506
err_console .print (f":cross_mark:[red] Invalid SS58 address: { child } [/red]" )
507
507
return
508
- if child == wallet . hotkey . ss58_address :
508
+ if child == hotkey :
509
509
err_console .print (":cross_mark:[red] Cannot set yourself as a child.[/red]" )
510
510
return
511
511
@@ -608,7 +608,7 @@ async def revoke_children(
608
608
subtensor = subtensor ,
609
609
wallet = wallet ,
610
610
netuid = netuid ,
611
- hotkey = wallet . hotkey . ss58_address ,
611
+ hotkey = get_hotkey_pub_ss58 ( wallet ) ,
612
612
children_with_proportions = [],
613
613
prompt = prompt ,
614
614
wait_for_inclusion = wait_for_inclusion ,
@@ -647,7 +647,7 @@ async def revoke_children(
647
647
subtensor = subtensor ,
648
648
wallet = wallet ,
649
649
netuid = netuid ,
650
- hotkey = wallet . hotkey . ss58_address ,
650
+ hotkey = get_hotkey_pub_ss58 ( wallet ) ,
651
651
children_with_proportions = [],
652
652
prompt = prompt ,
653
653
wait_for_inclusion = True ,
@@ -746,7 +746,7 @@ async def set_chk_take_subnet(subnet: int, chk_take: float) -> bool:
746
746
subtensor = subtensor ,
747
747
wallet = wallet ,
748
748
netuid = subnet ,
749
- hotkey = wallet . hotkey . ss58_address ,
749
+ hotkey = get_hotkey_pub_ss58 ( wallet ) ,
750
750
take = chk_take ,
751
751
prompt = prompt ,
752
752
wait_for_inclusion = wait_for_inclusion ,
@@ -756,7 +756,7 @@ async def set_chk_take_subnet(subnet: int, chk_take: float) -> bool:
756
756
if success :
757
757
console .print (":white_heavy_check_mark: [green]Set childkey take.[/green]" )
758
758
console .print (
759
- f"The childkey take for { wallet . hotkey . ss58_address } is now set to { take * 100 :.2f} %."
759
+ f"The childkey take for { get_hotkey_pub_ss58 ( wallet ) } is now set to { take * 100 :.2f} %."
760
760
)
761
761
return True
762
762
else :
@@ -766,9 +766,10 @@ async def set_chk_take_subnet(subnet: int, chk_take: float) -> bool:
766
766
return False
767
767
768
768
# 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 :
769
+ wallet_hk = get_hotkey_pub_ss58 (wallet )
770
+ if not hotkey or hotkey == wallet_hk :
771
+ hotkey = wallet_hk
772
+ if hotkey != wallet_hk or not take :
772
773
# display childkey take for other users
773
774
if netuid :
774
775
await display_chk_take (hotkey , netuid )
@@ -826,7 +827,7 @@ async def set_chk_take_subnet(subnet: int, chk_take: float) -> bool:
826
827
subtensor = subtensor ,
827
828
wallet = wallet ,
828
829
netuid = netuid_ ,
829
- hotkey = wallet . hotkey . ss58_address ,
830
+ hotkey = wallet_hk ,
830
831
take = take ,
831
832
prompt = prompt ,
832
833
wait_for_inclusion = True ,
0 commit comments