-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add polling by networkClientId
to AccountTrackerController
#3586
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adonesky1
reviewed
Dec 1, 2023
adonesky1
reviewed
Dec 1, 2023
adonesky1
previously approved these changes
Dec 1, 2023
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.
A few non blocking questions/comments! otherwise LGTM! Thanks for cranking these out!
adonesky1
previously approved these changes
Dec 7, 2023
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!
…ts-tracker' into jl/mmp-1029/multichain-v1-accounts-tracker
adonesky1
reviewed
Dec 7, 2023
shanejonas
previously approved these changes
Dec 8, 2023
adonesky1
reviewed
Dec 8, 2023
adonesky1
approved these changes
Dec 11, 2023
13 tasks
chrisleewilcox
pushed a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Feb 16, 2024
## **Description** Problem: When we change network or account, the native balance of the ERC-20 tokens is not reset. It shows a wrong value for a couple seconds and then updates. We should reset the state and show a skeleton text instead of a wrong value. [PR](MetaMask/core#3586) already Merged on core ## **Related issues** Fixes: #6101 ## **Manual testing steps** 1. Go to any network where you hold native tokens 2. switch to another network when you have 0 balance 3. you can see that the wrong balance was displayed for a short time ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/MetaMask/metamask-mobile/assets/26223211/d96b474f-60fc-4c4a-a43f-fde18c4a4a26 ### **After** https://github.com/MetaMask/metamask-mobile/assets/26223211/462d8c0e-dcf0-4da7-ae2f-7fdba65b9076 ## **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 clearly explained what problem this PR is solving and how it is solved. - [x] I've linked related issues - [x] I've included manual testing steps - [x] I've included screenshots/recordings if applicable - [x] I’ve included tests if applicable - [ ] 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. - [x] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [x] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
Adds the
PollingController
toAccountTrackerController
to help get us ready for multichain integration. Keeps the existing API intact while bringing in thePollingController
methods. It's unclear if this controller or the Extension version of the controller will be combined and if so which pattern will used (subscription to block tracker vs time based polling)References
networkClientId
toAccountTracker
metamask-extension#21868Changelog
@metamask/assets-controllers
AccountTrackerController
constructor params object requiresgetCurrentChainId
andgetNetworkClientById
hooksAccountTrackerController
adds a mutex torefresh
making it only possible for one call to be executed at timeAccountTrackerController
exposesaccountByChainId
property in stateAccountTrackerController
implementsPollingController
and can now poll bynetworkClientId
via the new methodsstartPollingByNetworkClientId
,stopPollingByPollingToken
, andstopPollingByPollingToken
.AccountTrackerController
accepts an optionalnetworkClientId
value on therefresh
methodAccountTrackerController
accepts an optionalnetworkClientId
value as the last parameter of thesyncBalanceWithAddresses
methodChecklist