Package org.stellar.sdk.federation
Class Federation
java.lang.Object
org.stellar.sdk.federation.Federation
Helper class for resolving Stellar addresses
- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a newFederation
instance with a defaultOkHttpClient
.Federation
(okhttp3.OkHttpClient httpClient) Creates a newFederation
instance. -
Method Summary
Modifier and TypeMethodDescriptionresolveAccountId
(String accountId, String domain) Resolves the given Stellar account ID to federation record if the user was found for a given Stellar account ID.resolveAddress
(String address) Resolves the given address to federation record if the user was found for a given Stellar address.
-
Constructor Details
-
Federation
public Federation(okhttp3.OkHttpClient httpClient) Creates a newFederation
instance.- Parameters:
httpClient
- OkHttpClient
-
Federation
public Federation()Creates a newFederation
instance with a defaultOkHttpClient
.
-
-
Method Details
-
resolveAddress
Resolves the given address to federation record if the user was found for a given Stellar address.- Parameters:
address
- Stellar address (e.g. `bob*stellar.org`).- Returns:
- FederationResponse
- Throws:
IllegalArgumentException
- Address is malformedNetworkException
- All the exceptions below are subclasses of NetworkErrorNotFoundException
- Stellar address not found in the federation serverStellarTomlNotFoundInvalidException
- Stellar.toml file not found or invalidNoFederationServerException
- No federation server defined in stellar.toml fileFederationServerInvalidException
- Federation server is invalidBadRequestException
- 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.
-
resolveAccountId
Resolves the given Stellar account ID to federation record if the user was found for a given Stellar account ID.- Parameters:
accountId
- Stellar account ID. (e.g. `GAVHK7L...`)domain
- The domain to get the federation server URI from. (e.g. `example.com`)- Returns:
- FederationResponse
- Throws:
NetworkException
- All the exceptions below are subclasses of NetworkErrorNotFoundException
- Stellar address not found in the federation serverStellarTomlNotFoundInvalidException
- Stellar.toml file not found or invalidFederationServerInvalidException
- Federation server is invalidNoFederationServerException
- No federation server defined in stellar.toml fileBadRequestException
- 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.
-