3939 print_error ,
4040 unlock_key ,
4141 hex_to_bytes ,
42+ get_hotkey_pub_ss58 ,
4243)
4344
4445if typing .TYPE_CHECKING :
@@ -490,7 +491,7 @@ async def register_extrinsic(
490491
491492 async def get_neuron_for_pubkey_and_subnet ():
492493 uid = await subtensor .query (
493- "SubtensorModule" , "Uids" , [netuid , wallet . hotkey . ss58_address ]
494+ "SubtensorModule" , "Uids" , [netuid , get_hotkey_pub_ss58 ( wallet ) ]
494495 )
495496 if uid is None :
496497 return NeuronInfo .get_null_neuron ()
@@ -525,7 +526,7 @@ async def get_neuron_for_pubkey_and_subnet():
525526 if not Confirm .ask (
526527 f"Continue Registration?\n "
527528 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 "
529530 f" coldkey [{ COLOR_PALETTE .G .CK } ]({ wallet .name } )[/{ COLOR_PALETTE .G .CK } ]:"
530531 f"\t [{ COLOR_PALETTE .G .CK } ]{ wallet .coldkeypub .ss58_address } [/{ COLOR_PALETTE .G .CK } ]\n "
531532 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():
577578 if not pow_result :
578579 # might be registered already on this subnet
579580 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 )
581582 )
582583 if is_registered :
583584 err_console .print (
@@ -598,7 +599,7 @@ async def get_neuron_for_pubkey_and_subnet():
598599 "block_number" : pow_result .block_number ,
599600 "nonce" : pow_result .nonce ,
600601 "work" : [int (byte_ ) for byte_ in pow_result .seal ],
601- "hotkey" : wallet . hotkey . ss58_address ,
602+ "hotkey" : get_hotkey_pub_ss58 ( wallet ) ,
602603 "coldkey" : wallet .coldkeypub .ss58_address ,
603604 },
604605 )
@@ -639,7 +640,7 @@ async def get_neuron_for_pubkey_and_subnet():
639640 is_registered = await is_hotkey_registered (
640641 subtensor ,
641642 netuid = netuid ,
642- hotkey_ss58 = wallet . hotkey . ss58_address ,
643+ hotkey_ss58 = get_hotkey_pub_ss58 ( wallet ) ,
643644 )
644645 if is_registered :
645646 console .print (
@@ -704,7 +705,7 @@ async def burned_register_extrinsic(
704705 spinner = "aesthetic" ,
705706 ) as status :
706707 my_uid = await subtensor .query (
707- "SubtensorModule" , "Uids" , [netuid , wallet . hotkey . ss58_address ]
708+ "SubtensorModule" , "Uids" , [netuid , get_hotkey_pub_ss58 ( wallet ) ]
708709 )
709710 block_hash = await subtensor .substrate .get_chain_head ()
710711
@@ -751,7 +752,7 @@ async def burned_register_extrinsic(
751752 call_function = "burned_register" ,
752753 call_params = {
753754 "netuid" : netuid ,
754- "hotkey" : wallet . hotkey . ss58_address ,
755+ "hotkey" : get_hotkey_pub_ss58 ( wallet ) ,
755756 },
756757 )
757758 success , err_msg = await subtensor .sign_and_send_extrinsic (
@@ -773,10 +774,10 @@ async def burned_register_extrinsic(
773774 reuse_block = False ,
774775 ),
775776 subtensor .get_netuids_for_hotkey (
776- wallet . hotkey . ss58_address , block_hash = block_hash
777+ get_hotkey_pub_ss58 ( wallet ) , block_hash = block_hash
777778 ),
778779 subtensor .query (
779- "SubtensorModule" , "Uids" , [netuid , wallet . hotkey . ss58_address ]
780+ "SubtensorModule" , "Uids" , [netuid , get_hotkey_pub_ss58 ( wallet ) ]
780781 ),
781782 )
782783
@@ -1146,7 +1147,7 @@ async def _block_solver(
11461147
11471148 timeout = 0.15 if cuda else 0.15
11481149 while netuid == - 1 or not await is_hotkey_registered (
1149- subtensor , netuid , wallet . hotkey . ss58_address
1150+ subtensor , netuid , get_hotkey_pub_ss58 ( wallet )
11501151 ):
11511152 # Wait until a solver finds a solution
11521153 try :
@@ -1755,37 +1756,39 @@ async def swap_hotkey_extrinsic(
17551756 :return: Success
17561757 """
17571758 block_hash = await subtensor .substrate .get_chain_head ()
1759+ hk_ss58 = get_hotkey_pub_ss58 (wallet )
17581760 netuids_registered = await subtensor .get_netuids_for_hotkey (
1759- wallet . hotkey . ss58_address , block_hash = block_hash
1761+ hk_ss58 , block_hash = block_hash
17601762 )
17611763 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
17631765 )
17641766
17651767 if netuid is not None and netuid not in netuids_registered :
17661768 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 } "
17681770 )
17691771 return False
17701772
17711773 elif not len (netuids_registered ) > 0 :
17721774 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. "
17741776 f"Please register and try again"
17751777 )
17761778 return False
17771779
1780+ new_hk_ss58 = get_hotkey_pub_ss58 (new_wallet )
17781781 if netuid is not None :
17791782 if netuid in netuids_registered_new_hotkey :
17801783 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 } "
17821785 f"is already registered on subnet { netuid } "
17831786 )
17841787 return False
17851788 else :
17861789 if len (netuids_registered_new_hotkey ) > 0 :
17871790 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 } "
17891792 f"is already registered on subnet(s) { netuids_registered_new_hotkey } "
17901793 )
17911794 return False
@@ -1798,28 +1801,28 @@ async def swap_hotkey_extrinsic(
17981801 if netuid is not None :
17991802 confirm_message = (
18001803 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 "
18031806 "This operation will cost [bold cyan]1 TAO (recycled)[/bold cyan]"
18041807 )
18051808 else :
18061809 confirm_message = (
18071810 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 "
18101813 "This operation will cost [bold cyan]1 TAO (recycled)[/bold cyan]"
18111814 )
18121815
18131816 if not Confirm .ask (confirm_message ):
18141817 return False
18151818 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 } )"
18181821 )
18191822 with console .status (":satellite: Swapping hotkeys..." , spinner = "aesthetic" ):
18201823 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 ,
18231826 "netuid" : netuid ,
18241827 }
18251828
@@ -1832,7 +1835,8 @@ async def swap_hotkey_extrinsic(
18321835
18331836 if success :
18341837 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 } )"
18361840 )
18371841 return True
18381842 else :
0 commit comments