@@ -3,15 +3,16 @@ import { z } from "zod";
33
44import { VERCEL_REQUEST_HEADERS } from "../config/server" ;
55import { Cluster , ClusterToName , priceFeedsSchema } from "../services/pyth" ;
6- import { absoluteUrl } from "../utils/absolute-url" ;
76import { DEFAULT_CACHE_TTL } from "../utils/cache" ;
7+ import { getHost } from "../utils/get-host" ;
88
99export async function getPublishersForFeedRequest (
1010 cluster : Cluster ,
1111 symbol : string ,
1212) {
13- const url = await absoluteUrl (
13+ const url = new URL (
1414 `/api/pyth/get-publishers/${ encodeURIComponent ( symbol ) } ` ,
15+ await getHost ( ) ,
1516 ) ;
1617 url . searchParams . set ( "cluster" , ClusterToName [ cluster ] ) ;
1718
@@ -29,8 +30,9 @@ export async function getFeedsForPublisherRequest(
2930 cluster : Cluster ,
3031 publisher : string ,
3132) {
32- const url = await absoluteUrl (
33+ const url = new URL (
3334 `/api/pyth/get-feeds-for-publisher/${ encodeURIComponent ( publisher ) } ` ,
35+ await getHost ( ) ,
3436 ) ;
3537 url . searchParams . set ( "cluster" , ClusterToName [ cluster ] ) ;
3638
@@ -46,7 +48,10 @@ export async function getFeedsForPublisherRequest(
4648}
4749
4850export const getFeedsRequest = async ( cluster : Cluster ) => {
49- const url = await absoluteUrl ( `/api/pyth/get-feeds` ) ;
51+ const url = new URL (
52+ `/api/pyth/get-feeds` ,
53+ await getHost ( ) ,
54+ ) ;
5055 url . searchParams . set ( "cluster" , ClusterToName [ cluster ] ) ;
5156 url . searchParams . set ( "excludePriceComponents" , "true" ) ;
5257
@@ -72,8 +77,9 @@ export const getFeedForSymbolRequest = async ({
7277 symbol : string ;
7378 cluster ?: Cluster ;
7479} ) : Promise < z . infer < typeof priceFeedsSchema . element > | undefined > => {
75- const url = await absoluteUrl (
80+ const url = new URL (
7681 `/api/pyth/get-feeds/${ encodeURIComponent ( symbol ) } ` ,
82+ await getHost ( ) ,
7783 ) ;
7884 url . searchParams . set ( "cluster" , ClusterToName [ cluster ] ) ;
7985
0 commit comments