Skip to content

Commit

Permalink
Merge pull request #719 from serokell/krendelhoff/#714-impove-ledger-…
Browse files Browse the repository at this point in the history
…prompts

[#714] Improve ledger prompts
  • Loading branch information
krendelhoff2 authored Sep 23, 2023
2 parents 2cfd028 + 69d7c5e commit 1107c99
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
19 changes: 18 additions & 1 deletion baking/src/tezos_baking/tezos_setup_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,12 +709,22 @@ 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()}"
)
baker_set_up = True
except PermissionError:
except Exception as e:
print("Something went wrong when calling octez-client:")
print(str(e))
print()
print("Please check your input and try again.")
print("Going back to the import mode selection.")
else:
baker_set_up = True
Expand All @@ -723,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 1107c99

Please sign in to comment.