From 8b3a4f8e8ecb150504d5ef81d976c219068205e4 Mon Sep 17 00:00:00 2001 From: KahanMajmudar Date: Wed, 20 Nov 2024 12:05:02 +0000 Subject: [PATCH] misc --- utils.py | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/utils.py b/utils.py index 19ca6be..a344e9e 100644 --- a/utils.py +++ b/utils.py @@ -280,8 +280,8 @@ def input_with_default_value(prompt: str, default_value: str) -> str: def input_select_chain(options: t.List[ChainType]): """Chose a single option from the offered ones""" - user_input = input( - f"Chose one of the following options {[option.name for option in options]}: " + user_input = input_with_default_value( + f"Chose one of the following options {[option.name for option in options]}", "GNOSIS" ) try: return ChainType.from_string(user_input.upper()) @@ -323,6 +323,21 @@ def get_local_config() -> MechQuickstartConfig: mech_quickstart_config.gnosis_rpc = input( f"Please enter a {ChainType.from_id(mech_quickstart_config.home_chain_id).name} RPC URL: " ) + + if mech_quickstart_config.mech_hash is None: + mech_hash = ( + input( + f"Do you want to set the mech_hash dict(set to {DEFAULT_MECH_HASH})? (y/n): " + ).lower() + == "y" + ) + if mech_hash: + while True: + user_input = input(f"Please enter the mech_hash: ") + mech_quickstart_config.mech_hash = user_input + break + else: + mech_quickstart_config.mech_hash = DEFAULT_MECH_HASH if mech_quickstart_config.password_migrated is None: mech_quickstart_config.password_migrated = False @@ -361,22 +376,6 @@ def get_local_config() -> MechQuickstartConfig: DEFAULT_TOOLS_TO_PACKAGE_HASH ) - if mech_quickstart_config.mech_hash is None: - mech_hash = ( - input( - f"Do you want to set the mech_hash dict(set to {DEFAULT_MECH_HASH})? (y/n): " - ).lower() - == "y" - ) - if mech_hash: - while True: - user_input = input(f"Please enter the mech_hash: ") - mech_quickstart_config.mech_hash = user_input - break - else: - mech_quickstart_config.mech_hash = DEFAULT_MECH_HASH - - mech_quickstart_config.store() return mech_quickstart_config