Skip to content

Commit c8b5554

Browse files
committed
fix
1 parent bd974bf commit c8b5554

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

app/coins/[id]/page.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ import { formatPrice, timeAgo } from '@/lib/utils';
1616
const CoinDetails = async ({ params }: { params: Promise<{ id: string }> }) => {
1717
const { id } = await params;
1818
const coinData = await getCoinDetails(id);
19+
const coinOHLCData = await getCoinOHLC(id, 1, 'usd', 'hourly', 'full');
1920

20-
const pool = coinData.asset_platform_id
21-
? await fetchTopPool(coinData.asset_platform_id, coinData.contract_address)
22-
: await fetchPools(id);
21+
const platform = coinData.asset_platform_id
22+
? coinData.detail_platforms[coinData.asset_platform_id]
23+
: null;
24+
const network = platform?.geckoterminal_url.split('/')[3] || null;
25+
const contractAddress = platform?.contract_address || null;
2326

24-
const coinOHLCData = await getCoinOHLC(id, 1, 'usd', 'hourly', 'full');
27+
const pool =
28+
network && contractAddress
29+
? await fetchTopPool(network, contractAddress)
30+
: await fetchPools(id);
2531

2632
const coinDetails = [
2733
{

0 commit comments

Comments
 (0)