You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feat/social controllers leaderboard opt out in (#9354)
## Explanation
Adds `optOutOfLeaderboard` and `optInToLeaderboard` to
`SocialController` and `SocialService`, with their corresponding
messenger actions. `@metamask/social-controllers` previously had no way
to opt a user out of (or back into) the Top Traders leaderboard; the
mobile client needs these to remove/restore a user from the global,
Clicker-backed leaderboard. Each method `POST`s to the existing
social-api endpoint (`/leaderboard/opt-out`, `/leaderboard/opt-in`) with
the JWT already attached by `SocialService`, and resolves to `void` on
the backend's `204`. Purely additive — no existing methods, types, or
behavior change.
## References
- Related to
[TSA-830](https://consensyssoftware.atlassian.net/browse/TSA-830) -
leaderboard opt-out: client flow + AUS persistence. Consumed by the
MetaMask mobile client.
## 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
[TSA-830]:
https://consensyssoftware.atlassian.net/browse/TSA-830?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Purely additive API surface with tests; no changes to existing
methods, state, or auth flow beyond new leaderboard preference calls.
>
> **Overview**
> Adds **`optOutOfLeaderboard`** and **`optInToLeaderboard`** to
`@metamask/social-controllers` so clients (e.g. mobile) can remove or
restore the signed-in user on the Top Traders / PnL leaderboard.
>
> **`SocialService`** issues JWT-authenticated **`POST`** requests to
**`/api/v1/leaderboard/opt-out`** and **`/api/v1/leaderboard/opt-in`**,
treats success as **`204`**, and surfaces failures via new
**`LEADERBOARD_OPT_OUT_FAILED`** / **`LEADERBOARD_OPT_IN_FAILED`**
messages. **`SocialController`** exposes the same operations as thin
messenger delegates (no controller state changes). Messenger action
types, package exports, changelog, and unit tests are updated
accordingly.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
bdef2c4. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: packages/social-controllers/CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
### Added
11
+
12
+
- Add `optOutOfLeaderboard` and `optInToLeaderboard` methods to `SocialController` and `SocialService`, with corresponding messenger actions (`SocialController:optOutOfLeaderboard`, `SocialController:optInToLeaderboard`, `SocialService:optOutOfLeaderboard`, `SocialService:optInToLeaderboard`). These call `POST /leaderboard/opt-out` and `POST /leaderboard/opt-in` respectively (JWT-authed, `204 No Content` on success) ([#9354](https://github.com/MetaMask/core/pull/9354))
13
+
10
14
### Changed
11
15
12
16
- Bump `@metamask/controller-utils` from `^12.2.0` to `^12.3.0` ([#9218](https://github.com/MetaMask/core/pull/9218))
0 commit comments