from Domain
Creates a Sep31Service by discovering the endpoint from stellar.toml.
Fetches the stellar.toml file for domain via StellarToml.fromDomain and extracts DIRECT_PAYMENT_SERVER. The TOML fetch follows its own HTTP configuration — including default redirect behavior — so legitimate www. canonicalization redirects work as expected. The resolved URL is then re-validated against the HTTPS requirement before the service is constructed.
This SDK does not enforce a relationship between the requested domain and the host component of the resolved DIRECT_PAYMENT_SERVER. A bilateral partner can legitimately advertise a different host (for example, cdn.payments.example.com for example.com); a hostile partner could too. HTTPS validation is the only transport guarantee.
Example:
val service = Sep31Service.fromDomain("anchor.example.org")Return
A configured Sep31Service.
Parameters
Stellar address domain hosting the stellar.toml file.
Optional HTTP client used both for the TOML fetch and for subsequent SEP-31 calls.
Optional headers attached to every outbound request.
Throws
if the domain string is invalid, the TOML does not advertise DIRECT_PAYMENT_SERVER, or the advertised URL is neither HTTPS nor HTTP against the loopback authorities localhost, 127.0.0.1, [::1].