Skip to content

Commit

Permalink
[#714] Improve the wizard prompts for ledger
Browse files Browse the repository at this point in the history
Problem: The setup wizard support a setup with a Ledger device. It often
isn't clear from the wizard itself, however, when an action is expected
from the user, which leads to unnecessary waiting and/or confusion.

Solution: Add visible prompts that an action from user is expected.
  • Loading branch information
krendelhoff2 committed Sep 22, 2023
1 parent d983174 commit 69d7c5e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
13 changes: 13 additions & 0 deletions baking/src/tezos_baking/tezos_setup_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,12 @@ def import_baker_key(self):

if self.config["key_import_mode"] == "ledger":
try:
print(
color(
"Waiting for your respond to the prompt on your Ledger Device...",
color_green,
)
)
proc_call(
f"sudo -u tezos {suppress_warning_text} octez-client {tezos_client_options} "
f"setup ledger to bake for {baker_alias} --main-hwm {self.get_current_head_level()}"
Expand All @@ -727,6 +733,13 @@ def register_baker(self):
print()
tezos_client_options = self.get_tezos_client_options()
baker_alias = self.config["baker_alias"]
if self.config["key_import_mode"] == "ledger":
print(
color(
"Waiting for your respond to the prompt on your Ledger Device...",
color_green,
)
)
proc_call(
f"sudo -u tezos {suppress_warning_text} octez-client {tezos_client_options} "
f"register key {baker_alias} as delegate"
Expand Down
15 changes: 15 additions & 0 deletions baking/src/tezos_baking/wizard_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,17 @@ def import_key(self, key_mode_query, ledger_app=None):
else:
print(f"Please open the Tezos {ledger_app} app on your ledger or")
print("press Ctrl+C to go back to the key import mode selection.")
print(
color(
"Waiting for the Ledger Device to appear...", color_green
),
end="",
flush=True,
)
ledgers_derivations = wait_for_ledger_app(
ledger_app, self.config["client_data_dir"]
)
print()
if ledgers_derivations is None:
print("Going back to the import mode selection.")
continue
Expand Down Expand Up @@ -318,6 +326,13 @@ def import_key(self, key_mode_query, ledger_app=None):
)
else:
baker_ledger_url = self.config["ledger_derivation"]

print(
color(
"Waiting for your respond to the prompt on your Ledger Device...",
color_green,
)
)
proc_call(
f"sudo -u tezos {suppress_warning_text} octez-client {tezos_client_options} "
f"import secret key {baker_alias} {baker_ledger_url} --force"
Expand Down

0 comments on commit 69d7c5e

Please sign in to comment.