@cosmosapp/pay_sdkDefinitionenServer

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: Client
  • data: SwapData

Properties

status

status: SwapStatus

network

network: string

source

Account performing the swap.

source: string

destination

Account that receives the swapped asset.

destination: string

sendAsset

Asset code being sent, or native for XLM.

sendAsset: string

sendAssetIssuer

sendAssetIssuer: string | null

sendAmount

sendAmount: string

feeAmount

feeAmount: string

feeBps

feeBps: number

swapAmount

Amount swapped after the fee is deducted.

swapAmount: string

destAsset

Asset code being received, or native for XLM.

destAsset: string

destAssetIssuer

destAssetIssuer: string | null

destEstimated

destEstimated: string

destMin

destMin: string

slippageBps

slippageBps: number

path

path: { code: string

issuer

issuer: string | null

member

}[]

memo

memo: string | null

xdr

Unsigned transaction envelope (base64 XDR).

xdr: string

uri

SEP-7 deep link.

uri: string

txHash

txHash: string

qr

QR code of the SEP-7 URI (PNG data URL).

qr: string

createdAt

createdAt: Date

updatedAt

updatedAt: Date

protected

protected _patch(data: SwapData): this

get

Whether the swap has settled on-chain.

get isSucceeded(): boolean

get

Whether the swap is still awaiting submission.

get isPending(): boolean

get

Human-readable send asset label (XLM for native).

get sendAssetLabel(): string

get

Human-readable destination asset label (XLM for native).

get destAssetLabel(): string

submit

Relay the signed transaction for this swap. Mutates this instance from the refreshed swap in the outcome and returns the outcome.

submit(options: { signedXdr: string

member

}): Promise<SwapSubmitOutcome>

Methods

fetch()

Re-fetch this swap from the API, returning a fresh instance.

fetch(): Promise<Swap>

Returns Promise<Swap>

toJSON()

toJSON(): SwapData

Returns SwapData

Auf dieser Seite