feat: init AUS watchlist integration#31734
Conversation
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. |
|
Adding |
|
This PR will need to go in after #32343 which integrates the terminal API |
|
@metamaskbot publish-preview |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|
⚡ Performance Test Results
✅ All tests passed · 1 tests · 1 device 📱 Devices tested (1)Android: Google Pixel 8 Pro (v14.0) ✅ Passed Tests (1)
Branch: |



Description
Integrates the Perps watchlist with the Authenticated User Storage (AUS) service, so a user's watched markets are persisted to remote storage and synced across devices when they are authenticated.
Changes
@metamask/perps-controllerbump to^9.0.0(package.json,yarn.lock)toggleWatchlistMarket. On add/remove, it writes the updated watchlist into theperps.watchlistMarketsfield ofNotificationPreferencesviaAuthenticatedUserStorageService:putNotificationPreferences. It gracefully degrades to local-only when the user is unauthenticated or the preferences blob has not yet been initialised.Messenger wiring (
perps-controller-messenger/index.ts)AuthenticatedUserStorageService:getNotificationPreferencesandAuthenticatedUserStorageService:putNotificationPreferencesactions to thePerpsControllerMessengerso the controller can call them through the root messenger.usePerpsWatchlistActionshook cleanup (usePerpsWatchlistActions.ts)TODOscaffolding comments for optimistic UI and User Storage API seams — those are now handled inside the controller.toggleWatchlistMarketcalls are now properlyawait-ed so errors surface and the error toast works correctly.Integration tests (
perps-controller/index.test.ts,perps-controller-messenger/index.test.ts)PerpsController watchlist ↔ AuthenticatedUserStorageService) covering: add writes the symbol to AUS, remove deletes it, list merges correctly with existing remote symbols, rollback on failed write, and graceful no-op when the preferences blob isnull.Changelog
CHANGELOG entry: Integrate AUS Perps Watchlist
Related issues
Fixes: TAT-2663
Manual testing steps
Screenshots/Recordings
Before
After
Screen.Recording.2026-06-15.at.1.23.59.PM.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
Touches cross-device user preference persistence via Authenticated User Storage; risk is mitigated by controller-owned rollback, skipped writes when prefs are uninitialized, and new integration coverage.
Overview
Wires Perps watchlist persistence to Authenticated User Storage (AUS) by adopting
@metamask/perps-controller^9.0.0 (viapackage.jsonresolution). Watchlist add/remove now runs optimistic local updates and syncsperps.watchlistMarketsthroughNotificationPreferences, with local-only behavior when prefs are missing or the user is unauthenticated.usePerpsWatchlistActionsdrops the old optimistic/AUS TODO scaffolding and documents thatPerpsController.toggleWatchlistMarketowns that behavior. Analytics for favorite/unfavorite only fire after confirming the symbol is actually on or off the list post-toggle (so failed adds or rollbacks do not emit misleading events).Adds integration tests on the real controller: AUS read/write on toggle, merge with remote symbols, rollback when
putNotificationPreferencesfails, and skipping remote writes whengetNotificationPreferencesisnull. Messenger test copy is updated to describe AUS notification-preference delegation.Reviewed by Cursor Bugbot for commit 0bcf1df. Bugbot is set up for automated code reviews on this repo. Configure here.