diff --git a/apps/balancer-tools/src/app/apr/api/route.ts b/apps/balancer-tools/src/app/apr/api/route.ts index 2e6d859fe..b77107016 100644 --- a/apps/balancer-tools/src/app/apr/api/route.ts +++ b/apps/balancer-tools/src/app/apr/api/route.ts @@ -7,7 +7,8 @@ import { fetcher } from "#/utils/fetcher"; import { calculatePoolStats } from "../(utils)/calculatePoolStats"; import { Round } from "../(utils)/rounds"; -const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL; +export const BASE_URL = + process.env.NEXT_PUBLIC_SITE_URL ?? process.env.NEXT_PUBLIC_VERCEL_URL; type Order = "asc" | "desc"; diff --git a/apps/balancer-tools/src/app/apr/pool/(components)/HistoricalAPRChart.tsx b/apps/balancer-tools/src/app/apr/pool/(components)/HistoricalAPRChart.tsx index 1ebaaec9b..7b82a5fc7 100644 --- a/apps/balancer-tools/src/app/apr/pool/(components)/HistoricalAPRChart.tsx +++ b/apps/balancer-tools/src/app/apr/pool/(components)/HistoricalAPRChart.tsx @@ -4,7 +4,7 @@ import { PlotType } from "plotly.js"; import { trimTrailingValues } from "#/lib/utils"; import { fetcher } from "#/utils/fetcher"; -import { PoolStatsResults } from "../../api/route"; +import { BASE_URL, PoolStatsResults } from "../../api/route"; import HistoricalAPRPlot from "./HistoricalAPRPlot"; const getRoundName = (roundId?: string | number) => @@ -20,7 +20,7 @@ export default async function HistoricalAPRChart({ const HOVERTEMPLATE = "%{x}
%{y:.2f}% APR"; const results: PoolStatsResults = await fetcher( - `${process.env.NEXT_PUBLIC_SITE_URL}/apr/api/?poolId=${poolId}&sort=roundId`, + `${BASE_URL}/apr/api/?poolId=${poolId}&sort=roundId`, ); const aprPerRoundCords = Object.entries(results.perRound).reduce( diff --git a/apps/balancer-tools/src/app/apr/pool/(components)/PoolOverviewCards.tsx b/apps/balancer-tools/src/app/apr/pool/(components)/PoolOverviewCards.tsx index 3a69a57e1..4ef30110f 100644 --- a/apps/balancer-tools/src/app/apr/pool/(components)/PoolOverviewCards.tsx +++ b/apps/balancer-tools/src/app/apr/pool/(components)/PoolOverviewCards.tsx @@ -5,18 +5,18 @@ import OverviewCards, { } from "../../(components)/OverviewCards"; import { calculatePoolStats } from "../../(utils)/calculatePoolStats"; import { formatAPR, formatTVL } from "../../(utils)/formatPoolStats"; -import { PoolStatsResults } from "../../api/route"; +import { BASE_URL, PoolStatsResults } from "../../api/route"; async function AverageTVLCard({ poolId }: { poolId: string }) { const data: PoolStatsResults = await fetcher( - `${process.env.NEXT_PUBLIC_SITE_URL}/apr/api/?poolId=${poolId}`, + `${BASE_URL}/apr/api/?poolId=${poolId}`, ); return
{formatTVL(data.average.tvl)}
; } async function AverageAPRCard({ poolId }: { poolId: string }) { const data: PoolStatsResults = await fetcher( - `${process.env.NEXT_PUBLIC_SITE_URL}/apr/api/?poolId=${poolId}`, + `${BASE_URL}/apr/api/?poolId=${poolId}`, ); return
{formatAPR(data.average.apr)}
; } diff --git a/apps/balancer-tools/src/app/apr/round/(components)/PoolListTable.tsx b/apps/balancer-tools/src/app/apr/round/(components)/PoolListTable.tsx index 45a7fbdf7..3707027a5 100644 --- a/apps/balancer-tools/src/app/apr/round/(components)/PoolListTable.tsx +++ b/apps/balancer-tools/src/app/apr/round/(components)/PoolListTable.tsx @@ -22,7 +22,7 @@ import { formatNumber } from "#/utils/formatNumber"; import { PoolTypeEnum } from "../../(utils)/calculatePoolStats"; import { formatAPR, formatTVL } from "../../(utils)/formatPoolStats"; -import { PoolStatsData, PoolStatsResults } from "../../api/route"; +import { BASE_URL, PoolStatsData, PoolStatsResults } from "../../api/route"; export function PoolListTable({ roundId, @@ -71,9 +71,7 @@ export function PoolListTable({ const loadMorePools = async () => { setIsLoadingMore(true); const aditionalPoolsData = await fetcher( - `${ - process.env.NEXT_PUBLIC_SITE_URL - }/apr/api/?roundId=${roundId}&sort=${sortField}&order=${order}&limit=10&offset=${ + `${BASE_URL}/apr/api/?roundId=${roundId}&sort=${sortField}&order=${order}&limit=10&offset=${ Object.keys(tableData).length }&minTvl=1000`, ); diff --git a/apps/balancer-tools/src/app/apr/round/(components)/PoolTableWrapper.tsx b/apps/balancer-tools/src/app/apr/round/(components)/PoolTableWrapper.tsx index e3b92b8f8..a1d97b2ac 100644 --- a/apps/balancer-tools/src/app/apr/round/(components)/PoolTableWrapper.tsx +++ b/apps/balancer-tools/src/app/apr/round/(components)/PoolTableWrapper.tsx @@ -1,6 +1,6 @@ import { fetcher } from "#/utils/fetcher"; -import { PoolStatsResults } from "../../api/route"; +import { BASE_URL, PoolStatsResults } from "../../api/route"; import { PoolListTable } from "./PoolListTable"; export default async function PoolTableWrapper({ @@ -9,7 +9,7 @@ export default async function PoolTableWrapper({ roundId: string; }) { const initialData = await fetcher( - `${process.env.NEXT_PUBLIC_SITE_URL}/apr/api/?roundId=${roundId}&sort=apr&limit=10&order=desc&minTvl=1000`, + `${BASE_URL}/apr/api/?roundId=${roundId}&sort=apr&limit=10&order=desc&minTvl=1000`, ); return ; } diff --git a/apps/balancer-tools/src/app/apr/round/(components)/TopPoolsChart.tsx b/apps/balancer-tools/src/app/apr/round/(components)/TopPoolsChart.tsx index f33d56bbc..b0f50a23b 100644 --- a/apps/balancer-tools/src/app/apr/round/(components)/TopPoolsChart.tsx +++ b/apps/balancer-tools/src/app/apr/round/(components)/TopPoolsChart.tsx @@ -4,14 +4,14 @@ import { PlotType } from "plotly.js"; import Plot from "#/components/Plot"; import { fetcher } from "#/utils/fetcher"; -import { PoolStatsResults } from "../../api/route"; +import { BASE_URL, PoolStatsResults } from "../../api/route"; export default async function TopPoolsChart({ roundId }: { roundId: string }) { const shades = Object.values(greenDarkA).map((color) => color.toString()); const colors = [...shades.slice(4, 10).reverse(), ...shades.slice(4, 10)]; const topAprApi = await fetcher( - `${process.env.NEXT_PUBLIC_SITE_URL}/apr/api/?roundId=${roundId}&sort=apr&limit=10&order=desc&minTvl=1000`, + `${BASE_URL}/apr/api/?roundId=${roundId}&sort=apr&limit=10&order=desc&minTvl=1000`, ); const chartData = {