Package org.stellar.sdk.requests
Class TransactionsRequestBuilder
java.lang.Object
org.stellar.sdk.requests.RequestBuilder
org.stellar.sdk.requests.TransactionsRequestBuilder
Builds requests connected to transactions.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.stellar.sdk.requests.RequestBuilder
RequestBuilder.Order
-
Constructor Summary
ConstructorDescriptionTransactionsRequestBuilder
(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl serverURI) -
Method Summary
Modifier and TypeMethodDescriptionSetscursor
parameter on the request.execute()
Build and execute request.static Page
<TransactionResponse> execute
(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl uri) forAccount
(@NonNull String account) Builds request toGET /accounts/{account}/transactions
forClaimableBalance
(@NonNull String claimableBalance) Builds request toGET /claimable_balances/{claimable_balance_id}/transactions
forLedger
(long ledgerSeq) Builds request toGET /ledgers/{ledgerSeq}/transactions
forLiquidityPool
(String liquidityPoolId) Builds request toGET /liquidity_pools/{ledgerSeq}/transactions
includeFailed
(boolean value) Adds a parameter defining whether to include failed transactions.limit
(int number) Setslimit
parameter on the request.order
(RequestBuilder.Order direction) Setsorder
parameter on the request.stream
(EventListener<TransactionResponse> listener) An overloaded version ofstream(EventListener, long)
with default reconnect timeout.stream
(EventListener<TransactionResponse> listener, long reconnectTimeout) Allows to stream SSE events from horizon.transaction
(String transactionId) RequestsGET /transactions/{transactionId}
transaction
(okhttp3.HttpUrl uri) Requests specificuri
and returnsTransactionResponse
.Methods inherited from class org.stellar.sdk.requests.RequestBuilder
setAssetParameter, setAssetsParameter
-
Constructor Details
-
TransactionsRequestBuilder
public TransactionsRequestBuilder(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl serverURI)
-
-
Method Details
-
transaction
Requests specificuri
and returnsTransactionResponse
. This method is helpful for getting the links.- Returns:
TransactionResponse
- Throws:
NetworkException
- All the exceptions below are subclasses of NetworkErrorBadRequestException
- if the request fails due to a bad request (4xx)BadResponseException
- if the request fails due to a bad response from the server (5xx)TooManyRequestsException
- if the request fails due to too many requests sent to the serverRequestTimeoutException
- When Horizon returns aTimeout
or connection timeout occurredUnknownResponseException
- if the server returns an unknown status codeConnectionErrorException
- When the request cannot be executed due to cancellation or connectivity problems, etc.
-
transaction
RequestsGET /transactions/{transactionId}
- Parameters:
transactionId
- Transaction to fetch- Returns:
TransactionResponse
- Throws:
NetworkException
- All the exceptions below are subclasses of NetworkErrorBadRequestException
- if the request fails due to a bad request (4xx)BadResponseException
- if the request fails due to a bad response from the server (5xx)TooManyRequestsException
- if the request fails due to too many requests sent to the serverRequestTimeoutException
- When Horizon returns aTimeout
or connection timeout occurredUnknownResponseException
- if the server returns an unknown status codeConnectionErrorException
- When the request cannot be executed due to cancellation or connectivity problems, etc.- See Also:
-
forAccount
Builds request toGET /accounts/{account}/transactions
- Parameters:
account
- Account for which to get transactions- See Also:
-
forClaimableBalance
Builds request toGET /claimable_balances/{claimable_balance_id}/transactions
- Parameters:
claimableBalance
- Claimable Balance for which to get transactions- See Also:
-
forLedger
Builds request toGET /ledgers/{ledgerSeq}/transactions
- Parameters:
ledgerSeq
- Ledger for which to get transactions- See Also:
-
forLiquidityPool
Builds request toGET /liquidity_pools/{ledgerSeq}/transactions
- Parameters:
liquidityPoolId
- Liquidity pool for which to get transactions- See Also:
-
includeFailed
Adds a parameter defining whether to include failed transactions. By default only successful transactions are returned.- Parameters:
value
- Set totrue
to include failed transactions.
-
execute
public static Page<TransactionResponse> execute(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl uri) - Parameters:
httpClient
-OkHttpClient
to use to send the request.uri
-HttpUrl
URI to send the request to.- Returns:
Page
ofTransactionResponse
- Throws:
NetworkException
- All the exceptions below are subclasses of NetworkErrorBadRequestException
- if the request fails due to a bad request (4xx)BadResponseException
- if the request fails due to a bad response from the server (5xx)TooManyRequestsException
- if the request fails due to too many requests sent to the serverRequestTimeoutException
- When Horizon returns aTimeout
or connection timeout occurredUnknownResponseException
- if the server returns an unknown status codeConnectionErrorException
- When the request cannot be executed due to cancellation or connectivity problems, etc.
-
stream
public SSEStream<TransactionResponse> stream(EventListener<TransactionResponse> listener, long reconnectTimeout) Allows to stream SSE events from horizon. Certain endpoints in Horizon can be called in streaming mode using Server-Sent Events. This mode will keep the connection to horizon open and horizon will continue to return responses as ledgers close.- Parameters:
listener
-EventListener
implementation withTransactionResponse
typereconnectTimeout
- Custom stream connection timeout in ms- Returns:
- EventSource object, so you can
close()
connection when not needed anymore - See Also:
-
stream
An overloaded version ofstream(EventListener, long)
with default reconnect timeout. -
execute
Build and execute request.- Returns:
Page
ofTransactionResponse
- Throws:
NetworkException
- All the exceptions below are subclasses of NetworkErrorBadRequestException
- if the request fails due to a bad request (4xx)BadResponseException
- if the request fails due to a bad response from the server (5xx)TooManyRequestsException
- if the request fails due to too many requests sent to the serverRequestTimeoutException
- When Horizon returns aTimeout
or connection timeout occurredUnknownResponseException
- if the server returns an unknown status codeConnectionErrorException
- When the request cannot be executed due to cancellation or connectivity problems, etc.
-
cursor
Description copied from class:RequestBuilder
Setscursor
parameter on the request. A cursor is a value that points to a specific location in a collection of resources. The cursor attribute itself is an opaque value meaning that users should not try to parse it.- Overrides:
cursor
in classRequestBuilder
- Parameters:
token
- A cursor is a value that points to a specific location in a collection of resources.- See Also:
-
limit
Description copied from class:RequestBuilder
Setslimit
parameter on the request. It defines maximum number of records to return. For range and default values check documentation of the endpoint requested.- Overrides:
limit
in classRequestBuilder
- Parameters:
number
- maxium number of records to return
-
order
Description copied from class:RequestBuilder
Setsorder
parameter on the request.- Overrides:
order
in classRequestBuilder
- Parameters:
direction
-RequestBuilder.Order
-