1
1
import "server-only" ;
2
2
3
- import type { Address } from "thirdweb" ;
4
3
import { NEXT_PUBLIC_THIRDWEB_BRIDGE_HOST } from "@/constants/public-envs" ;
5
4
import { DASHBOARD_THIRDWEB_SECRET_KEY } from "@/constants/server-envs" ;
6
5
import type { Route } from "./types/route" ;
@@ -10,21 +9,13 @@ export async function getRoutes({
10
9
offset,
11
10
originQuery,
12
11
destinationQuery,
13
- originChainId,
14
- destinationChainId,
15
- originTokenAddress,
16
- destinationTokenAddress,
17
12
} : {
18
13
limit ?: number ;
19
14
offset ?: number ;
20
15
originQuery ?: string ;
21
16
destinationQuery ?: string ;
22
- originChainId ?: number ;
23
- destinationChainId ?: number ;
24
- originTokenAddress ?: Address ;
25
- destinationTokenAddress ?: Address ;
26
17
} = { } ) {
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 ` ) ;
28
19
if ( limit ) {
29
20
url . searchParams . set ( "limit" , limit . toString ( ) ) ;
30
21
}
@@ -37,20 +28,7 @@ export async function getRoutes({
37
28
if ( destinationQuery ) {
38
29
url . searchParams . set ( "destinationQuery" , destinationQuery ) ;
39
30
}
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
- }
52
31
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
54
32
const routesResponse = await fetch ( url , {
55
33
headers : {
56
34
"x-secret-key" : DASHBOARD_THIRDWEB_SECRET_KEY ,
0 commit comments