kubo-rpc-client
Version:
A client library for the Kubo RPC API
18 lines (14 loc) • 437 B
text/typescript
import { createId } from './id.js'
import type { KuboRPCClient } from './index.js'
import type { HTTPRPCClient } from './lib/core.js'
export function createIsOnline (client: HTTPRPCClient): KuboRPCClient['isOnline'] {
const id = createId(client)
return async function isOnline (options = {}) {
try {
const res = await id(options)
return Boolean(res?.addresses?.length)
} catch {
return false
}
}
}