PathResponse
in package
Represents a payment path for asset conversion on Stellar network
This response contains details about a possible path for converting one asset to another through the Stellar network. Path payments enable sending one asset while the recipient receives a different asset, with automatic conversion through intermediate asset pairs.
Key fields:
- Source asset and amount required to send
- Destination asset and amount that will be received
- Ordered sequence of intermediate assets forming the conversion path
- Navigation links to related resources
The path represents the most efficient route found by Horizon for the desired conversion, considering available offers and liquidity pools. Multiple paths may be returned for the same conversion, allowing clients to choose based on amounts or other criteria.
Returned by Horizon endpoints:
- GET /paths/strict-receive - Find paths for receiving a specific amount
- GET /paths/strict-send - Find paths for sending a specific amount
Tags
Table of Contents
Methods
- fromJson() : PathResponse
- Creates a PathResponse from JSON data
- getDestinationAmount() : string
- Gets the amount of destination asset that will be received
- getDestinationAssetCode() : string|null
- Gets the destination asset code
- getDestinationAssetIssuer() : string|null
- Gets the destination asset issuer account
- getDestinationAssetType() : string
- Gets the destination asset type
- getLinks() : PathLinksResponse
- Gets the navigation links for this payment path
- getPath() : PathAssetsResponse
- Gets the ordered sequence of intermediate assets in the conversion path
- getSourceAmount() : string
- Gets the amount of source asset required for this path
- getSourceAssetCode() : string|null
- Gets the source asset code
- getSourceAssetIssuer() : string|null
- Gets the source asset issuer account
- getSourceAssetType() : string
- Gets the source asset type
- loadFromJson() : void
Methods
fromJson()
Creates a PathResponse from JSON data
public
static fromJson(array<string|int, mixed> $json) : PathResponse
Parameters
- $json : array<string|int, mixed>
-
Associative array of parsed JSON response
Return values
PathResponse —The populated path response
getDestinationAmount()
Gets the amount of destination asset that will be received
public
getDestinationAmount() : string
Return values
string —The destination amount
getDestinationAssetCode()
Gets the destination asset code
public
getDestinationAssetCode() : string|null
Return values
string|null —The asset code, or null for native XLM
getDestinationAssetIssuer()
Gets the destination asset issuer account
public
getDestinationAssetIssuer() : string|null
Return values
string|null —The issuer account ID, or null for native XLM
getDestinationAssetType()
Gets the destination asset type
public
getDestinationAssetType() : string
Return values
string —The asset type (native, credit_alphanum4, or credit_alphanum12)
getLinks()
Gets the navigation links for this payment path
public
getLinks() : PathLinksResponse
Return values
PathLinksResponse —The HAL links
getPath()
Gets the ordered sequence of intermediate assets in the conversion path
public
getPath() : PathAssetsResponse
Return values
PathAssetsResponse —The collection of intermediate assets
getSourceAmount()
Gets the amount of source asset required for this path
public
getSourceAmount() : string
Return values
string —The source amount
getSourceAssetCode()
Gets the source asset code
public
getSourceAssetCode() : string|null
Return values
string|null —The asset code, or null for native XLM
getSourceAssetIssuer()
Gets the source asset issuer account
public
getSourceAssetIssuer() : string|null
Return values
string|null —The issuer account ID, or null for native XLM
getSourceAssetType()
Gets the source asset type
public
getSourceAssetType() : string
Return values
string —The asset type (native, credit_alphanum4, or credit_alphanum12)
loadFromJson()
protected
loadFromJson(array<string|int, mixed> $json) : void
Parameters
- $json : array<string|int, mixed>