This is the real code: ```class KtorJsonRpcClient(...
# announcements
d
This is the real code:
Copy code
class KtorJsonRpcClient(val client: HttpClient, val endpoint: String): JsonRpcClient {
    override suspend fun <R : Any> invoke(method: String, params: Any, type: Class<R>): R {
        val response = client.get<JsonRpcResponse<R>>(endpoint) {
            contentType(ContentType.Application.Json)

            body = JsonRpcRequest(1, method, params)
        }

        if (response.result != null)
            return response.result
        else
            throw response.error!!.run { JsonRpcException(code, message, data) }
    }
}