@@ -2,7 +2,7 @@ import Fastify from 'fastify';
22import cors from '@fastify/cors' ;
33import rateLimit from '@fastify/rate-limit' ;
44import 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' ;
66import { getMonitoringResults , getMonitoringStatus , startRpcHealthCheck } from './rpcMonitor.js' ;
77import {
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