substrate_stellar_sdk/xdr/impls/operations/
payment.rs

1use crate::{
2    types::{OperationBody, PaymentOp},
3    Asset, IntoAmount, IntoMuxedAccountId, Operation, StellarSdkError,
4};
5
6impl Operation {
7    pub fn new_payment<S: IntoMuxedAccountId, U: IntoAmount>(
8        destination: S,
9        asset: Asset,
10        amount: U,
11    ) -> Result<Operation, StellarSdkError> {
12        Ok(Operation {
13            source_account: None,
14            body: OperationBody::Payment(PaymentOp {
15                destination: destination.into_muxed_account_id()?,
16                asset,
17                amount: amount.into_stroop_amount(false)?,
18            }),
19        })
20    }
21}