from Domain
Fetches and parses stellar.toml from a domain's well-known location.
The standard SEP-1 location is https://DOMAIN/.well-known/stellar.toml. As a development convenience, this method also accepts the three IETF loopback authorities — localhost, 127.0.0.1, and [::1], each optionally with a :port — and fetches over http:// against those hosts so callers can integrate against a local Anchor Platform instance without standing up a TLS-terminating proxy. Every non-loopback domain is fetched over HTTPS unconditionally.
This is the primary method for discovering a domain's Stellar integration information. Organizations publish their stellar.toml file at this standardized location to allow wallets, anchors, and other services to discover their capabilities and configuration.
Return
StellarToml containing the parsed stellar.toml data
Parameters
The domain name (without protocol). E.g., "example.com", "localhost:8080", "127.0.0.1", or "::1:8080".
Optional custom HTTP client for testing or proxy configuration
Optional custom HTTP headers to include in the request
Throws
If the stellar.toml file is not found (non-200 status code)
If the TOML content is invalid and cannot be parsed
Example:
// Fetch stellar.toml from a domain
try {
val stellarToml = StellarToml.fromDomain("example.com")
// Check if the domain supports WebAuth
stellarToml.generalInformation.webAuthEndpoint?.let {
println("WebAuth supported at: $it")
}
// Check for transfer server
stellarToml.generalInformation.transferServerSep24?.let {
println("SEP-24 transfers available")
}
} catch (e: Exception) {
println("Failed to fetch stellar.toml: ${e.message}")
}Example with custom headers:
val stellarToml = StellarToml.fromDomain(
"example.com",
httpRequestHeaders = mapOf("User-Agent" to "MyWallet/1.0")
)Local development example:
// Anchor Platform running on http://localhost:8080
val stellarToml = StellarToml.fromDomain("localhost:8080")