PaginationOptions

public final class PaginationOptions : Sendable

Pagination settings for Soroban RPC queries that return large result sets.

Use PaginationOptions to control the number of results returned and to navigate through multiple pages of results.

Parameters:

  • cursor: Continuation token from a previous response (for fetching next page)
  • limit: Maximum number of results to return per request

Example:

// Fetch first page with limit
let firstPageOptions = PaginationOptions(limit: 100)
let response1 = await server.getEvents(
    startLedger: 1000000,
    paginationOptions: firstPageOptions
)

// Fetch next page using cursor from first response
if let cursor = response1.cursor {
    let nextPageOptions = PaginationOptions(
        cursor: cursor,
        limit: 100
    )
    let response2 = await server.getEvents(
        startLedger: 1000000,
        paginationOptions: nextPageOptions
    )
}

See also:

  • [SorobanServer.getEvents] for event queries
  • [SorobanServer.getTransactions] for transaction queries
  • [SorobanServer.getLedgers] for ledger queries
  • Pagination cursor from previous response for retrieving the next page of results.

    Declaration

    Swift

    public let cursor: String?
  • Maximum number of records to return per page.

    Declaration

    Swift

    public let limit: Int?
  • Creates pagination options for limiting and offsetting query results.

    Declaration

    Swift

    public init(cursor: String? = nil, limit: Int? = nil)
  • Converts pagination options into request parameters for the Soroban RPC API.

    Declaration

    Swift

    public func buildRequestParams() -> [String : Any]