@@ -54,14 +54,16 @@ async def associate_hotkey(
54
54
wallet : Wallet ,
55
55
subtensor : SubtensorInterface ,
56
56
hotkey_ss58 : str ,
57
+ hotkey_display : str ,
57
58
prompt : bool = False ,
58
59
):
59
60
"""Associates a hotkey with a wallet"""
61
+
60
62
owner_ss58 = await subtensor .get_hotkey_owner (hotkey_ss58 )
61
63
if owner_ss58 :
62
64
if owner_ss58 == wallet .coldkeypub .ss58_address :
63
65
console .print (
64
- f":white_heavy_check_mark: Hotkey [ { COLORS . GENERAL . HK } ] { hotkey_ss58 } [/ { COLORS . GENERAL . HK } ] is already "
66
+ f":white_heavy_check_mark: { hotkey_display } is already "
65
67
f"associated with \n wallet [blue]{ wallet .name } [/blue], "
66
68
f"SS58: [{ COLORS .GENERAL .CK } ]{ owner_ss58 } [/{ COLORS .GENERAL .CK } ]"
67
69
)
@@ -70,18 +72,14 @@ async def associate_hotkey(
70
72
owner_wallet = _get_wallet_by_ss58 (wallet .path , owner_ss58 )
71
73
wallet_name = owner_wallet .name if owner_wallet else "unknown wallet"
72
74
console .print (
73
- f"[yellow]Warning[/yellow]: Hotkey [ { COLORS . GENERAL . HK } ] { hotkey_ss58 } [/ { COLORS . GENERAL . HK } ] is already associated with \n "
75
+ f"[yellow]Warning[/yellow]: { hotkey_display } is already associated with \n "
74
76
f"wallet: [blue]{ wallet_name } [/blue], SS58: [{ COLORS .GENERAL .CK } ]{ owner_ss58 } [/{ COLORS .GENERAL .CK } ]"
75
77
)
76
78
return False
77
79
else :
78
- console .print (
79
- f"Hotkey [{ COLORS .GENERAL .HK } ]{ hotkey_ss58 } [/{ COLORS .GENERAL .HK } ] is not associated with any wallet"
80
- )
80
+ console .print (f"{ hotkey_display } is not associated with any wallet" )
81
81
82
- if prompt and not Confirm .ask (
83
- "Do you want to continue with the association?"
84
- ):
82
+ if prompt and not Confirm .ask ("Do you want to continue with the association?" ):
85
83
return False
86
84
87
85
if not unlock_key (wallet ).success :
@@ -110,8 +108,8 @@ async def associate_hotkey(
110
108
return False
111
109
112
110
console .print (
113
- f"[green]:white_heavy_check_mark: Successfully associated hotkey[/green] "
114
- f"[ { COLORS . GENERAL . HK } ] { hotkey_ss58 } [/ { COLORS . GENERAL . HK } ] with \n wallet [blue]{ wallet .name } [/blue], "
111
+ f"[green]:white_heavy_check_mark: Successfully associated { hotkey_display } with \n "
112
+ f"wallet [blue]{ wallet .name } [/blue], "
115
113
f"SS58: [{ COLORS .GENERAL .CK } ]{ wallet .coldkeypub .ss58_address } [/{ COLORS .GENERAL .CK } ]"
116
114
)
117
115
return True
0 commit comments