Skip to content

feat(social-controllers): add intent and category fields to Trade type#8410

Open
Bigshmow wants to merge 3 commits intomainfrom
TSA-371-trade-intent-category-fields
Open

feat(social-controllers): add intent and category fields to Trade type#8410
Bigshmow wants to merge 3 commits intomainfrom
TSA-371-trade-intent-category-fields

Conversation

@Bigshmow
Copy link
Copy Markdown
Contributor

@Bigshmow Bigshmow commented Apr 9, 2026

Explanation

Add intent ("enter" | "exit") as the preferred alternative to the semi-deprecated direction field, and category (optional) to distinguish trade types (e.g. "receive" for airdrops/transfers).

TSA-371

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
Adds a new required Trade.intent field and tightens SocialService response validation, which can break consumers or runtime parsing if upstream APIs don’t yet provide the new field. Scope is limited to social trade/position typing and schema checks.

Overview
Updates the Trade model to include a new required intent field (preferred over the semi-deprecated direction) plus an optional category to distinguish trade types.

Extends SocialService superstruct validation for position/trade payloads to require intent and accept category, and updates tests/changelog accordingly.

Reviewed by Cursor Bugbot for commit 241032a. Bugbot is set up for automated code reviews on this repo. Configure here.

Bigshmow and others added 2 commits April 8, 2026 19:21
Add `intent` ("enter" | "exit") as the preferred alternative to the
semi-deprecated `direction` field, and `category` (optional) to
distinguish trade types (e.g. "receive" for airdrops/transfers).

TSA-371

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Bigshmow Bigshmow marked this pull request as ready for review April 9, 2026 01:41
@Bigshmow Bigshmow requested review from a team as code owners April 9, 2026 01:41
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 4480a26. Configure here.

@Bigshmow Bigshmow enabled auto-merge April 9, 2026 02:20
@@ -30,8 +30,12 @@ export type SocialHandles = {
* A single trade within a position.
*/
export type Trade = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of writing this type explicitly, we could infer it from the superstruct:

const TradeStruct = ...

export type Trade = Infer<typeof TradeStruct>

Comment on lines +61 to +62
intent: string(),
category: optional(string()),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since intent and category both have a predetermined set of values, we could make the typing tighter:

intent: enums(['enter', 'exit']),
category: optional(enums([...]),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

let me ping them and ask, receive is the only category I'm aware of after discussing with them so far.

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.

2 participants