from Domain
Creates a Sep08Service by discovering regulated assets from stellar.toml.
Fetches the stellar.toml file from the specified domain and extracts all regulated asset entries. The network and Horizon URL are resolved from the provided parameters or from the stellar.toml configuration.
Resolution order for network:
Explicit network parameter if provided
NETWORK_PASSPHRASE from stellar.toml, mapped to known networks or created as custom
Resolution order for Horizon URL:
Explicit horizonUrl parameter if provided
HORIZON_URL from stellar.toml
Default Horizon URL for the resolved network (public, testnet, or futurenet)
Return
Sep08Service configured with regulated assets from the domain's stellar.toml
Parameters
The domain name (without protocol). E.g., "example.com"
Optional Horizon server URL override
Optional network override
Optional custom HTTP client for testing
Optional custom headers for requests
Throws
If the network passphrase or Horizon URL cannot be determined
Example:
// Auto-configure from stellar.toml
val sep08 = Sep08Service.fromDomain("example.com")
// With explicit network and Horizon URL
val sep08Testnet = Sep08Service.fromDomain(
domain = "testanchor.example.com",
horizonUrl = "https://horizon-testnet.stellar.org",
network = Network.TESTNET
)