cli/commands/wallet/
mod.rs1pub mod address;
2pub mod balance;
3pub mod generate;
4pub mod send;
5pub mod status;
6
7use super::Network;
8use crate::exit_with_error;
9
10#[derive(Debug, clap::Args)]
11pub struct Wallet {
12 #[command(subcommand)]
13 pub command: WalletCommand,
14}
15
16#[derive(Debug, clap::Subcommand)]
17pub enum WalletCommand {
18 Address(address::Address),
20 Balance(balance::Balance),
22 Generate(generate::Generate),
24 Send(send::Send),
26 Status(status::Status),
28}
29
30impl Wallet {
31 pub fn run(self, network: Network) -> anyhow::Result<()> {
32 let result = match self.command {
33 WalletCommand::Address(cmd) => cmd.run(),
34 WalletCommand::Balance(cmd) => cmd.run(),
35 WalletCommand::Generate(cmd) => cmd.run(),
36 WalletCommand::Send(cmd) => cmd.run(network),
37 WalletCommand::Status(cmd) => cmd.run(),
38 };
39
40 if let Err(err) = result {
42 exit_with_error(err);
43 }
44
45 Ok(())
46 }
47}