Skip to content

Commit 5a36b21

Browse files
committed
update func
1 parent cc80115 commit 5a36b21

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

bittensor_cli/src/commands/wallets.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,16 @@ async def associate_hotkey(
5454
wallet: Wallet,
5555
subtensor: SubtensorInterface,
5656
hotkey_ss58: str,
57+
hotkey_display: str,
5758
prompt: bool = False,
5859
):
5960
"""Associates a hotkey with a wallet"""
61+
6062
owner_ss58 = await subtensor.get_hotkey_owner(hotkey_ss58)
6163
if owner_ss58:
6264
if owner_ss58 == wallet.coldkeypub.ss58_address:
6365
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 "
6567
f"associated with \nwallet [blue]{wallet.name}[/blue], "
6668
f"SS58: [{COLORS.GENERAL.CK}]{owner_ss58}[/{COLORS.GENERAL.CK}]"
6769
)
@@ -70,18 +72,14 @@ async def associate_hotkey(
7072
owner_wallet = _get_wallet_by_ss58(wallet.path, owner_ss58)
7173
wallet_name = owner_wallet.name if owner_wallet else "unknown wallet"
7274
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"
7476
f"wallet: [blue]{wallet_name}[/blue], SS58: [{COLORS.GENERAL.CK}]{owner_ss58}[/{COLORS.GENERAL.CK}]"
7577
)
7678
return False
7779
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")
8181

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?"):
8583
return False
8684

8785
if not unlock_key(wallet).success:
@@ -110,8 +108,8 @@ async def associate_hotkey(
110108
return False
111109

112110
console.print(
113-
f"[green]:white_heavy_check_mark: Successfully associated hotkey[/green] "
114-
f"[{COLORS.GENERAL.HK}]{hotkey_ss58}[/{COLORS.GENERAL.HK}] with \nwallet [blue]{wallet.name}[/blue], "
111+
f"[green]:white_heavy_check_mark: Successfully associated {hotkey_display} with \n"
112+
f"wallet [blue]{wallet.name}[/blue], "
115113
f"SS58: [{COLORS.GENERAL.CK}]{wallet.coldkeypub.ss58_address}[/{COLORS.GENERAL.CK}]"
116114
)
117115
return True

0 commit comments

Comments
 (0)