substrate_stellar_sdk/xdr/impls/operations/
create_passive_sell_offer.rs

1use crate::{
2    types::{CreatePassiveSellOfferOp, OperationBody},
3    Asset, IntoAmount, Operation, Price, StellarSdkError,
4};
5
6impl Operation {
7    pub fn new_create_passive_sell_offser<S: IntoAmount>(
8        selling: Asset,
9        buying: Asset,
10        amount: S,
11        price: Price,
12    ) -> Result<Operation, StellarSdkError> {
13        Ok(Operation {
14            source_account: None,
15            body: OperationBody::CreatePassiveSellOffer(CreatePassiveSellOfferOp {
16                selling,
17                buying,
18                amount: amount.into_stroop_amount(false)?,
19                price,
20            }),
21        })
22    }
23}