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 get_neuron_for_pubkey_and_subnet():
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 get_neuron_for_pubkey_and_subnet():
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 get_neuron_for_pubkey_and_subnet():
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 get_neuron_for_pubkey_and_subnet():
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 :
0 commit comments