From f9fd7a169c1264d7c600dfc39f56a354be1aef51 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Mon, 27 Jul 2020 23:52:00 +0800 Subject: [PATCH] Add network (chain) name selection to prompt --- eth2deposit/deposit.py | 1 + eth2deposit/settings.py | 2 +- test_deposit_script.py | 1 + tests/test_cli.py | 3 ++- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/eth2deposit/deposit.py b/eth2deposit/deposit.py index 2dc477c..4d4e599 100644 --- a/eth2deposit/deposit.py +++ b/eth2deposit/deposit.py @@ -70,6 +70,7 @@ def check_python_version() -> None: ) @click.option( '--chain', + prompt='Please choose the (mainnet or testnet) network/chain name', type=click.Choice(ALL_CHAINS.keys(), case_sensitive=False), default=MAINNET, ) diff --git a/eth2deposit/settings.py b/eth2deposit/settings.py index cfcb1a8..7a2cebd 100644 --- a/eth2deposit/settings.py +++ b/eth2deposit/settings.py @@ -5,7 +5,7 @@ class BaseChainSetting(NamedTuple): GENESIS_FORK_VERSION: bytes -# Eth2 Mainet setting +# Eth2 Mainnet setting MainnetSetting = BaseChainSetting(GENESIS_FORK_VERSION=bytes.fromhex('00000000')) # Eth2 spec v0.11.3 testnet WittiSetting = BaseChainSetting(GENESIS_FORK_VERSION=bytes.fromhex('00000113')) diff --git a/test_deposit_script.py b/test_deposit_script.py index e40b87b..4fd9428 100755 --- a/test_deposit_script.py +++ b/test_deposit_script.py @@ -27,6 +27,7 @@ async def main(): run_script_cmd, '--num_validators', '1', '--mnemonic_language', 'english', + '--chain', 'mainnet', '--password', 'MyPassword', '--folder', my_folder_path, ] diff --git a/tests/test_cli.py b/tests/test_cli.py index bee82d8..67976f1 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -41,7 +41,7 @@ def test_deposit(monkeypatch) -> None: os.mkdir(my_folder_path) runner = CliRunner() - inputs = ['5', 'english', 'MyPassword', 'MyPassword', 'fakephrase'] + inputs = ['5', 'english', 'mainnet', 'MyPassword', 'MyPassword', 'fakephrase'] data = '\n'.join(inputs) result = runner.invoke(main, ['--folder', my_folder_path], input=data) @@ -87,6 +87,7 @@ async def test_script() -> None: run_script_cmd, '--num_validators', '1', '--mnemonic_language', 'english', + '--chain', 'mainnet', '--password', 'MyPassword', '--folder', my_folder_path, ]