feat: add trader-activity feed to @metamask/social-controllers#9447
Open
joaosantos15 wants to merge 3 commits into
Open
feat: add trader-activity feed to @metamask/social-controllers#9447joaosantos15 wants to merge 3 commits into
@metamask/social-controllers#9447joaosantos15 wants to merge 3 commits into
Conversation
Add `fetchFeed` to `SocialService` (and the `SocialService:fetchFeed` messenger action) proxying the social-api `GET /feed` endpoint. - Supports a `scope` (`following` default, or `leaderboard`), `chains`, `limit`, and cursor pagination (`olderThan`/`newerThan`) for infinite scroll. - Adds `FeedItem`/`FeedPagination`/`FeedResponse`/`FetchFeedOptions` types; `FeedItem` reuses `Position` + `ProfileSummary`, and validation reuses `PositionStruct` via `assign`. - Adds a temporary `test` flag that serves the following feed for a fixed demo wallet until Clicker resolves feeds by profile id.
zone-live
previously approved these changes
Jul 9, 2026
Clicker's /v1/feed now accepts an `identifier` param, so the temporary `test` flag on `fetchFeed` is no longer needed. Remove it from `FetchFeedOptions` and the request builder. Also note that `chains` are CAIP-2 chain ids.
Contributor
Author
|
@metamaskbot publish-previews |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
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
The mobile app needs a trader-activity feed (see the "Trader activity" tab) but the
@metamask/social-controllerspackage had no way to fetch it. The social-api now proxies Clicker's feed endpoints; this PR exposes that surface to consumers.Adds a
fetchFeedmethod toSocialService, exposed over the messenger asSocialService:fetchFeed. It calls the social-apiGET /feedand returns the items plus cursor pagination:scope—following(default, personalized to the JWT-identified user) orleaderboard(generic, shared by all users). This is the query parameter the service uses to select the per-user vs generic feed.chains— filter as CAIP-2 chain ids (e.g.eip155:8453); the social-api translates them to Clicker chain names.limit— passthrough.olderThan/newerThan— opaque cursors for infinite scroll. The responsepaginationexposesolderCursor/newerCursorto feed back in.The method follows the existing read-only fetch pattern (
fetchOpenPositions,fetchTraderProfile, etc.): it lives onSocialService(notSocialController), since the feed is cursor-paginated data the UI manages itself rather than persisted controller state.New exported types:
FeedItem,FeedPagination,FeedResponse,FetchFeedOptions.FeedItemextends the existingPositiontype with the trade'sactor(ProfileSummary) and creationtimestamp, so most of the shape (and its superstruct validation, viaassign(PositionStruct, ...)) is reused rather than redefined.References
Checklist