Skip to content
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
87c9df7
Account manager migrated to clap derive
eserilev Oct 16, 2024
b61da17
Fix tests
eserilev Oct 16, 2024
eda8eff
Fix docs
eserilev Oct 16, 2024
d63f467
Fix test
eserilev Oct 16, 2024
08c86f3
Fix test
eserilev Oct 16, 2024
8237653
resolve merge conflicts
eserilev Jan 16, 2025
d61412b
Merge branch 'unstable' of https://github.com/sigp/lighthouse into cl…
eserilev Jan 20, 2025
5aa568a
sort and fmt
eserilev Jan 20, 2025
16c6314
resolve merge conflicts
eserilev Feb 10, 2025
2fedc21
Fmt
eserilev Feb 10, 2025
1bfb06a
Merge branch 'unstable' into clap-derive-accnt-manager
eserilev Feb 12, 2025
61dfcff
Merge branch 'unstable' into clap-derive-accnt-manager
eserilev Mar 17, 2025
7da95ec
Merge branch 'unstable' into clap-derive-accnt-manager
eserilev Apr 21, 2025
aaf190b
Merge branch 'unstable' into clap-derive-accnt-manager
eserilev Apr 22, 2025
5367623
Resolve merge conflicts
eserilev Apr 24, 2025
7faed09
update comments
eserilev Apr 24, 2025
32e5723
update comments
eserilev Apr 24, 2025
c0ce1cc
remove dyn box, ensure consistency in fn defs
eserilev Apr 25, 2025
9cfcc59
remove modifiable trait
eserilev Apr 25, 2025
83f274a
Merge branch 'unstable' into clap-derive-accnt-manager
eserilev May 11, 2025
ce75f06
Merge branch 'unstable' into clap-derive-accnt-manager
michaelsproul May 28, 2025
44e9296
Merge branch 'unstable' into clap-derive-accnt-manager
eserilev May 28, 2025
0cda089
Merge branch 'unstable' into clap-derive-accnt-manager
eserilev Jun 2, 2025
e350338
resolve merge conflicts
eserilev Jun 13, 2025
47a058b
Merge branch 'unstable' into clap-derive-accnt-manager
eserilev Jun 22, 2025
ff67101
Resolve merge conflicts
eserilev Jan 7, 2026
0e0171a
Revert
eserilev Jan 8, 2026
d2afff5
Merge branch 'unstable' of https://github.com/sigp/lighthouse into cl…
eserilev Jan 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions account_manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ eth2_wallet_manager = { path = "../common/eth2_wallet_manager" }
filesystem = { workspace = true }
safe_arith = { workspace = true }
sensitive_url = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
slashing_protection = { workspace = true }
slot_clock = { workspace = true }
Expand Down
42 changes: 24 additions & 18 deletions account_manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ pub mod validator;
pub mod wallet;

use clap::ArgMatches;
use clap::Command;
use clap::Parser;
use environment::Environment;
use serde::Deserialize;
use serde::Serialize;
use types::EthSpec;

pub const CMD: &str = "account_manager";
Expand All @@ -13,27 +15,31 @@ pub const VALIDATOR_DIR_FLAG: &str = "validator-dir";
pub const VALIDATOR_DIR_FLAG_ALIAS: &str = "validators-dir";
pub const WALLETS_DIR_FLAG: &str = "wallets-dir";

pub fn cli_app() -> Command {
Command::new(CMD)
.visible_aliases(["a", "am", "account"])
.about("Utilities for generating and managing Ethereum 2.0 accounts.")
.display_order(0)
.subcommand(wallet::cli_app())
.subcommand(validator::cli_app())
#[derive(Clone, Deserialize, Serialize, Debug, Parser)]
#[clap(visible_aliases = &["a", "am", "account"], about = "Utilities for generating and managing Ethereum 2.0 accounts.")]
pub struct AccountManager {
#[clap(subcommand)]
pub subcommand: AccountManagerSubcommand,
}

#[derive(Parser, Clone, Deserialize, Serialize, Debug)]
#[clap(rename_all = "kebab-case")]
pub enum AccountManagerSubcommand {
Wallet(wallet::cli::Wallet),
Validator(validator::cli::Validator),
}

/// Run the account manager, returning an error if the operation did not succeed.
pub fn run<E: EthSpec>(matches: &ArgMatches, env: Environment<E>) -> Result<(), String> {
match matches.subcommand() {
Some((wallet::CMD, matches)) => wallet::cli_run(matches)?,
Some((validator::CMD, matches)) => validator::cli_run(matches, env)?,
Some((unknown, _)) => {
return Err(format!(
"{} is not a valid {} command. See --help.",
unknown, CMD
));
pub fn run<E: EthSpec>(
matches: &ArgMatches,
account_manager: &AccountManager,
env: Environment<E>,
) -> Result<(), String> {
match &account_manager.subcommand {
AccountManagerSubcommand::Wallet(wallet_config) => wallet::cli_run(wallet_config, matches)?,
AccountManagerSubcommand::Validator(validator_config) => {
validator::cli_run(validator_config, matches, env)?
}
_ => return Err("No subcommand provided, see --help for options".to_string()),
}

Ok(())
Expand Down
Loading