fromDomain

suspend fun fromDomain(domain: String, httpClient: HttpClient? = null, httpRequestHeaders: Map<String, String>? = null): KYCService

Creates a KYCService by discovering the endpoint from stellar.toml.

Fetches the stellar.toml file from the specified domain and extracts the KYC server address. First checks for KYC_SERVER, falls back to TRANSFER_SERVER if not found (some anchors use the transfer server for KYC endpoints).

Return

KYCService configured with the domain's KYC endpoint

Parameters

domain

The domain name hosting the stellar.toml file

httpClient

Optional custom HTTP client for testing

httpRequestHeaders

Optional custom headers for requests

Throws

If neither KYC_SERVER nor TRANSFER_SERVER is found

Example:

val kycService = KYCService.fromDomain("testanchor.stellar.org")