@metamask-previews/social-controllers 3.2.0-preview-ff2ab0583 → 3.3.0-preview-c4789fdf4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Added
11
11
 
12
+ - Add `createSwapComment` method to `SocialService` (and the `SocialService:createSwapComment` messenger action) to create an author Call (user post) on the caller's own swap. Calls `POST /swap-comments` with `commentText` and exactly one of `positionUid` or `tradeInFlight`, plus optional `source`. `commentText` may include a `https://static.klipy.com/...gif` file URL (allowlisted by social-api). Returns `SwapCommentResponse` ([#10471](https://github.com/MetaMask/core/pull/10471))
13
+
14
+ ## [3.3.0]
15
+
16
+ ### Added
17
+
12
18
  - Add `fetchTokenFeed` method to `SocialService` (and the `SocialService:fetchTokenFeed` messenger action) for one token's positions as feed items. Calls `GET /tokens/:chain/:contractAddress/feed`, where `chain` is `TokenFeedChain` (`base`, `bsc`, `ethereum`, `hyperliquid`, `robinhood`, or `solana`), with optional `status` (`open` or `closed`; omit for both), `limit`, and cursor pagination (`olderThan`/`newerThan`). Reuses existing `FeedResponse` / `FeedItem` validation ([#10458](https://github.com/MetaMask/core/pull/10458))
13
19
 
14
20
  ## [3.2.0]
@@ -217,7 +223,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
217
223
  - `unfollowTrader` — unfollows traders and removes addresses from state
218
224
  - `updateFollowing` — fetches following list and replaces addresses in state
219
225
 
220
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@3.2.0...HEAD
226
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@3.3.0...HEAD
227
+ [3.3.0]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@3.2.0...@metamask/social-controllers@3.3.0
221
228
  [3.2.0]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@3.1.0...@metamask/social-controllers@3.2.0
222
229
  [3.1.0]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@3.0.2...@metamask/social-controllers@3.1.0
223
230
  [3.0.2]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@3.0.1...@metamask/social-controllers@3.0.2
@@ -197,6 +197,26 @@ export type SocialServiceRemoveCommentReactionAction = {
197
197
  type: `SocialService:removeCommentReaction`;
198
198
  handler: SocialService['removeCommentReaction'];
199
199
  };
200
+ /**
201
+ * Creates an author Call (user post) on one of the current user's swaps.
202
+ *
203
+ * Calls `POST ${baseUrl}/swap-comments`. Identify the swap with
204
+ * `positionUid` (the `positionId` of a feed item or position) or, for a
205
+ * trade too recent to be indexed, `tradeInFlight`. Provide exactly one of
206
+ * those two fields.
207
+ *
208
+ * @param options - Options bag.
209
+ * @param options.commentText - Message body of the post. May include a
210
+ * `https://static.klipy.com/...gif` file URL; social-api rejects other links.
211
+ * @param options.source - Free-form origin label stored on the comment.
212
+ * @param options.positionUid - Position UUID (`positionId` / feed item id).
213
+ * @param options.tradeInFlight - Hash, chain, and token of a swap in flight.
214
+ * @returns The created swap comment.
215
+ */
216
+ export type SocialServiceCreateSwapCommentAction = {
217
+ type: `SocialService:createSwapComment`;
218
+ handler: SocialService['createSwapComment'];
219
+ };
200
220
  /**
201
221
  * Fetches the list of traders the current user is following.
202
222
  *
@@ -276,5 +296,5 @@ export type SocialServiceRefreshNotificationPreferencesCacheAction = {
276
296
  /**
277
297
  * Union of all SocialService action types.
278
298
  */
279
- export type SocialServiceMethodActions = SocialServiceFetchLeaderboardAction | SocialServiceFetchTraderProfileAction | SocialServiceFetchOpenPositionsAction | SocialServiceFetchClosedPositionsAction | SocialServiceFetchFollowersAction | SocialServiceFetchPositionByIdAction | SocialServiceFetchFeedAction | SocialServiceFetchTraderFeedAction | SocialServiceFetchTokenFeedAction | SocialServiceReactToCommentAction | SocialServiceRemoveCommentReactionAction | SocialServiceFetchFollowingAction | SocialServiceFollowAction | SocialServiceUnfollowAction | SocialServiceOptOutOfLeaderboardAction | SocialServiceOptInToLeaderboardAction | SocialServiceRefreshNotificationPreferencesCacheAction;
299
+ export type SocialServiceMethodActions = SocialServiceFetchLeaderboardAction | SocialServiceFetchTraderProfileAction | SocialServiceFetchOpenPositionsAction | SocialServiceFetchClosedPositionsAction | SocialServiceFetchFollowersAction | SocialServiceFetchPositionByIdAction | SocialServiceFetchFeedAction | SocialServiceFetchTraderFeedAction | SocialServiceFetchTokenFeedAction | SocialServiceReactToCommentAction | SocialServiceRemoveCommentReactionAction | SocialServiceCreateSwapCommentAction | SocialServiceFetchFollowingAction | SocialServiceFollowAction | SocialServiceUnfollowAction | SocialServiceOptOutOfLeaderboardAction | SocialServiceOptInToLeaderboardAction | SocialServiceRefreshNotificationPreferencesCacheAction;
280
300
  //# sourceMappingURL=SocialService-method-action-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SocialService-method-action-types.d.ts","sourceRoot":"","sources":["../src/SocialService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC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,8BAA8B,CAAC;IACrC,OAAO,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;CAC1C,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;CAClC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;CACpC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,sDAAsD,GAAG;IACnE,IAAI,EAAE,mDAAmD,CAAC;IAC1D,OAAO,EAAE,aAAa,CAAC,qCAAqC,CAAC,CAAC;CAC/D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAClC,mCAAmC,GACnC,qCAAqC,GACrC,qCAAqC,GACrC,uCAAuC,GACvC,iCAAiC,GACjC,oCAAoC,GACpC,4BAA4B,GAC5B,kCAAkC,GAClC,iCAAiC,GACjC,iCAAiC,GACjC,wCAAwC,GACxC,iCAAiC,GACjC,yBAAyB,GACzB,2BAA2B,GAC3B,sCAAsC,GACtC,qCAAqC,GACrC,sDAAsD,CAAC"}
