BlockchainAnchorClientOptions
Base sealed class for blockchain anchor client options.
Provides type-safe configuration for blockchain adapters. Each blockchain type has its own specific options class.
Benefits of Type-Safe Options:
Compile-time validation of configuration
IDE autocomplete support
Clear documentation of available options
Prevents typos in option keys
Backward Compatibility: Options can be converted to/from Map<String, Any?> for compatibility with existing code and the SPI interface.
Extensibility: New blockchain types can be supported without modifying this class by calling BlockchainAnchorClientOptions.registerParser with a BlockchainAnchorOptionsParser.
Example Usage:
// Type-safe (recommended)
val options = AlgorandOptions(
algodUrl = "https://testnet-api.algonode.cloud",
privateKey = "base64-key"
)
val client = AlgorandBlockchainAnchorClient(chainId, options)
// From map (backward compatible)
val map = mapOf("algodUrl" to "https://testnet-api.algonode.cloud")
val options = BlockchainAnchorClientOptions.fromMap("algorand:testnet", map)
// Extend for a new chain without modifying this class
BlockchainAnchorClientOptions.registerParser { chainId, map ->
if (chainId.startsWith("mychain:")) MyChainOptions.fromMap(map) else null
}Content copied to clipboard