Skip to content

Commit 91fae3b

Browse files
committed
bugs fix and add more testing
1 parent 1227ea0 commit 91fae3b

3 files changed

Lines changed: 683 additions & 4 deletions

File tree

index.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Fastify from 'fastify';
22
import cors from '@fastify/cors';
33
import rateLimit from '@fastify/rate-limit';
44
import helmet from '@fastify/helmet';
5-
import { loadData, getCachedData, searchChains, getChainById, getAllChains, getAllRelations, getRelationsById, getEndpointsById, getAllEndpoints } from './dataService.js';
5+
import { loadData, getCachedData, searchChains, getChainById, getAllChains, getAllRelations, getRelationsById, getEndpointsById, getAllEndpoints, validateChainData } from './dataService.js';
66
import { getMonitoringResults, getMonitoringStatus, startRpcHealthCheck } from './rpcMonitor.js';
77
import {
88
PORT, HOST, BODY_LIMIT, MAX_PARAM_LENGTH,
@@ -277,6 +277,19 @@ export async function buildApp(options = {}) {
277277
}
278278
});
279279

280+
/**
281+
* Validate chain data for potential human errors
282+
*/
283+
fastify.get('/validate', async (_request, reply) => {
284+
const validationResults = validateChainData();
285+
286+
if (validationResults.error) {
287+
return sendError(reply, 503, validationResults.error);
288+
}
289+
290+
return validationResults;
291+
});
292+
280293
/**
281294
* Get RPC monitoring results
282295
*/
@@ -339,6 +352,7 @@ export async function buildApp(options = {}) {
339352
'/slip44': 'Get all SLIP-0044 coin types as JSON',
340353
'/slip44/:coinType': 'Get specific SLIP-0044 coin type by ID',
341354
'/reload': 'Reload data from sources (POST)',
355+
'/validate': 'Validate chain data for potential human errors',
342356
'/rpc-monitor': 'Get RPC endpoint monitoring results',
343357
'/rpc-monitor/:id': 'Get RPC monitoring results for a specific chain by ID'
344358
},

0 commit comments

Comments
 (0)