DrandHttpApi

class DrandHttpApi(baseUrl: String = "https://api.drand.sh", config: HttpConfig = HttpConfig(), httpClient: HttpClient = createDefaultHttpClient(config)) : DrandApi

HTTP implementation of the drand API using Ktor client.

Provides access to drand's v2 HTTP API with proper error handling and JSON serialization.

Example:

val api = DrandHttpApi()
val beacon = api.beacons.latest("default").getOrThrow()
api.close()

Parameters

baseUrl

Base URL for the drand API (default: https://api.drand.sh)

config

HTTP timeout configuration (optional, uses defaults if not specified)

httpClient

Custom HttpClient instance (optional, for testing/customization)

Throws

if baseUrl is invalid for HTTP transport

Constructors

Link copied to clipboard
constructor(baseUrl: String = "https://api.drand.sh", config: HttpConfig = HttpConfig(), httpClient: HttpClient = createDefaultHttpClient(config))

Properties

Link copied to clipboard

Operations for accessing drand networks by beacon ID.

Link copied to clipboard
open override val chains: DrandApi.ChainOperations

Operations for accessing drand networks by chain hash.

Functions

Link copied to clipboard
open override fun close()