ClaimableBalancesRequestBuilder

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

Builds requests connected to claimable balances.

Claimable balances are used for trustless, non-interactive asset transfers. They can be claimed by the intended destination account(s) when certain conditions are met.

Example usage:

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

// Get a specific claimable balance by ID
val balance = server.claimableBalances()
.claimableBalance("00000000da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be")

// Get claimable balances for a specific sponsor
val sponsoredBalances = server.claimableBalances()
.forSponsor("GCDNJUBQSX7AJWLJACMJ7I4BC3Z47BQUTMHEICZLE6MU4KQBRYG5JY6B")
.limit(20)
.execute()

// Get claimable balances for a specific asset
val assetBalances = server.claimableBalances()
.forAsset("credit_alphanum4", "USD", "GCDNJUBQSX7AJWLJACMJ7I4BC3Z47BQUTMHEICZLE6MU4KQBRYG5JY6B")
.execute()

// Get claimable balances claimable by a specific account
val claimantBalances = server.claimableBalances()
.forClaimant("GBVFTZL5HIPT4PFQVTZVIWR77V7LWYCXU4CLYWWHHOEXB64XPG5LDMTU")
.execute()

See also

Constructors

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

Functions

Link copied to clipboard
suspend fun claimableBalance(claimableBalanceId: String): ClaimableBalanceResponse

Requests a specific claimable balance by ID.

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

Sets the cursor parameter for pagination.

Link copied to clipboard

Build and execute request to get a page of claimable balances.

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

Returns all claimable balances which hold a given asset.

Link copied to clipboard

Returns all claimable balances which can be claimed by a given account ID.

Link copied to clipboard

Returns all claimable balances sponsored by a given account.

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

Sets the limit parameter defining maximum number of claimable balances to return.

Link copied to clipboard

Sets the order parameter defining the order in which to return claimable balances.

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.