38
38
print_verbose ,
39
39
print_error ,
40
40
unlock_key ,
41
- hex_to_bytes ,
41
+ hex_to_bytes , get_hotkey_pub_ss58 ,
42
42
)
43
43
44
44
if typing .TYPE_CHECKING :
@@ -490,7 +490,7 @@ async def register_extrinsic(
490
490
491
491
async def get_neuron_for_pubkey_and_subnet ():
492
492
uid = await subtensor .query (
493
- "SubtensorModule" , "Uids" , [netuid , wallet . hotkey . ss58_address ]
493
+ "SubtensorModule" , "Uids" , [netuid , get_hotkey_pub_ss58 ( wallet ) ]
494
494
)
495
495
if uid is None :
496
496
return NeuronInfo .get_null_neuron ()
@@ -525,7 +525,7 @@ async def get_neuron_for_pubkey_and_subnet():
525
525
if not Confirm .ask (
526
526
f"Continue Registration?\n "
527
527
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 "
528
+ f"\t [{ COLOR_PALETTE .G .HK } ]{ get_hotkey_pub_ss58 ( wallet ) } [/{ COLOR_PALETTE .G .HK } ]\n "
529
529
f" coldkey [{ COLOR_PALETTE .G .CK } ]({ wallet .name } )[/{ COLOR_PALETTE .G .CK } ]:"
530
530
f"\t [{ COLOR_PALETTE .G .CK } ]{ wallet .coldkeypub .ss58_address } [/{ COLOR_PALETTE .G .CK } ]\n "
531
531
f" network:\t \t [{ COLOR_PALETTE .G .LINKS } ]{ subtensor .network } [/{ COLOR_PALETTE .G .LINKS } ]\n "
@@ -577,7 +577,7 @@ async def get_neuron_for_pubkey_and_subnet():
577
577
if not pow_result :
578
578
# might be registered already on this subnet
579
579
is_registered = await is_hotkey_registered (
580
- subtensor , netuid = netuid , hotkey_ss58 = wallet . hotkey . ss58_address
580
+ subtensor , netuid = netuid , hotkey_ss58 = get_hotkey_pub_ss58 ( wallet )
581
581
)
582
582
if is_registered :
583
583
err_console .print (
@@ -598,7 +598,7 @@ async def get_neuron_for_pubkey_and_subnet():
598
598
"block_number" : pow_result .block_number ,
599
599
"nonce" : pow_result .nonce ,
600
600
"work" : [int (byte_ ) for byte_ in pow_result .seal ],
601
- "hotkey" : wallet . hotkey . ss58_address ,
601
+ "hotkey" : get_hotkey_pub_ss58 ( wallet ) ,
602
602
"coldkey" : wallet .coldkeypub .ss58_address ,
603
603
},
604
604
)
@@ -639,7 +639,7 @@ async def get_neuron_for_pubkey_and_subnet():
639
639
is_registered = await is_hotkey_registered (
640
640
subtensor ,
641
641
netuid = netuid ,
642
- hotkey_ss58 = wallet . hotkey . ss58_address ,
642
+ hotkey_ss58 = get_hotkey_pub_ss58 ( wallet ) ,
643
643
)
644
644
if is_registered :
645
645
console .print (
@@ -704,7 +704,7 @@ async def burned_register_extrinsic(
704
704
spinner = "aesthetic" ,
705
705
) as status :
706
706
my_uid = await subtensor .query (
707
- "SubtensorModule" , "Uids" , [netuid , wallet . hotkey . ss58_address ]
707
+ "SubtensorModule" , "Uids" , [netuid , get_hotkey_pub_ss58 ( wallet ) ]
708
708
)
709
709
block_hash = await subtensor .substrate .get_chain_head ()
710
710
@@ -751,7 +751,7 @@ async def burned_register_extrinsic(
751
751
call_function = "burned_register" ,
752
752
call_params = {
753
753
"netuid" : netuid ,
754
- "hotkey" : wallet . hotkey . ss58_address ,
754
+ "hotkey" : get_hotkey_pub_ss58 ( wallet ) ,
755
755
},
756
756
)
757
757
success , err_msg = await subtensor .sign_and_send_extrinsic (
@@ -773,10 +773,10 @@ async def burned_register_extrinsic(
773
773
reuse_block = False ,
774
774
),
775
775
subtensor .get_netuids_for_hotkey (
776
- wallet . hotkey . ss58_address , block_hash = block_hash
776
+ get_hotkey_pub_ss58 ( wallet ) , block_hash = block_hash
777
777
),
778
778
subtensor .query (
779
- "SubtensorModule" , "Uids" , [netuid , wallet . hotkey . ss58_address ]
779
+ "SubtensorModule" , "Uids" , [netuid , get_hotkey_pub_ss58 ( wallet ) ]
780
780
),
781
781
)
782
782
@@ -1146,7 +1146,7 @@ async def _block_solver(
1146
1146
1147
1147
timeout = 0.15 if cuda else 0.15
1148
1148
while netuid == - 1 or not await is_hotkey_registered (
1149
- subtensor , netuid , wallet . hotkey . ss58_address
1149
+ subtensor , netuid , get_hotkey_pub_ss58 ( wallet )
1150
1150
):
1151
1151
# Wait until a solver finds a solution
1152
1152
try :
@@ -1755,37 +1755,39 @@ async def swap_hotkey_extrinsic(
1755
1755
:return: Success
1756
1756
"""
1757
1757
block_hash = await subtensor .substrate .get_chain_head ()
1758
+ hk_ss58 = get_hotkey_pub_ss58 (wallet )
1758
1759
netuids_registered = await subtensor .get_netuids_for_hotkey (
1759
- wallet . hotkey . ss58_address , block_hash = block_hash
1760
+ hk_ss58 , block_hash = block_hash
1760
1761
)
1761
1762
netuids_registered_new_hotkey = await subtensor .get_netuids_for_hotkey (
1762
- new_wallet . hotkey . ss58_address , block_hash = block_hash
1763
+ hk_ss58 , block_hash = block_hash
1763
1764
)
1764
1765
1765
1766
if netuid is not None and netuid not in netuids_registered :
1766
1767
err_console .print (
1767
- f":cross_mark: [red]Failed[/red]: Original hotkey { wallet . hotkey . ss58_address } is not registered on subnet { netuid } "
1768
+ f":cross_mark: [red]Failed[/red]: Original hotkey { hk_ss58 } is not registered on subnet { netuid } "
1768
1769
)
1769
1770
return False
1770
1771
1771
1772
elif not len (netuids_registered ) > 0 :
1772
1773
err_console .print (
1773
- f"Original hotkey [dark_orange]{ wallet . hotkey . ss58_address } [/dark_orange] is not registered on any subnet. "
1774
+ f"Original hotkey [dark_orange]{ hk_ss58 } [/dark_orange] is not registered on any subnet. "
1774
1775
f"Please register and try again"
1775
1776
)
1776
1777
return False
1777
1778
1779
+ new_hk_ss58 = get_hotkey_pub_ss58 (new_wallet )
1778
1780
if netuid is not None :
1779
1781
if netuid in netuids_registered_new_hotkey :
1780
1782
err_console .print (
1781
- f":cross_mark: [red]Failed[/red]: New hotkey { new_wallet . hotkey . ss58_address } "
1783
+ f":cross_mark: [red]Failed[/red]: New hotkey { new_hk_ss58 } "
1782
1784
f"is already registered on subnet { netuid } "
1783
1785
)
1784
1786
return False
1785
1787
else :
1786
1788
if len (netuids_registered_new_hotkey ) > 0 :
1787
1789
err_console .print (
1788
- f":cross_mark: [red]Failed[/red]: New hotkey { new_wallet . hotkey . ss58_address } "
1790
+ f":cross_mark: [red]Failed[/red]: New hotkey { new_hk_ss58 } "
1789
1791
f"is already registered on subnet(s) { netuids_registered_new_hotkey } "
1790
1792
)
1791
1793
return False
@@ -1798,28 +1800,28 @@ async def swap_hotkey_extrinsic(
1798
1800
if netuid is not None :
1799
1801
confirm_message = (
1800
1802
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 "
1803
+ f"[dark_orange]{ hk_ss58 } ({ wallet .hotkey_str } )[/dark_orange] with hotkey \n \t "
1804
+ f"[dark_orange]{ new_hk_ss58 } ({ new_wallet .hotkey_str } )[/dark_orange] on subnet { netuid } \n "
1803
1805
"This operation will cost [bold cyan]1 TAO (recycled)[/bold cyan]"
1804
1806
)
1805
1807
else :
1806
1808
confirm_message = (
1807
1809
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 "
1810
+ f"[dark_orange]{ hk_ss58 } ({ wallet .hotkey_str } )[/dark_orange] with hotkey \n \t "
1811
+ f"[dark_orange]{ new_hk_ss58 } ({ new_wallet .hotkey_str } )[/dark_orange] on all subnets\n "
1810
1812
"This operation will cost [bold cyan]1 TAO (recycled)[/bold cyan]"
1811
1813
)
1812
1814
1813
1815
if not Confirm .ask (confirm_message ):
1814
1816
return False
1815
1817
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 } )"
1818
+ f"Swapping { wallet .name } 's hotkey ({ hk_ss58 } - { wallet .hotkey_str } ) with "
1819
+ f"{ new_wallet .name } 's hotkey ({ new_hk_ss58 } - { new_wallet .hotkey_str } )"
1818
1820
)
1819
1821
with console .status (":satellite: Swapping hotkeys..." , spinner = "aesthetic" ):
1820
1822
call_params = {
1821
- "hotkey" : wallet . hotkey . ss58_address ,
1822
- "new_hotkey" : new_wallet . hotkey . ss58_address ,
1823
+ "hotkey" : hk_ss58 ,
1824
+ "new_hotkey" : new_hk_ss58 ,
1823
1825
"netuid" : netuid ,
1824
1826
}
1825
1827
@@ -1832,7 +1834,8 @@ async def swap_hotkey_extrinsic(
1832
1834
1833
1835
if success :
1834
1836
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 } )"
1837
+ f"Hotkey { hk_ss58 } ({ wallet .hotkey_str } ) swapped for new hotkey: "
1838
+ f"{ new_hk_ss58 } ({ new_wallet .hotkey_str } )"
1836
1839
)
1837
1840
return True
1838
1841
else :
0 commit comments