Skip to content

Conversation

AGMASO
Copy link
Collaborator

@AGMASO AGMASO commented Aug 20, 2025

General Changes

  • Added dynamic categories and asset filters on the Market page using the Coingecko API. We can now filter by: All, Stablecoins, or ETH-Correlated.

  • Created two new hooks for fetching Stablecoin category tokens and ETH-Correlated tokens, reusable across any component.

  • Implemented fallback lists for Stablecoins and ETH-Correlated tokens in case the Coingecko API is unavailable.

  • Improved mobile view with layout modifications.

Developers Notes:

  • This is version 2.0.0, which only requires manual token updates for the fallback list.

  • NOTE: You need to add the API key for --> NEXT_PUBLIC_CG_API_KEY=

  • @mgrabina → added full-width support on mobile as requested, and fixed padding to be consistent on top, bottom, left, and right.


Reviewer Checklist

Please ensure you, as the reviewer(s), have gone through this checklist to ensure that the code changes are ready to ship safely and to help mitigate any downstream issues that may occur.

  • End-to-end tests are passing without any errors
  • Code changes do not significantly increase the application bundle size
  • If there are new 3rd-party packages, they do not introduce potential security threats
  • If there are new environment variables being added, they have been added to the .env.example file as well as the pertinant .github/actions/* files
  • There are no CI changes, or they have been approved by the DevOps and Engineering team(s)

@AGMASO AGMASO requested a review from foodaka August 20, 2025 13:37
Copy link

vercel bot commented Aug 20, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
interface Ready Ready Preview Comment Aug 27, 2025 1:51pm

@AGMASO AGMASO marked this pull request as ready for review August 21, 2025 16:55
Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link
Contributor

@mgrabina mgrabina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for automated categories but

hover seems off
Image
Also i think would be more pretty to have search on left and picker right.
and full width on mobile (and check left and right padding is same as top bottom seems smaller not sure)
Image

worth it adding in dashboard wherever we have more than X assets or assets in more than Y categories?

Copy link

Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link

Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@AGMASO AGMASO changed the title feat: added filters for categories in market section version 1.0.0 feat: added dynamic assets categories using Coingecko API Aug 25, 2025
Copy link

Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link

Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link

Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link

Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@AGMASO
Copy link
Collaborator Author

AGMASO commented Aug 26, 2025

Added the same style as in Figma, using the ReservePage timeframe buttons as a reference to ensure consistency across the app.

Copy link

const CG_ENDPOINT = 'https://pro-api.coingecko.com/api/v3/coins/markets';
const HEADERS: HeadersInit = {
accept: 'application/json',
'x-cg-pro-api-key': process.env.NEXT_PUBLIC_CG_API_KEY ?? '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's put the api key behind a proxy so we hide it from external abuse

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do it

setError(null);

try {
// Toda la lógica de fetch integrada aquí
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

english if a comment if necessary (this one we can delete yo creo)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry!

Comment on lines 32 to 39
fetch(`${CG_ENDPOINT}?vs_currency=usd&category=stablecoins&per_page=250&page=1`, {
method: 'GET',
headers: HEADERS,
}),
fetch(`${CG_ENDPOINT}?vs_currency=usd&category=stablecoins&per_page=250&page=2`, {
method: 'GET',
headers: HEADERS,
}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • In the CoinGecko API, we can’t set more than 250 items per page.

  • The full list of the stablecoins category has 356 items, so two pages are enough.

  • We could request specific tokens, but in this case I think the goal is to fetch the entire pre-made category so we don’t have to maintain the list ourselves.


import { STABLECOINS_SYMBOLS_FALLBACK } from './assetCategories';

const CG_ENDPOINT = 'https://pro-api.coingecko.com/api/v3/coins/markets';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how we define the chain id? so which chain ids are supported? e.g. i can't see it loading on zkSync not sure if bc it's not supported by coingecko something to double check

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To retrieve coins from a category in CoinGecko, we can’t specify a chain ID. The API returns the general tokens (without bridge variations like USDC.e for USDC) as well as chain-specific tokens when they exist. That’s why we can use the category endpoint directly, without worrying about chain IDs.

}
};

loadStablecoins();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be possible to merge all 'use' hooks and have a simpler useAssetCategories? e.g. this may grow in the future too

Copy link

Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link

Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link
Contributor

@mgrabina mgrabina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AMAZING progress since the past iteration! would like to have others reviews as well as we have some design decisions to do before merging!

return await response.json();
},
queryKey: ['coingecko-categories'],
staleTime: 1000 * 60 * 60 * 24,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can even cache the response for a week?

Comment on lines +86 to +99
const [resEth1, resEth2, resEth3] = await Promise.all([
fetch(`${CG_ENDPOINT}?vs_currency=usd&category=liquid-staked-eth&per_page=250&page=1`, {
method: 'GET',
headers: HEADERS,
}),
fetch(`${CG_ENDPOINT}?vs_currency=usd&category=ether-fi-ecosystem&per_page=250&page=1`, {
method: 'GET',
headers: HEADERS,
}),
fetch(`${CG_ENDPOINT}?vs_currency=usd&category=liquid-staking-tokens&per_page=250&page=1`, {
method: 'GET',
headers: HEADERS,
}),
]);
Copy link
Contributor

@mgrabina mgrabina Aug 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can make eth calls in parallel to stable to optimize

Comment on lines +17 to +39
const isOriginAllowed = (origin: string | undefined): boolean => {
if (!origin) return false;

if (allowedOrigins.includes(origin)) return true;

// Match any subdomain ending with avaraxyz.vercel.app for deployment urls
const allowedPatterns = [/^https:\/\/.*avaraxyz\.vercel\.app$/];

return allowedPatterns.some((pattern) => pattern.test(origin));
};

if (process.env.CORS_DOMAINS_ALLOWED === 'true') {
res.setHeader('Access-Control-Allow-Origin', '*');
} else if (origin && isOriginAllowed(origin)) {
res.setHeader('Access-Control-Allow-Origin', origin);
}

res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');

if (req.method === 'OPTIONS') {
return res.status(200).end();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really nice!

Comment on lines +75 to +82
.filter((res) =>
isAssetInCategoryDynamic(
res.symbol,
selectedCategory,
stablecoinSymbols,
ethCorrelatedSymbols
)
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! so clean

ETH_CORRELATED = 'eth_correlated',
}

export const STABLECOINS_SYMBOLS_FALLBACK = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting. so i imagine the effect if the request takes time and I've selected a category will see the list to update .e.g. adding more items because coingecko has more than the fallback, wondering if it makes sense to have a fallback or just disable the picker until we have data. Plus, we can cache the data in the localStorage for a long time, since categories wont change frequently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants