Closed XinyuCRO closed 2 years ago
getTokenPrices(cryptoSymbol: string, fiatCurrency: string, interval: string) {
...
const tokenSlugInfo = allTokensSlugMap?.find(tokenSlug => tokenSlug.symbol === cryptoSymbol);
const slug = tokenSlugInfo?.slug;
...
}
The problem with using barely cryptoSymbol
is that it may fetch token prices of identical symbol tokens from other chains, resulting in an incorrect price chart. Therefore we have to identify the corresponding slug based on more criteria:
tags
includes cronos-ecosystem
ethereum-ecosystem
. I could only apply our whitelistedERC20Tokens whitelist table for filtering. You may reference on getTokenPriceFromCryptoCom()
, see how I handled it. You may revise it and put the redundant logic into another function.
if only they respond token list with contract addresses, the token slugs may be the same under the same chain
if only they respond token list with contract addresses, the token slugs may be the same under the same chain
Ya sadly they don't. They don't provide the token contract address from any of their returned data neither. Slug
is the only thing we got to locate the corresponding token.
Added 24H price change %
Default Round price figure to 2 decimals
This pull request introduces 1 alert when merging 8c1583a2d97257ecada0d82e4f1758f70cf70058 into 465bd91c2aea03874d0ce099ccca0766f051f791 - view on LGTM.com
new alerts:
Closes #1157 #1158 #1159