feat: add assets migration selectors#29423
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. |
| assetPreferences: {}, | ||
| assetsInfo: {}, | ||
| assetsBalance: {}, | ||
| }, |
There was a problem hiding this comment.
This is not a valid initial state anymore. If the initial state is undefined, better let the controller handle the shape of the default state.
There was a problem hiding this comment.
These are the same selectors used in extension (the logic is, the selectors itself are slightly different because the state is not flattened here).
We also don't need to make assertions on the selector type here.
There was a problem hiding this comment.
As with extension, we now use the built-in mechanism for minimum version. This can be simplified.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #29423 +/- ##
==========================================
- Coverage 82.41% 82.23% -0.18%
==========================================
Files 5157 5166 +9
Lines 136690 137201 +511
Branches 30816 30980 +164
==========================================
+ Hits 112648 112826 +178
- Misses 16407 16743 +336
+ Partials 7635 7632 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2f8d001 to
65b6a92
Compare
f3d2958 to
0246d21
Compare
| conversionRates: {}, | ||
| }; | ||
|
|
||
| ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) |
There was a problem hiding this comment.
We can remove code fences. The selectors used will work even if multichain state is undefined.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit af13243. Configure here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: The impact is extremely broad:
The feature flag simplification (removing minimumVersion check) could also change which users see the new behavior. Tags selected:
Per tag descriptions: SmokeSwap requires SmokeConfirmations (already included); SmokeStake requires SmokeConfirmations (already included); SmokePerps requires SmokeWalletPlatform and SmokeConfirmations (already included); SmokeMultiChainAPI requires SmokeNetworkAbstractions and SmokeNetworkExpansion (already included). Performance Test Selection: |
|



Description
Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-2827
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Touches multiple core selectors that feed balances, token lists, and pricing into Bridge/asset UI; while gated by the
assetsUnifyStateflag, any selector mismatch could surface incorrect amounts/rates across the app.Overview
Introduces a new
selectors/assets/assets-migration.tslayer that, whenassetsUnifyStateis enabled, derives legacy controller-shaped data (tokens, token balances, account tracker balances, multichain balances/assets, currency rates, token market data, and conversion rates) from the newAssetsControllerunified state; when disabled it falls back to the existing controller state.Updates Bridge selectors, multichain selectors, asset list selectors, currency/token balance/token rate selectors, AccountTracker selectors, and Sentry trace tagging to consume these migration selectors instead of directly reading
engine.backgroundStatecontroller slices.Adjusts
assetsControllerInitto pass through persistedAssetsControllerstate as-is (undefined when absent rather than a synthesized empty object) and simplifies theassetsUnifyStatefeature-flag evaluation by removing appminimumVersionchecks; corresponding tests are updated and a comprehensive test suite is added for the migration selectors.Reviewed by Cursor Bugbot for commit a700851. Bugbot is set up for automated code reviews on this repo. Configure here.