public class Server
extends java.lang.Object
implements java.io.Closeable
Constructor and Description |
---|
Server(java.lang.String uri)
Constructs a new Server object with default HTTP clients.
|
Server(java.lang.String serverURI,
okhttp3.OkHttpClient httpClient,
okhttp3.OkHttpClient submitHttpClient)
Constructs a new Server object with custom HTTP clients.
|
Modifier and Type | Method and Description |
---|---|
AccountsRequestBuilder |
accounts() |
AssetsRequestBuilder |
assets() |
ClaimableBalancesRequestBuilder |
claimableBalances() |
void |
close() |
EffectsRequestBuilder |
effects() |
FeeStatsRequestBuilder |
feeStats() |
okhttp3.OkHttpClient |
getHttpClient() |
okhttp3.OkHttpClient |
getSubmitHttpClient()
submitHttpClient is used only for submitting transactions.
|
LedgersRequestBuilder |
ledgers() |
LiquidityPoolsRequestBuilder |
liquidityPools() |
TransactionBuilderAccount |
loadAccount(java.lang.String address)
Fetches an account's most current state in the ledger, then creates and returns an
Account object. |
OffersRequestBuilder |
offers() |
OperationsRequestBuilder |
operations() |
OrderBookRequestBuilder |
orderBook() |
PaymentsRequestBuilder |
payments() |
RootRequestBuilder |
root() |
void |
setHttpClient(okhttp3.OkHttpClient httpClient) |
void |
setSubmitHttpClient(okhttp3.OkHttpClient submitHttpClient)
submitHttpClient is used only for submitting transactions.
|
StrictReceivePathsRequestBuilder |
strictReceivePaths() |
StrictSendPathsRequestBuilder |
strictSendPaths() |
TransactionResponse |
submitTransaction(FeeBumpTransaction transaction)
Submits a fee bump transaction to the network
|
TransactionResponse |
submitTransaction(FeeBumpTransaction transaction,
boolean skipMemoRequiredCheck)
Submits a fee bump transaction to the network
|
TransactionResponse |
submitTransaction(Transaction transaction)
Submits a transaction to the network
|
TransactionResponse |
submitTransaction(Transaction transaction,
boolean skipMemoRequiredCheck)
Submits a transaction to the network
|
SubmitTransactionAsyncResponse |
submitTransactionAsync(FeeBumpTransaction transaction)
Submits a base64 asynchronous transaction to the network.
|
SubmitTransactionAsyncResponse |
submitTransactionAsync(FeeBumpTransaction transaction,
boolean skipMemoRequiredCheck)
Submits a base64 asynchronous transaction to the network.
|
SubmitTransactionAsyncResponse |
submitTransactionAsync(Transaction transaction)
Submits a base64 asynchronous transaction to the network.
|
SubmitTransactionAsyncResponse |
submitTransactionAsync(Transaction transaction,
boolean skipMemoRequiredCheck)
Submits a base64 asynchronous transaction to the network.
|
TransactionResponse |
submitTransactionXdr(java.lang.String transactionXdr)
Submits a base64 encoded transaction envelope to the network
|
SubmitTransactionAsyncResponse |
submitTransactionXdrAsync(java.lang.String transactionXdr)
Submits a base64 asynchronous transaction to the network.
|
TradeAggregationsRequestBuilder |
tradeAggregations(Asset baseAsset,
Asset counterAsset,
long startTime,
long endTime,
long resolution,
long offset) |
TradesRequestBuilder |
trades() |
TransactionsRequestBuilder |
transactions() |
public Server(java.lang.String uri)
uri
- The URI of the Horizon server.public Server(java.lang.String serverURI, okhttp3.OkHttpClient httpClient, okhttp3.OkHttpClient submitHttpClient)
serverURI
- The URI of the Horizon server.httpClient
- The OkHttpClient to use for general requests.submitHttpClient
- The OkHttpClient to use for submitting transactions.public TransactionBuilderAccount loadAccount(java.lang.String address)
Account
object.address
- The address of the account to load, muxed accounts are supported.Account
objectNetworkException
- 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 a Timeout
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.public RootRequestBuilder root()
RootRequestBuilder
instance.public AccountsRequestBuilder accounts()
AccountsRequestBuilder
instance.public AssetsRequestBuilder assets()
AssetsRequestBuilder
instance.public ClaimableBalancesRequestBuilder claimableBalances()
ClaimableBalancesRequestBuilder
instance.public EffectsRequestBuilder effects()
EffectsRequestBuilder
instance.public LedgersRequestBuilder ledgers()
LedgersRequestBuilder
instance.public OffersRequestBuilder offers()
OffersRequestBuilder
instance.public OperationsRequestBuilder operations()
OperationsRequestBuilder
instance.public FeeStatsRequestBuilder feeStats()
FeeStatsResponse
instance.public OrderBookRequestBuilder orderBook()
OrderBookRequestBuilder
instance.public TradesRequestBuilder trades()
TradesRequestBuilder
instance.public TradeAggregationsRequestBuilder tradeAggregations(Asset baseAsset, Asset counterAsset, long startTime, long endTime, long resolution, long offset)
TradeAggregationsRequestBuilder
instance.public StrictReceivePathsRequestBuilder strictReceivePaths()
StrictReceivePathsRequestBuilder
instance.public StrictSendPathsRequestBuilder strictSendPaths()
StrictSendPathsRequestBuilder
instance.public PaymentsRequestBuilder payments()
PaymentsRequestBuilder
instance.public TransactionsRequestBuilder transactions()
TransactionsRequestBuilder
instance.public LiquidityPoolsRequestBuilder liquidityPools()
LiquidityPoolsRequestBuilder
instance.public TransactionResponse submitTransactionXdr(java.lang.String transactionXdr)
transactionXdr
- base64 encoded transaction envelope to submit to the networkTransactionResponse
AccountRequiresMemoException
- when a transaction is trying to submit an operation to an
account which requires a memo.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 a Timeout
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.public TransactionResponse submitTransaction(Transaction transaction, boolean skipMemoRequiredCheck)
transaction
- transaction to submit to the networkskipMemoRequiredCheck
- set to true to skip memoRequiredCheckTransactionResponse
AccountRequiresMemoException
- when a transaction is trying to submit an operation to an
account which requires a memo.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 a Timeout
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.public TransactionResponse submitTransaction(FeeBumpTransaction transaction, boolean skipMemoRequiredCheck)
transaction
- transaction to submit to the networkskipMemoRequiredCheck
- set to true to skip memoRequiredCheckTransactionResponse
AccountRequiresMemoException
- when a transaction is trying to submit an operation to an
account which requires a memo.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 a Timeout
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.public TransactionResponse submitTransaction(Transaction transaction)
This function will always check if the destination account requires a memo in the
transaction as defined in SEP-0029 If you want to skip this check, use submitTransaction(Transaction, boolean)
.
transaction
- transaction to submit to the network.TransactionResponse
AccountRequiresMemoException
- when a transaction is trying to submit an operation to an
account which requires a memo.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 a Timeout
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.public TransactionResponse submitTransaction(FeeBumpTransaction transaction)
This function will always check if the destination account requires a memo in the
transaction as defined in SEP-0029 If you want to skip this check, use submitTransaction(Transaction, boolean)
.
transaction
- transaction to submit to the network.TransactionResponse
AccountRequiresMemoException
- when a transaction is trying to submit an operation to an
account which requires a memo.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 a Timeout
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.public SubmitTransactionAsyncResponse submitTransactionXdrAsync(java.lang.String transactionXdr)
transactionXdr
- base64 encoded transaction envelope to submit to the networkSubmitTransactionAsyncResponse
AccountRequiresMemoException
- when a transaction is trying to submit an operation to an
account which requires a memo.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 a Timeout
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.public SubmitTransactionAsyncResponse submitTransactionAsync(Transaction transaction, boolean skipMemoRequiredCheck)
transaction
- transaction to submit to the networkskipMemoRequiredCheck
- set to true to skip memoRequiredCheckTransactionResponse
AccountRequiresMemoException
- when a transaction is trying to submit an operation to an
account which requires a memo.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 a Timeout
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.public SubmitTransactionAsyncResponse submitTransactionAsync(FeeBumpTransaction transaction, boolean skipMemoRequiredCheck)
transaction
- transaction to submit to the networkskipMemoRequiredCheck
- set to true to skip memoRequiredCheckSubmitTransactionAsyncResponse
AccountRequiresMemoException
- when a transaction is trying to submit an operation to an
account which requires a memo.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 a Timeout
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.public SubmitTransactionAsyncResponse submitTransactionAsync(Transaction transaction)
This function will always check if the destination account requires a memo in the
transaction as defined in SEP-0029 If you want to skip this check, use submitTransactionAsync(Transaction, boolean)
.
transaction
- transaction to submit to the network.SubmitTransactionAsyncResponse
AccountRequiresMemoException
- when a transaction is trying to submit an operation to an
account which requires a memo.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 a Timeout
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.public SubmitTransactionAsyncResponse submitTransactionAsync(FeeBumpTransaction transaction)
This function will always check if the destination account requires a memo in the
transaction as defined in SEP-0029 If you want to skip this check, use submitTransactionAsync(Transaction, boolean)
.
transaction
- transaction to submit to the network.SubmitTransactionAsyncResponse
AccountRequiresMemoException
- when a transaction is trying to submit an operation to an
account which requires a memo.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 a Timeout
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.public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public okhttp3.OkHttpClient getHttpClient()
public void setHttpClient(okhttp3.OkHttpClient httpClient)
public okhttp3.OkHttpClient getSubmitHttpClient()
public void setSubmitHttpClient(okhttp3.OkHttpClient submitHttpClient)