Skip to content
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

chore: swap tokenList with tokensChainsCache in tokenDetectionController #4821

Merged

Conversation

sahar-fehri
Copy link
Contributor

@sahar-fehri sahar-fehri commented Oct 21, 2024

Explanation

PR to remove usage of tokenList from tokenDetectionController and instead use tokensChainsCache.

References

Changelog

@metamask/assets-controllers

  • CHANGED: Using tokensChainsCache in tokenDetectionController instead of tokenList
  • ADDED: Exported TokensChainsCache from tokenListController

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
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@sahar-fehri sahar-fehri marked this pull request as ready for review October 22, 2024 08:26
@sahar-fehri sahar-fehri requested a review from a team as a code owner October 22, 2024 08:26
@sahar-fehri sahar-fehri requested a review from kanthesha October 24, 2024 18:00
@sahar-fehri sahar-fehri requested a review from kanthesha October 28, 2024 13:15
Copy link
Contributor

@kanthesha kanthesha left a comment

Choose a reason for hiding this comment

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

LGTM.

@sahar-fehri sahar-fehri merged commit 770f5bc into main Oct 29, 2024
119 checks passed
@sahar-fehri sahar-fehri deleted the chore/update-tokenDetectionController-to-use-tokensChainCache branch October 29, 2024 13:38
sethkfman pushed a commit to MetaMask/metamask-mobile that referenced this pull request Oct 30, 2024
## **Description**

Patches tokenDetection updates to swap tokenList with tokensChainsCache

## **Related issues**

Fixes:
Related: MetaMask/core#4821

## **Manual testing steps**

1. I added a console.log in detectTokens fct in tokenDetectionController
to check how many times its being called
2. Switch between two networks back and forth and detectTokens should be
triggered just once
3. If you switch to a new network for the first time you will see an
extra call but it should happen only the first time and not everytime


## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->


https://github.com/user-attachments/assets/406ac8c3-d7a0-4b37-b4c0-398d0ff60bef




### **After**

<!-- [screenshots/recordings] -->


https://github.com/user-attachments/assets/2c737fb5-926a-4c6a-8a98-d240022145ef



## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] 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.
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.

4 participants