LiquidityPoolResponse
extends Response
in package
Represents a liquidity pool on the Stellar network
This response contains comprehensive liquidity pool details including the pool ID, pool type, fee structure, asset reserves, total shares, trustline count, and modification history. Liquidity pools are automated market makers (AMMs) that enable decentralized trading by allowing users to deposit assets and earn fees from trades.
Key fields:
- Unique pool ID for identification
- Pool type (currently constant_product)
- Fee charged in basis points
- Asset reserves held in the pool
- Total shares representing pool ownership
- Number of trustlines to the pool
- Ledger modification history
Returned by Horizon endpoints:
- GET /liquidity_pools - All liquidity pools
- GET /liquidity_pools/{liquidity_pool_id} - Specific pool details
- GET /accounts/{account_id}/liquidity_pools - Pools an account participates in
Tags
Table of Contents
Properties
- $httpClient : Client|null
- $rateLimitLimit : int|null
- $rateLimitRemaining : int|null
- $rateLimitReset : int|null
Methods
- fromJson() : LiquidityPoolResponse
- getFee() : int
- Gets the fee charged by this pool on trades
- getHttpClient() : Client|null
- Gets the HTTP client used for pagination requests
- getLastModifiedLedger() : int
- Gets the ledger sequence number when this pool was last modified
- getLastModifiedTime() : string
- Gets the timestamp when this pool was last modified
- getLinks() : LiquidityPoolLinksResponse
- Gets the links to related resources for this liquidity pool
- getPagingToken() : string
- Gets the paging token for this liquidity pool in list results
- getPoolId() : string
- Gets the unique identifier for this liquidity pool
- getRateLimitLimit() : int|null
- Returns X-RateLimit-Limit header from the response.
- getRateLimitRemaining() : int|null
- Returns X-RateLimit-Remaining header from the response.
- getRateLimitReset() : int|null
- Returns X-RateLimit-Reset header from the response. Seconds until a new window starts.
- getReserves() : ReservesResponse
- Gets the asset reserves held in this pool
- getTotalShares() : string
- Gets the total pool shares issued
- getTotalTrustlines() : string
- Gets the total number of trustlines to this pool
- getType() : string
- Gets the liquidity pool type
- setHeaders() : void
- Extracts and sets rate limiting information from HTTP response headers
- setHttpClient() : void
- Sets the HTTP client for making follow-up requests
- loadFromJson() : void
- Loads response data from a JSON array
Properties
$httpClient
protected
Client|null
$httpClient
= null
$rateLimitLimit
protected
int|null
$rateLimitLimit
= null
$rateLimitRemaining
protected
int|null
$rateLimitRemaining
= null
$rateLimitReset
protected
int|null
$rateLimitReset
= null
Methods
fromJson()
public
static fromJson(array<string|int, mixed> $json) : LiquidityPoolResponse
Parameters
- $json : array<string|int, mixed>
Return values
LiquidityPoolResponsegetFee()
Gets the fee charged by this pool on trades
public
getFee() : int
Return values
int —The fee in basis points (e.g., 30 = 0.3%)
getHttpClient()
Gets the HTTP client used for pagination requests
public
getHttpClient() : Client|null
Return values
Client|null —The HTTP client instance, or null if not set
getLastModifiedLedger()
Gets the ledger sequence number when this pool was last modified
public
getLastModifiedLedger() : int
Return values
int —The last modified ledger sequence
getLastModifiedTime()
Gets the timestamp when this pool was last modified
public
getLastModifiedTime() : string
Return values
string —The last modified time in ISO 8601 format
getLinks()
Gets the links to related resources for this liquidity pool
public
getLinks() : LiquidityPoolLinksResponse
Return values
LiquidityPoolLinksResponse —The navigation links
getPagingToken()
Gets the paging token for this liquidity pool in list results
public
getPagingToken() : string
Return values
string —The paging token used for cursor-based pagination
getPoolId()
Gets the unique identifier for this liquidity pool
public
getPoolId() : string
Return values
string —The liquidity pool ID
getRateLimitLimit()
Returns X-RateLimit-Limit header from the response.
public
getRateLimitLimit() : int|null
This number represents the he maximum number of requests that the current client can make in one hour.
Tags
Return values
int|nullgetRateLimitRemaining()
Returns X-RateLimit-Remaining header from the response.
public
getRateLimitRemaining() : int|null
The number of remaining requests for the current window.
Tags
Return values
int|nullgetRateLimitReset()
Returns X-RateLimit-Reset header from the response. Seconds until a new window starts.
public
getRateLimitReset() : int|null
Tags
Return values
int|nullgetReserves()
Gets the asset reserves held in this pool
public
getReserves() : ReservesResponse
Return values
ReservesResponse —The pool's asset reserves
getTotalShares()
Gets the total pool shares issued
public
getTotalShares() : string
Return values
string —The total shares representing ownership in the pool
getTotalTrustlines()
Gets the total number of trustlines to this pool
public
getTotalTrustlines() : string
Return values
string —The count of accounts with trustlines to this pool
getType()
Gets the liquidity pool type
public
getType() : string
Return values
string —The pool type (e.g., "constant_product")
setHeaders()
Extracts and sets rate limiting information from HTTP response headers
public
setHeaders(array<string|int, mixed> $headers) : void
This method processes the X-Ratelimit-* headers from the HTTP response and stores them for client access.
Parameters
- $headers : array<string|int, mixed>
-
Associative array of HTTP headers from the response
setHttpClient()
Sets the HTTP client for making follow-up requests
public
setHttpClient([Client|null $httpClient = null ]) : void
Paginated responses contain links to next/previous pages. This HTTP client is used when following those links to fetch additional pages.
Parameters
- $httpClient : Client|null = null
-
The Guzzle HTTP client to use for pagination
loadFromJson()
Loads response data from a JSON array
protected
loadFromJson(array<string|int, mixed> $json) : void
This method is used internally to populate response objects from parsed JSON. Subclasses override this to extract their specific data fields.
Parameters
- $json : array<string|int, mixed>
-
Associative array of parsed JSON data