soroban_cli/commands/tx/new/
create_account.rs1use clap::Parser;
2
3use crate::{commands::tx, config::address, tx::builder, xdr};
4
5#[derive(Parser, Debug, Clone)]
6#[group(skip)]
7pub struct Cmd {
8 #[command(flatten)]
9 pub tx: tx::Args,
10 #[clap(flatten)]
11 pub op: Args,
12}
13
14#[derive(Debug, clap::Args, Clone)]
15pub struct Args {
16 #[arg(long)]
18 pub destination: address::UnresolvedMuxedAccount,
19 #[arg(long, default_value = "10_000_000")]
21 pub starting_balance: builder::Amount,
22}
23
24impl TryFrom<&Cmd> for xdr::OperationBody {
25 type Error = tx::args::Error;
26 fn try_from(cmd: &Cmd) -> Result<Self, Self::Error> {
27 Ok(xdr::OperationBody::CreateAccount(xdr::CreateAccountOp {
28 destination: cmd.tx.resolve_account_id(&cmd.op.destination)?,
29 starting_balance: cmd.op.starting_balance.into(),
30 }))
31 }
32}