diff --git a/apps/marginfi-v2-ui/src/pages/api/oracle/price.ts b/apps/marginfi-v2-ui/src/pages/api/oracle/price.ts index 8321af8861..da00492d59 100644 --- a/apps/marginfi-v2-ui/src/pages/api/oracle/price.ts +++ b/apps/marginfi-v2-ui/src/pages/api/oracle/price.ts @@ -412,20 +412,20 @@ async function fetchMultiPrice(tokens: string[]): Promise throw new Error("No tokens provided"); } - // use abort controller to restrict fetch to 10 seconds const controller = new AbortController(); const timeoutId = setTimeout(() => { controller.abort(); }, 5000); - // Fetch from API and update cache try { - const response = await fetch(`${BIRDEYE_API}/defi/multi_price?list_address=${tokens.join("%2C")}`, { - headers: { - Accept: "application/json", - "x-chain": "solana", - "X-Api-Key": process.env.BIRDEYE_API_KEY || "", - }, + const baseUrl = + process.env.VERCEL_ENV === "production" && process.env.VERCEL_PROJECT_PRODUCTION_URL + ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}` + : process.env.VERCEL_BRANCH_URL + ? `https://${process.env.VERCEL_BRANCH_URL}` + : "localhost:3004"; + + const response = await fetch(`${baseUrl}/api/tokens/multi?mintList=${tokens.join(",")}`, { signal: controller.signal, }); clearTimeout(timeoutId); diff --git a/turbo.json b/turbo.json index 73ee2d22dd..d898ee470e 100644 --- a/turbo.json +++ b/turbo.json @@ -104,6 +104,9 @@ "NEXT_PUBLIC_RPC_PROXY_KEY", "NEXT_PUBLIC_TX_SINGLE_BROADCAST_TYPE", "NEXT_PUBLIC_TX_MULTI_BROADCAST_TYPE", - "NEXT_PUBLIC_TX_FALLBACK_SEQUENCE" + "NEXT_PUBLIC_TX_FALLBACK_SEQUENCE", + "VERCEL_ENV", + "VERCEL_BRANCH_URL", + "VERCEL_PROJECT_PRODUCTION_URL" ] }