UNPKG

@ethersphere/bee-js

Version:
30 lines (29 loc) 894 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isGateway = exports.checkConnection = void 0; const cafe_utility_1 = require("cafe-utility"); const http_1 = require("../utils/http"); /** * Ping the base bee URL. If connection was not successful throw error * * @param requestOptions Options for making requests */ async function checkConnection(requestOptions) { await (0, http_1.http)(requestOptions, { url: '', }); } exports.checkConnection = checkConnection; async function isGateway(requestOptions) { try { const response = await (0, http_1.http)(requestOptions, { url: '/gateway', }); const data = cafe_utility_1.Types.asObject(response.data); return cafe_utility_1.Types.asBoolean(data.gateway); } catch (error) { return false; } } exports.isGateway = isGateway;