1
+ {"version":3,"file":"SocialService-method-action-types.d.ts","sourceRoot":"","sources":["../src/SocialService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EA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,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,sDAAsD,GAAG;IACnE,IAAI,EAAE,mDAAmD,CAAC;IAC1D,OAAO,EAAE,aAAa,CAAC,qCAAqC,CAAC,CAAC;CAC/D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAClC,mCAAmC,GACnC,qCAAqC,GACrC,qCAAqC,GACrC,uCAAuC,GACvC,iCAAiC,GACjC,oCAAoC,GACpC,4BAA4B,GAC5B,kCAAkC,GAClC,iCAAiC,GACjC,iCAAiC,GACjC,wCAAwC,GACxC,oCAAoC,GACpC,iCAAiC,GACjC,yBAAyB,GACzB,2BAA2B,GAC3B,sCAAsC,GACtC,qCAAqC,GACrC,sDAAsD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SocialService-method-action-types.js","sourceRoot":"","sources":["../src/SocialService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SocialService } from './SocialService.js';\n\n/**\n * Fetches the leaderboard of top traders.\n *\n * Calls `GET ${baseUrl}/leaderboard`.\n *\n * @param options - Optional query parameters for sorting, chain filtering, and limit.\n * @returns The leaderboard response with ranked traders.\n */\nexport type SocialServiceFetchLeaderboardAction = {\n type: `SocialService:fetchLeaderboard`;\n handler: SocialService['fetchLeaderboard'];\n};\n\n/**\n * Fetches a trader's profile by address or profile ID.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/profile`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @returns The trader profile response.\n */\nexport type SocialServiceFetchTraderProfileAction = {\n type: `SocialService:fetchTraderProfile`;\n handler: SocialService['fetchTraderProfile'];\n};\n\n/**\n * Fetches a trader's open positions.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/positions/open`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.chain - Filter by chain.\n * @param options.sort - Sort by 'value' or 'latest'.\n * @param options.limit - Number of results per page.\n * @param options.page - Page number (1-based).\n * @returns The positions response.\n */\nexport type SocialServiceFetchOpenPositionsAction = {\n type: `SocialService:fetchOpenPositions`;\n handler: SocialService['fetchOpenPositions'];\n};\n\n/**\n * Fetches a trader's closed positions.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/positions/closed`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.chain - Filter by chain.\n * @param options.sort - Sort by 'value' or 'latest'.\n * @param options.limit - Number of results per page.\n * @param options.page - Page number (1-based).\n * @returns The positions response.\n */\nexport type SocialServiceFetchClosedPositionsAction = {\n type: `SocialService:fetchClosedPositions`;\n handler: SocialService['fetchClosedPositions'];\n};\n\n/**\n * Fetches a trader's MetaMask followers.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/followers`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @returns The followers response.\n */\nexport type SocialServiceFetchFollowersAction = {\n type: `SocialService:fetchFollowers`;\n handler: SocialService['fetchFollowers'];\n};\n\n/**\n * Fetches a single position by its unique ID.\n *\n * Calls `GET ${baseUrl}/traders/position/${positionId}`.\n *\n * @param options - Options bag.\n * @param options.positionId - Unique position ID (UUID).\n * @returns The position.\n */\nexport type SocialServiceFetchPositionByIdAction = {\n type: `SocialService:fetchPositionById`;\n handler: SocialService['fetchPositionById'];\n};\n\n/**\n * Fetches a page of the trader-activity feed.\n *\n * Calls `GET ${baseUrl}/feed`. For the `following` scope the current user is\n * identified server-side from the JWT sub claim carried in the Authorization\n * header; the `leaderboard` scope is generic and shared by all users.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.scope - `following` (default) or `leaderboard`.\n * @param options.chains - Filter by one or more chains.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\nexport type SocialServiceFetchFeedAction = {\n type: `SocialService:fetchFeed`;\n handler: SocialService['fetchFeed'];\n};\n\n/**\n * Fetches a page of one trader's activity as feed items.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/feed`. Unlike {@link fetchFeed},\n * this is scoped to a single profile (open and closed positions in the feed)\n * and does not accept `scope` or `chains`. Set `commentedOnly` to only return\n * positions that carry an author comment.\n *\n * The route is public, but the Authorization header is still sent so the\n * social-api can hydrate `authorComment.engagement.userReaction` for the\n * signed-in viewer.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.commentedOnly - When true, only positions with a comment.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\nexport type SocialServiceFetchTraderFeedAction = {\n type: `SocialService:fetchTraderFeed`;\n handler: SocialService['fetchTraderFeed'];\n};\n\n/**\n * Fetches a page of positions in one token, most recently traded first.\n *\n * Calls `GET ${baseUrl}/tokens/${chain}/${contractAddress}/feed`. Unlike\n * {@link fetchFeed}, this is scoped to a single token and does not accept\n * `scope` or `chains`. Omit `status` to include both open and recently\n * closed positions.\n *\n * The route is public, but the Authorization header is still sent so the\n * social-api can hydrate `authorComment.engagement.userReaction` for the\n * signed-in viewer.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.chain - Chain name where the token is deployed (`TokenFeedChain`).\n * @param options.contractAddress - Token contract address.\n * @param options.status - `open`, `closed`, or omit for both.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\nexport type SocialServiceFetchTokenFeedAction = {\n type: `SocialService:fetchTokenFeed`;\n handler: SocialService['fetchTokenFeed'];\n};\n\n/**\n * Adds or replaces the current user's reaction on a swap comment (Call).\n *\n * Calls `PUT ${baseUrl}/swap-comment/${commentId}/reaction`. One emotion per\n * user per comment: a later PUT replaces the previous emotion.\n *\n * @param options - Options bag.\n * @param options.commentId - `authorComment.uid` from a feed item.\n * @param options.emotion - Emoji or short code to store.\n * @returns Refreshed per-emotion counts and the caller's `userReaction`.\n */\nexport type SocialServiceReactToCommentAction = {\n type: `SocialService:reactToComment`;\n handler: SocialService['reactToComment'];\n};\n\n/**\n * Removes the current user's reaction on a swap comment (Call).\n *\n * Calls `DELETE ${baseUrl}/swap-comment/${commentId}/reaction`. Idempotent\n * when the caller has never reacted.\n *\n * @param options - Options bag.\n * @param options.commentId - `authorComment.uid` from a feed item.\n * @returns Refreshed per-emotion counts and a null `userReaction`.\n */\nexport type SocialServiceRemoveCommentReactionAction = {\n type: `SocialService:removeCommentReaction`;\n handler: SocialService['removeCommentReaction'];\n};\n\n/**\n * Fetches the list of traders the current user is following.\n *\n * Calls `GET ${baseUrl}/users/me/following`. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @returns The following response.\n */\nexport type SocialServiceFetchFollowingAction = {\n type: `SocialService:fetchFollowing`;\n handler: SocialService['fetchFollowing'];\n};\n\n/**\n * Follows one or more traders on behalf of the current user.\n *\n * Calls `PUT ${baseUrl}/users/me/follows`. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.targets - Array of wallet addresses or profile IDs to follow.\n * @returns The follow response with confirmed follows.\n */\nexport type SocialServiceFollowAction = {\n type: `SocialService:follow`;\n handler: SocialService['follow'];\n};\n\n/**\n * Unfollows one or more traders on behalf of the current user.\n *\n * Calls `DELETE ${baseUrl}/users/me/follows?targets=...`. Targets are sent\n * as query params because Fastify does not parse request bodies on DELETE\n * requests per RFC 9110. The caller is identified server-side from the JWT\n * sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.targets - Array of wallet addresses or profile IDs to unfollow.\n * @returns The unfollow response with confirmed unfollows.\n */\nexport type SocialServiceUnfollowAction = {\n type: `SocialService:unfollow`;\n handler: SocialService['unfollow'];\n};\n\n/**\n * Opts the current user out of the PnL leaderboard.\n */\nexport type SocialServiceOptOutOfLeaderboardAction = {\n type: `SocialService:optOutOfLeaderboard`;\n handler: SocialService['optOutOfLeaderboard'];\n};\n\n/**\n * Opts the current user back into the PnL leaderboard.\n */\nexport type SocialServiceOptInToLeaderboardAction = {\n type: `SocialService:optInToLeaderboard`;\n handler: SocialService['optInToLeaderboard'];\n};\n\n/**\n * Asks the social-api to refresh its cached copy of the current user's\n * notification preferences.\n *\n * Calls `POST ${baseUrl}/notifications/preferences/cache-refresh`. The caller\n * is identified server-side from the JWT sub claim carried in the\n * Authorization header, so it can only ever refresh its own entry.\n *\n * The client calls this immediately after writing a preference change to\n * Authenticated User Storage (AUS), which is the source of truth. The social\n * api re-reads from AUS and repopulates its cache so the change is honoured\n * near-instantly rather than after the cache TTL lapses. It is a pure\n * optimisation on top of that bounded TTL: the write has already succeeded by\n * the time this runs, so callers should treat it as best-effort and must not\n * roll back the AUS write if it fails.\n */\nexport type SocialServiceRefreshNotificationPreferencesCacheAction = {\n type: `SocialService:refreshNotificationPreferencesCache`;\n handler: SocialService['refreshNotificationPreferencesCache'];\n};\n\n/**\n * Union of all SocialService action types.\n */\nexport type SocialServiceMethodActions =\n | SocialServiceFetchLeaderboardAction\n | SocialServiceFetchTraderProfileAction\n | SocialServiceFetchOpenPositionsAction\n | SocialServiceFetchClosedPositionsAction\n | SocialServiceFetchFollowersAction\n | SocialServiceFetchPositionByIdAction\n | SocialServiceFetchFeedAction\n | SocialServiceFetchTraderFeedAction\n | SocialServiceFetchTokenFeedAction\n | SocialServiceReactToCommentAction\n | SocialServiceRemoveCommentReactionAction\n | SocialServiceFetchFollowingAction\n | SocialServiceFollowAction\n | SocialServiceUnfollowAction\n | SocialServiceOptOutOfLeaderboardAction\n | SocialServiceOptInToLeaderboardAction\n | SocialServiceRefreshNotificationPreferencesCacheAction;\n"]}
1
+ {"version":3,"file":"SocialService-method-action-types.js","sourceRoot":"","sources":["../src/SocialService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SocialService } from './SocialService.js';\n\n/**\n * Fetches the leaderboard of top traders.\n *\n * Calls `GET ${baseUrl}/leaderboard`.\n *\n * @param options - Optional query parameters for sorting, chain filtering, and limit.\n * @returns The leaderboard response with ranked traders.\n */\nexport type SocialServiceFetchLeaderboardAction = {\n type: `SocialService:fetchLeaderboard`;\n handler: SocialService['fetchLeaderboard'];\n};\n\n/**\n * Fetches a trader's profile by address or profile ID.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/profile`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @returns The trader profile response.\n */\nexport type SocialServiceFetchTraderProfileAction = {\n type: `SocialService:fetchTraderProfile`;\n handler: SocialService['fetchTraderProfile'];\n};\n\n/**\n * Fetches a trader's open positions.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/positions/open`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.chain - Filter by chain.\n * @param options.sort - Sort by 'value' or 'latest'.\n * @param options.limit - Number of results per page.\n * @param options.page - Page number (1-based).\n * @returns The positions response.\n */\nexport type SocialServiceFetchOpenPositionsAction = {\n type: `SocialService:fetchOpenPositions`;\n handler: SocialService['fetchOpenPositions'];\n};\n\n/**\n * Fetches a trader's closed positions.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/positions/closed`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.chain - Filter by chain.\n * @param options.sort - Sort by 'value' or 'latest'.\n * @param options.limit - Number of results per page.\n * @param options.page - Page number (1-based).\n * @returns The positions response.\n */\nexport type SocialServiceFetchClosedPositionsAction = {\n type: `SocialService:fetchClosedPositions`;\n handler: SocialService['fetchClosedPositions'];\n};\n\n/**\n * Fetches a trader's MetaMask followers.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/followers`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @returns The followers response.\n */\nexport type SocialServiceFetchFollowersAction = {\n type: `SocialService:fetchFollowers`;\n handler: SocialService['fetchFollowers'];\n};\n\n/**\n * Fetches a single position by its unique ID.\n *\n * Calls `GET ${baseUrl}/traders/position/${positionId}`.\n *\n * @param options - Options bag.\n * @param options.positionId - Unique position ID (UUID).\n * @returns The position.\n */\nexport type SocialServiceFetchPositionByIdAction = {\n type: `SocialService:fetchPositionById`;\n handler: SocialService['fetchPositionById'];\n};\n\n/**\n * Fetches a page of the trader-activity feed.\n *\n * Calls `GET ${baseUrl}/feed`. For the `following` scope the current user is\n * identified server-side from the JWT sub claim carried in the Authorization\n * header; the `leaderboard` scope is generic and shared by all users.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.scope - `following` (default) or `leaderboard`.\n * @param options.chains - Filter by one or more chains.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\nexport type SocialServiceFetchFeedAction = {\n type: `SocialService:fetchFeed`;\n handler: SocialService['fetchFeed'];\n};\n\n/**\n * Fetches a page of one trader's activity as feed items.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/feed`. Unlike {@link fetchFeed},\n * this is scoped to a single profile (open and closed positions in the feed)\n * and does not accept `scope` or `chains`. Set `commentedOnly` to only return\n * positions that carry an author comment.\n *\n * The route is public, but the Authorization header is still sent so the\n * social-api can hydrate `authorComment.engagement.userReaction` for the\n * signed-in viewer.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.commentedOnly - When true, only positions with a comment.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\nexport type SocialServiceFetchTraderFeedAction = {\n type: `SocialService:fetchTraderFeed`;\n handler: SocialService['fetchTraderFeed'];\n};\n\n/**\n * Fetches a page of positions in one token, most recently traded first.\n *\n * Calls `GET ${baseUrl}/tokens/${chain}/${contractAddress}/feed`. Unlike\n * {@link fetchFeed}, this is scoped to a single token and does not accept\n * `scope` or `chains`. Omit `status` to include both open and recently\n * closed positions.\n *\n * The route is public, but the Authorization header is still sent so the\n * social-api can hydrate `authorComment.engagement.userReaction` for the\n * signed-in viewer.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.chain - Chain name where the token is deployed (`TokenFeedChain`).\n * @param options.contractAddress - Token contract address.\n * @param options.status - `open`, `closed`, or omit for both.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\nexport type SocialServiceFetchTokenFeedAction = {\n type: `SocialService:fetchTokenFeed`;\n handler: SocialService['fetchTokenFeed'];\n};\n\n/**\n * Adds or replaces the current user's reaction on a swap comment (Call).\n *\n * Calls `PUT ${baseUrl}/swap-comment/${commentId}/reaction`. One emotion per\n * user per comment: a later PUT replaces the previous emotion.\n *\n * @param options - Options bag.\n * @param options.commentId - `authorComment.uid` from a feed item.\n * @param options.emotion - Emoji or short code to store.\n * @returns Refreshed per-emotion counts and the caller's `userReaction`.\n */\nexport type SocialServiceReactToCommentAction = {\n type: `SocialService:reactToComment`;\n handler: SocialService['reactToComment'];\n};\n\n/**\n * Removes the current user's reaction on a swap comment (Call).\n *\n * Calls `DELETE ${baseUrl}/swap-comment/${commentId}/reaction`. Idempotent\n * when the caller has never reacted.\n *\n * @param options - Options bag.\n * @param options.commentId - `authorComment.uid` from a feed item.\n * @returns Refreshed per-emotion counts and a null `userReaction`.\n */\nexport type SocialServiceRemoveCommentReactionAction = {\n type: `SocialService:removeCommentReaction`;\n handler: SocialService['removeCommentReaction'];\n};\n\n/**\n * Creates an author Call (user post) on one of the current user's swaps.\n *\n * Calls `POST ${baseUrl}/swap-comments`. Identify the swap with\n * `positionUid` (the `positionId` of a feed item or position) or, for a\n * trade too recent to be indexed, `tradeInFlight`. Provide exactly one of\n * those two fields.\n *\n * @param options - Options bag.\n * @param options.commentText - Message body of the post. May include a\n * `https://static.klipy.com/...gif` file URL; social-api rejects other links.\n * @param options.source - Free-form origin label stored on the comment.\n * @param options.positionUid - Position UUID (`positionId` / feed item id).\n * @param options.tradeInFlight - Hash, chain, and token of a swap in flight.\n * @returns The created swap comment.\n */\nexport type SocialServiceCreateSwapCommentAction = {\n type: `SocialService:createSwapComment`;\n handler: SocialService['createSwapComment'];\n};\n\n/**\n * Fetches the list of traders the current user is following.\n *\n * Calls `GET ${baseUrl}/users/me/following`. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @returns The following response.\n */\nexport type SocialServiceFetchFollowingAction = {\n type: `SocialService:fetchFollowing`;\n handler: SocialService['fetchFollowing'];\n};\n\n/**\n * Follows one or more traders on behalf of the current user.\n *\n * Calls `PUT ${baseUrl}/users/me/follows`. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.targets - Array of wallet addresses or profile IDs to follow.\n * @returns The follow response with confirmed follows.\n */\nexport type SocialServiceFollowAction = {\n type: `SocialService:follow`;\n handler: SocialService['follow'];\n};\n\n/**\n * Unfollows one or more traders on behalf of the current user.\n *\n * Calls `DELETE ${baseUrl}/users/me/follows?targets=...`. Targets are sent\n * as query params because Fastify does not parse request bodies on DELETE\n * requests per RFC 9110. The caller is identified server-side from the JWT\n * sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.targets - Array of wallet addresses or profile IDs to unfollow.\n * @returns The unfollow response with confirmed unfollows.\n */\nexport type SocialServiceUnfollowAction = {\n type: `SocialService:unfollow`;\n handler: SocialService['unfollow'];\n};\n\n/**\n * Opts the current user out of the PnL leaderboard.\n */\nexport type SocialServiceOptOutOfLeaderboardAction = {\n type: `SocialService:optOutOfLeaderboard`;\n handler: SocialService['optOutOfLeaderboard'];\n};\n\n/**\n * Opts the current user back into the PnL leaderboard.\n */\nexport type SocialServiceOptInToLeaderboardAction = {\n type: `SocialService:optInToLeaderboard`;\n handler: SocialService['optInToLeaderboard'];\n};\n\n/**\n * Asks the social-api to refresh its cached copy of the current user's\n * notification preferences.\n *\n * Calls `POST ${baseUrl}/notifications/preferences/cache-refresh`. The caller\n * is identified server-side from the JWT sub claim carried in the\n * Authorization header, so it can only ever refresh its own entry.\n *\n * The client calls this immediately after writing a preference change to\n * Authenticated User Storage (AUS), which is the source of truth. The social\n * api re-reads from AUS and repopulates its cache so the change is honoured\n * near-instantly rather than after the cache TTL lapses. It is a pure\n * optimisation on top of that bounded TTL: the write has already succeeded by\n * the time this runs, so callers should treat it as best-effort and must not\n * roll back the AUS write if it fails.\n */\nexport type SocialServiceRefreshNotificationPreferencesCacheAction = {\n type: `SocialService:refreshNotificationPreferencesCache`;\n handler: SocialService['refreshNotificationPreferencesCache'];\n};\n\n/**\n * Union of all SocialService action types.\n */\nexport type SocialServiceMethodActions =\n | SocialServiceFetchLeaderboardAction\n | SocialServiceFetchTraderProfileAction\n | SocialServiceFetchOpenPositionsAction\n | SocialServiceFetchClosedPositionsAction\n | SocialServiceFetchFollowersAction\n | SocialServiceFetchPositionByIdAction\n | SocialServiceFetchFeedAction\n | SocialServiceFetchTraderFeedAction\n | SocialServiceFetchTokenFeedAction\n | SocialServiceReactToCommentAction\n | SocialServiceRemoveCommentReactionAction\n | SocialServiceCreateSwapCommentAction\n | SocialServiceFetchFollowingAction\n | SocialServiceFollowAction\n | SocialServiceUnfollowAction\n | SocialServiceOptOutOfLeaderboardAction\n | SocialServiceOptInToLeaderboardAction\n | SocialServiceRefreshNotificationPreferencesCacheAction;\n"]}
@@ -4,7 +4,7 @@ import type { CreateServicePolicyOptions } from '@metamask/controller-utils';
4
4
  import type { Messenger } from '@metamask/messenger';
5
5
  import type { AuthenticationController } from '@metamask/profile-sync-controller';
6
6
  import { serviceName } from './social-constants.js';
7
- import type { CommentEngagement, FeedResponse, FetchFeedOptions, FetchFollowersOptions, FetchLeaderboardOptions, FetchPositionByIdOptions, FetchPositionsOptions, FetchTokenFeedOptions, FetchTraderFeedOptions, FetchTraderProfileOptions, FollowersResponse, FollowingResponse, FollowOptions, FollowResponse, LeaderboardResponse, Position, PositionsResponse, ReactToCommentOptions, RemoveCommentReactionOptions, TraderProfileResponse, UnfollowOptions, UnfollowResponse } from './social-types.js';
7
+ import type { CommentEngagement, CreateSwapCommentOptions, FeedResponse, FetchFeedOptions, FetchFollowersOptions, FetchLeaderboardOptions, FetchPositionByIdOptions, FetchPositionsOptions, FetchTokenFeedOptions, FetchTraderFeedOptions, FetchTraderProfileOptions, FollowersResponse, FollowingResponse, FollowOptions, FollowResponse, LeaderboardResponse, Position, PositionsResponse, ReactToCommentOptions, RemoveCommentReactionOptions, SwapCommentResponse, TraderProfileResponse, UnfollowOptions, UnfollowResponse } from './social-types.js';
8
8
  import type { SocialServiceMethodActions } from './SocialService-method-action-types.js';
9
9
  export type SocialServiceActions = SocialServiceMethodActions | DataServiceInvalidateQueriesAction<typeof serviceName>;
10
10
  export type SocialServiceEvents = DataServiceCacheUpdatedEvent<typeof serviceName> | DataServiceGranularCacheUpdatedEvent<typeof serviceName>;
@@ -182,6 +182,23 @@ export declare class SocialService extends BaseDataService<typeof serviceName, S
182
182
  * @returns Refreshed per-emotion counts and a null `userReaction`.
183
183
  */
184
184
  removeCommentReaction(options: RemoveCommentReactionOptions): Promise<CommentEngagement>;
185
+ /**
186
+ * Creates an author Call (user post) on one of the current user's swaps.
187
+ *
188
+ * Calls `POST ${baseUrl}/swap-comments`. Identify the swap with
189
+ * `positionUid` (the `positionId` of a feed item or position) or, for a
190
+ * trade too recent to be indexed, `tradeInFlight`. Provide exactly one of
191
+ * those two fields.
192
+ *
193
+ * @param options - Options bag.
194
+ * @param options.commentText - Message body of the post. May include a
195
+ * `https://static.klipy.com/...gif` file URL; social-api rejects other links.
196
+ * @param options.source - Free-form origin label stored on the comment.
197
+ * @param options.positionUid - Position UUID (`positionId` / feed item id).
198
+ * @param options.tradeInFlight - Hash, chain, and token of a swap in flight.
199
+ * @returns The created swap comment.
200
+ */
201
+ createSwapComment(options: CreateSwapCommentOptions): Promise<SwapCommentResponse>;
185
202
  /**
186
203
  * Fetches the list of traders the current user is following.
187
204
  *
@@ -1 +1 @@
1
- {"version":3,"file":"SocialService.d.ts","sourceRoot":"","sources":["../src/SocialService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EACnC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE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mC,IAAI,OAAO,CAAC,IAAI,CAAC,CAkBzD;CAqEF"}
@@ -142,6 +142,28 @@ const AuthorCommentStruct = structType({
142
142
  timestamp: number(),
143
143
  engagement: CommentEngagementStruct,
144
144
  });
145
+ const SwapCommentAuthorStruct = structType({
146
+ id: string(),
147
+ name: string(),
148
+ images: optional(structType({
149
+ raw: nullable(string()),
150
+ xs: nullable(string()),
151
+ sm: nullable(string()),
152
+ })),
153
+ addresses: optional(array(string())),
154
+ externalId: optional(string()),
155
+ });
156
+ const SwapCommentResponseStruct = structType({
157
+ uid: string(),
158
+ transactionHash: string(),
159
+ chain: string(),
160
+ tokenAddress: string(),
161
+ commentText: string(),
162
+ author: SwapCommentAuthorStruct,
163
+ timestamp: number(),
164
+ isAppUserComment: boolean(),
165
+ metrics: CommentEngagementStruct,
166
+ });
145
167
  const FeedItemStruct = assign(PositionStruct, structType({
146
168
  actor: FeedActorStruct,
147
169
  timestamp: number(),
@@ -190,6 +212,7 @@ const MESSENGER_EXPOSED_METHODS = [
190
212
  'fetchTokenFeed',
191
213
  'reactToComment',
192
214
  'removeCommentReaction',
215
+ 'createSwapComment',
193
216
  'follow',
194
217
  'unfollow',
195
218
  'optOutOfLeaderboard',
@@ -624,6 +647,57 @@ export class SocialService extends BaseDataService {
624
647
  },
625
648
  });
626
649
  }
650
+ /**
651
+ * Creates an author Call (user post) on one of the current user's swaps.
652
+ *
653
+ * Calls `POST ${baseUrl}/swap-comments`. Identify the swap with
654
+ * `positionUid` (the `positionId` of a feed item or position) or, for a
655
+ * trade too recent to be indexed, `tradeInFlight`. Provide exactly one of
656
+ * those two fields.
657
+ *
658
+ * @param options - Options bag.
659
+ * @param options.commentText - Message body of the post. May include a
660
+ * `https://static.klipy.com/...gif` file URL; social-api rejects other links.
661
+ * @param options.source - Free-form origin label stored on the comment.
662
+ * @param options.positionUid - Position UUID (`positionId` / feed item id).
663
+ * @param options.tradeInFlight - Hash, chain, and token of a swap in flight.
664
+ * @returns The created swap comment.
665
+ */
666
+ async createSwapComment(options) {
667
+ const { commentText, source, positionUid, tradeInFlight } = options;
668
+ return await this.fetchQuery({
669
+ queryKey: [
670
+ `${this.name}:createSwapComment`,
671
+ {
672
+ commentText,
673
+ source: source ?? null,
674
+ positionUid: positionUid ?? null,
675
+ tradeInFlight: tradeInFlight ?? null,
676
+ },
677
+ ],
678
+ staleTime: 0,
679
+ queryFn: async () => {
680
+ const url = `${this.#v1Url}/swap-comments`;
681
+ const authHeaders = await this.#getAuthHeaders();
682
+ const response = await fetch(url, {
683
+ method: 'POST',
684
+ headers: { ...authHeaders, 'Content-Type': 'application/json' },
685
+ body: JSON.stringify({
686
+ commentText,
687
+ ...(source === undefined ? {} : { source }),
688
+ ...(positionUid === undefined ? {} : { positionUid }),
689
+ ...(tradeInFlight === undefined ? {} : { tradeInFlight }),
690
+ }),
691
+ });
692
+ _a.#throwIfNotOk(response, SocialServiceErrorMessage.CREATE_SWAP_COMMENT_FAILED);
693
+ const comment = (await response.json());
694
+ if (!is(comment, SwapCommentResponseStruct)) {
695
+ throw new Error(SocialServiceErrorMessage.CREATE_SWAP_COMMENT_INVALID_RESPONSE);
696
+ }
697
+ return comment;
698
+ },
699
+ });
700
+ }
627
701
  /**
628
702
  * Fetches the list of traders the current user is following.
629
703
  *
@@ -1 +1 @@
1
- {"version":3,"file":"SocialService.js","sourceRoot":"","sources":["../src/SocialService.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAGvD,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,EAAE,EACF,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,MAAM,EACN,IAAI,IAAI,UAAU,GACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAyB/E,OAAO,EAA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CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBAC1C,CAAC;gBACD,0DAA0D;gBAC1D,IAAI,IAAI,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;oBAChC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBACxC,CAAC;gBACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBAClD,CAAC;gBACD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;oBACvB,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;gBAChD,CAAC;gBAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;gBACjD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE;oBAC3C,OAAO,EAAE,WAAW;iBACrB,CAAC,CAAC;gBACH,EAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;gBACrD,MAAM,aAAa,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAC5C,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,uBAAuB,CAAC,EAAE,CAAC;oBAChD,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;gBAClC,CAAC;gBACD,OAAO,aAAa,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import type {\n DataServiceCacheUpdatedEvent,\n DataServiceGranularCacheUpdatedEvent,\n DataServiceInvalidateQueriesAction,\n} from '@metamask/base-data-service';\nimport { BaseDataService } from '@metamask/base-data-service';\nimport type { CreateServicePolicyOptions } from '@metamask/controller-utils';\nimport { HttpError } from '@metamask/controller-utils';\nimport type { Messenger } from '@metamask/messenger';\nimport type { AuthenticationController } from '@metamask/profile-sync-controller';\nimport {\n array,\n assign,\n boolean,\n enums,\n is,\n nullable,\n number,\n optional,\n record,\n string,\n type as structType,\n} from '@metamask/superstruct';\n\nimport { serviceName, SocialServiceErrorMessage } from './social-constants.js';\nimport type {\n CommentEngagement,\n FeedResponse,\n FetchFeedOptions,\n FetchFollowersOptions,\n FetchLeaderboardOptions,\n FetchPositionByIdOptions,\n FetchPositionsOptions,\n FetchTokenFeedOptions,\n FetchTraderFeedOptions,\n FetchTraderProfileOptions,\n FollowersResponse,\n FollowingResponse,\n FollowOptions,\n FollowResponse,\n LeaderboardResponse,\n Position,\n PositionsResponse,\n ReactToCommentOptions,\n RemoveCommentReactionOptions,\n TraderProfileResponse,\n UnfollowOptions,\n UnfollowResponse,\n} from './social-types.js';\nimport { TRADER_RANKING_TAGS, TradeStruct } from './social-types.js';\nimport type { SocialServiceMethodActions } from './SocialService-method-action-types.js';\n\n// ---------------------------------------------------------------------------\n// Superstruct validation schemas\n// ---------------------------------------------------------------------------\n\nconst SocialHandlesStruct = structType({\n twitter: optional(nullable(string())),\n farcaster: optional(nullable(string())),\n ens: optional(nullable(string())),\n lens: optional(nullable(string())),\n});\n\nconst ProfileSummaryStruct = structType({\n profileId: string(),\n address: string(),\n name: string(),\n imageUrl: optional(nullable(string())),\n});\n\nconst FeedActorStruct = assign(\n ProfileSummaryStruct,\n structType({\n winRate30d: optional(nullable(number())),\n pnl30d: optional(nullable(number())),\n tradeCount30d: optional(nullable(number())),\n followerCount: optional(nullable(number())),\n }),\n);\n\nconst PositionStruct = structType({\n positionId: string(),\n tokenSymbol: string(),\n tokenName: string(),\n tokenAddress: string(),\n chain: string(),\n positionAmount: number(),\n isOpen: optional(boolean()),\n boughtUsd: number(),\n soldUsd: number(),\n realizedPnl: number(),\n costBasis: number(),\n trades: array(TradeStruct),\n lastTradeAt: number(),\n tokenImageUrl: optional(nullable(string())),\n currentValueUSD: optional(nullable(number())),\n pnlValueUsd: optional(nullable(number())),\n pnlPercent: optional(nullable(number())),\n perpPositionType: optional(nullable(enums(['long', 'short']))),\n perpLeverage: optional(nullable(number())),\n positionAmountWithLeverage: optional(nullable(number())),\n});\n\nconst PaginationStruct = structType({\n hasMore: boolean(),\n nextPage: optional(number()),\n});\n\nconst LeaderboardEntryStruct = structType({\n rank: number(),\n addresses: array(string()),\n profileId: string(),\n name: string(),\n imageUrl: optional(nullable(string())),\n pnl30d: number(),\n winRate30d: optional(nullable(number())),\n roiPercent30d: optional(nullable(number())),\n tradeCount30d: optional(nullable(number())),\n pnl7d: optional(nullable(number())),\n winRate7d: optional(nullable(number())),\n roiPercent7d: optional(nullable(number())),\n tradeCount7d: optional(nullable(number())),\n pnlPerChain: record(string(), number()),\n followerCount: number(),\n socialHandles: SocialHandlesStruct,\n});\n\nconst LeaderboardResponseStruct = structType({\n traders: array(LeaderboardEntryStruct),\n});\n\nconst TraderProfileStruct = structType({\n profileId: string(),\n address: string(),\n allAddresses: array(string()),\n name: string(),\n imageUrl: optional(nullable(string())),\n});\n\nconst TraderStatsStruct = structType({\n pnl30d: optional(nullable(number())),\n winRate30d: optional(nullable(number())),\n roiPercent30d: optional(nullable(number())),\n tradeCount30d: optional(nullable(number())),\n volumeUsd30d: optional(nullable(number())),\n pnl7d: optional(nullable(number())),\n winRate7d: optional(nullable(number())),\n roiPercent7d: optional(nullable(number())),\n tradeCount7d: optional(nullable(number())),\n medianHoldMinutes: optional(nullable(number())),\n});\n\nconst PerChainBreakdownStruct = structType({\n perChainPnl: record(string(), number()),\n perChainRoi: record(string(), nullable(number())),\n perChainVolume: record(string(), number()),\n perChainPnl7d: optional(record(string(), number())),\n perChainRoi7d: optional(record(string(), nullable(number()))),\n perChainVolume7d: optional(record(string(), number())),\n});\n\nconst CopytradedAllTimeStruct = structType({\n count: number(),\n volumeUSD: number(),\n distinctActors: number(),\n});\n\nconst TraderProfileResponseStruct = structType({\n profile: TraderProfileStruct,\n stats: TraderStatsStruct,\n perChainBreakdown: PerChainBreakdownStruct,\n socialHandles: SocialHandlesStruct,\n followerCount: number(),\n followingCount: number(),\n copytradedAllTime: CopytradedAllTimeStruct,\n rankingTag: optional(nullable(enums(TRADER_RANKING_TAGS))),\n});\n\nconst PositionsResponseStruct = structType({\n positions: array(PositionStruct),\n pagination: PaginationStruct,\n computedAt: optional(nullable(string())),\n});\n\n// A feed item is a position plus the trader who made the trade (`actor`) and\n// the item's creation timestamp. Reuses PositionStruct so the trade/position\n// fields stay in lockstep with the positions endpoints.\nconst CommentReactionProfileStruct = structType({\n id: string(),\n name: string(),\n});\n\nconst CommentReactionStruct = structType({\n emotion: string(),\n count: number(),\n profiles: array(CommentReactionProfileStruct),\n});\n\nconst CommentEngagementStruct = structType({\n reactions: array(CommentReactionStruct),\n userReaction: nullable(string()),\n replyCount: optional(number()),\n});\n\nconst AuthorCommentStruct = structType({\n uid: string(),\n text: string(),\n timestamp: number(),\n engagement: CommentEngagementStruct,\n});\n\nconst FeedItemStruct = assign(\n PositionStruct,\n structType({\n actor: FeedActorStruct,\n timestamp: number(),\n authorComment: optional(nullable(AuthorCommentStruct)),\n commentCount: optional(number()),\n replyCount: optional(number()),\n firstTradeAt: optional(nullable(number())),\n holdTimeMs: optional(nullable(number())),\n entryPriceUsd: optional(nullable(number())),\n }),\n);\n\nconst FeedPaginationStruct = structType({\n olderCursor: nullable(string()),\n newerCursor: nullable(string()),\n});\n\nconst FeedResponseStruct = structType({\n items: array(FeedItemStruct),\n pagination: FeedPaginationStruct,\n});\n\nconst FollowersResponseStruct = structType({\n followers: array(ProfileSummaryStruct),\n count: number(),\n});\n\nconst FollowingResponseStruct = structType({\n following: array(ProfileSummaryStruct),\n count: number(),\n});\n\nconst FollowResponseStruct = structType({\n followed: array(ProfileSummaryStruct),\n});\n\nconst UnfollowResponseStruct = structType({\n unfollowed: array(ProfileSummaryStruct),\n});\n\n// ---------------------------------------------------------------------------\n// Messenger types\n// ---------------------------------------------------------------------------\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'fetchLeaderboard',\n 'fetchTraderProfile',\n 'fetchOpenPositions',\n 'fetchClosedPositions',\n 'fetchFollowers',\n 'fetchFollowing',\n 'fetchPositionById',\n 'fetchFeed',\n 'fetchTraderFeed',\n 'fetchTokenFeed',\n 'reactToComment',\n 'removeCommentReaction',\n 'follow',\n 'unfollow',\n 'optOutOfLeaderboard',\n 'optInToLeaderboard',\n 'refreshNotificationPreferencesCache',\n] as const;\n\nexport type SocialServiceActions =\n | SocialServiceMethodActions\n | DataServiceInvalidateQueriesAction<typeof serviceName>;\n\nexport type SocialServiceEvents =\n | DataServiceCacheUpdatedEvent<typeof serviceName>\n | DataServiceGranularCacheUpdatedEvent<typeof serviceName>;\n\ntype AllowedActions =\n AuthenticationController.AuthenticationControllerGetBearerTokenAction;\n\ntype AllowedEvents = never;\n\nexport type SocialServiceMessenger = Messenger<\n typeof serviceName,\n SocialServiceActions | AllowedActions,\n SocialServiceEvents | AllowedEvents\n>;\n\n// ---------------------------------------------------------------------------\n// Service\n// ---------------------------------------------------------------------------\n\n/**\n * Data service wrapping social-api endpoints.\n */\nexport class SocialService extends BaseDataService<\n typeof serviceName,\n SocialServiceMessenger\n> {\n readonly #baseUrl: string;\n\n get #v1Url(): string {\n return `${this.#baseUrl}/api/v1`;\n }\n\n get #v2Url(): string {\n return `${this.#baseUrl}/api/v2`;\n }\n\n constructor({\n messenger,\n baseUrl,\n policyOptions,\n }: {\n messenger: SocialServiceMessenger;\n baseUrl: string;\n policyOptions?: CreateServicePolicyOptions;\n }) {\n super({ name: serviceName, messenger, policyOptions });\n this.#baseUrl = baseUrl;\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Throws an HttpError if the response is not ok.\n *\n * @param response - The fetch response to check.\n * @param message - The error message prefix from SocialServiceErrorMessage.\n */\n static #throwIfNotOk(response: Response, message: string): void {\n if (!response.ok) {\n throw new HttpError(response.status, `${message}: ${response.status}`);\n }\n }\n\n /**\n * Returns an Authorization header with a JWT bearer token obtained from the\n * AuthenticationController.\n *\n * @returns A headers object containing the Authorization header.\n */\n async #getAuthHeaders(): Promise<Record<string, string>> {\n const token = await this.messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n return { Authorization: `Bearer ${token}` };\n }\n\n /**\n * Fetches the leaderboard of top traders.\n *\n * Calls `GET ${baseUrl}/leaderboard`.\n *\n * @param options - Optional query parameters for sorting, chain filtering, and limit.\n * @returns The leaderboard response with ranked traders.\n */\n async fetchLeaderboard(\n options?: FetchLeaderboardOptions,\n ): Promise<LeaderboardResponse> {\n const leaderboardResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchLeaderboard`, options ?? null],\n queryFn: async () => {\n const { sort, chains, limit } = options ?? {};\n const url = new URL(`${this.#v1Url}/leaderboard`);\n if (sort) {\n url.searchParams.append('sort', sort);\n }\n if (chains) {\n for (const chain of chains) {\n url.searchParams.append('chains', chain);\n }\n }\n if (limit !== undefined) {\n url.searchParams.append('limit', String(limit));\n }\n\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url.toString(), {\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_LEADERBOARD_FAILED,\n );\n const leaderboardData = await response.json();\n if (!is(leaderboardData, LeaderboardResponseStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_LEADERBOARD_INVALID_RESPONSE,\n );\n }\n return leaderboardData;\n },\n });\n\n return leaderboardResponse;\n }\n\n /**\n * Fetches a trader's profile by address or profile ID.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/profile`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @returns The trader profile response.\n */\n async fetchTraderProfile(\n options: FetchTraderProfileOptions,\n ): Promise<TraderProfileResponse> {\n const { addressOrId } = options;\n\n const traderProfileResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchTraderProfile`, addressOrId],\n queryFn: async () => {\n const url = `${this.#v1Url}/traders/${encodeURIComponent(addressOrId)}/profile`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, { headers: authHeaders });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_TRADER_PROFILE_FAILED,\n );\n const traderProfileData = await response.json();\n if (!is(traderProfileData, TraderProfileResponseStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_TRADER_PROFILE_INVALID_RESPONSE,\n );\n }\n return traderProfileData;\n },\n });\n\n return traderProfileResponse;\n }\n\n /**\n * Fetches a trader's open positions.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/positions/open`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.chain - Filter by chain.\n * @param options.sort - Sort by 'value' or 'latest'.\n * @param options.limit - Number of results per page.\n * @param options.page - Page number (1-based).\n * @returns The positions response.\n */\n async fetchOpenPositions(\n options: FetchPositionsOptions,\n ): Promise<PositionsResponse> {\n return this.#fetchPositions('open', options);\n }\n\n /**\n * Fetches a trader's closed positions.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/positions/closed`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.chain - Filter by chain.\n * @param options.sort - Sort by 'value' or 'latest'.\n * @param options.limit - Number of results per page.\n * @param options.page - Page number (1-based).\n * @returns The positions response.\n */\n async fetchClosedPositions(\n options: FetchPositionsOptions,\n ): Promise<PositionsResponse> {\n return this.#fetchPositions('closed', options);\n }\n\n /**\n * Fetches a trader's MetaMask followers.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/followers`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @returns The followers response.\n */\n async fetchFollowers(\n options: FetchFollowersOptions,\n ): Promise<FollowersResponse> {\n const { addressOrId } = options;\n\n const followersResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchFollowers`, addressOrId],\n queryFn: async () => {\n const url = `${this.#v1Url}/traders/${encodeURIComponent(addressOrId)}/followers`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, { headers: authHeaders });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_FOLLOWERS_FAILED,\n );\n const followersData = await response.json();\n if (!is(followersData, FollowersResponseStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_FOLLOWERS_INVALID_RESPONSE,\n );\n }\n return followersData;\n },\n });\n\n return followersResponse;\n }\n\n /**\n * Fetches a single position by its unique ID.\n *\n * Calls `GET ${baseUrl}/traders/position/${positionId}`.\n *\n * @param options - Options bag.\n * @param options.positionId - Unique position ID (UUID).\n * @returns The position.\n */\n async fetchPositionById(\n options: FetchPositionByIdOptions,\n ): Promise<Position> {\n const { positionId } = options;\n\n const positionResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchPositionById`, positionId],\n queryFn: async () => {\n const url = `${this.#v1Url}/traders/position/${encodeURIComponent(positionId)}`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, { headers: authHeaders });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_POSITION_BY_ID_FAILED,\n );\n const positionData = await response.json();\n if (!is(positionData, PositionStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_POSITION_BY_ID_INVALID_RESPONSE,\n );\n }\n return positionData;\n },\n });\n\n return positionResponse;\n }\n\n /**\n * Fetches a page of the trader-activity feed.\n *\n * Calls `GET ${baseUrl}/feed`. For the `following` scope the current user is\n * identified server-side from the JWT sub claim carried in the Authorization\n * header; the `leaderboard` scope is generic and shared by all users.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.scope - `following` (default) or `leaderboard`.\n * @param options.chains - Filter by one or more chains.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\n async fetchFeed(options?: FetchFeedOptions): Promise<FeedResponse> {\n const feedResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchFeed`, options ?? null],\n staleTime: 0,\n queryFn: async () => {\n const { scope, chains, limit, olderThan, newerThan } = options ?? {};\n const url = new URL(`${this.#v1Url}/feed`);\n if (scope) {\n url.searchParams.append('scope', scope);\n }\n if (chains) {\n for (const chain of chains) {\n url.searchParams.append('chains', chain);\n }\n }\n if (limit !== undefined) {\n url.searchParams.append('limit', String(limit));\n }\n if (olderThan) {\n url.searchParams.append('olderThan', olderThan);\n }\n if (newerThan) {\n url.searchParams.append('newerThan', newerThan);\n }\n\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url.toString(), {\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_FEED_FAILED,\n );\n const feedData = await response.json();\n if (!is(feedData, FeedResponseStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_FEED_INVALID_RESPONSE,\n );\n }\n return feedData;\n },\n });\n\n return feedResponse;\n }\n\n /**\n * Fetches a page of one trader's activity as feed items.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/feed`. Unlike {@link fetchFeed},\n * this is scoped to a single profile (open and closed positions in the feed)\n * and does not accept `scope` or `chains`. Set `commentedOnly` to only return\n * positions that carry an author comment.\n *\n * The route is public, but the Authorization header is still sent so the\n * social-api can hydrate `authorComment.engagement.userReaction` for the\n * signed-in viewer.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.commentedOnly - When true, only positions with a comment.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\n async fetchTraderFeed(\n options: FetchTraderFeedOptions,\n ): Promise<FeedResponse> {\n const traderFeedResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchTraderFeed`, options],\n staleTime: 0,\n queryFn: async () => {\n const { addressOrId, commentedOnly, limit, olderThan, newerThan } =\n options;\n const url = new URL(\n `${this.#v1Url}/traders/${encodeURIComponent(addressOrId)}/feed`,\n );\n if (commentedOnly === true) {\n url.searchParams.append('commentedOnly', 'true');\n }\n if (limit !== undefined) {\n url.searchParams.append('limit', String(limit));\n }\n if (olderThan) {\n url.searchParams.append('olderThan', olderThan);\n }\n if (newerThan) {\n url.searchParams.append('newerThan', newerThan);\n }\n\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url.toString(), {\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_TRADER_FEED_FAILED,\n );\n const feedData = await response.json();\n if (!is(feedData, FeedResponseStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_TRADER_FEED_INVALID_RESPONSE,\n );\n }\n return feedData;\n },\n });\n\n return traderFeedResponse;\n }\n\n /**\n * Fetches a page of positions in one token, most recently traded first.\n *\n * Calls `GET ${baseUrl}/tokens/${chain}/${contractAddress}/feed`. Unlike\n * {@link fetchFeed}, this is scoped to a single token and does not accept\n * `scope` or `chains`. Omit `status` to include both open and recently\n * closed positions.\n *\n * The route is public, but the Authorization header is still sent so the\n * social-api can hydrate `authorComment.engagement.userReaction` for the\n * signed-in viewer.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.chain - Chain name where the token is deployed (`TokenFeedChain`).\n * @param options.contractAddress - Token contract address.\n * @param options.status - `open`, `closed`, or omit for both.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\n async fetchTokenFeed(options: FetchTokenFeedOptions): Promise<FeedResponse> {\n const tokenFeedResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchTokenFeed`, options],\n staleTime: 0,\n queryFn: async () => {\n const { chain, contractAddress, status, limit, olderThan, newerThan } =\n options;\n const url = new URL(\n `${this.#v1Url}/tokens/${encodeURIComponent(chain)}/${encodeURIComponent(contractAddress)}/feed`,\n );\n if (status) {\n url.searchParams.append('status', status);\n }\n if (limit !== undefined) {\n url.searchParams.append('limit', String(limit));\n }\n if (olderThan) {\n url.searchParams.append('olderThan', olderThan);\n }\n if (newerThan) {\n url.searchParams.append('newerThan', newerThan);\n }\n\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url.toString(), {\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_TOKEN_FEED_FAILED,\n );\n const feedData = (await response.json()) as unknown;\n if (!is(feedData, FeedResponseStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_TOKEN_FEED_INVALID_RESPONSE,\n );\n }\n return feedData;\n },\n });\n\n return tokenFeedResponse;\n }\n\n /**\n * Adds or replaces the current user's reaction on a swap comment (Call).\n *\n * Calls `PUT ${baseUrl}/swap-comment/${commentId}/reaction`. One emotion per\n * user per comment: a later PUT replaces the previous emotion.\n *\n * @param options - Options bag.\n * @param options.commentId - `authorComment.uid` from a feed item.\n * @param options.emotion - Emoji or short code to store.\n * @returns Refreshed per-emotion counts and the caller's `userReaction`.\n */\n async reactToComment(\n options: ReactToCommentOptions,\n ): Promise<CommentEngagement> {\n const { commentId, emotion } = options;\n\n return await this.fetchQuery({\n queryKey: [`${this.name}:reactToComment`, commentId, emotion],\n staleTime: 0,\n queryFn: async () => {\n const url = `${this.#v1Url}/swap-comment/${encodeURIComponent(commentId)}/reaction`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, {\n method: 'PUT',\n headers: { ...authHeaders, 'Content-Type': 'application/json' },\n body: JSON.stringify({ emotion }),\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.REACT_TO_COMMENT_FAILED,\n );\n const metrics = await response.json();\n if (!is(metrics, CommentEngagementStruct)) {\n throw new Error(\n SocialServiceErrorMessage.REACT_TO_COMMENT_INVALID_RESPONSE,\n );\n }\n return metrics;\n },\n });\n }\n\n /**\n * Removes the current user's reaction on a swap comment (Call).\n *\n * Calls `DELETE ${baseUrl}/swap-comment/${commentId}/reaction`. Idempotent\n * when the caller has never reacted.\n *\n * @param options - Options bag.\n * @param options.commentId - `authorComment.uid` from a feed item.\n * @returns Refreshed per-emotion counts and a null `userReaction`.\n */\n async removeCommentReaction(\n options: RemoveCommentReactionOptions,\n ): Promise<CommentEngagement> {\n const { commentId } = options;\n\n return await this.fetchQuery({\n queryKey: [`${this.name}:removeCommentReaction`, commentId],\n staleTime: 0,\n queryFn: async () => {\n const url = `${this.#v1Url}/swap-comment/${encodeURIComponent(commentId)}/reaction`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, {\n method: 'DELETE',\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.REMOVE_COMMENT_REACTION_FAILED,\n );\n const metrics = await response.json();\n if (!is(metrics, CommentEngagementStruct)) {\n throw new Error(\n SocialServiceErrorMessage.REMOVE_COMMENT_REACTION_INVALID_RESPONSE,\n );\n }\n return metrics;\n },\n });\n }\n\n /**\n * Fetches the list of traders the current user is following.\n *\n * Calls `GET ${baseUrl}/users/me/following`. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @returns The following response.\n */\n async fetchFollowing(): Promise<FollowingResponse> {\n const followingResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchFollowing`],\n staleTime: 0,\n queryFn: async () => {\n const url = `${this.#v1Url}/users/me/following`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, { headers: authHeaders });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_FOLLOWING_FAILED,\n );\n const followingData = await response.json();\n if (!is(followingData, FollowingResponseStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_FOLLOWING_INVALID_RESPONSE,\n );\n }\n return followingData;\n },\n });\n\n return followingResponse;\n }\n\n /**\n * Follows one or more traders on behalf of the current user.\n *\n * Calls `PUT ${baseUrl}/users/me/follows`. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.targets - Array of wallet addresses or profile IDs to follow.\n * @returns The follow response with confirmed follows.\n */\n async follow(options: FollowOptions): Promise<FollowResponse> {\n const { targets } = options;\n\n const followResponse = await this.fetchQuery({\n queryKey: [`${this.name}:follow`, targets],\n staleTime: 0,\n queryFn: async () => {\n const url = `${this.#v1Url}/users/me/follows`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, {\n method: 'PUT',\n headers: { ...authHeaders, 'Content-Type': 'application/json' },\n body: JSON.stringify({ targets }),\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FOLLOW_FAILED,\n );\n const followData = await response.json();\n if (!is(followData, FollowResponseStruct)) {\n throw new Error(SocialServiceErrorMessage.FOLLOW_INVALID_RESPONSE);\n }\n return followData;\n },\n });\n\n return followResponse;\n }\n\n /**\n * Unfollows one or more traders on behalf of the current user.\n *\n * Calls `DELETE ${baseUrl}/users/me/follows?targets=...`. Targets are sent\n * as query params because Fastify does not parse request bodies on DELETE\n * requests per RFC 9110. The caller is identified server-side from the JWT\n * sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.targets - Array of wallet addresses or profile IDs to unfollow.\n * @returns The unfollow response with confirmed unfollows.\n */\n async unfollow(options: UnfollowOptions): Promise<UnfollowResponse> {\n const { targets } = options;\n\n const unfollowResponse = await this.fetchQuery({\n queryKey: [`${this.name}:unfollow`, targets],\n staleTime: 0,\n queryFn: async () => {\n const url = new URL(`${this.#v1Url}/users/me/follows`);\n for (const target of targets) {\n url.searchParams.append('targets', target);\n }\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url.toString(), {\n method: 'DELETE',\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.UNFOLLOW_FAILED,\n );\n const unfollowData = await response.json();\n if (!is(unfollowData, UnfollowResponseStruct)) {\n throw new Error(SocialServiceErrorMessage.UNFOLLOW_INVALID_RESPONSE);\n }\n return unfollowData;\n },\n });\n\n return unfollowResponse;\n }\n\n /**\n * Opts the current user out of the PnL leaderboard.\n */\n async optOutOfLeaderboard(): Promise<void> {\n await this.fetchQuery({\n queryKey: [`${this.name}:optOutOfLeaderboard`],\n staleTime: 0,\n queryFn: async () => {\n const url = `${this.#v1Url}/leaderboard/opt-out`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, {\n method: 'POST',\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.LEADERBOARD_OPT_OUT_FAILED,\n );\n return null;\n },\n });\n }\n\n /**\n * Opts the current user back into the PnL leaderboard.\n */\n async optInToLeaderboard(): Promise<void> {\n await this.fetchQuery({\n queryKey: [`${this.name}:optInToLeaderboard`],\n staleTime: 0,\n queryFn: async () => {\n const url = `${this.#v1Url}/leaderboard/opt-in`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, {\n method: 'POST',\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.LEADERBOARD_OPT_IN_FAILED,\n );\n return null;\n },\n });\n }\n\n /**\n * Asks the social-api to refresh its cached copy of the current user's\n * notification preferences.\n *\n * Calls `POST ${baseUrl}/notifications/preferences/cache-refresh`. The caller\n * is identified server-side from the JWT sub claim carried in the\n * Authorization header, so it can only ever refresh its own entry.\n *\n * The client calls this immediately after writing a preference change to\n * Authenticated User Storage (AUS), which is the source of truth. The social\n * api re-reads from AUS and repopulates its cache so the change is honoured\n * near-instantly rather than after the cache TTL lapses. It is a pure\n * optimisation on top of that bounded TTL: the write has already succeeded by\n * the time this runs, so callers should treat it as best-effort and must not\n * roll back the AUS write if it fails.\n */\n async refreshNotificationPreferencesCache(): Promise<void> {\n await this.fetchQuery({\n queryKey: [`${this.name}:refreshNotificationPreferencesCache`],\n staleTime: 0,\n queryFn: async () => {\n const url = `${this.#v1Url}/notifications/preferences/cache-refresh`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, {\n method: 'POST',\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.NOTIFICATION_PREFERENCES_CACHE_REFRESH_FAILED,\n );\n return null;\n },\n });\n }\n\n /**\n * Shared helper for fetching open/closed positions.\n *\n * @param status - \"open\" or \"closed\".\n * @param options - Options bag including addressOrId and query parameters.\n * @returns The positions response.\n */\n async #fetchPositions(\n status: 'open' | 'closed',\n options: FetchPositionsOptions,\n ): Promise<PositionsResponse> {\n const { addressOrId, chain, sort, limit, page } = options;\n\n const failedMessage =\n status === 'open'\n ? SocialServiceErrorMessage.FETCH_OPEN_POSITIONS_FAILED\n : SocialServiceErrorMessage.FETCH_CLOSED_POSITIONS_FAILED;\n const invalidMessage =\n status === 'open'\n ? SocialServiceErrorMessage.FETCH_OPEN_POSITIONS_INVALID_RESPONSE\n : SocialServiceErrorMessage.FETCH_CLOSED_POSITIONS_INVALID_RESPONSE;\n\n const positionsResponse = await this.fetchQuery({\n queryKey: [\n `${this.name}:fetch${status === 'open' ? 'Open' : 'Closed'}Positions`,\n addressOrId,\n chain ?? null,\n // sort is not used for open positions (v2 endpoint dropped it),\n // so exclude it from the key to avoid redundant cache entries\n status === 'closed' ? (sort ?? null) : null,\n limit ?? null,\n page ?? null,\n ],\n queryFn: async () => {\n const baseUrl = status === 'open' ? this.#v2Url : this.#v1Url;\n const url = new URL(\n `${baseUrl}/traders/${encodeURIComponent(addressOrId)}/positions/${status}`,\n );\n if (chain) {\n url.searchParams.append('chain', chain);\n }\n // sort is not supported on the v2 open-positions endpoint\n if (sort && status === 'closed') {\n url.searchParams.append('sort', sort);\n }\n if (limit !== undefined) {\n url.searchParams.append('limit', String(limit));\n }\n if (page !== undefined) {\n url.searchParams.append('page', String(page));\n }\n\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url.toString(), {\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(response, failedMessage);\n const positionsData = await response.json();\n if (!is(positionsData, PositionsResponseStruct)) {\n throw new Error(invalidMessage);\n }\n return positionsData;\n },\n });\n\n return positionsResponse;\n }\n}\n"]}
1
+ {"version":3,"file":"SocialService.js","sourceRoot":"","sources":["../src/SocialService.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAGvD,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,EAAE,EACF,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,MAAM,EACN,IAAI,IAAI,UAAU,GACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AA2B/E,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrE,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAE9E,MAAM,mBAAmB,GAAG,UAAU,CAAC;IACrC,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACrC,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACvC,GAAG,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;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,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;gBACjD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE;oBAC3C,OAAO,EAAE,WAAW;iBACrB,CAAC,CAAC;gBACH,EAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;gBACrD,MAAM,aAAa,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAC5C,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,uBAAuB,CAAC,EAAE,CAAC;oBAChD,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;gBAClC,CAAC;gBACD,OAAO,aAAa,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import type {\n DataServiceCacheUpdatedEvent,\n DataServiceGranularCacheUpdatedEvent,\n DataServiceInvalidateQueriesAction,\n} from '@metamask/base-data-service';\nimport { BaseDataService } from '@metamask/base-data-service';\nimport type { CreateServicePolicyOptions } from '@metamask/controller-utils';\nimport { HttpError } from '@metamask/controller-utils';\nimport type { Messenger } from '@metamask/messenger';\nimport type { AuthenticationController } from '@metamask/profile-sync-controller';\nimport {\n array,\n assign,\n boolean,\n enums,\n is,\n nullable,\n number,\n optional,\n record,\n string,\n type as structType,\n} from '@metamask/superstruct';\n\nimport { serviceName, SocialServiceErrorMessage } from './social-constants.js';\nimport type {\n CommentEngagement,\n CreateSwapCommentOptions,\n FeedResponse,\n FetchFeedOptions,\n FetchFollowersOptions,\n FetchLeaderboardOptions,\n FetchPositionByIdOptions,\n FetchPositionsOptions,\n FetchTokenFeedOptions,\n FetchTraderFeedOptions,\n FetchTraderProfileOptions,\n FollowersResponse,\n FollowingResponse,\n FollowOptions,\n FollowResponse,\n LeaderboardResponse,\n Position,\n PositionsResponse,\n ReactToCommentOptions,\n RemoveCommentReactionOptions,\n SwapCommentResponse,\n TraderProfileResponse,\n UnfollowOptions,\n UnfollowResponse,\n} from './social-types.js';\nimport { TRADER_RANKING_TAGS, TradeStruct } from './social-types.js';\nimport type { SocialServiceMethodActions } from './SocialService-method-action-types.js';\n\n// ---------------------------------------------------------------------------\n// Superstruct validation schemas\n// ---------------------------------------------------------------------------\n\nconst SocialHandlesStruct = structType({\n twitter: optional(nullable(string())),\n farcaster: optional(nullable(string())),\n ens: optional(nullable(string())),\n lens: optional(nullable(string())),\n});\n\nconst ProfileSummaryStruct = structType({\n profileId: string(),\n address: string(),\n name: string(),\n imageUrl: optional(nullable(string())),\n});\n\nconst FeedActorStruct = assign(\n ProfileSummaryStruct,\n structType({\n winRate30d: optional(nullable(number())),\n pnl30d: optional(nullable(number())),\n tradeCount30d: optional(nullable(number())),\n followerCount: optional(nullable(number())),\n }),\n);\n\nconst PositionStruct = structType({\n positionId: string(),\n tokenSymbol: string(),\n tokenName: string(),\n tokenAddress: string(),\n chain: string(),\n positionAmount: number(),\n isOpen: optional(boolean()),\n boughtUsd: number(),\n soldUsd: number(),\n realizedPnl: number(),\n costBasis: number(),\n trades: array(TradeStruct),\n lastTradeAt: number(),\n tokenImageUrl: optional(nullable(string())),\n currentValueUSD: optional(nullable(number())),\n pnlValueUsd: optional(nullable(number())),\n pnlPercent: optional(nullable(number())),\n perpPositionType: optional(nullable(enums(['long', 'short']))),\n perpLeverage: optional(nullable(number())),\n positionAmountWithLeverage: optional(nullable(number())),\n});\n\nconst PaginationStruct = structType({\n hasMore: boolean(),\n nextPage: optional(number()),\n});\n\nconst LeaderboardEntryStruct = structType({\n rank: number(),\n addresses: array(string()),\n profileId: string(),\n name: string(),\n imageUrl: optional(nullable(string())),\n pnl30d: number(),\n winRate30d: optional(nullable(number())),\n roiPercent30d: optional(nullable(number())),\n tradeCount30d: optional(nullable(number())),\n pnl7d: optional(nullable(number())),\n winRate7d: optional(nullable(number())),\n roiPercent7d: optional(nullable(number())),\n tradeCount7d: optional(nullable(number())),\n pnlPerChain: record(string(), number()),\n followerCount: number(),\n socialHandles: SocialHandlesStruct,\n});\n\nconst LeaderboardResponseStruct = structType({\n traders: array(LeaderboardEntryStruct),\n});\n\nconst TraderProfileStruct = structType({\n profileId: string(),\n address: string(),\n allAddresses: array(string()),\n name: string(),\n imageUrl: optional(nullable(string())),\n});\n\nconst TraderStatsStruct = structType({\n pnl30d: optional(nullable(number())),\n winRate30d: optional(nullable(number())),\n roiPercent30d: optional(nullable(number())),\n tradeCount30d: optional(nullable(number())),\n volumeUsd30d: optional(nullable(number())),\n pnl7d: optional(nullable(number())),\n winRate7d: optional(nullable(number())),\n roiPercent7d: optional(nullable(number())),\n tradeCount7d: optional(nullable(number())),\n medianHoldMinutes: optional(nullable(number())),\n});\n\nconst PerChainBreakdownStruct = structType({\n perChainPnl: record(string(), number()),\n perChainRoi: record(string(), nullable(number())),\n perChainVolume: record(string(), number()),\n perChainPnl7d: optional(record(string(), number())),\n perChainRoi7d: optional(record(string(), nullable(number()))),\n perChainVolume7d: optional(record(string(), number())),\n});\n\nconst CopytradedAllTimeStruct = structType({\n count: number(),\n volumeUSD: number(),\n distinctActors: number(),\n});\n\nconst TraderProfileResponseStruct = structType({\n profile: TraderProfileStruct,\n stats: TraderStatsStruct,\n perChainBreakdown: PerChainBreakdownStruct,\n socialHandles: SocialHandlesStruct,\n followerCount: number(),\n followingCount: number(),\n copytradedAllTime: CopytradedAllTimeStruct,\n rankingTag: optional(nullable(enums(TRADER_RANKING_TAGS))),\n});\n\nconst PositionsResponseStruct = structType({\n positions: array(PositionStruct),\n pagination: PaginationStruct,\n computedAt: optional(nullable(string())),\n});\n\n// A feed item is a position plus the trader who made the trade (`actor`) and\n// the item's creation timestamp. Reuses PositionStruct so the trade/position\n// fields stay in lockstep with the positions endpoints.\nconst CommentReactionProfileStruct = structType({\n id: string(),\n name: string(),\n});\n\nconst CommentReactionStruct = structType({\n emotion: string(),\n count: number(),\n profiles: array(CommentReactionProfileStruct),\n});\n\nconst CommentEngagementStruct = structType({\n reactions: array(CommentReactionStruct),\n userReaction: nullable(string()),\n replyCount: optional(number()),\n});\n\nconst AuthorCommentStruct = structType({\n uid: string(),\n text: string(),\n timestamp: number(),\n engagement: CommentEngagementStruct,\n});\n\nconst SwapCommentAuthorStruct = structType({\n id: string(),\n name: string(),\n images: optional(\n structType({\n raw: nullable(string()),\n xs: nullable(string()),\n sm: nullable(string()),\n }),\n ),\n addresses: optional(array(string())),\n externalId: optional(string()),\n});\n\nconst SwapCommentResponseStruct = structType({\n uid: string(),\n transactionHash: string(),\n chain: string(),\n tokenAddress: string(),\n commentText: string(),\n author: SwapCommentAuthorStruct,\n timestamp: number(),\n isAppUserComment: boolean(),\n metrics: CommentEngagementStruct,\n});\n\nconst FeedItemStruct = assign(\n PositionStruct,\n structType({\n actor: FeedActorStruct,\n timestamp: number(),\n authorComment: optional(nullable(AuthorCommentStruct)),\n commentCount: optional(number()),\n replyCount: optional(number()),\n firstTradeAt: optional(nullable(number())),\n holdTimeMs: optional(nullable(number())),\n entryPriceUsd: optional(nullable(number())),\n }),\n);\n\nconst FeedPaginationStruct = structType({\n olderCursor: nullable(string()),\n newerCursor: nullable(string()),\n});\n\nconst FeedResponseStruct = structType({\n items: array(FeedItemStruct),\n pagination: FeedPaginationStruct,\n});\n\nconst FollowersResponseStruct = structType({\n followers: array(ProfileSummaryStruct),\n count: number(),\n});\n\nconst FollowingResponseStruct = structType({\n following: array(ProfileSummaryStruct),\n count: number(),\n});\n\nconst FollowResponseStruct = structType({\n followed: array(ProfileSummaryStruct),\n});\n\nconst UnfollowResponseStruct = structType({\n unfollowed: array(ProfileSummaryStruct),\n});\n\n// ---------------------------------------------------------------------------\n// Messenger types\n// ---------------------------------------------------------------------------\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'fetchLeaderboard',\n 'fetchTraderProfile',\n 'fetchOpenPositions',\n 'fetchClosedPositions',\n 'fetchFollowers',\n 'fetchFollowing',\n 'fetchPositionById',\n 'fetchFeed',\n 'fetchTraderFeed',\n 'fetchTokenFeed',\n 'reactToComment',\n 'removeCommentReaction',\n 'createSwapComment',\n 'follow',\n 'unfollow',\n 'optOutOfLeaderboard',\n 'optInToLeaderboard',\n 'refreshNotificationPreferencesCache',\n] as const;\n\nexport type SocialServiceActions =\n | SocialServiceMethodActions\n | DataServiceInvalidateQueriesAction<typeof serviceName>;\n\nexport type SocialServiceEvents =\n | DataServiceCacheUpdatedEvent<typeof serviceName>\n | DataServiceGranularCacheUpdatedEvent<typeof serviceName>;\n\ntype AllowedActions =\n AuthenticationController.AuthenticationControllerGetBearerTokenAction;\n\ntype AllowedEvents = never;\n\nexport type SocialServiceMessenger = Messenger<\n typeof serviceName,\n SocialServiceActions | AllowedActions,\n SocialServiceEvents | AllowedEvents\n>;\n\n// ---------------------------------------------------------------------------\n// Service\n// ---------------------------------------------------------------------------\n\n/**\n * Data service wrapping social-api endpoints.\n */\nexport class SocialService extends BaseDataService<\n typeof serviceName,\n SocialServiceMessenger\n> {\n readonly #baseUrl: string;\n\n get #v1Url(): string {\n return `${this.#baseUrl}/api/v1`;\n }\n\n get #v2Url(): string {\n return `${this.#baseUrl}/api/v2`;\n }\n\n constructor({\n messenger,\n baseUrl,\n policyOptions,\n }: {\n messenger: SocialServiceMessenger;\n baseUrl: string;\n policyOptions?: CreateServicePolicyOptions;\n }) {\n super({ name: serviceName, messenger, policyOptions });\n this.#baseUrl = baseUrl;\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Throws an HttpError if the response is not ok.\n *\n * @param response - The fetch response to check.\n * @param message - The error message prefix from SocialServiceErrorMessage.\n */\n static #throwIfNotOk(response: Response, message: string): void {\n if (!response.ok) {\n throw new HttpError(response.status, `${message}: ${response.status}`);\n }\n }\n\n /**\n * Returns an Authorization header with a JWT bearer token obtained from the\n * AuthenticationController.\n *\n * @returns A headers object containing the Authorization header.\n */\n async #getAuthHeaders(): Promise<Record<string, string>> {\n const token = await this.messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n return { Authorization: `Bearer ${token}` };\n }\n\n /**\n * Fetches the leaderboard of top traders.\n *\n * Calls `GET ${baseUrl}/leaderboard`.\n *\n * @param options - Optional query parameters for sorting, chain filtering, and limit.\n * @returns The leaderboard response with ranked traders.\n */\n async fetchLeaderboard(\n options?: FetchLeaderboardOptions,\n ): Promise<LeaderboardResponse> {\n const leaderboardResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchLeaderboard`, options ?? null],\n queryFn: async () => {\n const { sort, chains, limit } = options ?? {};\n const url = new URL(`${this.#v1Url}/leaderboard`);\n if (sort) {\n url.searchParams.append('sort', sort);\n }\n if (chains) {\n for (const chain of chains) {\n url.searchParams.append('chains', chain);\n }\n }\n if (limit !== undefined) {\n url.searchParams.append('limit', String(limit));\n }\n\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url.toString(), {\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_LEADERBOARD_FAILED,\n );\n const leaderboardData = await response.json();\n if (!is(leaderboardData, LeaderboardResponseStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_LEADERBOARD_INVALID_RESPONSE,\n );\n }\n return leaderboardData;\n },\n });\n\n return leaderboardResponse;\n }\n\n /**\n * Fetches a trader's profile by address or profile ID.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/profile`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @returns The trader profile response.\n */\n async fetchTraderProfile(\n options: FetchTraderProfileOptions,\n ): Promise<TraderProfileResponse> {\n const { addressOrId } = options;\n\n const traderProfileResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchTraderProfile`, addressOrId],\n queryFn: async () => {\n const url = `${this.#v1Url}/traders/${encodeURIComponent(addressOrId)}/profile`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, { headers: authHeaders });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_TRADER_PROFILE_FAILED,\n );\n const traderProfileData = await response.json();\n if (!is(traderProfileData, TraderProfileResponseStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_TRADER_PROFILE_INVALID_RESPONSE,\n );\n }\n return traderProfileData;\n },\n });\n\n return traderProfileResponse;\n }\n\n /**\n * Fetches a trader's open positions.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/positions/open`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.chain - Filter by chain.\n * @param options.sort - Sort by 'value' or 'latest'.\n * @param options.limit - Number of results per page.\n * @param options.page - Page number (1-based).\n * @returns The positions response.\n */\n async fetchOpenPositions(\n options: FetchPositionsOptions,\n ): Promise<PositionsResponse> {\n return this.#fetchPositions('open', options);\n }\n\n /**\n * Fetches a trader's closed positions.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/positions/closed`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.chain - Filter by chain.\n * @param options.sort - Sort by 'value' or 'latest'.\n * @param options.limit - Number of results per page.\n * @param options.page - Page number (1-based).\n * @returns The positions response.\n */\n async fetchClosedPositions(\n options: FetchPositionsOptions,\n ): Promise<PositionsResponse> {\n return this.#fetchPositions('closed', options);\n }\n\n /**\n * Fetches a trader's MetaMask followers.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/followers`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @returns The followers response.\n */\n async fetchFollowers(\n options: FetchFollowersOptions,\n ): Promise<FollowersResponse> {\n const { addressOrId } = options;\n\n const followersResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchFollowers`, addressOrId],\n queryFn: async () => {\n const url = `${this.#v1Url}/traders/${encodeURIComponent(addressOrId)}/followers`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, { headers: authHeaders });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_FOLLOWERS_FAILED,\n );\n const followersData = await response.json();\n if (!is(followersData, FollowersResponseStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_FOLLOWERS_INVALID_RESPONSE,\n );\n }\n return followersData;\n },\n });\n\n return followersResponse;\n }\n\n /**\n * Fetches a single position by its unique ID.\n *\n * Calls `GET ${baseUrl}/traders/position/${positionId}`.\n *\n * @param options - Options bag.\n * @param options.positionId - Unique position ID (UUID).\n * @returns The position.\n */\n async fetchPositionById(\n options: FetchPositionByIdOptions,\n ): Promise<Position> {\n const { positionId } = options;\n\n const positionResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchPositionById`, positionId],\n queryFn: async () => {\n const url = `${this.#v1Url}/traders/position/${encodeURIComponent(positionId)}`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, { headers: authHeaders });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_POSITION_BY_ID_FAILED,\n );\n const positionData = await response.json();\n if (!is(positionData, PositionStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_POSITION_BY_ID_INVALID_RESPONSE,\n );\n }\n return positionData;\n },\n });\n\n return positionResponse;\n }\n\n /**\n * Fetches a page of the trader-activity feed.\n *\n * Calls `GET ${baseUrl}/feed`. For the `following` scope the current user is\n * identified server-side from the JWT sub claim carried in the Authorization\n * header; the `leaderboard` scope is generic and shared by all users.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.scope - `following` (default) or `leaderboard`.\n * @param options.chains - Filter by one or more chains.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\n async fetchFeed(options?: FetchFeedOptions): Promise<FeedResponse> {\n const feedResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchFeed`, options ?? null],\n staleTime: 0,\n queryFn: async () => {\n const { scope, chains, limit, olderThan, newerThan } = options ?? {};\n const url = new URL(`${this.#v1Url}/feed`);\n if (scope) {\n url.searchParams.append('scope', scope);\n }\n if (chains) {\n for (const chain of chains) {\n url.searchParams.append('chains', chain);\n }\n }\n if (limit !== undefined) {\n url.searchParams.append('limit', String(limit));\n }\n if (olderThan) {\n url.searchParams.append('olderThan', olderThan);\n }\n if (newerThan) {\n url.searchParams.append('newerThan', newerThan);\n }\n\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url.toString(), {\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_FEED_FAILED,\n );\n const feedData = await response.json();\n if (!is(feedData, FeedResponseStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_FEED_INVALID_RESPONSE,\n );\n }\n return feedData;\n },\n });\n\n return feedResponse;\n }\n\n /**\n * Fetches a page of one trader's activity as feed items.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/feed`. Unlike {@link fetchFeed},\n * this is scoped to a single profile (open and closed positions in the feed)\n * and does not accept `scope` or `chains`. Set `commentedOnly` to only return\n * positions that carry an author comment.\n *\n * The route is public, but the Authorization header is still sent so the\n * social-api can hydrate `authorComment.engagement.userReaction` for the\n * signed-in viewer.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.commentedOnly - When true, only positions with a comment.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\n async fetchTraderFeed(\n options: FetchTraderFeedOptions,\n ): Promise<FeedResponse> {\n const traderFeedResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchTraderFeed`, options],\n staleTime: 0,\n queryFn: async () => {\n const { addressOrId, commentedOnly, limit, olderThan, newerThan } =\n options;\n const url = new URL(\n `${this.#v1Url}/traders/${encodeURIComponent(addressOrId)}/feed`,\n );\n if (commentedOnly === true) {\n url.searchParams.append('commentedOnly', 'true');\n }\n if (limit !== undefined) {\n url.searchParams.append('limit', String(limit));\n }\n if (olderThan) {\n url.searchParams.append('olderThan', olderThan);\n }\n if (newerThan) {\n url.searchParams.append('newerThan', newerThan);\n }\n\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url.toString(), {\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_TRADER_FEED_FAILED,\n );\n const feedData = await response.json();\n if (!is(feedData, FeedResponseStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_TRADER_FEED_INVALID_RESPONSE,\n );\n }\n return feedData;\n },\n });\n\n return traderFeedResponse;\n }\n\n /**\n * Fetches a page of positions in one token, most recently traded first.\n *\n * Calls `GET ${baseUrl}/tokens/${chain}/${contractAddress}/feed`. Unlike\n * {@link fetchFeed}, this is scoped to a single token and does not accept\n * `scope` or `chains`. Omit `status` to include both open and recently\n * closed positions.\n *\n * The route is public, but the Authorization header is still sent so the\n * social-api can hydrate `authorComment.engagement.userReaction` for the\n * signed-in viewer.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.chain - Chain name where the token is deployed (`TokenFeedChain`).\n * @param options.contractAddress - Token contract address.\n * @param options.status - `open`, `closed`, or omit for both.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\n async fetchTokenFeed(options: FetchTokenFeedOptions): Promise<FeedResponse> {\n const tokenFeedResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchTokenFeed`, options],\n staleTime: 0,\n queryFn: async () => {\n const { chain, contractAddress, status, limit, olderThan, newerThan } =\n options;\n const url = new URL(\n `${this.#v1Url}/tokens/${encodeURIComponent(chain)}/${encodeURIComponent(contractAddress)}/feed`,\n );\n if (status) {\n url.searchParams.append('status', status);\n }\n if (limit !== undefined) {\n url.searchParams.append('limit', String(limit));\n }\n if (olderThan) {\n url.searchParams.append('olderThan', olderThan);\n }\n if (newerThan) {\n url.searchParams.append('newerThan', newerThan);\n }\n\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url.toString(), {\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_TOKEN_FEED_FAILED,\n );\n const feedData = (await response.json()) as unknown;\n if (!is(feedData, FeedResponseStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_TOKEN_FEED_INVALID_RESPONSE,\n );\n }\n return feedData;\n },\n });\n\n return tokenFeedResponse;\n }\n\n /**\n * Adds or replaces the current user's reaction on a swap comment (Call).\n *\n * Calls `PUT ${baseUrl}/swap-comment/${commentId}/reaction`. One emotion per\n * user per comment: a later PUT replaces the previous emotion.\n *\n * @param options - Options bag.\n * @param options.commentId - `authorComment.uid` from a feed item.\n * @param options.emotion - Emoji or short code to store.\n * @returns Refreshed per-emotion counts and the caller's `userReaction`.\n */\n async reactToComment(\n options: ReactToCommentOptions,\n ): Promise<CommentEngagement> {\n const { commentId, emotion } = options;\n\n return await this.fetchQuery({\n queryKey: [`${this.name}:reactToComment`, commentId, emotion],\n staleTime: 0,\n queryFn: async () => {\n const url = `${this.#v1Url}/swap-comment/${encodeURIComponent(commentId)}/reaction`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, {\n method: 'PUT',\n headers: { ...authHeaders, 'Content-Type': 'application/json' },\n body: JSON.stringify({ emotion }),\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.REACT_TO_COMMENT_FAILED,\n );\n const metrics = await response.json();\n if (!is(metrics, CommentEngagementStruct)) {\n throw new Error(\n SocialServiceErrorMessage.REACT_TO_COMMENT_INVALID_RESPONSE,\n );\n }\n return metrics;\n },\n });\n }\n\n /**\n * Removes the current user's reaction on a swap comment (Call).\n *\n * Calls `DELETE ${baseUrl}/swap-comment/${commentId}/reaction`. Idempotent\n * when the caller has never reacted.\n *\n * @param options - Options bag.\n * @param options.commentId - `authorComment.uid` from a feed item.\n * @returns Refreshed per-emotion counts and a null `userReaction`.\n */\n async removeCommentReaction(\n options: RemoveCommentReactionOptions,\n ): Promise<CommentEngagement> {\n const { commentId } = options;\n\n return await this.fetchQuery({\n queryKey: [`${this.name}:removeCommentReaction`, commentId],\n staleTime: 0,\n queryFn: async () => {\n const url = `${this.#v1Url}/swap-comment/${encodeURIComponent(commentId)}/reaction`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, {\n method: 'DELETE',\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.REMOVE_COMMENT_REACTION_FAILED,\n );\n const metrics = await response.json();\n if (!is(metrics, CommentEngagementStruct)) {\n throw new Error(\n SocialServiceErrorMessage.REMOVE_COMMENT_REACTION_INVALID_RESPONSE,\n );\n }\n return metrics;\n },\n });\n }\n\n /**\n * Creates an author Call (user post) on one of the current user's swaps.\n *\n * Calls `POST ${baseUrl}/swap-comments`. Identify the swap with\n * `positionUid` (the `positionId` of a feed item or position) or, for a\n * trade too recent to be indexed, `tradeInFlight`. Provide exactly one of\n * those two fields.\n *\n * @param options - Options bag.\n * @param options.commentText - Message body of the post. May include a\n * `https://static.klipy.com/...gif` file URL; social-api rejects other links.\n * @param options.source - Free-form origin label stored on the comment.\n * @param options.positionUid - Position UUID (`positionId` / feed item id).\n * @param options.tradeInFlight - Hash, chain, and token of a swap in flight.\n * @returns The created swap comment.\n */\n async createSwapComment(\n options: CreateSwapCommentOptions,\n ): Promise<SwapCommentResponse> {\n const { commentText, source, positionUid, tradeInFlight } = options;\n\n return await this.fetchQuery({\n queryKey: [\n `${this.name}:createSwapComment`,\n {\n commentText,\n source: source ?? null,\n positionUid: positionUid ?? null,\n tradeInFlight: tradeInFlight ?? null,\n },\n ],\n staleTime: 0,\n queryFn: async () => {\n const url = `${this.#v1Url}/swap-comments`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, {\n method: 'POST',\n headers: { ...authHeaders, 'Content-Type': 'application/json' },\n body: JSON.stringify({\n commentText,\n ...(source === undefined ? {} : { source }),\n ...(positionUid === undefined ? {} : { positionUid }),\n ...(tradeInFlight === undefined ? {} : { tradeInFlight }),\n }),\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.CREATE_SWAP_COMMENT_FAILED,\n );\n const comment = (await response.json()) as unknown;\n if (!is(comment, SwapCommentResponseStruct)) {\n throw new Error(\n SocialServiceErrorMessage.CREATE_SWAP_COMMENT_INVALID_RESPONSE,\n );\n }\n return comment;\n },\n });\n }\n\n /**\n * Fetches the list of traders the current user is following.\n *\n * Calls `GET ${baseUrl}/users/me/following`. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @returns The following response.\n */\n async fetchFollowing(): Promise<FollowingResponse> {\n const followingResponse = await this.fetchQuery({\n queryKey: [`${this.name}:fetchFollowing`],\n staleTime: 0,\n queryFn: async () => {\n const url = `${this.#v1Url}/users/me/following`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, { headers: authHeaders });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FETCH_FOLLOWING_FAILED,\n );\n const followingData = await response.json();\n if (!is(followingData, FollowingResponseStruct)) {\n throw new Error(\n SocialServiceErrorMessage.FETCH_FOLLOWING_INVALID_RESPONSE,\n );\n }\n return followingData;\n },\n });\n\n return followingResponse;\n }\n\n /**\n * Follows one or more traders on behalf of the current user.\n *\n * Calls `PUT ${baseUrl}/users/me/follows`. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.targets - Array of wallet addresses or profile IDs to follow.\n * @returns The follow response with confirmed follows.\n */\n async follow(options: FollowOptions): Promise<FollowResponse> {\n const { targets } = options;\n\n const followResponse = await this.fetchQuery({\n queryKey: [`${this.name}:follow`, targets],\n staleTime: 0,\n queryFn: async () => {\n const url = `${this.#v1Url}/users/me/follows`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, {\n method: 'PUT',\n headers: { ...authHeaders, 'Content-Type': 'application/json' },\n body: JSON.stringify({ targets }),\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.FOLLOW_FAILED,\n );\n const followData = await response.json();\n if (!is(followData, FollowResponseStruct)) {\n throw new Error(SocialServiceErrorMessage.FOLLOW_INVALID_RESPONSE);\n }\n return followData;\n },\n });\n\n return followResponse;\n }\n\n /**\n * Unfollows one or more traders on behalf of the current user.\n *\n * Calls `DELETE ${baseUrl}/users/me/follows?targets=...`. Targets are sent\n * as query params because Fastify does not parse request bodies on DELETE\n * requests per RFC 9110. The caller is identified server-side from the JWT\n * sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.targets - Array of wallet addresses or profile IDs to unfollow.\n * @returns The unfollow response with confirmed unfollows.\n */\n async unfollow(options: UnfollowOptions): Promise<UnfollowResponse> {\n const { targets } = options;\n\n const unfollowResponse = await this.fetchQuery({\n queryKey: [`${this.name}:unfollow`, targets],\n staleTime: 0,\n queryFn: async () => {\n const url = new URL(`${this.#v1Url}/users/me/follows`);\n for (const target of targets) {\n url.searchParams.append('targets', target);\n }\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url.toString(), {\n method: 'DELETE',\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.UNFOLLOW_FAILED,\n );\n const unfollowData = await response.json();\n if (!is(unfollowData, UnfollowResponseStruct)) {\n throw new Error(SocialServiceErrorMessage.UNFOLLOW_INVALID_RESPONSE);\n }\n return unfollowData;\n },\n });\n\n return unfollowResponse;\n }\n\n /**\n * Opts the current user out of the PnL leaderboard.\n */\n async optOutOfLeaderboard(): Promise<void> {\n await this.fetchQuery({\n queryKey: [`${this.name}:optOutOfLeaderboard`],\n staleTime: 0,\n queryFn: async () => {\n const url = `${this.#v1Url}/leaderboard/opt-out`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, {\n method: 'POST',\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.LEADERBOARD_OPT_OUT_FAILED,\n );\n return null;\n },\n });\n }\n\n /**\n * Opts the current user back into the PnL leaderboard.\n */\n async optInToLeaderboard(): Promise<void> {\n await this.fetchQuery({\n queryKey: [`${this.name}:optInToLeaderboard`],\n staleTime: 0,\n queryFn: async () => {\n const url = `${this.#v1Url}/leaderboard/opt-in`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, {\n method: 'POST',\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.LEADERBOARD_OPT_IN_FAILED,\n );\n return null;\n },\n });\n }\n\n /**\n * Asks the social-api to refresh its cached copy of the current user's\n * notification preferences.\n *\n * Calls `POST ${baseUrl}/notifications/preferences/cache-refresh`. The caller\n * is identified server-side from the JWT sub claim carried in the\n * Authorization header, so it can only ever refresh its own entry.\n *\n * The client calls this immediately after writing a preference change to\n * Authenticated User Storage (AUS), which is the source of truth. The social\n * api re-reads from AUS and repopulates its cache so the change is honoured\n * near-instantly rather than after the cache TTL lapses. It is a pure\n * optimisation on top of that bounded TTL: the write has already succeeded by\n * the time this runs, so callers should treat it as best-effort and must not\n * roll back the AUS write if it fails.\n */\n async refreshNotificationPreferencesCache(): Promise<void> {\n await this.fetchQuery({\n queryKey: [`${this.name}:refreshNotificationPreferencesCache`],\n staleTime: 0,\n queryFn: async () => {\n const url = `${this.#v1Url}/notifications/preferences/cache-refresh`;\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url, {\n method: 'POST',\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(\n response,\n SocialServiceErrorMessage.NOTIFICATION_PREFERENCES_CACHE_REFRESH_FAILED,\n );\n return null;\n },\n });\n }\n\n /**\n * Shared helper for fetching open/closed positions.\n *\n * @param status - \"open\" or \"closed\".\n * @param options - Options bag including addressOrId and query parameters.\n * @returns The positions response.\n */\n async #fetchPositions(\n status: 'open' | 'closed',\n options: FetchPositionsOptions,\n ): Promise<PositionsResponse> {\n const { addressOrId, chain, sort, limit, page } = options;\n\n const failedMessage =\n status === 'open'\n ? SocialServiceErrorMessage.FETCH_OPEN_POSITIONS_FAILED\n : SocialServiceErrorMessage.FETCH_CLOSED_POSITIONS_FAILED;\n const invalidMessage =\n status === 'open'\n ? SocialServiceErrorMessage.FETCH_OPEN_POSITIONS_INVALID_RESPONSE\n : SocialServiceErrorMessage.FETCH_CLOSED_POSITIONS_INVALID_RESPONSE;\n\n const positionsResponse = await this.fetchQuery({\n queryKey: [\n `${this.name}:fetch${status === 'open' ? 'Open' : 'Closed'}Positions`,\n addressOrId,\n chain ?? null,\n // sort is not used for open positions (v2 endpoint dropped it),\n // so exclude it from the key to avoid redundant cache entries\n status === 'closed' ? (sort ?? null) : null,\n limit ?? null,\n page ?? null,\n ],\n queryFn: async () => {\n const baseUrl = status === 'open' ? this.#v2Url : this.#v1Url;\n const url = new URL(\n `${baseUrl}/traders/${encodeURIComponent(addressOrId)}/positions/${status}`,\n );\n if (chain) {\n url.searchParams.append('chain', chain);\n }\n // sort is not supported on the v2 open-positions endpoint\n if (sort && status === 'closed') {\n url.searchParams.append('sort', sort);\n }\n if (limit !== undefined) {\n url.searchParams.append('limit', String(limit));\n }\n if (page !== undefined) {\n url.searchParams.append('page', String(page));\n }\n\n const authHeaders = await this.#getAuthHeaders();\n const response = await fetch(url.toString(), {\n headers: authHeaders,\n });\n SocialService.#throwIfNotOk(response, failedMessage);\n const positionsData = await response.json();\n if (!is(positionsData, PositionsResponseStruct)) {\n throw new Error(invalidMessage);\n }\n return positionsData;\n },\n });\n\n return positionsResponse;\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -3,8 +3,8 @@ export { SocialController, getDefaultSocialControllerState, } from './SocialCont
3
3
  export type { SocialControllerFollowTraderAction, SocialControllerOptInToLeaderboardAction, SocialControllerOptOutOfLeaderboardAction, SocialControllerUnfollowTraderAction, SocialControllerUpdateFollowingAction, SocialControllerUpdateLeaderboardAction, } from './SocialController-method-action-types.js';
4
4
  export type { SocialServiceActions, SocialServiceEvents, SocialServiceMessenger, } from './SocialService.js';
5
5
  export { SocialService } from './SocialService.js';
6
- export type { SocialServiceFetchClosedPositionsAction, SocialServiceFetchFeedAction, SocialServiceFetchFollowersAction, SocialServiceFetchTokenFeedAction, SocialServiceFetchFollowingAction, SocialServiceFetchLeaderboardAction, SocialServiceFetchOpenPositionsAction, SocialServiceFetchPositionByIdAction, SocialServiceFetchTraderFeedAction, SocialServiceFetchTraderProfileAction, SocialServiceFollowAction, SocialServiceOptInToLeaderboardAction, SocialServiceOptOutOfLeaderboardAction, SocialServiceReactToCommentAction, SocialServiceRefreshNotificationPreferencesCacheAction, SocialServiceRemoveCommentReactionAction, SocialServiceUnfollowAction, } from './SocialService-method-action-types.js';
6
+ export type { SocialServiceFetchClosedPositionsAction, SocialServiceFetchFeedAction, SocialServiceFetchFollowersAction, SocialServiceFetchTokenFeedAction, SocialServiceFetchFollowingAction, SocialServiceFetchLeaderboardAction, SocialServiceFetchOpenPositionsAction, SocialServiceFetchPositionByIdAction, SocialServiceFetchTraderFeedAction, SocialServiceFetchTraderProfileAction, SocialServiceFollowAction, SocialServiceOptInToLeaderboardAction, SocialServiceOptOutOfLeaderboardAction, SocialServiceReactToCommentAction, SocialServiceCreateSwapCommentAction, SocialServiceRefreshNotificationPreferencesCacheAction, SocialServiceRemoveCommentReactionAction, SocialServiceUnfollowAction, } from './SocialService-method-action-types.js';
7
7
  export { TRADER_RANKING_TAGS, TradeStruct } from './social-types.js';
8
- export type { AuthorComment, CommentEngagement, CommentReaction, CommentReactionProfile, CopytradedAllTime, FeedActorSummary, FeedItem, FeedPagination, FeedResponse, FetchFeedOptions, FetchFollowersOptions, FetchTokenFeedOptions, FetchLeaderboardOptions, FetchPositionByIdOptions, FetchPositionsOptions, FetchTraderFeedOptions, FetchTraderProfileOptions, FollowersResponse, FollowingResponse, FollowOptions, FollowResponse, LeaderboardEntry, LeaderboardResponse, Pagination, PerChainBreakdown, Position, PositionsResponse, ProfileSummary, ReactToCommentOptions, RemoveCommentReactionOptions, SocialControllerState, SocialHandles, TokenFeedChain, TokenFeedStatus, Trade, TradeAction, TraderProfile, TraderProfileResponse, TraderRankingTag, TraderStats, UnfollowOptions, UnfollowResponse, } from './social-types.js';
8
+ export type { AuthorComment, CommentEngagement, CommentReaction, CommentReactionProfile, CopytradedAllTime, CreateSwapCommentOptions, FeedActorSummary, FeedItem, FeedPagination, FeedResponse, FetchFeedOptions, FetchFollowersOptions, FetchTokenFeedOptions, FetchLeaderboardOptions, FetchPositionByIdOptions, FetchPositionsOptions, FetchTraderFeedOptions, FetchTraderProfileOptions, FollowersResponse, FollowingResponse, FollowOptions, FollowResponse, LeaderboardEntry, LeaderboardResponse, Pagination, PerChainBreakdown, Position, PositionsResponse, ProfileSummary, ReactToCommentOptions, RemoveCommentReactionOptions, SocialControllerState, SocialHandles, SwapCommentAuthor, SwapCommentResponse, TokenFeedChain, TokenFeedStatus, Trade, TradeAction, TradeInFlight, TraderProfile, TraderProfileResponse, TraderRankingTag, TraderStats, UnfollowOptions, UnfollowResponse, } from './social-types.js';
9
9
  export { serviceName as socialServiceName, SocialServiceErrorMessage, } from './social-constants.js';
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,8BAA8B,EAC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,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,IAAI,iBAAiB,EAChC,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,8BAA8B,EAC9B,yBAAyB,EACzB,uBAAuB,EACvB,gCAAgC,GACjC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,gBAAgB,EAChB,+BAA+B,GAChC,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACV,kCAAkC,EAClC,wCAAwC,EACxC,yCAAyC,EACzC,oCAAoC,EACpC,qCAAqC,EACrC,uCAAuC,GACxC,MAAM,2CAA2C,CAAC;AAEnD,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,YAAY,EACV,uCAAuC,EACvC,4BAA4B,EAC5B,iCAAiC,EACjC,iCAAiC,EACjC,iCAAiC,EACjC,mCAAmC,EACnC,qCAAqC,EACrC,oCAAoC,EACpC,kCAAkC,EAClC,qCAAqC,EACrC,yBAAyB,EACzB,qCAAqC,EACrC,sCAAsC,EACtC,iCAAiC,EACjC,oCAAoC,EACpC,sDAAsD,EACtD,wCAAwC,EACxC,2BAA2B,GAC5B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrE,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,4BAA4B,EAC5B,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,KAAK,EACL,WAAW,EACX,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,IAAI,iBAAiB,EAChC,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,gBAAgB,EAChB,+BAA+B,GAChC,MAAM,uBAAuB,CAAC;AAgB/B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAsBnD,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA8CrE,OAAO,EACL,WAAW,IAAI,iBAAiB,EAChC,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC","sourcesContent":["export type {\n SocialControllerActions,\n SocialControllerEvents,\n SocialControllerGetStateAction,\n SocialControllerMessenger,\n SocialControllerOptions,\n SocialControllerStateChangeEvent,\n} from './SocialController.js';\nexport {\n SocialController,\n getDefaultSocialControllerState,\n} from './SocialController.js';\n\nexport type {\n SocialControllerFollowTraderAction,\n SocialControllerOptInToLeaderboardAction,\n SocialControllerOptOutOfLeaderboardAction,\n SocialControllerUnfollowTraderAction,\n SocialControllerUpdateFollowingAction,\n SocialControllerUpdateLeaderboardAction,\n} from './SocialController-method-action-types.js';\n\nexport type {\n SocialServiceActions,\n SocialServiceEvents,\n SocialServiceMessenger,\n} from './SocialService.js';\nexport { SocialService } from './SocialService.js';\n\nexport type {\n SocialServiceFetchClosedPositionsAction,\n SocialServiceFetchFeedAction,\n SocialServiceFetchFollowersAction,\n SocialServiceFetchTokenFeedAction,\n SocialServiceFetchFollowingAction,\n SocialServiceFetchLeaderboardAction,\n SocialServiceFetchOpenPositionsAction,\n SocialServiceFetchPositionByIdAction,\n SocialServiceFetchTraderFeedAction,\n SocialServiceFetchTraderProfileAction,\n SocialServiceFollowAction,\n SocialServiceOptInToLeaderboardAction,\n SocialServiceOptOutOfLeaderboardAction,\n SocialServiceReactToCommentAction,\n SocialServiceRefreshNotificationPreferencesCacheAction,\n SocialServiceRemoveCommentReactionAction,\n SocialServiceUnfollowAction,\n} from './SocialService-method-action-types.js';\n\nexport { TRADER_RANKING_TAGS, TradeStruct } from './social-types.js';\nexport type {\n AuthorComment,\n CommentEngagement,\n CommentReaction,\n CommentReactionProfile,\n CopytradedAllTime,\n FeedActorSummary,\n FeedItem,\n FeedPagination,\n FeedResponse,\n FetchFeedOptions,\n FetchFollowersOptions,\n FetchTokenFeedOptions,\n FetchLeaderboardOptions,\n FetchPositionByIdOptions,\n FetchPositionsOptions,\n FetchTraderFeedOptions,\n FetchTraderProfileOptions,\n FollowersResponse,\n FollowingResponse,\n FollowOptions,\n FollowResponse,\n LeaderboardEntry,\n LeaderboardResponse,\n Pagination,\n PerChainBreakdown,\n Position,\n PositionsResponse,\n ProfileSummary,\n ReactToCommentOptions,\n RemoveCommentReactionOptions,\n SocialControllerState,\n SocialHandles,\n TokenFeedChain,\n TokenFeedStatus,\n Trade,\n TradeAction,\n TraderProfile,\n TraderProfileResponse,\n TraderRankingTag,\n TraderStats,\n UnfollowOptions,\n UnfollowResponse,\n} from './social-types.js';\n\nexport {\n serviceName as socialServiceName,\n SocialServiceErrorMessage,\n} from './social-constants.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,gBAAgB,EAChB,+BAA+B,GAChC,MAAM,uBAAuB,CAAC;AAgB/B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAuBnD,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAkDrE,OAAO,EACL,WAAW,IAAI,iBAAiB,EAChC,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC","sourcesContent":["export type {\n SocialControllerActions,\n SocialControllerEvents,\n SocialControllerGetStateAction,\n SocialControllerMessenger,\n SocialControllerOptions,\n SocialControllerStateChangeEvent,\n} from './SocialController.js';\nexport {\n SocialController,\n getDefaultSocialControllerState,\n} from './SocialController.js';\n\nexport type {\n SocialControllerFollowTraderAction,\n SocialControllerOptInToLeaderboardAction,\n SocialControllerOptOutOfLeaderboardAction,\n SocialControllerUnfollowTraderAction,\n SocialControllerUpdateFollowingAction,\n SocialControllerUpdateLeaderboardAction,\n} from './SocialController-method-action-types.js';\n\nexport type {\n SocialServiceActions,\n SocialServiceEvents,\n SocialServiceMessenger,\n} from './SocialService.js';\nexport { SocialService } from './SocialService.js';\n\nexport type {\n SocialServiceFetchClosedPositionsAction,\n SocialServiceFetchFeedAction,\n SocialServiceFetchFollowersAction,\n SocialServiceFetchTokenFeedAction,\n SocialServiceFetchFollowingAction,\n SocialServiceFetchLeaderboardAction,\n SocialServiceFetchOpenPositionsAction,\n SocialServiceFetchPositionByIdAction,\n SocialServiceFetchTraderFeedAction,\n SocialServiceFetchTraderProfileAction,\n SocialServiceFollowAction,\n SocialServiceOptInToLeaderboardAction,\n SocialServiceOptOutOfLeaderboardAction,\n SocialServiceReactToCommentAction,\n SocialServiceCreateSwapCommentAction,\n SocialServiceRefreshNotificationPreferencesCacheAction,\n SocialServiceRemoveCommentReactionAction,\n SocialServiceUnfollowAction,\n} from './SocialService-method-action-types.js';\n\nexport { TRADER_RANKING_TAGS, TradeStruct } from './social-types.js';\nexport type {\n AuthorComment,\n CommentEngagement,\n CommentReaction,\n CommentReactionProfile,\n CopytradedAllTime,\n CreateSwapCommentOptions,\n FeedActorSummary,\n FeedItem,\n FeedPagination,\n FeedResponse,\n FetchFeedOptions,\n FetchFollowersOptions,\n FetchTokenFeedOptions,\n FetchLeaderboardOptions,\n FetchPositionByIdOptions,\n FetchPositionsOptions,\n FetchTraderFeedOptions,\n FetchTraderProfileOptions,\n FollowersResponse,\n FollowingResponse,\n FollowOptions,\n FollowResponse,\n LeaderboardEntry,\n LeaderboardResponse,\n Pagination,\n PerChainBreakdown,\n Position,\n PositionsResponse,\n ProfileSummary,\n ReactToCommentOptions,\n RemoveCommentReactionOptions,\n SocialControllerState,\n SocialHandles,\n SwapCommentAuthor,\n SwapCommentResponse,\n TokenFeedChain,\n TokenFeedStatus,\n Trade,\n TradeAction,\n TradeInFlight,\n TraderProfile,\n TraderProfileResponse,\n TraderRankingTag,\n TraderStats,\n UnfollowOptions,\n UnfollowResponse,\n} from './social-types.js';\n\nexport {\n serviceName as socialServiceName,\n SocialServiceErrorMessage,\n} from './social-constants.js';\n"]}
@@ -31,6 +31,8 @@ export declare const SocialServiceErrorMessage: {
31
31
  readonly REACT_TO_COMMENT_INVALID_RESPONSE: 'SocialService: Comment reaction returned invalid response';
32
32
  readonly REMOVE_COMMENT_REACTION_FAILED: 'SocialService: Comment reaction removal request failed';
33
33
  readonly REMOVE_COMMENT_REACTION_INVALID_RESPONSE: 'SocialService: Comment reaction removal returned invalid response';
34
+ readonly CREATE_SWAP_COMMENT_FAILED: 'SocialService: Swap comment request failed';
35
+ readonly CREATE_SWAP_COMMENT_INVALID_RESPONSE: 'SocialService: Swap comment returned invalid response';
34
36
  readonly NOTIFICATION_PREFERENCES_CACHE_REFRESH_FAILED: 'SocialService: Notification preferences cache refresh request failed';
35
37
  };
36
38
  //# sourceMappingURL=social-constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"social-constants.d.ts","sourceRoot":"","sources":["../src/social-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,kBAAkB,CAAC;AAE3C,eAAO,MAAM,cAAc,qBAAqB,CAAC;AAEjD,eAAO,MAAM,yBAAyB;aACpC,wBAAwB,EAAE,2CAA2C;aACrE,kCAAkC,EAChC,sDAAsD;aACxD,2BAA2B,EAAE,8CAA8C;aAC3E,qCAAqC,EACnC,yDAAyD;aAC3D,2BAA2B,EAAE,8CAA8C;aAC3E,qCAAqC,EACnC,yDAAyD;aAC3D,6BAA6B,EAC3B,gDAAgD;aAClD,uCAAuC,EACrC,2DAA2D;aAC7D,sBAAsB,EAAE,yCAAyC;aACjE,gCAAgC,EAC9B,oDAAoD;aACtD,sBAAsB,EAAE,yCAAyC;aACjE,gCAAgC,EAC9B,oDAAoD;aACtD,aAAa,EAAE,sCAAsC;aACrD,uBAAuB,EAAE,iDAAiD;aAC1E,eAAe,EAAE,wCAAwC;aACzD,yBAAyB,EACvB,mDAAmD;aACrD,2BAA2B,EAAE,wCAAwC;aACrE,qCAAqC,EACnC,mDAAmD;aACrD,0BAA0B,EACxB,mDAAmD;aACrD,yBAAyB,EAAE,kDAAkD;aAC7E,iBAAiB,EAAE,oCAAoC;aACvD,2BAA2B,EAAE,+CAA+C;aAC5E,wBAAwB,EAAE,2CAA2C;aACrE,kCAAkC,EAChC,sDAAsD;aACxD,uBAAuB,EAAE,0CAA0C;aACnE,iCAAiC,EAC/B,qDAAqD;aACvD,uBAAuB,EAAE,gDAAgD;aACzE,iCAAiC,EAC/B,2DAA2D;aAC7D,8BAA8B,EAC5B,wDAAwD;aAC1D,wCAAwC,EACtC,mEAAmE;aACrE,6CAA6C,EAC3C,sEAAsE;CAChE,CAAC"}
1
+ {"version":3,"file":"social-constants.d.ts","sourceRoot":"","sources":["../src/social-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,kBAAkB,CAAC;AAE3C,eAAO,MAAM,cAAc,qBAAqB,CAAC;AAEjD,eAAO,MAAM,yBAAyB;aACpC,wBAAwB,EAAE,2CAA2C;aACrE,kCAAkC,EAChC,sDAAsD;aACxD,2BAA2B,EAAE,8CAA8C;aAC3E,qCAAqC,EACnC,yDAAyD;aAC3D,2BAA2B,EAAE,8CAA8C;aAC3E,qCAAqC,EACnC,yDAAyD;aAC3D,6BAA6B,EAC3B,gDAAgD;aAClD,uCAAuC,EACrC,2DAA2D;aAC7D,sBAAsB,EAAE,yCAAyC;aACjE,gCAAgC,EAC9B,oDAAoD;aACtD,sBAAsB,EAAE,yCAAyC;aACjE,gCAAgC,EAC9B,oDAAoD;aACtD,aAAa,EAAE,sCAAsC;aACrD,uBAAuB,EAAE,iDAAiD;aAC1E,eAAe,EAAE,wCAAwC;aACzD,yBAAyB,EACvB,mDAAmD;aACrD,2BAA2B,EAAE,wCAAwC;aACrE,qCAAqC,EACnC,mDAAmD;aACrD,0BAA0B,EACxB,mDAAmD;aACrD,yBAAyB,EAAE,kDAAkD;aAC7E,iBAAiB,EAAE,oCAAoC;aACvD,2BAA2B,EAAE,+CAA+C;aAC5E,wBAAwB,EAAE,2CAA2C;aACrE,kCAAkC,EAChC,sDAAsD;aACxD,uBAAuB,EAAE,0CAA0C;aACnE,iCAAiC,EAC/B,qDAAqD;aACvD,uBAAuB,EAAE,gDAAgD;aACzE,iCAAiC,EAC/B,2DAA2D;aAC7D,8BAA8B,EAC5B,wDAAwD;aAC1D,wCAAwC,EACtC,mEAAmE;aACrE,0BAA0B,EAAE,4CAA4C;aACxE,oCAAoC,EAClC,uDAAuD;aACzD,6CAA6C,EAC3C,sEAAsE;CAChE,CAAC"}
@@ -31,6 +31,8 @@ export const SocialServiceErrorMessage = {
31
31
  REACT_TO_COMMENT_INVALID_RESPONSE: 'SocialService: Comment reaction returned invalid response',
32
32
  REMOVE_COMMENT_REACTION_FAILED: 'SocialService: Comment reaction removal request failed',
33
33
  REMOVE_COMMENT_REACTION_INVALID_RESPONSE: 'SocialService: Comment reaction removal returned invalid response',
34
+ CREATE_SWAP_COMMENT_FAILED: 'SocialService: Swap comment request failed',
35
+ CREATE_SWAP_COMMENT_INVALID_RESPONSE: 'SocialService: Swap comment returned invalid response',
34
36
  NOTIFICATION_PREFERENCES_CACHE_REFRESH_FAILED: 'SocialService: Notification preferences cache refresh request failed',
35
37
  };
36
38
  //# sourceMappingURL=social-constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"social-constants.js","sourceRoot":"","sources":["../src/social-constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC;AAE3C,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAEjD,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,wBAAwB,EAAE,2CAA2C;IACrE,kCAAkC,EAChC,sDAAsD;IACxD,2BAA2B,EAAE,8CAA8C;IAC3E,qCAAqC,EACnC,yDAAyD;IAC3D,2BAA2B,EAAE,8CAA8C;IAC3E,qCAAqC,EACnC,yDAAyD;IAC3D,6BAA6B,EAC3B,gDAAgD;IAClD,uCAAuC,EACrC,2DAA2D;IAC7D,sBAAsB,EAAE,yCAAyC;IACjE,gCAAgC,EAC9B,oDAAoD;IACtD,sBAAsB,EAAE,yCAAyC;IACjE,gCAAgC,EAC9B,oDAAoD;IACtD,aAAa,EAAE,sCAAsC;IACrD,uBAAuB,EAAE,iDAAiD;IAC1E,eAAe,EAAE,wCAAwC;IACzD,yBAAyB,EACvB,mDAAmD;IACrD,2BAA2B,EAAE,wCAAwC;IACrE,qCAAqC,EACnC,mDAAmD;IACrD,0BAA0B,EACxB,mDAAmD;IACrD,yBAAyB,EAAE,kDAAkD;IAC7E,iBAAiB,EAAE,oCAAoC;IACvD,2BAA2B,EAAE,+CAA+C;IAC5E,wBAAwB,EAAE,2CAA2C;IACrE,kCAAkC,EAChC,sDAAsD;IACxD,uBAAuB,EAAE,0CAA0C;IACnE,iCAAiC,EAC/B,qDAAqD;IACvD,uBAAuB,EAAE,gDAAgD;IACzE,iCAAiC,EAC/B,2DAA2D;IAC7D,8BAA8B,EAC5B,wDAAwD;IAC1D,wCAAwC,EACtC,mEAAmE;IACrE,6CAA6C,EAC3C,sEAAsE;CAChE,CAAC","sourcesContent":["export const serviceName = 'SocialService';\n\nexport const controllerName = 'SocialController';\n\nexport const SocialServiceErrorMessage = {\n FETCH_LEADERBOARD_FAILED: 'SocialService: Leaderboard request failed',\n FETCH_LEADERBOARD_INVALID_RESPONSE:\n 'SocialService: Leaderboard returned invalid response',\n FETCH_TRADER_PROFILE_FAILED: 'SocialService: Trader profile request failed',\n FETCH_TRADER_PROFILE_INVALID_RESPONSE:\n 'SocialService: Trader profile returned invalid response',\n FETCH_OPEN_POSITIONS_FAILED: 'SocialService: Open positions request failed',\n FETCH_OPEN_POSITIONS_INVALID_RESPONSE:\n 'SocialService: Open positions returned invalid response',\n FETCH_CLOSED_POSITIONS_FAILED:\n 'SocialService: Closed positions request failed',\n FETCH_CLOSED_POSITIONS_INVALID_RESPONSE:\n 'SocialService: Closed positions returned invalid response',\n FETCH_FOLLOWERS_FAILED: 'SocialService: Followers request failed',\n FETCH_FOLLOWERS_INVALID_RESPONSE:\n 'SocialService: Followers returned invalid response',\n FETCH_FOLLOWING_FAILED: 'SocialService: Following request failed',\n FETCH_FOLLOWING_INVALID_RESPONSE:\n 'SocialService: Following returned invalid response',\n FOLLOW_FAILED: 'SocialService: Follow request failed',\n FOLLOW_INVALID_RESPONSE: 'SocialService: Follow returned invalid response',\n UNFOLLOW_FAILED: 'SocialService: Unfollow request failed',\n UNFOLLOW_INVALID_RESPONSE:\n 'SocialService: Unfollow returned invalid response',\n FETCH_POSITION_BY_ID_FAILED: 'SocialService: Position request failed',\n FETCH_POSITION_BY_ID_INVALID_RESPONSE:\n 'SocialService: Position returned invalid response',\n LEADERBOARD_OPT_OUT_FAILED:\n 'SocialService: Leaderboard opt-out request failed',\n LEADERBOARD_OPT_IN_FAILED: 'SocialService: Leaderboard opt-in request failed',\n FETCH_FEED_FAILED: 'SocialService: Feed request failed',\n FETCH_FEED_INVALID_RESPONSE: 'SocialService: Feed returned invalid response',\n FETCH_TRADER_FEED_FAILED: 'SocialService: Trader feed request failed',\n FETCH_TRADER_FEED_INVALID_RESPONSE:\n 'SocialService: Trader feed returned invalid response',\n FETCH_TOKEN_FEED_FAILED: 'SocialService: Token feed request failed',\n FETCH_TOKEN_FEED_INVALID_RESPONSE:\n 'SocialService: Token feed returned invalid response',\n REACT_TO_COMMENT_FAILED: 'SocialService: Comment reaction request failed',\n REACT_TO_COMMENT_INVALID_RESPONSE:\n 'SocialService: Comment reaction returned invalid response',\n REMOVE_COMMENT_REACTION_FAILED:\n 'SocialService: Comment reaction removal request failed',\n REMOVE_COMMENT_REACTION_INVALID_RESPONSE:\n 'SocialService: Comment reaction removal returned invalid response',\n NOTIFICATION_PREFERENCES_CACHE_REFRESH_FAILED:\n 'SocialService: Notification preferences cache refresh request failed',\n} as const;\n"]}
1
+ {"version":3,"file":"social-constants.js","sourceRoot":"","sources":["../src/social-constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC;AAE3C,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAEjD,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,wBAAwB,EAAE,2CAA2C;IACrE,kCAAkC,EAChC,sDAAsD;IACxD,2BAA2B,EAAE,8CAA8C;IAC3E,qCAAqC,EACnC,yDAAyD;IAC3D,2BAA2B,EAAE,8CAA8C;IAC3E,qCAAqC,EACnC,yDAAyD;IAC3D,6BAA6B,EAC3B,gDAAgD;IAClD,uCAAuC,EACrC,2DAA2D;IAC7D,sBAAsB,EAAE,yCAAyC;IACjE,gCAAgC,EAC9B,oDAAoD;IACtD,sBAAsB,EAAE,yCAAyC;IACjE,gCAAgC,EAC9B,oDAAoD;IACtD,aAAa,EAAE,sCAAsC;IACrD,uBAAuB,EAAE,iDAAiD;IAC1E,eAAe,EAAE,wCAAwC;IACzD,yBAAyB,EACvB,mDAAmD;IACrD,2BAA2B,EAAE,wCAAwC;IACrE,qCAAqC,EACnC,mDAAmD;IACrD,0BAA0B,EACxB,mDAAmD;IACrD,yBAAyB,EAAE,kDAAkD;IAC7E,iBAAiB,EAAE,oCAAoC;IACvD,2BAA2B,EAAE,+CAA+C;IAC5E,wBAAwB,EAAE,2CAA2C;IACrE,kCAAkC,EAChC,sDAAsD;IACxD,uBAAuB,EAAE,0CAA0C;IACnE,iCAAiC,EAC/B,qDAAqD;IACvD,uBAAuB,EAAE,gDAAgD;IACzE,iCAAiC,EAC/B,2DAA2D;IAC7D,8BAA8B,EAC5B,wDAAwD;IAC1D,wCAAwC,EACtC,mEAAmE;IACrE,0BAA0B,EAAE,4CAA4C;IACxE,oCAAoC,EAClC,uDAAuD;IACzD,6CAA6C,EAC3C,sEAAsE;CAChE,CAAC","sourcesContent":["export const serviceName = 'SocialService';\n\nexport const controllerName = 'SocialController';\n\nexport const SocialServiceErrorMessage = {\n FETCH_LEADERBOARD_FAILED: 'SocialService: Leaderboard request failed',\n FETCH_LEADERBOARD_INVALID_RESPONSE:\n 'SocialService: Leaderboard returned invalid response',\n FETCH_TRADER_PROFILE_FAILED: 'SocialService: Trader profile request failed',\n FETCH_TRADER_PROFILE_INVALID_RESPONSE:\n 'SocialService: Trader profile returned invalid response',\n FETCH_OPEN_POSITIONS_FAILED: 'SocialService: Open positions request failed',\n FETCH_OPEN_POSITIONS_INVALID_RESPONSE:\n 'SocialService: Open positions returned invalid response',\n FETCH_CLOSED_POSITIONS_FAILED:\n 'SocialService: Closed positions request failed',\n FETCH_CLOSED_POSITIONS_INVALID_RESPONSE:\n 'SocialService: Closed positions returned invalid response',\n FETCH_FOLLOWERS_FAILED: 'SocialService: Followers request failed',\n FETCH_FOLLOWERS_INVALID_RESPONSE:\n 'SocialService: Followers returned invalid response',\n FETCH_FOLLOWING_FAILED: 'SocialService: Following request failed',\n FETCH_FOLLOWING_INVALID_RESPONSE:\n 'SocialService: Following returned invalid response',\n FOLLOW_FAILED: 'SocialService: Follow request failed',\n FOLLOW_INVALID_RESPONSE: 'SocialService: Follow returned invalid response',\n UNFOLLOW_FAILED: 'SocialService: Unfollow request failed',\n UNFOLLOW_INVALID_RESPONSE:\n 'SocialService: Unfollow returned invalid response',\n FETCH_POSITION_BY_ID_FAILED: 'SocialService: Position request failed',\n FETCH_POSITION_BY_ID_INVALID_RESPONSE:\n 'SocialService: Position returned invalid response',\n LEADERBOARD_OPT_OUT_FAILED:\n 'SocialService: Leaderboard opt-out request failed',\n LEADERBOARD_OPT_IN_FAILED: 'SocialService: Leaderboard opt-in request failed',\n FETCH_FEED_FAILED: 'SocialService: Feed request failed',\n FETCH_FEED_INVALID_RESPONSE: 'SocialService: Feed returned invalid response',\n FETCH_TRADER_FEED_FAILED: 'SocialService: Trader feed request failed',\n FETCH_TRADER_FEED_INVALID_RESPONSE:\n 'SocialService: Trader feed returned invalid response',\n FETCH_TOKEN_FEED_FAILED: 'SocialService: Token feed request failed',\n FETCH_TOKEN_FEED_INVALID_RESPONSE:\n 'SocialService: Token feed returned invalid response',\n REACT_TO_COMMENT_FAILED: 'SocialService: Comment reaction request failed',\n REACT_TO_COMMENT_INVALID_RESPONSE:\n 'SocialService: Comment reaction returned invalid response',\n REMOVE_COMMENT_REACTION_FAILED:\n 'SocialService: Comment reaction removal request failed',\n REMOVE_COMMENT_REACTION_INVALID_RESPONSE:\n 'SocialService: Comment reaction removal returned invalid response',\n CREATE_SWAP_COMMENT_FAILED: 'SocialService: Swap comment request failed',\n CREATE_SWAP_COMMENT_INVALID_RESPONSE:\n 'SocialService: Swap comment returned invalid response',\n NOTIFICATION_PREFERENCES_CACHE_REFRESH_FAILED:\n 'SocialService: Notification preferences cache refresh request failed',\n} as const;\n"]}
@@ -337,6 +337,64 @@ export type ReactToCommentOptions = {
337
337
  export type RemoveCommentReactionOptions = {
338
338
  commentId: string;
339
339
  };
340
+ /**
341
+ * Identifies a swap that may not be indexed yet. Prefer {@link CreateSwapCommentOptions.positionUid}
342
+ * when the client already has a feed or positions `positionId`.
343
+ */
344
+ export type TradeInFlight = {
345
+ transactionHash: string;
346
+ chain: string;
347
+ tokenAddress: string;
348
+ };
349
+ /**
350
+ * Options for `POST /v1/swap-comments`. Provide exactly one of `positionUid`
351
+ * or `tradeInFlight`; the social-api rejects a body that names both or neither.
352
+ */
353
+ export type CreateSwapCommentOptions = {
354
+ /**
355
+ * Message body of the post. May include a `https://static.klipy.com/...gif`
356
+ * file URL (the social-api allowlists that host); other links are rejected.
357
+ */
358
+ commentText: string;
359
+ /** Free-form origin label stored on the comment. */
360
+ source?: string;
361
+ /**
362
+ * Position UUID (`positionId` / feed `itemId`). The comment attaches to that
363
+ * position's most recent trade, which must be the caller's own.
364
+ */
365
+ positionUid?: string;
366
+ /** Swap made seconds ago that may not have a position yet. */
367
+ tradeInFlight?: TradeInFlight;
368
+ };
369
+ /**
370
+ * Author profile on a swap-comment write response. Matches social-api
371
+ * `ProfileResponseV1`; extra fields from newer builds are allowed.
372
+ */
373
+ export type SwapCommentAuthor = {
374
+ id: string;
375
+ name: string;
376
+ images?: {
377
+ raw: string | null;
378
+ xs: string | null;
379
+ sm: string | null;
380
+ };
381
+ addresses?: string[];
382
+ externalId?: string;
383
+ };
384
+ /**
385
+ * Response from `POST /v1/swap-comments`.
386
+ */
387
+ export type SwapCommentResponse = {
388
+ uid: string;
389
+ transactionHash: string;
390
+ chain: string;
391
+ tokenAddress: string;
392
+ commentText: string;
393
+ author: SwapCommentAuthor;
394
+ timestamp: number;
395
+ isAppUserComment: boolean;
396
+ metrics: CommentEngagement;
397
+ };
340
398
  /**
341
399
  * Cursor pagination for the feed. Pass `olderCursor` back as `olderThan` to
342
400
  * load older items (infinite scroll), and `newerCursor` as `newerThan` to
@@ -1 +1 @@
1
- {"version":3,"file":"social-types.d.ts","sourceRoot":"","sources":["../src/social-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,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C5B,8EAA8E;IAC9E,cAAc,EAAE,QAAQ,CACtB,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CACrD;IACD,uDAAuD;IACvD,gBAAgB,EAAE,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAC9D,8EAA8E;IAC9E,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1C,WAAW,EAAE,MAAM,EAAE;IACrB,OAAO,EAAE,MAAM,EAAE;IACjB,8EAA8E;IAC9E,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,EAAE;IACnB,eAAe,EAAE,MAAM,EAAE;CAC1B,CAAC,CAAC;AAuCH,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E,qEAAqE;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAU,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n enums,\n nullable,\n number,\n optional,\n string,\n type as structType,\n} from '@metamask/superstruct';\n\n// ---------------------------------------------------------------------------\n// Shared sub-types\n// ---------------------------------------------------------------------------\n\n/**\n * Minimal profile summary used across follow/follower responses.\n */\nexport type ProfileSummary = {\n /** Clicker profile ID (UUID). */\n profileId: string;\n /** Primary wallet address. */\n address: string;\n /** Display name or truncated address. */\n name: string;\n /** Profile avatar URL. */\n imageUrl?: string | null;\n};\n\n/**\n * Trader attached to a feed item. Extends {@link ProfileSummary} with the\n * profile stats the feed hydrator already loaded and used to drop.\n *\n * Every field is optional: a social-api that predates them omits the keys,\n * and `null` means the window has no data (distinct from \"not sent\").\n */\nexport type FeedActorSummary = ProfileSummary & {\n /** 30-day win rate as a 0–1 ratio. */\n winRate30d?: number | null;\n /** 30-day realized PnL in USD. */\n pnl30d?: number | null;\n /** 30-day sell count behind `winRate30d`. */\n tradeCount30d?: number | null;\n /** Profiles following this trader. */\n followerCount?: number | null;\n};\n\n/**\n * Social media handles attached to a trader profile.\n */\nexport type SocialHandles = {\n twitter?: string | null;\n farcaster?: string | null;\n ens?: string | null;\n lens?: string | null;\n};\n\n/**\n * Where a fill sits in its position's lifecycle.\n *\n * Deliberately asset-agnostic so the classification is computed once, upstream:\n * clients render `opened / added / reduced / closed` for perps and\n * `bought / bought more / sold some / sold all` for spot from the same value.\n *\n * Distinct from `intent`, which only says whether the fill grew or shrank the\n * position — `intent: 'exit'` covers both a partial trim and a full close.\n */\nexport type TradeAction = 'opened' | 'added' | 'reduced' | 'closed';\n\nexport const TradeStruct = structType({\n direction: enums(['buy', 'sell']),\n intent: enums(['enter', 'exit']),\n /**\n * Lifecycle stage of this fill. Absent on responses from a social-api that\n * predates the field, so treat it as a hint and keep a client-side fallback.\n */\n action: optional(enums(['opened', 'added', 'reduced', 'closed'])),\n category: optional(string()),\n /** High-level trade classification. `null` when Clicker does not classify. */\n classification: optional(\n nullable(enums(['spot', 'perp', 'send', 'receive'])),\n ),\n /** Perp side for this fill. `null` for spot trades. */\n perpPositionType: optional(nullable(enums(['long', 'short']))),\n /** Leverage multiplier for perp trades (e.g. `5` for 5x). `null` for spot. */\n perpLeverage: optional(nullable(number())),\n tokenAmount: number(),\n usdCost: number(),\n /** Token market cap in USD at trade time. `null` when Clicker has no mark. */\n marketCap: optional(nullable(number())),\n timestamp: number(),\n transactionHash: string(),\n});\n\nexport type Trade = Infer<typeof TradeStruct>;\n\n// ---------------------------------------------------------------------------\n// Leaderboard\n// ---------------------------------------------------------------------------\n\n/**\n * A single entry in the leaderboard response.\n */\nexport type LeaderboardEntry = {\n rank: number;\n addresses: string[];\n profileId: string;\n name: string;\n imageUrl?: string | null;\n pnl30d: number;\n winRate30d?: number | null;\n /** Renamed from roi30d. */\n roiPercent30d?: number | null;\n /** Renamed from tradeCount. */\n tradeCount30d?: number | null;\n pnl7d?: number | null;\n winRate7d?: number | null;\n roiPercent7d?: number | null;\n tradeCount7d?: number | null;\n pnlPerChain: Record<string, number>;\n followerCount: number;\n socialHandles: SocialHandles;\n};\n\n/**\n * Response from `GET /v1/leaderboard`.\n */\nexport type LeaderboardResponse = {\n traders: LeaderboardEntry[];\n};\n\n// ---------------------------------------------------------------------------\n// Trader profile\n// ---------------------------------------------------------------------------\n\n/** Values for `TraderProfileResponse.rankingTag` from social-api. */\nexport const TRADER_RANKING_TAGS = ['shrimp', 'dolphin', 'whale'] as const;\n\nexport type TraderRankingTag = (typeof TRADER_RANKING_TAGS)[number];\n\nexport type TraderProfile = {\n profileId: string;\n address: string;\n allAddresses: string[];\n name: string;\n imageUrl?: string | null;\n};\n\nexport type TraderStats = {\n pnl30d?: number | null;\n winRate30d?: number | null;\n /** Renamed from roi30d. */\n roiPercent30d?: number | null;\n /** Renamed from tradeCount. */\n tradeCount30d?: number | null;\n /** 30-day trading volume in USD. */\n volumeUsd30d?: number | null;\n pnl7d?: number | null;\n winRate7d?: number | null;\n roiPercent7d?: number | null;\n tradeCount7d?: number | null;\n /** Median holding time in minutes. */\n medianHoldMinutes?: number | null;\n};\n\nexport type CopytradedAllTime = {\n count: number;\n volumeUSD: number;\n distinctActors: number;\n};\n\nexport type PerChainBreakdown = {\n perChainPnl: Record<string, number>;\n /** ROI can be null for chains with no trading activity (zero cost-basis). */\n perChainRoi: Record<string, number | null>;\n perChainVolume: Record<string, number>;\n /**\n * 7-day per-chain PnL in USD. Optional: older social-api versions only\n * return the 30-day breakdown (`perChainPnl`). The unsuffixed fields above\n * remain the 30-day window for backward compatibility.\n */\n perChainPnl7d?: Record<string, number>;\n /** 7-day per-chain ROI. Null for chains with no trading activity. */\n perChainRoi7d?: Record<string, number | null>;\n /** 7-day per-chain volume in USD. */\n perChainVolume7d?: Record<string, number>;\n};\n\n/**\n * Response from `GET /v1/traders/:addressOrId/profile`.\n */\nexport type TraderProfileResponse = {\n profile: TraderProfile;\n stats: TraderStats;\n perChainBreakdown: PerChainBreakdown;\n socialHandles: SocialHandles;\n followerCount: number;\n followingCount: number;\n /**\n * Linked copy-swap stats for this trader. Social-api always sends zeros\n * when there are none.\n */\n copytradedAllTime: CopytradedAllTime;\n /**\n * Backend-derived tier from the Auth primary account 30d PnL. Omitted on older\n * social-api builds; `null` when unclaimed or activity is insufficient.\n */\n rankingTag?: TraderRankingTag | null;\n};\n\n// ---------------------------------------------------------------------------\n// Positions\n// ---------------------------------------------------------------------------\n\nexport type Position = {\n positionId: string;\n tokenSymbol: string;\n tokenName: string;\n tokenAddress: string;\n chain: string;\n positionAmount: number;\n /**\n * Whether the position still carries exposure. Clicker's own verdict, which\n * beats a `positionAmount === 0` check: it survives precision dust and\n * distinguishes \"no position\" from \"a position of size ~0\". Absent on\n * responses from a social-api that predates the field.\n */\n isOpen?: boolean;\n boughtUsd: number;\n soldUsd: number;\n realizedPnl: number;\n costBasis: number;\n trades: Trade[];\n lastTradeAt: number;\n /** Daylight-hosted token image URL. */\n tokenImageUrl?: string | null;\n /** Current USD value of the remaining position (open positions only). */\n currentValueUSD?: number | null;\n /** Unrealized + realized PnL in USD. */\n pnlValueUsd?: number | null;\n /** PnL as a percentage of cost basis. */\n pnlPercent?: number | null;\n /** Perp side of the position. `null`/absent for spot positions. */\n perpPositionType?: 'long' | 'short' | null;\n /** Leverage multiplier for perp positions. `null`/absent for spot. */\n perpLeverage?: number | null;\n /**\n * Leveraged/notional position size as reported by Clicker. NOT necessarily\n * `positionAmount` × `perpLeverage` — the ratio varies for positions built\n * across fills at different leverage, so use this field directly rather than\n * deriving it, and treat `perpLeverage` as the authoritative leverage. This is\n * notional exposure, not capital at risk (the margin/capital at risk is\n * `costBasis`). Hyperliquid/perp positions only; absent for spot.\n */\n positionAmountWithLeverage?: number | null;\n};\n\nexport type Pagination = {\n hasMore: boolean;\n nextPage?: number;\n};\n\n/**\n * Response from `GET /v1/traders/:addressOrId/positions/open`\n * and `GET /v1/traders/:addressOrId/positions/closed`.\n */\nexport type PositionsResponse = {\n positions: Position[];\n pagination: Pagination;\n /** ISO 8601 timestamp indicating when the response was computed server-side. */\n computedAt?: string | null;\n};\n\n// ---------------------------------------------------------------------------\n// Feed\n// ---------------------------------------------------------------------------\n\n/**\n * One emotion's aggregated count on a Call (swap comment), plus an optional\n * facepile sample. `profiles` is always present on the wire and is often empty.\n */\nexport type CommentReaction = {\n emotion: string;\n count: number;\n profiles: CommentReactionProfile[];\n};\n\nexport type CommentReactionProfile = {\n id: string;\n name: string;\n};\n\n/**\n * Engagement on a Call. Counts live on `reactions`; do not read deprecated\n * `likeCount` / `isLikedByUser` even if the social-api still emits them as 0/false.\n */\nexport type CommentEngagement = {\n reactions: CommentReaction[];\n /** Viewer's own emotion, when the hydrator was given their profile. */\n userReaction: string | null;\n /** Reply count on the comment. Present on feed `authorComment`, not on write responses. */\n replyCount?: number;\n};\n\n/**\n * Position thesis for the feed big card. `null` when that intent phase has no Call.\n */\nexport type AuthorComment = {\n uid: string;\n text: string;\n /** Unix timestamp (seconds) when the comment was created. */\n timestamp: number;\n engagement: CommentEngagement;\n};\n\n/**\n * A single trader-activity feed item: a {@link Position} the trade belongs to,\n * plus the {@link FeedActorSummary} of the trader who made it (`actor`) and the\n * item's creation `timestamp` (Unix seconds).\n */\nexport type FeedItem = Position & {\n /** The trader who made this trade. */\n actor: FeedActorSummary;\n /** Unix timestamp (seconds) when the feed item was created. */\n timestamp: number;\n /**\n * Latest author Call in the current intent phase. Absent on older social-api\n * builds; `null` when that phase has no comment.\n */\n authorComment?: AuthorComment | null;\n /** Author comments on this position. Absent on older social-api builds. */\n commentCount?: number;\n /** Replies across those comments. Absent on older social-api builds. */\n replyCount?: number;\n /**\n * Unix seconds of the position's first fill. Count from this to render a\n * live hold on a position that is still open, where {@link holdTimeMs} is\n * `null`. `null` when unknown. Absent on older social-api builds.\n */\n firstTradeAt?: number | null;\n /**\n * Final hold in milliseconds, first fill to last. Only set once the\n * position is closed; `null` while it is still running, because that span\n * grows every second — use {@link firstTradeAt} for those. Absent on older\n * social-api builds.\n */\n holdTimeMs?: number | null;\n /**\n * Average entry price in USD from remaining cost basis / remaining holding.\n * `null` when the position is flat. Absent on older social-api builds.\n */\n entryPriceUsd?: number | null;\n};\n\nexport type ReactToCommentOptions = {\n commentId: string;\n /** Emoji or short code (1–64 chars), e.g. `👍`. */\n emotion: string;\n};\n\nexport type RemoveCommentReactionOptions = {\n commentId: string;\n};\n\n/**\n * Cursor pagination for the feed. Pass `olderCursor` back as `olderThan` to\n * load older items (infinite scroll), and `newerCursor` as `newerThan` to\n * fetch newer items. `null` when there are no items in that direction.\n */\nexport type FeedPagination = {\n olderCursor: string | null;\n newerCursor: string | null;\n};\n\n/**\n * Response from `GET /v1/feed`.\n */\nexport type FeedResponse = {\n items: FeedItem[];\n pagination: FeedPagination;\n};\n\n// ---------------------------------------------------------------------------\n// Followers\n// ---------------------------------------------------------------------------\n\n/**\n * Response from `GET /v1/traders/:addressOrId/followers`.\n */\nexport type FollowersResponse = {\n followers: ProfileSummary[];\n count: number;\n};\n\n// ---------------------------------------------------------------------------\n// Following\n// ---------------------------------------------------------------------------\n\n/**\n * Response from `GET /v1/users/me/following`.\n */\nexport type FollowingResponse = {\n following: ProfileSummary[];\n count: number;\n};\n\n// ---------------------------------------------------------------------------\n// Follow / Unfollow\n// ---------------------------------------------------------------------------\n\n/**\n * Response from `PUT /v1/users/me/follows`.\n */\nexport type FollowResponse = {\n followed: ProfileSummary[];\n};\n\n/**\n * Response from `DELETE /v1/users/me/follows`.\n */\nexport type UnfollowResponse = {\n unfollowed: ProfileSummary[];\n};\n\n// ---------------------------------------------------------------------------\n// Fetch options\n// ---------------------------------------------------------------------------\n\nexport type FetchLeaderboardOptions = {\n sort?: 'pnl' | 'winRate' | 'roi';\n chains?: string[];\n limit?: number;\n};\n\nexport type FetchTraderProfileOptions = {\n /** Wallet address or Clicker profile ID. */\n addressOrId: string;\n};\n\nexport type FetchPositionsOptions = {\n /** Wallet address or Clicker profile ID. */\n addressOrId: string;\n chain?: string;\n sort?: 'value' | 'latest';\n limit?: number;\n page?: number;\n};\n\nexport type FetchFollowersOptions = {\n /** Wallet address or Clicker profile ID. */\n addressOrId: string;\n};\n\nexport type FetchTraderFeedOptions = {\n /** Wallet address or Clicker profile ID. */\n addressOrId: string;\n /**\n * When true, return only positions that carry an author comment.\n * Omitted from the request when false or unset (API default is false).\n */\n commentedOnly?: boolean;\n /** Number of results to return. */\n limit?: number;\n /** Cursor for older items (infinite scroll). Use `pagination.olderCursor`. */\n olderThan?: string;\n /** Cursor for newer items (pull to refresh). Use `pagination.newerCursor`. */\n newerThan?: string;\n};\n\n/**\n * Position status filter for a token feed.\n * Omit to return both open and recently closed positions.\n */\nexport type TokenFeedStatus = 'open' | 'closed';\n\n/**\n * Chain name accepted by `GET /v1/tokens/:chain/:contractAddress/feed`.\n */\nexport type TokenFeedChain =\n | 'base'\n | 'bsc'\n | 'ethereum'\n | 'hyperliquid'\n | 'robinhood'\n | 'solana';\n\n/**\n * Options for `GET /v1/tokens/:chain/:contractAddress/feed`.\n */\nexport type FetchTokenFeedOptions = {\n /** Chain name where the token is deployed. */\n chain: TokenFeedChain;\n /** Token contract address. */\n contractAddress: string;\n /**\n * Only open or only closed positions. Omit for both. Closed positions are\n * limited to the API's recent lookback.\n */\n status?: TokenFeedStatus;\n /** Number of results to return (1–100). Server default is 25. */\n limit?: number;\n /** Cursor for older items (infinite scroll). Use `pagination.olderCursor`. */\n olderThan?: string;\n /** Cursor for newer items (pull to refresh). Use `pagination.newerCursor`. */\n newerThan?: string;\n};\n\nexport type FetchFeedOptions = {\n /**\n * Which feed to fetch: `following` (personalized to the current user,\n * identified server-side from the JWT) or `leaderboard` (generic, shared by\n * all users). Defaults to `following` server-side when omitted.\n */\n scope?: 'following' | 'leaderboard';\n /**\n * Filter by one or more chains, given as CAIP-2 chain ids (e.g.\n * `eip155:8453`). Omit for the server defaults.\n */\n chains?: string[];\n /** Number of results to return. */\n limit?: number;\n /** Cursor for older items (infinite scroll). Use `pagination.olderCursor`. */\n olderThan?: string;\n /** Cursor for newer items (pull to refresh). Use `pagination.newerCursor`. */\n newerThan?: string;\n};\n\nexport type FetchPositionByIdOptions = {\n /** Unique position ID (UUID). */\n positionId: string;\n};\n\nexport type FollowOptions = {\n /** Array of wallet addresses or profile IDs to follow. */\n targets: string[];\n};\n\nexport type UnfollowOptions = {\n /** Array of wallet addresses or profile IDs to unfollow. */\n targets: string[];\n};\n\n// ---------------------------------------------------------------------------\n// Controller state\n// ---------------------------------------------------------------------------\n\n/**\n * State managed by the SocialController.\n *\n * The controller acts as a simple store — no TTL or eviction logic.\n * The UI decides when to re-fetch; the social-api's own cache layer\n * handles upstream rate-limiting.\n */\nexport type SocialControllerState = {\n /** Cached ranked trader list from the last `updateLeaderboard` call. */\n leaderboardEntries: LeaderboardEntry[];\n /** Wallet addresses the current user follows. */\n followingAddresses: string[];\n /** Clicker profile IDs the current user follows — used by mobile UI. */\n followingProfileIds: string[];\n};\n"]}
1
+ {"version":3,"file":"social-types.js","sourceRoot":"","sources":["../src/social-types.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,IAAI,UAAU,GACnB,MAAM,uBAAuB,CAAC;AA4D/B,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC;IACpC,SAAS,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAChC;;;OAGG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjE,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC5B,8EAA8E;IAC9E,cAAc,EAAE,QAAQ,CACtB,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CACrD;IACD,uDAAuD;IACvD,gBAAgB,EAAE,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAC9D,8EAA8E;IAC9E,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1C,WAAW,EAAE,MAAM,EAAE;IACrB,OAAO,EAAE,MAAM,EAAE;IACjB,8EAA8E;IAC9E,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,EAAE;IACnB,eAAe,EAAE,MAAM,EAAE;CAC1B,CAAC,CAAC;AAuCH,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E,qEAAqE;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAU,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n enums,\n nullable,\n number,\n optional,\n string,\n type as structType,\n} from '@metamask/superstruct';\n\n// ---------------------------------------------------------------------------\n// Shared sub-types\n// ---------------------------------------------------------------------------\n\n/**\n * Minimal profile summary used across follow/follower responses.\n */\nexport type ProfileSummary = {\n /** Clicker profile ID (UUID). */\n profileId: string;\n /** Primary wallet address. */\n address: string;\n /** Display name or truncated address. */\n name: string;\n /** Profile avatar URL. */\n imageUrl?: string | null;\n};\n\n/**\n * Trader attached to a feed item. Extends {@link ProfileSummary} with the\n * profile stats the feed hydrator already loaded and used to drop.\n *\n * Every field is optional: a social-api that predates them omits the keys,\n * and `null` means the window has no data (distinct from \"not sent\").\n */\nexport type FeedActorSummary = ProfileSummary & {\n /** 30-day win rate as a 0–1 ratio. */\n winRate30d?: number | null;\n /** 30-day realized PnL in USD. */\n pnl30d?: number | null;\n /** 30-day sell count behind `winRate30d`. */\n tradeCount30d?: number | null;\n /** Profiles following this trader. */\n followerCount?: number | null;\n};\n\n/**\n * Social media handles attached to a trader profile.\n */\nexport type SocialHandles = {\n twitter?: string | null;\n farcaster?: string | null;\n ens?: string | null;\n lens?: string | null;\n};\n\n/**\n * Where a fill sits in its position's lifecycle.\n *\n * Deliberately asset-agnostic so the classification is computed once, upstream:\n * clients render `opened / added / reduced / closed` for perps and\n * `bought / bought more / sold some / sold all` for spot from the same value.\n *\n * Distinct from `intent`, which only says whether the fill grew or shrank the\n * position — `intent: 'exit'` covers both a partial trim and a full close.\n */\nexport type TradeAction = 'opened' | 'added' | 'reduced' | 'closed';\n\nexport const TradeStruct = structType({\n direction: enums(['buy', 'sell']),\n intent: enums(['enter', 'exit']),\n /**\n * Lifecycle stage of this fill. Absent on responses from a social-api that\n * predates the field, so treat it as a hint and keep a client-side fallback.\n */\n action: optional(enums(['opened', 'added', 'reduced', 'closed'])),\n category: optional(string()),\n /** High-level trade classification. `null` when Clicker does not classify. */\n classification: optional(\n nullable(enums(['spot', 'perp', 'send', 'receive'])),\n ),\n /** Perp side for this fill. `null` for spot trades. */\n perpPositionType: optional(nullable(enums(['long', 'short']))),\n /** Leverage multiplier for perp trades (e.g. `5` for 5x). `null` for spot. */\n perpLeverage: optional(nullable(number())),\n tokenAmount: number(),\n usdCost: number(),\n /** Token market cap in USD at trade time. `null` when Clicker has no mark. */\n marketCap: optional(nullable(number())),\n timestamp: number(),\n transactionHash: string(),\n});\n\nexport type Trade = Infer<typeof TradeStruct>;\n\n// ---------------------------------------------------------------------------\n// Leaderboard\n// ---------------------------------------------------------------------------\n\n/**\n * A single entry in the leaderboard response.\n */\nexport type LeaderboardEntry = {\n rank: number;\n addresses: string[];\n profileId: string;\n name: string;\n imageUrl?: string | null;\n pnl30d: number;\n winRate30d?: number | null;\n /** Renamed from roi30d. */\n roiPercent30d?: number | null;\n /** Renamed from tradeCount. */\n tradeCount30d?: number | null;\n pnl7d?: number | null;\n winRate7d?: number | null;\n roiPercent7d?: number | null;\n tradeCount7d?: number | null;\n pnlPerChain: Record<string, number>;\n followerCount: number;\n socialHandles: SocialHandles;\n};\n\n/**\n * Response from `GET /v1/leaderboard`.\n */\nexport type LeaderboardResponse = {\n traders: LeaderboardEntry[];\n};\n\n// ---------------------------------------------------------------------------\n// Trader profile\n// ---------------------------------------------------------------------------\n\n/** Values for `TraderProfileResponse.rankingTag` from social-api. */\nexport const TRADER_RANKING_TAGS = ['shrimp', 'dolphin', 'whale'] as const;\n\nexport type TraderRankingTag = (typeof TRADER_RANKING_TAGS)[number];\n\nexport type TraderProfile = {\n profileId: string;\n address: string;\n allAddresses: string[];\n name: string;\n imageUrl?: string | null;\n};\n\nexport type TraderStats = {\n pnl30d?: number | null;\n winRate30d?: number | null;\n /** Renamed from roi30d. */\n roiPercent30d?: number | null;\n /** Renamed from tradeCount. */\n tradeCount30d?: number | null;\n /** 30-day trading volume in USD. */\n volumeUsd30d?: number | null;\n pnl7d?: number | null;\n winRate7d?: number | null;\n roiPercent7d?: number | null;\n tradeCount7d?: number | null;\n /** Median holding time in minutes. */\n medianHoldMinutes?: number | null;\n};\n\nexport type CopytradedAllTime = {\n count: number;\n volumeUSD: number;\n distinctActors: number;\n};\n\nexport type PerChainBreakdown = {\n perChainPnl: Record<string, number>;\n /** ROI can be null for chains with no trading activity (zero cost-basis). */\n perChainRoi: Record<string, number | null>;\n perChainVolume: Record<string, number>;\n /**\n * 7-day per-chain PnL in USD. Optional: older social-api versions only\n * return the 30-day breakdown (`perChainPnl`). The unsuffixed fields above\n * remain the 30-day window for backward compatibility.\n */\n perChainPnl7d?: Record<string, number>;\n /** 7-day per-chain ROI. Null for chains with no trading activity. */\n perChainRoi7d?: Record<string, number | null>;\n /** 7-day per-chain volume in USD. */\n perChainVolume7d?: Record<string, number>;\n};\n\n/**\n * Response from `GET /v1/traders/:addressOrId/profile`.\n */\nexport type TraderProfileResponse = {\n profile: TraderProfile;\n stats: TraderStats;\n perChainBreakdown: PerChainBreakdown;\n socialHandles: SocialHandles;\n followerCount: number;\n followingCount: number;\n /**\n * Linked copy-swap stats for this trader. Social-api always sends zeros\n * when there are none.\n */\n copytradedAllTime: CopytradedAllTime;\n /**\n * Backend-derived tier from the Auth primary account 30d PnL. Omitted on older\n * social-api builds; `null` when unclaimed or activity is insufficient.\n */\n rankingTag?: TraderRankingTag | null;\n};\n\n// ---------------------------------------------------------------------------\n// Positions\n// ---------------------------------------------------------------------------\n\nexport type Position = {\n positionId: string;\n tokenSymbol: string;\n tokenName: string;\n tokenAddress: string;\n chain: string;\n positionAmount: number;\n /**\n * Whether the position still carries exposure. Clicker's own verdict, which\n * beats a `positionAmount === 0` check: it survives precision dust and\n * distinguishes \"no position\" from \"a position of size ~0\". Absent on\n * responses from a social-api that predates the field.\n */\n isOpen?: boolean;\n boughtUsd: number;\n soldUsd: number;\n realizedPnl: number;\n costBasis: number;\n trades: Trade[];\n lastTradeAt: number;\n /** Daylight-hosted token image URL. */\n tokenImageUrl?: string | null;\n /** Current USD value of the remaining position (open positions only). */\n currentValueUSD?: number | null;\n /** Unrealized + realized PnL in USD. */\n pnlValueUsd?: number | null;\n /** PnL as a percentage of cost basis. */\n pnlPercent?: number | null;\n /** Perp side of the position. `null`/absent for spot positions. */\n perpPositionType?: 'long' | 'short' | null;\n /** Leverage multiplier for perp positions. `null`/absent for spot. */\n perpLeverage?: number | null;\n /**\n * Leveraged/notional position size as reported by Clicker. NOT necessarily\n * `positionAmount` × `perpLeverage` — the ratio varies for positions built\n * across fills at different leverage, so use this field directly rather than\n * deriving it, and treat `perpLeverage` as the authoritative leverage. This is\n * notional exposure, not capital at risk (the margin/capital at risk is\n * `costBasis`). Hyperliquid/perp positions only; absent for spot.\n */\n positionAmountWithLeverage?: number | null;\n};\n\nexport type Pagination = {\n hasMore: boolean;\n nextPage?: number;\n};\n\n/**\n * Response from `GET /v1/traders/:addressOrId/positions/open`\n * and `GET /v1/traders/:addressOrId/positions/closed`.\n */\nexport type PositionsResponse = {\n positions: Position[];\n pagination: Pagination;\n /** ISO 8601 timestamp indicating when the response was computed server-side. */\n computedAt?: string | null;\n};\n\n// ---------------------------------------------------------------------------\n// Feed\n// ---------------------------------------------------------------------------\n\n/**\n * One emotion's aggregated count on a Call (swap comment), plus an optional\n * facepile sample. `profiles` is always present on the wire and is often empty.\n */\nexport type CommentReaction = {\n emotion: string;\n count: number;\n profiles: CommentReactionProfile[];\n};\n\nexport type CommentReactionProfile = {\n id: string;\n name: string;\n};\n\n/**\n * Engagement on a Call. Counts live on `reactions`; do not read deprecated\n * `likeCount` / `isLikedByUser` even if the social-api still emits them as 0/false.\n */\nexport type CommentEngagement = {\n reactions: CommentReaction[];\n /** Viewer's own emotion, when the hydrator was given their profile. */\n userReaction: string | null;\n /** Reply count on the comment. Present on feed `authorComment`, not on write responses. */\n replyCount?: number;\n};\n\n/**\n * Position thesis for the feed big card. `null` when that intent phase has no Call.\n */\nexport type AuthorComment = {\n uid: string;\n text: string;\n /** Unix timestamp (seconds) when the comment was created. */\n timestamp: number;\n engagement: CommentEngagement;\n};\n\n/**\n * A single trader-activity feed item: a {@link Position} the trade belongs to,\n * plus the {@link FeedActorSummary} of the trader who made it (`actor`) and the\n * item's creation `timestamp` (Unix seconds).\n */\nexport type FeedItem = Position & {\n /** The trader who made this trade. */\n actor: FeedActorSummary;\n /** Unix timestamp (seconds) when the feed item was created. */\n timestamp: number;\n /**\n * Latest author Call in the current intent phase. Absent on older social-api\n * builds; `null` when that phase has no comment.\n */\n authorComment?: AuthorComment | null;\n /** Author comments on this position. Absent on older social-api builds. */\n commentCount?: number;\n /** Replies across those comments. Absent on older social-api builds. */\n replyCount?: number;\n /**\n * Unix seconds of the position's first fill. Count from this to render a\n * live hold on a position that is still open, where {@link holdTimeMs} is\n * `null`. `null` when unknown. Absent on older social-api builds.\n */\n firstTradeAt?: number | null;\n /**\n * Final hold in milliseconds, first fill to last. Only set once the\n * position is closed; `null` while it is still running, because that span\n * grows every second — use {@link firstTradeAt} for those. Absent on older\n * social-api builds.\n */\n holdTimeMs?: number | null;\n /**\n * Average entry price in USD from remaining cost basis / remaining holding.\n * `null` when the position is flat. Absent on older social-api builds.\n */\n entryPriceUsd?: number | null;\n};\n\nexport type ReactToCommentOptions = {\n commentId: string;\n /** Emoji or short code (1–64 chars), e.g. `👍`. */\n emotion: string;\n};\n\nexport type RemoveCommentReactionOptions = {\n commentId: string;\n};\n\n/**\n * Identifies a swap that may not be indexed yet. Prefer {@link CreateSwapCommentOptions.positionUid}\n * when the client already has a feed or positions `positionId`.\n */\nexport type TradeInFlight = {\n transactionHash: string;\n chain: string;\n tokenAddress: string;\n};\n\n/**\n * Options for `POST /v1/swap-comments`. Provide exactly one of `positionUid`\n * or `tradeInFlight`; the social-api rejects a body that names both or neither.\n */\nexport type CreateSwapCommentOptions = {\n /**\n * Message body of the post. May include a `https://static.klipy.com/...gif`\n * file URL (the social-api allowlists that host); other links are rejected.\n */\n commentText: string;\n /** Free-form origin label stored on the comment. */\n source?: string;\n /**\n * Position UUID (`positionId` / feed `itemId`). The comment attaches to that\n * position's most recent trade, which must be the caller's own.\n */\n positionUid?: string;\n /** Swap made seconds ago that may not have a position yet. */\n tradeInFlight?: TradeInFlight;\n};\n\n/**\n * Author profile on a swap-comment write response. Matches social-api\n * `ProfileResponseV1`; extra fields from newer builds are allowed.\n */\nexport type SwapCommentAuthor = {\n id: string;\n name: string;\n images?: {\n raw: string | null;\n xs: string | null;\n sm: string | null;\n };\n addresses?: string[];\n externalId?: string;\n};\n\n/**\n * Response from `POST /v1/swap-comments`.\n */\nexport type SwapCommentResponse = {\n uid: string;\n transactionHash: string;\n chain: string;\n tokenAddress: string;\n commentText: string;\n author: SwapCommentAuthor;\n timestamp: number;\n isAppUserComment: boolean;\n metrics: CommentEngagement;\n};\n\n/**\n * Cursor pagination for the feed. Pass `olderCursor` back as `olderThan` to\n * load older items (infinite scroll), and `newerCursor` as `newerThan` to\n * fetch newer items. `null` when there are no items in that direction.\n */\nexport type FeedPagination = {\n olderCursor: string | null;\n newerCursor: string | null;\n};\n\n/**\n * Response from `GET /v1/feed`.\n */\nexport type FeedResponse = {\n items: FeedItem[];\n pagination: FeedPagination;\n};\n\n// ---------------------------------------------------------------------------\n// Followers\n// ---------------------------------------------------------------------------\n\n/**\n * Response from `GET /v1/traders/:addressOrId/followers`.\n */\nexport type FollowersResponse = {\n followers: ProfileSummary[];\n count: number;\n};\n\n// ---------------------------------------------------------------------------\n// Following\n// ---------------------------------------------------------------------------\n\n/**\n * Response from `GET /v1/users/me/following`.\n */\nexport type FollowingResponse = {\n following: ProfileSummary[];\n count: number;\n};\n\n// ---------------------------------------------------------------------------\n// Follow / Unfollow\n// ---------------------------------------------------------------------------\n\n/**\n * Response from `PUT /v1/users/me/follows`.\n */\nexport type FollowResponse = {\n followed: ProfileSummary[];\n};\n\n/**\n * Response from `DELETE /v1/users/me/follows`.\n */\nexport type UnfollowResponse = {\n unfollowed: ProfileSummary[];\n};\n\n// ---------------------------------------------------------------------------\n// Fetch options\n// ---------------------------------------------------------------------------\n\nexport type FetchLeaderboardOptions = {\n sort?: 'pnl' | 'winRate' | 'roi';\n chains?: string[];\n limit?: number;\n};\n\nexport type FetchTraderProfileOptions = {\n /** Wallet address or Clicker profile ID. */\n addressOrId: string;\n};\n\nexport type FetchPositionsOptions = {\n /** Wallet address or Clicker profile ID. */\n addressOrId: string;\n chain?: string;\n sort?: 'value' | 'latest';\n limit?: number;\n page?: number;\n};\n\nexport type FetchFollowersOptions = {\n /** Wallet address or Clicker profile ID. */\n addressOrId: string;\n};\n\nexport type FetchTraderFeedOptions = {\n /** Wallet address or Clicker profile ID. */\n addressOrId: string;\n /**\n * When true, return only positions that carry an author comment.\n * Omitted from the request when false or unset (API default is false).\n */\n commentedOnly?: boolean;\n /** Number of results to return. */\n limit?: number;\n /** Cursor for older items (infinite scroll). Use `pagination.olderCursor`. */\n olderThan?: string;\n /** Cursor for newer items (pull to refresh). Use `pagination.newerCursor`. */\n newerThan?: string;\n};\n\n/**\n * Position status filter for a token feed.\n * Omit to return both open and recently closed positions.\n */\nexport type TokenFeedStatus = 'open' | 'closed';\n\n/**\n * Chain name accepted by `GET /v1/tokens/:chain/:contractAddress/feed`.\n */\nexport type TokenFeedChain =\n | 'base'\n | 'bsc'\n | 'ethereum'\n | 'hyperliquid'\n | 'robinhood'\n | 'solana';\n\n/**\n * Options for `GET /v1/tokens/:chain/:contractAddress/feed`.\n */\nexport type FetchTokenFeedOptions = {\n /** Chain name where the token is deployed. */\n chain: TokenFeedChain;\n /** Token contract address. */\n contractAddress: string;\n /**\n * Only open or only closed positions. Omit for both. Closed positions are\n * limited to the API's recent lookback.\n */\n status?: TokenFeedStatus;\n /** Number of results to return (1–100). Server default is 25. */\n limit?: number;\n /** Cursor for older items (infinite scroll). Use `pagination.olderCursor`. */\n olderThan?: string;\n /** Cursor for newer items (pull to refresh). Use `pagination.newerCursor`. */\n newerThan?: string;\n};\n\nexport type FetchFeedOptions = {\n /**\n * Which feed to fetch: `following` (personalized to the current user,\n * identified server-side from the JWT) or `leaderboard` (generic, shared by\n * all users). Defaults to `following` server-side when omitted.\n */\n scope?: 'following' | 'leaderboard';\n /**\n * Filter by one or more chains, given as CAIP-2 chain ids (e.g.\n * `eip155:8453`). Omit for the server defaults.\n */\n chains?: string[];\n /** Number of results to return. */\n limit?: number;\n /** Cursor for older items (infinite scroll). Use `pagination.olderCursor`. */\n olderThan?: string;\n /** Cursor for newer items (pull to refresh). Use `pagination.newerCursor`. */\n newerThan?: string;\n};\n\nexport type FetchPositionByIdOptions = {\n /** Unique position ID (UUID). */\n positionId: string;\n};\n\nexport type FollowOptions = {\n /** Array of wallet addresses or profile IDs to follow. */\n targets: string[];\n};\n\nexport type UnfollowOptions = {\n /** Array of wallet addresses or profile IDs to unfollow. */\n targets: string[];\n};\n\n// ---------------------------------------------------------------------------\n// Controller state\n// ---------------------------------------------------------------------------\n\n/**\n * State managed by the SocialController.\n *\n * The controller acts as a simple store — no TTL or eviction logic.\n * The UI decides when to re-fetch; the social-api's own cache layer\n * handles upstream rate-limiting.\n */\nexport type SocialControllerState = {\n /** Cached ranked trader list from the last `updateLeaderboard` call. */\n leaderboardEntries: LeaderboardEntry[];\n /** Wallet addresses the current user follows. */\n followingAddresses: string[];\n /** Clicker profile IDs the current user follows — used by mobile UI. */\n followingProfileIds: string[];\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/social-controllers",
3
- "version": "3.2.0-preview-ff2ab0583",
3
+ "version": "3.3.0-preview-c4789fdf4",
4
4
  "description": "A collection of social related controllers",
5
5
  "keywords": [
6
6
  "Ethereum",