49 lines
1.6 KiB
Rust
Raw Normal View History

2025-08-06 14:56:58 +03:00
use anyhow::Result;
use clap::{CommandFactory as _, Parser as _};
2025-08-06 14:56:58 +03:00
use tokio::runtime::Builder;
use wallet::cli::{
Args, OverCommand, execute_continuous_run, execute_keys_restoration, execute_setup,
2025-11-12 08:26:25 +02:00
execute_subcommand,
};
2025-08-06 14:56:58 +03:00
pub const NUM_THREADS: usize = 2;
2025-11-19 17:33:25 +03:00
// TODO #169: We have sample configs for sequencer, but not for wallet
2025-11-26 00:27:20 +03:00
// TODO #168: Why it requires config as a directory? Maybe better to deduce directory from config
// file path?
// TODO #172: Why it requires config as env var while sequencer_runner accepts as
// argument?
// TODO #171: Running pinata doesn't give output about transaction hash and etc.
2025-08-06 14:56:58 +03:00
fn main() -> Result<()> {
let runtime = Builder::new_multi_thread()
.worker_threads(NUM_THREADS)
.enable_all()
.build()
.unwrap();
let args = Args::parse();
2025-08-07 14:07:34 +03:00
env_logger::init();
2025-08-06 14:56:58 +03:00
runtime.block_on(async move {
if let Some(over_command) = args.command {
match over_command {
2025-11-11 12:15:20 +02:00
OverCommand::Command(command) => {
let _output = execute_subcommand(command).await?;
Ok(())
2025-11-11 12:15:20 +02:00
}
2025-11-11 17:25:08 +02:00
OverCommand::RestoreKeys { password, depth } => {
execute_keys_restoration(password, depth).await
2025-11-11 17:25:08 +02:00
}
OverCommand::Setup { password } => execute_setup(password).await,
2025-11-11 12:15:20 +02:00
}
} else if args.continuous_run {
execute_continuous_run().await
2025-10-15 15:17:30 +03:00
} else {
2025-10-20 10:01:54 +03:00
let help = Args::command().render_long_help();
println!("{help}");
Ok(())
2025-10-15 15:17:30 +03:00
}
})
2025-08-06 14:56:58 +03:00
}