2025-08-06 14:56:58 +03:00
|
|
|
use anyhow::Result;
|
2025-11-27 22:07:53 +03:00
|
|
|
use clap::{CommandFactory as _, Parser as _};
|
2025-08-06 14:56:58 +03:00
|
|
|
use tokio::runtime::Builder;
|
2025-12-10 08:46:39 +02:00
|
|
|
use wallet::cli::{Args, execute_continuous_run_with_auth, execute_subcommand_with_auth};
|
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
|
2025-11-27 22:07:53 +03:00
|
|
|
// file path?
|
|
|
|
|
// TODO #172: Why it requires config as env var while sequencer_runner accepts as
|
|
|
|
|
// argument?
|
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 {
|
2025-12-03 13:10:07 +02:00
|
|
|
if let Some(command) = args.command {
|
2025-12-10 08:46:39 +02:00
|
|
|
let _output = execute_subcommand_with_auth(command, args.auth).await?;
|
2025-12-03 13:10:07 +02:00
|
|
|
Ok(())
|
2025-11-30 03:16:47 +03:00
|
|
|
} else if args.continuous_run {
|
2025-12-08 18:26:35 +03:00
|
|
|
execute_continuous_run_with_auth(args.auth).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}");
|
2025-11-27 22:07:53 +03:00
|
|
|
Ok(())
|
2025-10-15 15:17:30 +03:00
|
|
|
}
|
2025-11-27 22:07:53 +03:00
|
|
|
})
|
2025-08-06 14:56:58 +03:00
|
|
|
}
|