@blockfrost/blockfrost-js
Version:
A JavaScript/TypeScript SDK for interacting with the https://blockfrost.io API
41 lines (40 loc) • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.healthClock = exports.health = void 0;
const errors_1 = require("../../../utils/errors");
/**
* Obtains backend status
* @remarks
* Your application should handle situations when backend for the given chain is unavailable.
* @see {@link https://docs.blockfrost.io/#tag/Health/paths/~1health/get | API docs for Backend health status}
*
* @returns Backend status in the format `{is_healthy: boolean}`
*
*/
async function health() {
try {
const res = await this.instance(`health`);
return res.body;
}
catch (error) {
throw (0, errors_1.handleError)(error);
}
}
exports.health = health;
/**
* Obtains the current UNIX time. Your application might use this to verify if the client clock is not out of sync.
* @see {@link https://docs.blockfrost.io/#tag/Health/paths/~1health~1clock/get | API docs for Current backend time}
*
* @returns Unix time in the format `{server_time: number}`
*
*/
async function healthClock() {
try {
const res = await this.instance(`health/clock`);
return res.body;
}
catch (error) {
throw (0, errors_1.handleError)(error);
}
}
exports.healthClock = healthClock;