"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.statusRoute = void 0;
const express_1 = __importDefault(require("express"));
const config_1 = __importDefault(require("../config"));
const Loggify_1 = require("../decorators/Loggify");
const state_1 = require("../models/state");
const router = express_1.default.Router({ mergeParams: true });
router.get('/enabled-chains', function (_, res) {
    const chainNetworks = new Array();
    for (const chain of Object.keys(config_1.default.chains)) {
        for (const network of Object.keys(config_1.default.chains[chain])) {
            chainNetworks.push({ chain, network });
        }
    }
    res.json(chainNetworks);
});
router.get('/performance', function (_, res) {
    res.json(Loggify_1.PerformanceTracker);
});
router.get('/:chain/:network/sync', async function (req, res) {
    const { chain, network } = req.params;
    const state = await state_1.StateStorage.collection.findOne({});
    const initialSyncComplete = state && state.initialSyncComplete && state.initialSyncComplete.includes(`${chain}:${network}`);
    res.json({ initialSyncComplete });
});
exports.statusRoute = {
    router,
    path: '/status'
};
//# sourceMappingURL=status.js.map