-
Notifications
You must be signed in to change notification settings - Fork 5.4k
feat: assets controllers package upgrade with fix #36808
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
base: main
Are you sure you want to change the base?
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
✨ Files requiring CODEOWNER review ✨✅ @MetaMask/confirmations (1 files, +0 -15)
🔄 @MetaMask/swaps-engineers (1 files, +4 -8)
👨🔧 @MetaMask/wallet-integrations (2 files, +6 -16)
|
useExternalServices: true, | ||
// from core PreferencesController | ||
isMultiAccountBalancesEnabled: true, | ||
useMultiAccountBalanceChecker: true, |
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.
Putting them together as it'll be easier to remove one when we eventually migrate to the core PreferencesController
. For now, and considering this PR is already big enough, we are keeping both.
*/ | ||
export function getKeyringControllerMessenger( | ||
messenger: Messenger<AllowedActions, AllowedEvents>, | ||
messenger: Messenger<never, never>, |
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.
It was using the wrong types from a different controller. KeyringController
does not require any AllowedActions
or AllowedEvents
networkClientId, | ||
); | ||
}, | ||
includeStakedAssets: false, |
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.
Not part of this PR to include staked assets in the assets list. When we want to enable them, we can do so.
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 just moved the properties together so it's easier to refactor them when the time comes.
setUseMultiAccountBalanceChecker(val: boolean): void { | ||
this.update((state) => { | ||
state.useMultiAccountBalanceChecker = val; | ||
state.isMultiAccountBalancesEnabled = val; |
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.
Making sure isMultiAccountBalancesEnabled
gets updated as well. Before this, it was always kept as true and not being used at all.
Builds ready [73b667c]
UI Startup Metrics (1256 ± 75 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
73b667c
to
2df6aa5
Compare
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [6047fba]
Bundle size diffs [🚀 Bundle size reduced!]
|
## Explanation <!-- 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? --> Adds single address balance refresh based on transaction events to make up for removing them on extension client side during migration. Previews: MetaMask/metamask-extension#36808 MetaMask/metamask-mobile#21465 ## 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? 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-1368 ## Checklist - [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] > AccountTrackerController now listens to transaction events to refresh the originating address balance, with internal refresh refactor, tests, and changelog updates. > > - **AccountTrackerController**: > - **New listeners**: Subscribes to `TransactionController:unapprovedTransactionAdded` and `TransactionController:transactionConfirmed` to refresh the `txParams.from` address balance. > - **Refactor**: Extracts `#refreshAccounts` and `#refreshAddress`; `refresh` delegates to these helpers. > - **Types/Events**: Extends `AllowedEvents` to include the above transaction events; imports `TransactionStatus`/`TransactionMeta`. > - **Tests**: > - Add cases ensuring balances refresh on unapproved and confirmed transaction events. > - Expand test messenger `allowedEvents`; expose `messenger` from test harness. > - **Changelog**: > - Notes BREAKING requirement to allow new transaction events in the controller messenger. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8504447. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [fd8906f]
Bundle size diffs [🚀 Bundle size reduced!]
|
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [b96ae8e]
Bundle size diffs [🚀 Bundle size reduced!]
|
## Explanation <!-- 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? --> Assets controller major release. Preview PRs: MetaMask/metamask-mobile#21465 MetaMask/metamask-extension#36808 ## 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? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## 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 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 - [ ] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Releases core 632 with @metamask/assets-controllers v82 (breaking event listeners, multicall additions, Snap request batching) and aligns bridge packages with breaking peer bumps. > > - **Packages**: > - `@metamask/[email protected]`: > - **BREAKING:** Add balance refresh listeners for `TransactionControllerUnapprovedTransactionAddedEvent` and `TransactionControllerTransactionConfirmedEvent`. > - Add multicall addresses for additional chains; batch `OnAssetConversion` and `OnAssetsMarketData` requests to non‑EVM Snaps. > - `@metamask/[email protected]`: > - **BREAKING:** Bump peer `@metamask/assets-controllers` to `^82.0.0`. > - `@metamask/[email protected]`: > - **BREAKING:** Bump peer `@metamask/bridge-controller` to `^54.0.0`. > - **Repo**: Bump monorepo version to `632.0.0` and update lockfile. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 45f4843. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [105d8af]
Bundle size diffs [🚀 Bundle size reduced!]
|
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [3fbd97d]
Bundle size diffs [🚀 Bundle size reduced!]
|
Description
This PR concludes the migration to
AccountsTrackerController
from core. This is necessary in order to benefit from performance changes added and planned to the core controller.Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-1368
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Replaces legacy AccountTracker with core controller, updates state to checksummed accountsByChainId only, adjusts polling, selectors, and middleware, adds migration, and updates tests/fixtures and dependency.
AccountTrackerController
with@metamask/assets-controllers
version; update init to usegetStakedBalanceForChain
,allowExternalServices
, and feature-flagged API chain IDs.accounts
and block gas limit fields; rely onaccountsByChainId
only.182
to rebuildAccountTracker.accountsByChainId
with checksummed addresses and balances.accountsByChainId
and normalize addresses to lowercase for UI use.{ networkClientIds }
and manage a single polling token.number_of_accounts
fromaccountsByChainId
.@metamask-previews/[email protected]
and removesingle-call-balance-checker-abi
/contracts constants.Written by Cursor Bugbot for commit 3fbd97d. This will update automatically on new commits. Configure here.