substrate_stellar_sdk/xdr/impls/operations/
clawback.rs1use crate::{
2 amount::IntoAmount,
3 types::{ClawbackOp, OperationBody},
4 Asset, IntoAccountId, Operation, StellarSdkError,
5};
6
7impl Operation {
8 pub fn new_clawback<T: IntoAmount, U: IntoAccountId>(
9 asset: Asset,
10 amount: T,
11 from: U,
12 ) -> Result<Operation, StellarSdkError> {
13 Ok(Operation {
14 source_account: None,
15 body: OperationBody::Clawback(ClawbackOp {
16 asset,
17 from: from.into_account_id()?.into(),
18 amount: amount.into_stroop_amount(false)?,
19 }),
20 })
21 }
22}