lssa/wallet/src/main.rs

43 lines
1.4 KiB
Rust
Raw Normal View History

2025-08-06 14:56:58 +03:00
use anyhow::Result;
2025-10-20 10:01:54 +03:00
use clap::{CommandFactory, Parser};
2025-08-06 14:56:58 +03:00
use tokio::runtime::Builder;
2025-11-11 12:15:20 +02:00
use wallet::{Args, OverCommand, execute_continious_run, execute_setup, 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 {
2025-11-11 12:15:20 +02:00
if let Some(overcommand) = args.command {
match overcommand {
OverCommand::Command(command) => {
execute_subcommand(command).await.unwrap();
}
OverCommand::Setup { password } => {
execute_setup(password).await.unwrap();
}
}
2025-10-15 15:17:30 +03:00
} else if args.continious_run {
execute_continious_run().await.unwrap();
} else {
2025-10-20 10:01:54 +03:00
let help = Args::command().render_long_help();
println!("{help}");
2025-10-15 15:17:30 +03:00
}
2025-08-06 14:56:58 +03:00
});
Ok(())
}