-
-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get token prices from our API instead of CoinGecko #3600
Conversation
1969e05
to
1302cc3
Compare
Putting into draft again because I'm going to make sure to incorporate changes in MetaMask/metamask-mobile#7957. |
6e9c8d1
to
0a9c0a7
Compare
CoinGecko is planning on retiring their `/simple/token_price` endpoint soon. This endpoint is critical for us, as we use to fetch prices for tokens. This commit removes all code related to CoinGecko in TokenRatesController so that it hits an internal API instead. This is set up in such a way that we can upgrade to newer versions of the API (or even other services) in the future without breaking backward compatibility. However, at the moment it does introduce breaking changes to TokenRatesController.
0a9c0a7
to
c61add8
Compare
// Base | ||
'0x2105', | ||
// Shiden | ||
// NOTE: This is the wrong chain ID, this should be 0x150 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm asking Tomas about this: MetaMask/metamask-mobile#7957 (comment)
* The list of currencies that can be supplied as the `vsCurrency` parameter to | ||
* the `/spot-prices` endpoint, in lowercase form. | ||
*/ | ||
export const SUPPORTED_CURRENCIES = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This list comes from MetaMask/metamask-mobile#7957.
* the `/spot-prices` endpoint, but in hexadecimal form (for consistency with | ||
* how we represent chain IDs in other places). | ||
*/ | ||
export const SUPPORTED_CHAIN_IDS = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This list comes from MetaMask/metamask-mobile#7957.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Probably just some changes to do on inline docs
packages/assets-controllers/src/token-prices-service/codefi-v2.ts
Outdated
Show resolved
Hide resolved
I am thinking about how/if this relates to this issue. Do we handle the case where a list of tokens overflows the service rate limit? And in case not, what would be the best way to do that after these changes? |
I think in a future PR, we can wrap the call to |
PR #3600 included a non-breaking change to `controller-utils` that was required by the `assets-controllers` changes.
Explanation
CoinGecko is planning on retiring their
/simple/token_price
endpoint soon. This endpoint is critical for us, as we use to fetch prices for tokens. This commit removes all code related to CoinGecko in TokenRatesController so that it hits an internal API instead.This is set up in such a way that we can upgrade to newer versions of the API (or even other services) in the future without breaking backward compatibility. However, at the moment it does introduce breaking changes to TokenRatesController.
References
Fixes #3574.
Changelog
(Updated in PR)
Checklist