Conversation
Bigshmow
left a comment
There was a problem hiding this comment.
Just a note on median vs mean, otherwise LGTM.
Co-authored-by: Devin Stewart <49423028+Bigshmow@users.noreply.github.com>
…core into TSA-372-385-387-social-updates
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.
Reviewed by Cursor Bugbot for commit b1fc8cb. Configure here.
| winRate7d: optional(nullable(number())), | ||
| roiPercent7d: optional(nullable(number())), | ||
| tradeCount7d: optional(nullable(number())), | ||
| medianHoldMinutes: optional(nullable(number())), |
There was a problem hiding this comment.
Schema field name likely mismatches API response key
Medium Severity
The PR discussion states the backend API (clicker) returns medianHoldingTimeMinutes, but the superstruct schema and TraderStats type both define the field as medianHoldMinutes. Since superstruct's type() matches on exact key names and this field is optional(nullable(...)), validation silently passes even though the key is absent — meaning medianHoldMinutes will always be undefined at runtime, and the actual API value under medianHoldingTimeMinutes is silently discarded.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b1fc8cb. Configure here.


Explanation
Add tokenImageUrl to Position and avgHoldMinutes to TraderStats types and superstruct schemas so the extension can consume the new API fields. Also fixes fetchClosedPositions hitting a v2 URL that doesn't exist (the closed positions endpoint is v1-only), which was causing 404s.
References
Checklist
Note
Medium Risk
Touches social API response validation/types and changes the
fetchClosedPositionsURL selection, which could affect consumers if the API payloads or endpoints differ from assumptions. Scope is limited to@metamask/social-controllerswith updated tests covering the new fields and endpoint.Overview
Adds support for new social-api response fields by extending
Position/PositionStructwith optionaltokenImageUrlandTraderStats/TraderStatsStructwith optionalmedianHoldMinutes.Fixes
fetchClosedPositionsto call the v1 closed-positions endpoint (while keeping open positions on v2) to avoid 404s, and updates tests/changelog accordingly.Reviewed by Cursor Bugbot for commit b1fc8cb. Bugbot is set up for automated code reviews on this repo. Configure here.