substrate_stellar_sdk/xdr/impls/operations/
change_trust.rs1use crate::{
2 types::{ChangeTrustAsset, ChangeTrustOp, OperationBody},
3 IntoAmount, Operation, StellarSdkError,
4};
5
6impl Operation {
7 pub fn new_change_trust(line: ChangeTrustAsset) -> Result<Operation, StellarSdkError> {
8 Ok(Operation {
9 source_account: None,
10 body: OperationBody::ChangeTrust(ChangeTrustOp { line, limit: i64::MAX }),
11 })
12 }
13
14 pub fn new_change_trust_with_limit<T: IntoAmount>(
15 line: ChangeTrustAsset,
16 limit: T,
17 ) -> Result<Operation, StellarSdkError> {
18 Ok(Operation {
19 source_account: None,
20 body: OperationBody::ChangeTrust(ChangeTrustOp { line, limit: limit.into_stroop_amount(true)? }),
21 })
22 }
23}