11import "server-only" ;
22
3- import type { Address } from "thirdweb" ;
43import { NEXT_PUBLIC_THIRDWEB_BRIDGE_HOST } from "@/constants/public-envs" ;
54import { DASHBOARD_THIRDWEB_SECRET_KEY } from "@/constants/server-envs" ;
65import type { Route } from "./types/route" ;
@@ -10,21 +9,13 @@ export async function getRoutes({
109 offset,
1110 originQuery,
1211 destinationQuery,
13- originChainId,
14- destinationChainId,
15- originTokenAddress,
16- destinationTokenAddress,
1712} : {
1813 limit ?: number ;
1914 offset ?: number ;
2015 originQuery ?: string ;
2116 destinationQuery ?: string ;
22- originChainId ?: number ;
23- destinationChainId ?: number ;
24- originTokenAddress ?: Address ;
25- destinationTokenAddress ?: Address ;
2617} = { } ) {
27- const url = new URL ( `${ NEXT_PUBLIC_THIRDWEB_BRIDGE_HOST } /v1/routes` ) ;
18+ const url = new URL ( `${ NEXT_PUBLIC_THIRDWEB_BRIDGE_HOST } /v1/routes/search ` ) ;
2819 if ( limit ) {
2920 url . searchParams . set ( "limit" , limit . toString ( ) ) ;
3021 }
@@ -37,20 +28,7 @@ export async function getRoutes({
3728 if ( destinationQuery ) {
3829 url . searchParams . set ( "destinationQuery" , destinationQuery ) ;
3930 }
40- if ( originChainId ) {
41- url . searchParams . set ( "originChainId" , originChainId . toString ( ) ) ;
42- }
43- if ( destinationChainId ) {
44- url . searchParams . set ( "destinationChainId" , destinationChainId . toString ( ) ) ;
45- }
46- if ( originTokenAddress ) {
47- url . searchParams . set ( "originTokenAddress" , originTokenAddress ) ;
48- }
49- if ( destinationTokenAddress ) {
50- url . searchParams . set ( "destinationTokenAddress" , destinationTokenAddress ) ;
51- }
5231 url . searchParams . set ( "sortBy" , "popularity" ) ;
53- // It's faster to filter client side, doesn't seem to be a big performance boost to paginate/filter server side
5432 const routesResponse = await fetch ( url , {
5533 headers : {
5634 "x-secret-key" : DASHBOARD_THIRDWEB_SECRET_KEY ,
0 commit comments