from Domain
suspend fun fromDomain(domain: String, httpClient: HttpClient? = null, httpRequestHeaders: Map<String, String>? = null): FederationService
Creates a FederationService by discovering the federation server from stellar.toml.
Fetches the stellar.toml file from the specified domain and extracts the FEDERATION_SERVER URL. This is the standard way to discover federation servers for a given domain.
Return
FederationService configured with the federation server URL from stellar.toml
Parameters
domain
The domain name (without protocol). E.g., "stellar.org"
http Client
Optional custom HTTP client for testing
http Request Headers
Optional custom headers for requests
Throws
If the stellar.toml does not contain a FEDERATION_SERVER field
Example:
// Auto-configure from stellar.toml
val service = FederationService.fromDomain("stellar.org")
// Resolve addresses using this domain's federation server
val response = service.resolveStellarAddress("bob*stellar.org")Content copied to clipboard