PathPaymentOperation
public class PathPaymentOperation : Operation, @unchecked Sendable
Represents a path payment operation. Sends an amount in a specific asset to a destination account through a path of offers. This allows the asset sent (e.g., 450 XLM) to be different from the asset received (e.g, 6 BTC). See Stellar developer docs
-
The asset deducted from the sender’s account.
Declaration
Swift
public let sendAsset: Asset -
The maximum amount of send asset to deduct, excluding fees.
Declaration
Swift
public let sendMax: Decimal -
The destination account that receives the payment.
Declaration
Swift
public let destinationAccountId: String -
The asset the destination account receives.
Declaration
Swift
public let destAsset: Asset -
The amount of destination asset the destination account receives.
Declaration
Swift
public let destAmount: Decimal -
The assets involved in the offers the path takes. Maximum of 5 assets.
Declaration
Swift
public let path: [Asset] -
Creates a new PathPaymentOperation object.
Throws
Throws StellarSDKError.invalidArgument if maximum number of assets in the path is > 5
Declaration
Parameters
sourceAccountId(optional) source account Id, must be valid, otherwise it will be ignored.
sendAssetThe asset deducted from the sender’s account.
sendMaxThe maximum amount of send asset to deduct (excluding fees).
destinationAccountIdAccount address that receives the payment, must be valid, otherwise this will throw an exception.
destAssetThe asset the destination account receives.
destAmountThe amount of destination asset the destination account receives.
pathThe assets (other than send asset and destination asset) involved in the offers the path takes. For example, if you can only find a path from USD to EUR through XLM and BTC, the path would be USD -> XLM -> BTC -> EUR and the path field would contain XLM and BTC. The maximum number of assets in the path is 5
-
Creates a new PathPaymentOperation object from the given PathPaymentOperationXDR object.
Declaration
Swift
public init(fromXDR: PathPaymentOperationXDR, sourceAccountId: String?)Parameters
fromXDRthe PathPaymentOperationXDR object to be used to create a new PathPaymentOperation object.
sourceAccountId(optional) source account Id, must be valid, otherwise it will be ignored.
View on GitHub
Install in Dash