feat: filter pooled-staking vault token and surface its balance as stakedBalance#32126
Conversation
…lance as stakedBalance Filter the pooled-staking vault ERC-20 (0x4fef9d74…) from regular token/balance lists and instead populate stakedBalance on the account tracker entry so it is picked up by the StakingBalance component on the Token Details page. Adds 7 new unit tests covering: - stakedBalance is populated from the vault ERC-20 balance - native balance spread-guard preserves stakedBalance regardless of iteration order - regular ERC-20s do not set stakedBalance - vault token is excluded from getTokensControllerAllTokens (assetsBalance and customAssets paths) - vault token is excluded from getTokenBalancesControllerTokenBalances (balance and zero-placeholder paths)
|
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. |
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
SmokeStake: Directly impacted - the staked balance display mechanism is changed. The vault token is now the source of SmokeWalletPlatform: The token list filtering affects the wallet's token display. The vault token should no longer appear as a regular ERC-20 in the token list, affecting the wallet home screen token list. SmokeConfirmations: Required per tag dependency rules when SmokeStake is selected (staking flows involve transaction confirmations). The test file changes are unit tests only and don't affect E2E test selection directly. Performance Test Selection: |
|
⚡ Performance Test Results
✅ All tests passed · 2 tests · 1 device 📱 Devices tested (1)Android: Google Pixel 8 Pro (v14.0) ✅ Passed Tests (2)
Branch: |



Filter the pooled-staking vault ERC-20 (0x4fef9d74…) from regular token/balance lists and instead populate stakedBalance on the account tracker entry so it is picked up by the StakingBalance component on the Token Details page.
Adds 7 new unit tests covering:
Description
Changelog
CHANGELOG entry: filter pooled-staking vault token and surface its balance as stakedBalance
Related issues
Fixes: #32113
Manual testing steps
Screenshots/Recordings
Before
After
staking.mov
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
Changes balance and token list shaping behind a feature flag; wrong filtering could hide balances or mis-report staked ETH, but scope is limited to two known vault asset IDs and is well covered by tests.
Overview
When assets unify state is enabled, the pooled-staking vault ERC-20 (
0x4FEF9D74…on Ethereum mainnet and Hoodi) is no longer shown as a normal token. Its balance is mapped tostakedBalanceon the account-tracker migration so staking UI (e.g. Token Details / StakingBalance) can show staked ETH separately.assets-migration.tsadds chain-scoped CAIP-19 filtering (STAKED_TOKEN_ASSET_IDS_TO_FILTER+isStakedTokenAssetId) and skips the vault ingetTokensControllerAllTokensandgetTokenBalancesControllerTokenBalances(including custom-asset zero placeholders).getAccountTrackerControllerAccountsByChainIdnow handles native balances and vault ERC-20 in one loop, settingstakedBalancefrom the vault amount and using a spread on the native branch sostakedBalanceis not lost if asset iteration order varies.Tests cover
stakedBalancepopulation, iteration-order preservation, non-vault ERC-20s unchanged, and vault exclusion from all token/balance migration paths.Reviewed by Cursor Bugbot for commit f902b31. Bugbot is set up for automated code reviews on this repo. Configure here.