feat: AUS Perps Watchlist#9010
Conversation
|
@metamaskbot publish-previews |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
* main: (497 commits) Release/1053.0.0 (#9195) Revert @metamask/transaction-pay-controller changes not required (#9194) chore: add discovery event names (#9178) chore: deprecate CurrencyRateController (#9182) Release/1052.0.0 (#9188) fix: getQuoteUser function is broken if request is not postQuote (#9187) fix(network-controller): Remove deprecated NetworkControllerGetNetworkConfigurationByNetworkClientId type (#9185) fix(network-controller): Remove MegaETH v1 default configuration (#9183) Release/1051.0.0 (#9181) fix: MM Pay transaction with isQuoteRequired that have same source and destination chain and token (#9150) Release/1050.0.0 (#9180) fix(network-controller): Only consider failover endpoints when using Infura (#9125) feat(assets-controllers): add isDeprecated to multichain controllers (#9044) refactor(smart-transactions-controller): import AuthenticationController namespace (#9167) Release 1049.0.0 (#9177) fix(transaction-pay-controller): vault musd via sentinel (#9161) Release 1048.0.0 (#9174) chore: remove orphaned semver.sh helper (#9172) fix(rpc-service): Consider all Infura HTTP errors as service failures except 400 and 429 (#9123) chore: remove outdated migrate-tags guide (#9171) ...
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
geositta
left a comment
There was a problem hiding this comment.
Requesting changes. The AUS integration follows the expected messenger and read merge write pattern, and the queue addresses concurrent toggle ordering. I found one source of truth issue where an intentionally cleared remote watchlist can be overwritten by stale local cache during init. Changing the init check to use exchange key presence instead of symbol count should preserve remote clears and keep migration limited to users who have not been migrated yet.
geositta
left a comment
There was a problem hiding this comment.
Approve. Thanks, the AUS watchlist sync now preserves remote source of truth, including empty remote watchlists.
Explanation
Persists
state.watchlistMarketsto AUS so the watchlist follows the user across devices and clients, rather than being device-local only.What changed
toggleWatchlistMarketnow performs an optimistic local update first (UI is instant), then syncs to AUS. If the remote write fails, local state is reverted.Integration (client PRs)
Each client needs to grant the PerpsController messenger two new allowed actions:
AuthenticatedUserStorageService:getNotificationPreferencesAuthenticatedUserStorageService:putNotificationPreferencesNo other wiring needed —
AuthenticatedUserStorageServiceis already running whereverNotificationServicesControlleris wired, andAuthenticationController:getBearerTokenwas already allowed.References
Checklist
Note
Medium Risk
Cross-device user preference writes and a breaking
toggleWatchlistMarketAPI change require correct messenger wiring; merge logic and queue ordering reduce race risk but remote/local divergence on auth failures is possible by design.Overview
Perps watchlist favorites are now synced to Authenticated UserStorage (
perps.watchlistMarketsinside notification preferences) so they follow the signed-in user across devices, while local persisted state remains the offline cache.toggleWatchlistMarketis nowasync(Promise<void>) and does an optimistic local update, then a serialized AUS read-merge-write via#ausQueue; failed remote writes revert local state. Init kicks off non-blocking#syncWatchlistFromRemoteon the same queue so hydration finishes before toggles race it. Remote is source of truth when an exchange key exists (including empty lists); missing exchange keys trigger a one-time migration from local favorites.resolveWatchlistExchangeKeymapshyperliquid/myx;aggregatedand missing blobs skip AUS without throwing. Favorite-toggle analytics are emitted on toggle.Clients must allow messenger actions
AuthenticatedUserStorageService:getNotificationPreferencesandputNotificationPreferences(README dependency graph updated). Package adds@metamask/authenticated-user-storageas a dev dependency and extensive AUS sync tests.Reviewed by Cursor Bugbot for commit f1d5db8. Bugbot is set up for automated code reviews on this repo. Configure here.