-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
feat: Implement market data by Chain ID #4206
Conversation
f8009ff
to
69ff1aa
Compare
295320e
to
282e7b2
Compare
33e4ed1
to
4f1966f
Compare
@salimtb I spoke to the shared libraries devs at office hours. Their recommendation was to make a breaking change to move to the new structure, rather than maintain backwards compatibility with the old structure. Because having the same data in multiple places has been a source of bugs. That would mean removing I think it'd be good to keep This will probably be difficult to get on mobile, until it has upgraded to a more recent version of assets controllers. We may want to help accelerate this vs trying a tricky patch |
This comment was marked as outdated.
This comment was marked as outdated.
4f1966f
to
4ffca63
Compare
This comment was marked as outdated.
This comment was marked as outdated.
LGTM |
packages/assets-controllers/src/token-prices-service/codefi-v2.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/token-prices-service/codefi-v2.ts
Outdated
Show resolved
Hide resolved
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.
Sorry for the delay in reviewing. I made some suggestions below, mostly having to do with naming and updating of JSDocs.
packages/assets-controllers/src/token-prices-service/codefi-v2.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/token-prices-service/codefi-v2.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/token-prices-service/codefi-v2.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/token-prices-service/codefi-v2.test.ts
Outdated
Show resolved
Hide resolved
0d7b2f6
to
4dbb8a5
Compare
Be sure to update PR description/title to reflect the broader market data being added. Since it's more than just the daily % change now. |
4dbb8a5
to
0b3af00
Compare
packages/assets-controllers/src/token-prices-service/codefi-v2.ts
Outdated
Show resolved
Hide resolved
094de65
to
cc0c0a2
Compare
2e06ec0
to
8271d75
Compare
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.
LGTM, thanks for your changes.
## Explanation When adding market data for tokens in #4206, it also changed the token addresses to be lowercased instead of checksum. This PR moves it back to the checksum format, since some places on the client expected it. ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? For example: * Fixes #12345 * Related to #67890 --> ## Changelog <!-- If you're making any consumer-facing changes, list those changes here as if you were updating a changelog, using the template below as a guide. (CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or FIXED. For security-related issues, follow the Security Advisory process.) Please take care to name the exact pieces of the API you've added or changed (e.g. types, interfaces, functions, or methods). If there are any breaking changes, make sure to offer a solution for consumers to follow once they upgrade to the changes. Finally, if you're only making changes to development scripts or tests, you may replace the template below with "None". --> ### `@metamask/assets-controllers` - **CHANGED**: Token rates controller uses checksum instead of lowercase format for token addresses ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've highlighted breaking changes using the "BREAKING" category above as appropriate
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This pull request introduces a new feature to the MetaMask extension that enhances user experience by displaying the percentage increase or decrease for each token directly within the UI. This update aims to provide users with immediate visual feedback on the performance of their tokens, helping them make more informed decisions based on recent market trends. core PR: MetaMask/core#4206 [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/24223?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to the wallet view 2. You should see the percentage of increase/decrease ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <img width="360" alt="Screenshot 2024-04-24 at 15 03 39" src="https://github.com/MetaMask/metamask-extension/assets/26223211/636bdde4-eab2-40f8-8ed5-935007dd3cda"> ### **After** <img width="356" alt="Screenshot 2024-04-24 at 14 53 25" src="https://github.com/MetaMask/metamask-extension/assets/26223211/06a22e59-3c5c-4079-a286-79caef75b801"> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This pull request introduces a new feature to the MetaMask mobile that enhances user experience by displaying the percentage increase or decrease for each token directly within the UI. This update aims to provide users with immediate visual feedback on the performance of their tokens, helping them make more informed decisions based on recent market trends. core PR: MetaMask/core#4206 figma: https://www.figma.com/design/aMYisczaJyEsYl1TYdcPUL/Wallet-Assets?node-id=1620-23897&t=EJSzfKoFvTJ5LuK0-0 ## **Related issues** Fixes: #9635 ## **Manual testing steps** 1. Go to the wallet view 2. You should see the percentage of increase/decrease ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <img width="487" alt="Screenshot 2024-05-15 at 16 54 25" src="https://github.com/MetaMask/metamask-mobile/assets/26223211/5b165737-4150-4ca7-83a3-3cb667b6f4a6"> ### **After** ![Screenshot 2024-05-15 at 16 39 31](https://github.com/MetaMask/metamask-mobile/assets/26223211/3792f1d2-6300-4cad-ad5a-6c49e1697773) ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
Explanation
This pull request introduces a significant enhancement to our application's functionality by integrating a new feature that presents market data more comprehensively. This includes updates such as daily percentage changes and the fluctuation in amounts for a variety of assets. To accommodate this, we've expanded our state structure to encapsulate a broader array of data points. Below is a snippet illustrating the enriched data now available:
As a result, the TokenRatesController state has been meticulously updated to include this marketData, enriching our application with a more detailed and dynamic representation of asset performance. This enhancement not only broadens the scope of information we provide but also elevates the user experience by offering a granular view of market trends and asset valuations.
References
Changelog
We've introduced a new marketData property to the application's state, providing a comprehensive overview of market-related information for various assets. This enhancement brings a wealth of data directly into our application.
This update significantly enriches the data available within our application, offering users detailed insights into asset performance and market trends. The marketData property is meticulously structured to ensure easy access to a wide array of information, enhancing the overall user experience by providing a granular and dynamic view of the market.
@metamask/package-assets-controllers
marketData
to TokenRatesStatecontractExchangeRates
from TokenRatesStatecontractExchangeRatesByChainId
from TokenRatesStateChecklist