Repository navigation
change: set defi controller to refresh only one account - #6944
Merged
Merged
Conversation
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
salimtb
reviewed
Oct 27, 2025
salimtb
previously approved these changes
Oct 27, 2025
bergarces
force-pushed
the
defi-controller-changes
branch
from
October 27, 2025 12:06
4f7407c to
a3456b1
Compare
salimtb
previously approved these changes
Oct 27, 2025
bergarces
force-pushed
the
defi-controller-changes
branch
from
October 27, 2025 13:55
e30122d to
4076d85
Compare
salimtb
previously approved these changes
Oct 27, 2025
bergarces
enabled auto-merge
October 27, 2025 15:33
bergarces
force-pushed
the
defi-controller-changes
branch
from
October 27, 2025 19:47
052c435 to
26f7172
Compare
Prithpal-Sooriya
approved these changes
Nov 3, 2025
auto-merge was automatically disabled
November 3, 2025 15:02
Merge commits are not allowed on this repository
juanmigdr
pushed a commit
that referenced
this pull request
Nov 3, 2025
<!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> - Updates DeFiPositionsController to only update the selected EVM account - Adds timeout & retry mechanism - Fixes issue with DeFi polling starting before onboarding due to subscription to `KeyringController:unlocked` event Draft PR for extension: MetaMask/metamask-extension#37215 Draft PR for mobile: MetaMask/metamask-mobile#21657 <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> Related to https://consensyssoftware.atlassian.net/browse/ASSETS-1238 - [X] I've updated the test suite for new or updated code as appropriate - [X] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [X] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [X] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Updates DeFi positions to only refresh the selected EVM address, gates updates on relevant events, and adds an 8s timeout with a single retry to the API fetch. > > - **DeFiPositionsController** > - Refreshes DeFi positions for only the selected EVM account (`_executePoll`, `#updateAccountPositions`). > - Replaces AccountsController dependencies with `AccountTreeController:getAccountsFromSelectedAccountGroup` to derive selected EVM address. > - Event changes: > - Stops polling on `KeyringController:lock` (unchanged). > - Removes `KeyringController:unlock` and `AccountsController:accountAdded` listeners. > - Adds `AccountTreeController:selectedAccountGroupChange` to refresh selected address. > - `TransactionController:transactionConfirmed` now updates only if it matches the selected address. > - **Fetch behavior** > - `fetch-positions`: wraps API call with `timeoutWithRetry` (8s timeout, 1 retry). > - Adds `utils/timeout-with-retry` with unit tests. > - **Tests** > - Update unit tests to new selected-account-only behavior and new events. > - **Changelog** > - Documents breaking changes to events/behavior and new timeout+retry. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit fe03293. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or 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
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
KeyringController:unlockedeventDraft PR for extension: MetaMask/metamask-extension#37215
Draft PR for mobile: MetaMask/metamask-mobile#21657
References
Related to https://consensyssoftware.atlassian.net/browse/ASSETS-1238
Checklist
Note
Updates DeFi positions to only refresh the selected EVM address, gates updates on relevant events, and adds an 8s timeout with a single retry to the API fetch.
_executePoll,#updateAccountPositions).AccountTreeController:getAccountsFromSelectedAccountGroupto derive selected EVM address.KeyringController:lock(unchanged).KeyringController:unlockandAccountsController:accountAddedlisteners.AccountTreeController:selectedAccountGroupChangeto refresh selected address.TransactionController:transactionConfirmednow updates only if it matches the selected address.fetch-positions: wraps API call withtimeoutWithRetry(8s timeout, 1 retry).utils/timeout-with-retrywith unit tests.Written by Cursor Bugbot for commit fe03293. This will update automatically on new commits. Configure here.