substrate_stellar_sdk/xdr/impls/operations/
create_account.rs

1use crate::{
2    types::{CreateAccountOp, OperationBody},
3    IntoAccountId, IntoAmount, Operation, StellarSdkError,
4};
5
6impl Operation {
7    pub fn new_create_account<T: IntoAccountId, U: IntoAmount>(
8        destination: T,
9        starting_balance: U,
10    ) -> Result<Operation, StellarSdkError> {
11        Ok(Operation {
12            source_account: None,
13            body: OperationBody::CreateAccount(CreateAccountOp {
14                destination: destination.into_account_id()?,
15                starting_balance: starting_balance.into_stroop_amount(true)?,
16            }),
17        })
18    }
19}