Open MadeofTin opened 3 years ago
Hmmm this should be doing it? so maybe something else.
async function getTokensWithMarketcap(tokens) {
const marketCapped = await Promise.all(
tokens.map(async (token) => {
token.marketCap = await getMarketCapForAddress(token.id, token.symbol)
return token
})
)
return marketCapped.sort((prev, next) => prev.marketCap >= next.marketCap).slice(0, MAX_TOKENS)
}
Maybe we need to sort the list by market cap first?
Looks like it may be going in alphabetical order, but it needs to go in Descending order by marketcap.