Merged
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ord validation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mcmire
reviewed
Mar 30, 2026
…ibility Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…esponses Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
## Explanation Adds SocialController — a BaseController extension that manages social trading state for the extension UI. Consumes the SocialService from TSA-317 and exposes 4 messenger actions for leaderboard and follow state management. ### Why no TTL or caching logic The controller acts as a simple store — no TTL, no eviction, no staleness checks. The social-api already caches upstream (leaderboard at 5min, positions at 30s), and the UI knows best when to re-fetch (screen focus, pull-to-refresh, user actions). Double-caching adds complexity without meaningful benefit. State is persisted across sessions so the UI can render immediately on startup while a fresh fetch is in flight. See CHANGELOG.md for the full list of additions. <!-- 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? --> ## 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 - [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/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Adds a new persisted `BaseController` with messenger-exposed methods that update stored follow/leaderboard state, which could affect UI behavior and state persistence if wiring or state updates are incorrect. Changes are scoped to the new `@metamask/social-controllers` package with good test coverage. > > **Overview** > Introduces **`SocialController`** (a `BaseController`) that persists social trading UI state and exposes messenger actions `updateLeaderboard`, `followTrader`, `unfollowTrader`, and `updateFollowing`, updating `leaderboardEntries` and `followingAddresses` based on `SocialService` responses. > > Exports the new controller/types from `index.ts`, adds `SocialControllerState` to `social-types`, and wires in the `@metamask/base-controller` dependency/TS project references. Adds comprehensive unit tests covering state updates, messenger callability, and error propagation, and updates the changelog accordingly. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit a6a3c13. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
Contributor
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Contributor
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
joaosantos15
reviewed
Apr 2, 2026
Comment on lines
+86
to
+87
| address: string; | ||
| allAddresses: string[]; |
Contributor
There was a problem hiding this comment.
we need to remove address and keep only addresses
joaosantos15
approved these changes
Apr 2, 2026
micaelae
pushed a commit
that referenced
this pull request
Apr 7, 2026
## Explanation Adds SocialService — a stateless data service that wraps all social-api endpoints with TypeScript types and superstruct response validation. This is the data layer that a future [SocialController (TSA-318)](https://consensyssoftware.atlassian.net/browse/TSA-318) will consume. We intentionally shipped the service without the controller so callers can weigh in on what state shape and messenger actions they actually need before we wire up BaseController. The service stands on its own and can be used directly for testing integration with the social-api once it's deployed. See CHANGELOG.md for the full list of additions. <!-- 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? --> ## 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 - [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/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Introduces new networking and persisted state logic (via `BaseDataService`/`BaseController`) for social-api interactions, which could impact consumers if schemas/endpoints differ or caching semantics are wrong. Scoped to a new package but touches request construction, response validation, and follow/unfollow state updates. > > **Overview** > Adds an initial implementation of `@metamask/social-controllers` focused on social trading data and state. > > Introduces `SocialService` (a `BaseDataService`) that wraps social-api endpoints (`leaderboard`, trader profile, open/closed positions, followers/following, follow/unfollow) with `superstruct` response validation, consistent `HttpError` handling, and query caching (including special-casing open-positions cache keys and forcing fresh fetches for follow/following mutations). > > Adds `SocialController` (a `BaseController`) that persists UI-facing state for `leaderboardEntries` and `followingAddresses`, exposing messenger actions to refresh the leaderboard, follow/unfollow traders (with address dedupe), and sync the following list. Package exports are updated accordingly, with comprehensive Jest coverage, new dependencies, TS project references, and an updated changelog. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 08282b0. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: António Regadas <apregadas@gmail.com> Co-authored-by: Antonio Regadas <antonio.regadas@consensys.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Explanation
Adds SocialService — a stateless data service that wraps all social-api endpoints with TypeScript types and superstruct response validation. This is the data layer that a future SocialController (TSA-318) will consume.
We intentionally shipped the service without the controller so callers can weigh in on what state shape and messenger actions they actually need before we wire up BaseController. The service stands on its own and can be used directly for testing integration with the social-api once it's deployed.
See CHANGELOG.md for the full list of additions.
References
Checklist
Note
Medium Risk
Introduces new networking and persisted state logic (via
BaseDataService/BaseController) for social-api interactions, which could impact consumers if schemas/endpoints differ or caching semantics are wrong. Scoped to a new package but touches request construction, response validation, and follow/unfollow state updates.Overview
Adds an initial implementation of
@metamask/social-controllersfocused on social trading data and state.Introduces
SocialService(aBaseDataService) that wraps social-api endpoints (leaderboard, trader profile, open/closed positions, followers/following, follow/unfollow) withsuperstructresponse validation, consistentHttpErrorhandling, and query caching (including special-casing open-positions cache keys and forcing fresh fetches for follow/following mutations).Adds
SocialController(aBaseController) that persists UI-facing state forleaderboardEntriesandfollowingAddresses, exposing messenger actions to refresh the leaderboard, follow/unfollow traders (with address dedupe), and sync the following list. Package exports are updated accordingly, with comprehensive Jest coverage, new dependencies, TS project references, and an updated changelog.Written by Cursor Bugbot for commit 08282b0. This will update automatically on new commits. Configure here.