File tree Expand file tree Collapse file tree 5 files changed +448
-195
lines changed
Expand file tree Collapse file tree 5 files changed +448
-195
lines changed Original file line number Diff line number Diff line change 1- import { NextResponse } from 'next/server' ;
1+ import { NextResponse , NextRequest } from 'next/server' ;
22import { Chains } from '@/types' ;
33import fs from 'fs/promises' ;
44import path from 'path' ;
5+ import { pickBy } from 'es-toolkit' ;
56
6- export async function GET ( ) {
7+ export async function GET ( _req : NextRequest ) {
78 try {
9+ const chainIds = _req . nextUrl . searchParams . get ( 'chain_ids' ) ?. split ( ',' ) ;
810 const filePath = path . join ( process . cwd ( ) , 'data' , 'chains.json' ) ;
911 const jsonData = await fs . readFile ( filePath , 'utf8' ) ;
12+
1013 const chainsData : Chains = JSON . parse ( jsonData ) ;
14+ const filteredChains = chainIds && chainIds . length > 0 ?
15+ pickBy ( chainsData , ( _ , chainId ) => chainIds . includes ( String ( chainId ) ) ) :
16+ chainsData ;
1117
12- return NextResponse . json ( chainsData ) ;
18+ return NextResponse . json ( filteredChains ) ;
1319 } catch ( error ) {
1420 console . error ( 'Error reading chains data:' , error ) ;
1521 return NextResponse . json ( { error : 'Failed to load chains data' } , { status : 500 } ) ;
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ const MenuLinks: React.FC<MenuLinksProps> = ({ isMobile = false }) => (
3030 < MenuLink href = "https://eaas.blockscout.com/#features" isMobile = { isMobile } > Features</ MenuLink >
3131 < MenuLink href = "https://eaas.blockscout.com/#explorer-as-a-service" isMobile = { isMobile } > Explorer as a Service</ MenuLink >
3232 < MenuLink href = "https://eaas.blockscout.com/#future-updates" isMobile = { isMobile } > Future Updates</ MenuLink >
33- < MenuLink href = "https://eaas .blog.blockscout.com/" target = "_blank" isMobile = { isMobile } > Blog</ MenuLink >
33+ < MenuLink href = "https://www .blog.blockscout.com/" target = "_blank" isMobile = { isMobile } > Blog</ MenuLink >
3434 < MenuLink href = "https://docs.blockscout.com/" target = "_blank" isMobile = { isMobile } > Docs</ MenuLink >
3535 < MenuLink href = "https://eaas.blockscout.com/#contact" isMobile = { isMobile } > Contact</ MenuLink >
3636 </ nav >
You can’t perform that action at this time.
0 commit comments