Swap
A Stellar path-payment swap. Solana and Monad swaps are ChainSwap. Wraps the raw API payload with typed accessors and atomic action methods so you can operate…
A Stellar path-payment swap. Solana and Monad swaps are {@link ChainSwap}. Wraps the raw API payload with typed accessors and atomic action methods so you can operate on it directly: await swap.fetch(), await swap.submit({ signedXdr }).
Constructor
Swap
constructor(client: Client, data: SwapData)Parameters
client:Clientdata:SwapData
Properties
status
status: SwapStatusnetwork
network: stringsource
Account performing the swap.
source: stringdestination
Account that receives the swapped asset.
destination: stringsendAsset
Asset code being sent, or native for XLM.
sendAsset: stringsendAssetIssuer
sendAssetIssuer: string | nullsendAmount
sendAmount: stringfeeAmount
feeAmount: stringfeeBps
feeBps: numberswapAmount
Amount swapped after the fee is deducted.
swapAmount: stringdestAsset
Asset code being received, or native for XLM.
destAsset: stringdestAssetIssuer
destAssetIssuer: string | nulldestEstimated
destEstimated: stringdestMin
destMin: stringslippageBps
slippageBps: numberpath
path: { code: stringissuer
issuer: string | nullmember
}[]memo
memo: string | nullxdr
Unsigned transaction envelope (base64 XDR).
xdr: stringuri
SEP-7 deep link.
uri: stringtxHash
txHash: stringqr
QR code of the SEP-7 URI (PNG data URL).
qr: stringcreatedAt
createdAt: DateupdatedAt
updatedAt: Dateprotected
protected _patch(data: SwapData): thisget
Whether the swap has settled on-chain.
get isSucceeded(): booleanget
Whether the swap is still awaiting submission.
get isPending(): booleanget
Human-readable send asset label (XLM for native).
get sendAssetLabel(): stringget
Human-readable destination asset label (XLM for native).
get destAssetLabel(): stringsubmit
Relay the signed transaction for this swap. Mutates this instance from the refreshed swap in the outcome and returns the outcome.
submit(options: { signedXdr: stringmember
}): Promise<SwapSubmitOutcome>Methods
fetch()
Re-fetch this swap from the API, returning a fresh instance.
fetch(): Promise<Swap>Returns Promise<Swap>
toJSON()
toJSON(): SwapDataReturns SwapData