StrictSendPathsRequestBuilder

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

Builds requests connected to strict send paths.

The strict send path finding endpoint lists the possible payment paths that can be taken starting with a specific source asset and amount. This is useful when you know how much you want to send and want to find out what destinations are reachable.

You must specify:

  • Source asset (what you're sending)

  • Source amount (how much you're sending)

  • Either a destination account OR a list of destination assets

Example usage:

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

// Find paths sending 10 XLM to a specific account
val paths = server.strictSendPaths()
.sourceAsset("native")
.sourceAmount("10.0")
.destinationAccount("GCDNJUBQSX7AJWLJACMJ7I4BC3Z47BQUTMHEICZLE6MU4KQBRYG5JY6B")
.execute()

// Find paths sending 100 USD to accounts holding EUR or GBP
val paths2 = server.strictSendPaths()
.sourceAsset("credit_alphanum4", "USD", "ISSUER_ID")
.sourceAmount("100.0")
.destinationAssets(listOf(
Triple("credit_alphanum4", "EUR", "ISSUER_ID"),
Triple("credit_alphanum4", "GBP", "ISSUER_ID")
))
.execute()

See also

Constructors

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

Functions

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

Sets the cursor parameter for pagination.

Link copied to clipboard

Sets the destination account for the path search. Cannot be used together with destinationAssets().

Link copied to clipboard

Sets the list of destination assets for the path search. Cannot be used together with destinationAccount().

Link copied to clipboard
suspend fun execute(): Page<PathResponse>

Build and execute request to get a page of paths.

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

Sets the limit parameter defining maximum number of paths to return.

Link copied to clipboard

Sets the order parameter defining the order in which to return paths.

Link copied to clipboard

Sets the source amount for the path search. This is the amount you want to send.

Link copied to clipboard
fun sourceAsset(assetType: String, assetCode: String? = null, assetIssuer: String? = null): StrictSendPathsRequestBuilder

Sets the source asset for the path search. This is the asset you want to send.

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.