UNPKG

@apexfusionfoundation/blockfrost-js

Version:

A JavaScript/TypeScript SDK for interacting with the https://blockfrost.io API

45 lines (44 loc) 1.42 kB
"use strict"; 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}` * */ function health() { return new Promise((resolve, reject) => { this.instance(`health`) .then(resp => { resolve(resp.body); }) .catch(err => { reject((0, errors_1.handleError)(err)); }); }); } 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}` * */ function healthClock() { return new Promise((resolve, reject) => { this.instance(`health/clock`) .then(resp => { resolve(resp.body); }) .catch(err => { reject((0, errors_1.handleError)(err)); }); }); } exports.healthClock = healthClock;