Skip to content

Commit fbb721e

Browse files
committed
Updates
1 parent ba519d7 commit fbb721e

File tree

2 files changed

+27
-23
lines changed

2 files changed

+27
-23
lines changed

bittensor_cli/cli.py

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,6 +2274,7 @@ def wallet_associate_hotkey(
22742274
wallet_path: Optional[str] = Options.wallet_path,
22752275
wallet_hotkey: Optional[str] = Options.wallet_hotkey_ss58,
22762276
network: Optional[list[str]] = Options.network,
2277+
prompt: bool = Options.prompt,
22772278
quiet: bool = Options.quiet,
22782279
verbose: bool = Options.verbose,
22792280
):
@@ -2296,33 +2297,33 @@ def wallet_associate_hotkey(
22962297
default=self.config.get("wallet_name") or defaults.wallet.name,
22972298
)
22982299
if not wallet_hotkey:
2299-
hotkey_or_wallet = Prompt.ask(
2300+
wallet_hotkey = Prompt.ask(
23002301
"Enter the [blue]hotkey[/blue] name or "
23012302
"[blue]hotkey ss58 address[/blue] [dim](to associate with your coldkey)[/dim]"
23022303
)
2303-
if is_valid_ss58_address(hotkey_or_wallet):
2304-
hotkey_ss58 = hotkey_or_wallet
2305-
wallet = self.wallet_ask(
2306-
wallet_name,
2307-
wallet_path,
2308-
wallet_hotkey,
2309-
ask_for=[WO.NAME, WO.PATH],
2310-
validate=WV.WALLET,
2311-
)
2312-
else:
2313-
wallet = self.wallet_ask(
2314-
wallet_name,
2315-
wallet_path,
2316-
hotkey_or_wallet,
2317-
ask_for=[WO.NAME, WO.PATH, WO.HOTKEY],
2318-
validate=WV.WALLET_AND_HOTKEY,
2319-
)
2320-
hotkey_ss58 = wallet.hotkey.ss58_address
2304+
2305+
if is_valid_ss58_address(wallet_hotkey):
2306+
hotkey_ss58 = wallet_hotkey
2307+
wallet = self.wallet_ask(
2308+
wallet_name,
2309+
wallet_path,
2310+
None,
2311+
ask_for=[WO.NAME, WO.PATH],
2312+
validate=WV.WALLET,
2313+
)
2314+
else:
2315+
wallet = self.wallet_ask(
2316+
wallet_name,
2317+
wallet_path,
2318+
wallet_hotkey,
2319+
ask_for=[WO.NAME, WO.PATH, WO.HOTKEY],
2320+
validate=WV.WALLET_AND_HOTKEY,
2321+
)
2322+
hotkey_ss58 = wallet.hotkey.ss58_address
2323+
23212324
return self._run_command(
23222325
wallets.associate_hotkey(
2323-
wallet,
2324-
self.initialize_chain(network),
2325-
hotkey_ss58,
2326+
wallet, self.initialize_chain(network), hotkey_ss58, prompt
23262327
)
23272328
)
23282329

bittensor_cli/src/commands/wallets.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ async def associate_hotkey(
5454
wallet: Wallet,
5555
subtensor: SubtensorInterface,
5656
hotkey_ss58: str,
57+
prompt: bool = False,
5758
):
5859
"""Associates a hotkey with a wallet"""
5960
owner_ss58 = await subtensor.get_hotkey_owner(hotkey_ss58)
@@ -78,7 +79,9 @@ async def associate_hotkey(
7879
f"Hotkey [{COLORS.GENERAL.HK}]{hotkey_ss58}[/{COLORS.GENERAL.HK}] is not associated with any wallet"
7980
)
8081

81-
if not Confirm.ask("Do you want to continue with the association?"):
82+
if prompt and not Confirm.ask(
83+
"Do you want to continue with the association?"
84+
):
8285
return False
8386

8487
if not unlock_key(wallet).success:

0 commit comments

Comments
 (0)