Skip to content

chore: add imageUrl#8448

Merged
zone-live merged 14 commits intomainfrom
TSA-372-385-387-social-updates
Apr 15, 2026
Merged

chore: add imageUrl#8448
zone-live merged 14 commits intomainfrom
TSA-372-385-387-social-updates

Conversation

@joaosantos15
Copy link
Copy Markdown
Contributor

@joaosantos15 joaosantos15 commented Apr 14, 2026

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

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Touches social API response validation/types and changes the fetchClosedPositions URL selection, which could affect consumers if the API payloads or endpoints differ from assumptions. Scope is limited to @metamask/social-controllers with updated tests covering the new fields and endpoint.

Overview
Adds support for new social-api response fields by extending Position/PositionStruct with optional tokenImageUrl and TraderStats/TraderStatsStruct with optional medianHoldMinutes.

Fixes fetchClosedPositions to 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.

@joaosantos15 joaosantos15 marked this pull request as ready for review April 14, 2026 09:38
@joaosantos15 joaosantos15 requested review from a team as code owners April 14, 2026 09:38
zone-live
zone-live previously approved these changes Apr 14, 2026
Comment thread packages/social-controllers/CHANGELOG.md Outdated
Bigshmow
Bigshmow previously approved these changes Apr 14, 2026
Copy link
Copy Markdown
Contributor

@Bigshmow Bigshmow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note on median vs mean, otherwise LGTM.

Comment thread packages/social-controllers/src/social-types.ts Outdated
Comment thread packages/social-controllers/src/social-types.ts Outdated
zone-live
zone-live previously approved these changes Apr 15, 2026
Co-authored-by: Devin Stewart <49423028+Bigshmow@users.noreply.github.com>
zone-live
zone-live previously approved these changes Apr 15, 2026
@zone-live zone-live enabled auto-merge April 15, 2026 09:11
Comment thread packages/social-controllers/src/SocialService.ts
Comment thread packages/social-controllers/CHANGELOG.md Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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())),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b1fc8cb. Configure here.

@zone-live zone-live added this pull request to the merge queue Apr 15, 2026
Merged via the queue into main with commit f105195 Apr 15, 2026
345 checks passed
@zone-live zone-live deleted the TSA-372-385-387-social-updates branch April 15, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants