@gluneau/hive-mcp-server
Version:
An MCP server that enables AI assistants to interact with the Hive blockchain
47 lines • 2.38 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getChainProperties = getChainProperties;
// Blockchain-related tools implementation
const client_1 = __importDefault(require("../config/client"));
const error_1 = require("../utils/error");
const response_1 = require("../utils/response");
// Get blockchain properties and statistics
function getChainProperties(
// Using an empty object for the params since the tool doesn't need any inputs
_params) {
return __awaiter(this, void 0, void 0, function* () {
try {
// Fetch global properties
const dynamicProps = yield client_1.default.database.getDynamicGlobalProperties();
const chainProps = yield client_1.default.database.getChainProperties();
const currentMedianHistoryPrice = yield client_1.default.database.getCurrentMedianHistoryPrice();
// Format the response
const response = {
dynamic_properties: dynamicProps,
chain_properties: chainProps,
current_median_history_price: {
base: currentMedianHistoryPrice.base,
quote: currentMedianHistoryPrice.quote,
},
timestamp: new Date().toISOString(),
};
return (0, response_1.successJson)(response);
}
catch (error) {
return (0, response_1.errorResponse)((0, error_1.handleError)(error, 'get_chain_properties'));
}
});
}
//# sourceMappingURL=blockchain.js.map