LiquidityPoolsRequestBuilder

class LiquidityPoolsRequestBuilder(httpClient: HttpClient, serverUri: Url) : RequestBuilder

Builds requests connected to liquidity pools.

Liquidity pools enable automated market makers (AMMs) on the Stellar network, allowing users to deposit assets and earn fees from trades.

Example usage:

val server = HorizonServer("https://horizon.stellar.org")

// Get a specific liquidity pool by ID
val pool = server.liquidityPools()
.liquidityPool("67260c4c1807b262ff851b0a3fe141194936bb0215b2f77447f1df11998eabb9")

// Get liquidity pools for specific reserves
val pools = server.liquidityPools()
.forReserves(
"EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S",
"native"
)
.limit(20)
.execute()

// Get liquidity pools an account is participating in
val accountPools = server.liquidityPools()
.forAccount("GCDNJUBQSX7AJWLJACMJ7I4BC3Z47BQUTMHEICZLE6MU4KQBRYG5JY6B")
.execute()

See also

Constructors

Link copied to clipboard
constructor(httpClient: HttpClient, serverUri: Url)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun cursor(cursor: String): LiquidityPoolsRequestBuilder

Sets the cursor parameter for pagination.

Link copied to clipboard

Build and execute request to get a page of liquidity pools.

Link copied to clipboard

Returns all liquidity pools the specified account is participating in.

Link copied to clipboard

Returns all liquidity pools that contain reserves in all specified assets.

Link copied to clipboard
open override fun limit(number: Int): LiquidityPoolsRequestBuilder

Sets the limit parameter defining maximum number of liquidity pools to return.

Link copied to clipboard
suspend fun liquidityPool(liquidityPoolId: String): LiquidityPoolResponse

Requests a specific liquidity pool by ID.

Link copied to clipboard

Sets the order parameter defining the order in which to return liquidity pools.

Link copied to clipboard
fun <T : Response> stream(serializer: KSerializer<T>, listener: EventListener<T>, reconnectTimeout: Duration = SSEStream.DEFAULT_RECONNECT_TIMEOUT): SSEStream<T>

Creates a Server-Sent Events (SSE) stream for this request. The stream will automatically reconnect on connection loss and resume from the last received event.