@metamask-previews/social-controllers 3.4.0-preview-0f8c056e2 → 3.6.0-preview-0305ce0
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 +24 -1
- package/dist/SocialService-method-action-types.d.ts +61 -1
- package/dist/SocialService-method-action-types.d.ts.map +1 -1
- package/dist/SocialService-method-action-types.js.map +1 -1
- package/dist/SocialService.d.ts +49 -1
- package/dist/SocialService.d.ts.map +1 -1
- package/dist/SocialService.js +151 -0
- package/dist/SocialService.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/social-constants.d.ts +7 -0
- package/dist/social-constants.d.ts.map +1 -1
- package/dist/social-constants.js +7 -0
- package/dist/social-constants.js.map +1 -1
- package/dist/social-types.d.ts +82 -1
- package/dist/social-types.d.ts.map +1 -1
- package/dist/social-types.js.map +1 -1
- package/package.json +7 -8
package/CHANGELOG.md
CHANGED
|
@@ -9,11 +9,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
+
- Add `fetchMyFollowers` method to `SocialService` (and the `SocialService:fetchMyFollowers` messenger action) for the authenticated user's inbound followers. Calls `GET /users/me/followers` and returns `FollowersResponse` (`followers` profile summaries plus total `count`) ([#10649](https://github.com/MetaMask/core/pull/10649))
|
|
13
|
+
|
|
14
|
+
## [3.6.0]
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- Add `block`, `fetchBlockedProfiles`, and `fetchBlockedContent` methods to `SocialService` (and the matching `SocialService:block`, `SocialService:fetchBlockedProfiles`, and `SocialService:fetchBlockedContent` messenger actions) for the social-api moderation block endpoints ([#10656](https://github.com/MetaMask/core/pull/10656))
|
|
19
|
+
- `block` calls `PUT /moderation/block` with exactly one of `profileId`, `commentId`, or `replyId`, plus an optional `reason`. The endpoint returns 204.
|
|
20
|
+
- `fetchBlockedProfiles` calls `GET /moderation/blocks/profiles` and returns traders the caller has blocked, most recently blocked first. Pass `cursor` from the previous page; `cursor` is `null` on the last page.
|
|
21
|
+
- `fetchBlockedContent` calls `GET /moderation/blocks/content` and returns comments and replies the caller has blocked, most recently blocked first, with the same cursor pagination.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- Bump `@metamask/core-backend` from `^12.0.0` to `^12.0.1` ([#10662](https://github.com/MetaMask/core/pull/10662))
|
|
26
|
+
- Bump `@metamask/profile-sync-controller` from `^33.0.0` to `^34.0.0` ([#10662](https://github.com/MetaMask/core/pull/10662))
|
|
27
|
+
|
|
28
|
+
## [3.5.0]
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
12
32
|
- Add `SocialRealtimeService` for subscribing to Social realtime feed events through the shared backend WebSocket connection ([#10561](https://github.com/MetaMask/core/pull/10561))
|
|
13
33
|
|
|
14
34
|
### Changed
|
|
15
35
|
|
|
16
36
|
- Bump `@metamask/base-data-service` from `^2.0.0` to `^2.1.0` ([#10502](https://github.com/MetaMask/core/pull/10502))
|
|
37
|
+
- Bump `@metamask/core-backend` from `^11.0.0` to `^12.0.0` ([#10648](https://github.com/MetaMask/core/pull/10648))
|
|
17
38
|
|
|
18
39
|
## [3.4.0]
|
|
19
40
|
|
|
@@ -233,7 +254,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
233
254
|
- `unfollowTrader` — unfollows traders and removes addresses from state
|
|
234
255
|
- `updateFollowing` — fetches following list and replaces addresses in state
|
|
235
256
|
|
|
236
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@3.
|
|
257
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@3.6.0...HEAD
|
|
258
|
+
[3.6.0]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@3.5.0...@metamask/social-controllers@3.6.0
|
|
259
|
+
[3.5.0]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@3.4.0...@metamask/social-controllers@3.5.0
|
|
237
260
|
[3.4.0]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@3.3.0...@metamask/social-controllers@3.4.0
|
|
238
261
|
[3.3.0]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@3.2.0...@metamask/social-controllers@3.3.0
|
|
239
262
|
[3.2.0]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@3.1.0...@metamask/social-controllers@3.2.0
|
|
@@ -229,6 +229,18 @@ export type SocialServiceFetchFollowingAction = {
|
|
|
229
229
|
type: `SocialService:fetchFollowing`;
|
|
230
230
|
handler: SocialService['fetchFollowing'];
|
|
231
231
|
};
|
|
232
|
+
/**
|
|
233
|
+
* Fetches the list of traders following the current user.
|
|
234
|
+
*
|
|
235
|
+
* Calls `GET ${baseUrl}/users/me/followers`. The caller is identified
|
|
236
|
+
* server-side from the JWT sub claim carried in the Authorization header.
|
|
237
|
+
*
|
|
238
|
+
* @returns The followers response.
|
|
239
|
+
*/
|
|
240
|
+
export type SocialServiceFetchMyFollowersAction = {
|
|
241
|
+
type: `SocialService:fetchMyFollowers`;
|
|
242
|
+
handler: SocialService['fetchMyFollowers'];
|
|
243
|
+
};
|
|
232
244
|
/**
|
|
233
245
|
* Follows one or more traders on behalf of the current user.
|
|
234
246
|
*
|
|
@@ -293,8 +305,56 @@ export type SocialServiceRefreshNotificationPreferencesCacheAction = {
|
|
|
293
305
|
type: `SocialService:refreshNotificationPreferencesCache`;
|
|
294
306
|
handler: SocialService['refreshNotificationPreferencesCache'];
|
|
295
307
|
};
|
|
308
|
+
/**
|
|
309
|
+
* Blocks a trader, swap comment, or reply for the current user.
|
|
310
|
+
*
|
|
311
|
+
* Calls `PUT ${baseUrl}/moderation/block`. Provide exactly one of
|
|
312
|
+
* `profileId`, `commentId`, or `replyId`. Blocking the same target again
|
|
313
|
+
* replaces `reason` when one is given. The caller is identified server-side
|
|
314
|
+
* from the JWT sub claim carried in the Authorization header.
|
|
315
|
+
*
|
|
316
|
+
* @param options - Options bag. Exactly one target, plus an optional reason.
|
|
317
|
+
* @param options.profileId - Profile id (UUID) of the trader to block.
|
|
318
|
+
* @param options.commentId - Swap comment to block.
|
|
319
|
+
* @param options.replyId - Comment reply to block.
|
|
320
|
+
* @param options.reason - Free-form reason stored on the block.
|
|
321
|
+
*/
|
|
322
|
+
export type SocialServiceBlockAction = {
|
|
323
|
+
type: `SocialService:block`;
|
|
324
|
+
handler: SocialService['block'];
|
|
325
|
+
};
|
|
326
|
+
/**
|
|
327
|
+
* Fetches traders the current user has blocked.
|
|
328
|
+
*
|
|
329
|
+
* Calls `GET ${baseUrl}/moderation/blocks/profiles`. Results are most
|
|
330
|
+
* recently blocked first, 250 per page. The caller is identified
|
|
331
|
+
* server-side from the JWT sub claim carried in the Authorization header.
|
|
332
|
+
*
|
|
333
|
+
* @param options - Options bag.
|
|
334
|
+
* @param options.cursor - Cursor from the previous page. Omit for the first page.
|
|
335
|
+
* @returns The blocked profiles page.
|
|
336
|
+
*/
|
|
337
|
+
export type SocialServiceFetchBlockedProfilesAction = {
|
|
338
|
+
type: `SocialService:fetchBlockedProfiles`;
|
|
339
|
+
handler: SocialService['fetchBlockedProfiles'];
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* Fetches comments and replies the current user has blocked.
|
|
343
|
+
*
|
|
344
|
+
* Calls `GET ${baseUrl}/moderation/blocks/content`. Results are most
|
|
345
|
+
* recently blocked first, 250 per page. The caller is identified
|
|
346
|
+
* server-side from the JWT sub claim carried in the Authorization header.
|
|
347
|
+
*
|
|
348
|
+
* @param options - Options bag.
|
|
349
|
+
* @param options.cursor - Cursor from the previous page. Omit for the first page.
|
|
350
|
+
* @returns The blocked content page.
|
|
351
|
+
*/
|
|
352
|
+
export type SocialServiceFetchBlockedContentAction = {
|
|
353
|
+
type: `SocialService:fetchBlockedContent`;
|
|
354
|
+
handler: SocialService['fetchBlockedContent'];
|
|
355
|
+
};
|
|
296
356
|
/**
|
|
297
357
|
* Union of all SocialService action types.
|
|
298
358
|
*/
|
|
299
|
-
export type SocialServiceMethodActions = SocialServiceFetchLeaderboardAction | SocialServiceFetchTraderProfileAction | SocialServiceFetchOpenPositionsAction | SocialServiceFetchClosedPositionsAction | SocialServiceFetchFollowersAction | SocialServiceFetchPositionByIdAction | SocialServiceFetchFeedAction | SocialServiceFetchTraderFeedAction | SocialServiceFetchTokenFeedAction | SocialServiceReactToCommentAction | SocialServiceRemoveCommentReactionAction | SocialServiceCreateSwapCommentAction | SocialServiceFetchFollowingAction | SocialServiceFollowAction | SocialServiceUnfollowAction | SocialServiceOptOutOfLeaderboardAction | SocialServiceOptInToLeaderboardAction | SocialServiceRefreshNotificationPreferencesCacheAction;
|
|
359
|
+
export type SocialServiceMethodActions = SocialServiceFetchLeaderboardAction | SocialServiceFetchTraderProfileAction | SocialServiceFetchOpenPositionsAction | SocialServiceFetchClosedPositionsAction | SocialServiceFetchFollowersAction | SocialServiceFetchPositionByIdAction | SocialServiceFetchFeedAction | SocialServiceFetchTraderFeedAction | SocialServiceFetchTokenFeedAction | SocialServiceReactToCommentAction | SocialServiceRemoveCommentReactionAction | SocialServiceCreateSwapCommentAction | SocialServiceFetchFollowingAction | SocialServiceFetchMyFollowersAction | SocialServiceFollowAction | SocialServiceUnfollowAction | SocialServiceOptOutOfLeaderboardAction | SocialServiceOptInToLeaderboardAction | SocialServiceRefreshNotificationPreferencesCacheAction | SocialServiceBlockAction | SocialServiceFetchBlockedProfilesAction | SocialServiceFetchBlockedContentAction;
|
|
300
360
|
//# 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;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qC,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
|
+
{"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,uCAA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AAqB,CAAC;IAC5B,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;;;;;;GAUG;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,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,mCAAmC,GACnC,yBAAyB,GACzB,2BAA2B,GAC3B,sCAAsC,GACtC,qCAAqC,GACrC,sDAAsD,GACtD,wBAAwB,GACxB,uCAAuC,GACvC,sCAAsC,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 * 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"]}
|
|
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 * Fetches the list of traders following the current user.\n *\n * Calls `GET ${baseUrl}/users/me/followers`. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @returns The followers response.\n */\nexport type SocialServiceFetchMyFollowersAction = {\n type: `SocialService:fetchMyFollowers`;\n handler: SocialService['fetchMyFollowers'];\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 * Blocks a trader, swap comment, or reply for the current user.\n *\n * Calls `PUT ${baseUrl}/moderation/block`. Provide exactly one of\n * `profileId`, `commentId`, or `replyId`. Blocking the same target again\n * replaces `reason` when one is given. The caller is identified server-side\n * from the JWT sub claim carried in the Authorization header.\n *\n * @param options - Options bag. Exactly one target, plus an optional reason.\n * @param options.profileId - Profile id (UUID) of the trader to block.\n * @param options.commentId - Swap comment to block.\n * @param options.replyId - Comment reply to block.\n * @param options.reason - Free-form reason stored on the block.\n */\nexport type SocialServiceBlockAction = {\n type: `SocialService:block`;\n handler: SocialService['block'];\n};\n\n/**\n * Fetches traders the current user has blocked.\n *\n * Calls `GET ${baseUrl}/moderation/blocks/profiles`. Results are most\n * recently blocked first, 250 per page. 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.cursor - Cursor from the previous page. Omit for the first page.\n * @returns The blocked profiles page.\n */\nexport type SocialServiceFetchBlockedProfilesAction = {\n type: `SocialService:fetchBlockedProfiles`;\n handler: SocialService['fetchBlockedProfiles'];\n};\n\n/**\n * Fetches comments and replies the current user has blocked.\n *\n * Calls `GET ${baseUrl}/moderation/blocks/content`. Results are most\n * recently blocked first, 250 per page. 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.cursor - Cursor from the previous page. Omit for the first page.\n * @returns The blocked content page.\n */\nexport type SocialServiceFetchBlockedContentAction = {\n type: `SocialService:fetchBlockedContent`;\n handler: SocialService['fetchBlockedContent'];\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 | SocialServiceFetchMyFollowersAction\n | SocialServiceFollowAction\n | SocialServiceUnfollowAction\n | SocialServiceOptOutOfLeaderboardAction\n | SocialServiceOptInToLeaderboardAction\n | SocialServiceRefreshNotificationPreferencesCacheAction\n | SocialServiceBlockAction\n | SocialServiceFetchBlockedProfilesAction\n | SocialServiceFetchBlockedContentAction;\n"]}
|
package/dist/SocialService.d.ts
CHANGED
|
@@ -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, 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';
|
|
7
|
+
import type { BlockedContentResponse, BlockedProfilesResponse, BlockOptions, CommentEngagement, CreateSwapCommentOptions, FeedResponse, FetchBlockedListOptions, 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>;
|
|
@@ -208,6 +208,15 @@ export declare class SocialService extends BaseDataService<typeof serviceName, S
|
|
|
208
208
|
* @returns The following response.
|
|
209
209
|
*/
|
|
210
210
|
fetchFollowing(): Promise<FollowingResponse>;
|
|
211
|
+
/**
|
|
212
|
+
* Fetches the list of traders following the current user.
|
|
213
|
+
*
|
|
214
|
+
* Calls `GET ${baseUrl}/users/me/followers`. The caller is identified
|
|
215
|
+
* server-side from the JWT sub claim carried in the Authorization header.
|
|
216
|
+
*
|
|
217
|
+
* @returns The followers response.
|
|
218
|
+
*/
|
|
219
|
+
fetchMyFollowers(): Promise<FollowersResponse>;
|
|
211
220
|
/**
|
|
212
221
|
* Follows one or more traders on behalf of the current user.
|
|
213
222
|
*
|
|
@@ -257,6 +266,45 @@ export declare class SocialService extends BaseDataService<typeof serviceName, S
|
|
|
257
266
|
* roll back the AUS write if it fails.
|
|
258
267
|
*/
|
|
259
268
|
refreshNotificationPreferencesCache(): Promise<void>;
|
|
269
|
+
/**
|
|
270
|
+
* Blocks a trader, swap comment, or reply for the current user.
|
|
271
|
+
*
|
|
272
|
+
* Calls `PUT ${baseUrl}/moderation/block`. Provide exactly one of
|
|
273
|
+
* `profileId`, `commentId`, or `replyId`. Blocking the same target again
|
|
274
|
+
* replaces `reason` when one is given. The caller is identified server-side
|
|
275
|
+
* from the JWT sub claim carried in the Authorization header.
|
|
276
|
+
*
|
|
277
|
+
* @param options - Options bag. Exactly one target, plus an optional reason.
|
|
278
|
+
* @param options.profileId - Profile id (UUID) of the trader to block.
|
|
279
|
+
* @param options.commentId - Swap comment to block.
|
|
280
|
+
* @param options.replyId - Comment reply to block.
|
|
281
|
+
* @param options.reason - Free-form reason stored on the block.
|
|
282
|
+
*/
|
|
283
|
+
block(options: BlockOptions): Promise<void>;
|
|
284
|
+
/**
|
|
285
|
+
* Fetches traders the current user has blocked.
|
|
286
|
+
*
|
|
287
|
+
* Calls `GET ${baseUrl}/moderation/blocks/profiles`. Results are most
|
|
288
|
+
* recently blocked first, 250 per page. The caller is identified
|
|
289
|
+
* server-side from the JWT sub claim carried in the Authorization header.
|
|
290
|
+
*
|
|
291
|
+
* @param options - Options bag.
|
|
292
|
+
* @param options.cursor - Cursor from the previous page. Omit for the first page.
|
|
293
|
+
* @returns The blocked profiles page.
|
|
294
|
+
*/
|
|
295
|
+
fetchBlockedProfiles(options?: FetchBlockedListOptions): Promise<BlockedProfilesResponse>;
|
|
296
|
+
/**
|
|
297
|
+
* Fetches comments and replies the current user has blocked.
|
|
298
|
+
*
|
|
299
|
+
* Calls `GET ${baseUrl}/moderation/blocks/content`. Results are most
|
|
300
|
+
* recently blocked first, 250 per page. The caller is identified
|
|
301
|
+
* server-side from the JWT sub claim carried in the Authorization header.
|
|
302
|
+
*
|
|
303
|
+
* @param options - Options bag.
|
|
304
|
+
* @param options.cursor - Cursor from the previous page. Omit for the first page.
|
|
305
|
+
* @returns The blocked content page.
|
|
306
|
+
*/
|
|
307
|
+
fetchBlockedContent(options?: FetchBlockedListOptions): Promise<BlockedContentResponse>;
|
|
260
308
|
}
|
|
261
309
|
export {};
|
|
262
310
|
//# sourceMappingURL=SocialService.d.ts.map
|
|
@@ -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,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAE7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAelF,OAAO,EAAE,WAAW,EAA6B,MAAM,uBAAuB,CAAC;AAC/E,OAAO,KAAK,EACV,iBAAiB,EACjB,wBAAwB,EACxB,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,QAAQ,EACR,iBAAiB,EACjB,qBAAqB,EACrB,4BAA4B,EAC5B,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;
|
|
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,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAE7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAelF,OAAO,EAAE,WAAW,EAA6B,MAAM,uBAAuB,CAAC;AAC/E,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,iBAAiB,EACjB,wBAAwB,EACxB,YAAY,EACZ,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,QAAQ,EACR,iBAAiB,EACjB,qBAAqB,EACrB,4BAA4B,EAC5B,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AA4RzF,MAAM,MAAM,oBAAoB,GAC5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OAaG;IACG,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBhD;IAED;;;;;;;;;;OAUG;IACG,oBAAoB,CACxB,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,uBAAuB,CAAC,CA6BlC;IAED;;;;;;;;;;OAUG;IACG,mBAAmB,CACvB,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,sBAAsB,CAAC,CA6BjC;CAqEF"}
|
package/dist/SocialService.js
CHANGED
|
@@ -196,6 +196,28 @@ const FollowResponseStruct = structType({
|
|
|
196
196
|
const UnfollowResponseStruct = structType({
|
|
197
197
|
unfollowed: array(ProfileSummaryStruct),
|
|
198
198
|
});
|
|
199
|
+
const BlockedProfileStruct = structType({
|
|
200
|
+
blockedAt: number(),
|
|
201
|
+
reason: nullable(string()),
|
|
202
|
+
profile: ProfileSummaryStruct,
|
|
203
|
+
});
|
|
204
|
+
const BlockedProfilesResponseStruct = structType({
|
|
205
|
+
items: array(BlockedProfileStruct),
|
|
206
|
+
cursor: nullable(string()),
|
|
207
|
+
});
|
|
208
|
+
const BlockedContentStruct = structType({
|
|
209
|
+
blockedAt: number(),
|
|
210
|
+
reason: nullable(string()),
|
|
211
|
+
type: enums(['comment', 'reply']),
|
|
212
|
+
id: string(),
|
|
213
|
+
text: string(),
|
|
214
|
+
createdAt: number(),
|
|
215
|
+
author: nullable(ProfileSummaryStruct),
|
|
216
|
+
});
|
|
217
|
+
const BlockedContentResponseStruct = structType({
|
|
218
|
+
items: array(BlockedContentStruct),
|
|
219
|
+
cursor: nullable(string()),
|
|
220
|
+
});
|
|
199
221
|
// ---------------------------------------------------------------------------
|
|
200
222
|
// Messenger types
|
|
201
223
|
// ---------------------------------------------------------------------------
|
|
@@ -206,6 +228,7 @@ const MESSENGER_EXPOSED_METHODS = [
|
|
|
206
228
|
'fetchClosedPositions',
|
|
207
229
|
'fetchFollowers',
|
|
208
230
|
'fetchFollowing',
|
|
231
|
+
'fetchMyFollowers',
|
|
209
232
|
'fetchPositionById',
|
|
210
233
|
'fetchFeed',
|
|
211
234
|
'fetchTraderFeed',
|
|
@@ -218,6 +241,9 @@ const MESSENGER_EXPOSED_METHODS = [
|
|
|
218
241
|
'optOutOfLeaderboard',
|
|
219
242
|
'optInToLeaderboard',
|
|
220
243
|
'refreshNotificationPreferencesCache',
|
|
244
|
+
'block',
|
|
245
|
+
'fetchBlockedProfiles',
|
|
246
|
+
'fetchBlockedContent',
|
|
221
247
|
];
|
|
222
248
|
// ---------------------------------------------------------------------------
|
|
223
249
|
// Service
|
|
@@ -724,6 +750,32 @@ export class SocialService extends BaseDataService {
|
|
|
724
750
|
});
|
|
725
751
|
return followingResponse;
|
|
726
752
|
}
|
|
753
|
+
/**
|
|
754
|
+
* Fetches the list of traders following the current user.
|
|
755
|
+
*
|
|
756
|
+
* Calls `GET ${baseUrl}/users/me/followers`. The caller is identified
|
|
757
|
+
* server-side from the JWT sub claim carried in the Authorization header.
|
|
758
|
+
*
|
|
759
|
+
* @returns The followers response.
|
|
760
|
+
*/
|
|
761
|
+
async fetchMyFollowers() {
|
|
762
|
+
const followersResponse = await this.fetchQuery({
|
|
763
|
+
queryKey: [`${this.name}:fetchMyFollowers`],
|
|
764
|
+
staleTime: 0,
|
|
765
|
+
queryFn: async () => {
|
|
766
|
+
const url = `${this.#v1Url}/users/me/followers`;
|
|
767
|
+
const authHeaders = await this.#getAuthHeaders();
|
|
768
|
+
const response = await fetch(url, { headers: authHeaders });
|
|
769
|
+
_a.#throwIfNotOk(response, SocialServiceErrorMessage.FETCH_MY_FOLLOWERS_FAILED);
|
|
770
|
+
const followersData = (await response.json());
|
|
771
|
+
if (!is(followersData, FollowersResponseStruct)) {
|
|
772
|
+
throw new Error(SocialServiceErrorMessage.FETCH_MY_FOLLOWERS_INVALID_RESPONSE);
|
|
773
|
+
}
|
|
774
|
+
return followersData;
|
|
775
|
+
},
|
|
776
|
+
});
|
|
777
|
+
return followersResponse;
|
|
778
|
+
}
|
|
727
779
|
/**
|
|
728
780
|
* Follows one or more traders on behalf of the current user.
|
|
729
781
|
*
|
|
@@ -864,6 +916,105 @@ export class SocialService extends BaseDataService {
|
|
|
864
916
|
},
|
|
865
917
|
});
|
|
866
918
|
}
|
|
919
|
+
/**
|
|
920
|
+
* Blocks a trader, swap comment, or reply for the current user.
|
|
921
|
+
*
|
|
922
|
+
* Calls `PUT ${baseUrl}/moderation/block`. Provide exactly one of
|
|
923
|
+
* `profileId`, `commentId`, or `replyId`. Blocking the same target again
|
|
924
|
+
* replaces `reason` when one is given. The caller is identified server-side
|
|
925
|
+
* from the JWT sub claim carried in the Authorization header.
|
|
926
|
+
*
|
|
927
|
+
* @param options - Options bag. Exactly one target, plus an optional reason.
|
|
928
|
+
* @param options.profileId - Profile id (UUID) of the trader to block.
|
|
929
|
+
* @param options.commentId - Swap comment to block.
|
|
930
|
+
* @param options.replyId - Comment reply to block.
|
|
931
|
+
* @param options.reason - Free-form reason stored on the block.
|
|
932
|
+
*/
|
|
933
|
+
async block(options) {
|
|
934
|
+
await this.fetchQuery({
|
|
935
|
+
queryKey: [`${this.name}:block`, options],
|
|
936
|
+
staleTime: 0,
|
|
937
|
+
queryFn: async () => {
|
|
938
|
+
const url = `${this.#v1Url}/moderation/block`;
|
|
939
|
+
const authHeaders = await this.#getAuthHeaders();
|
|
940
|
+
const response = await fetch(url, {
|
|
941
|
+
method: 'PUT',
|
|
942
|
+
headers: { ...authHeaders, 'Content-Type': 'application/json' },
|
|
943
|
+
body: JSON.stringify(options),
|
|
944
|
+
});
|
|
945
|
+
_a.#throwIfNotOk(response, SocialServiceErrorMessage.BLOCK_FAILED);
|
|
946
|
+
return null;
|
|
947
|
+
},
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* Fetches traders the current user has blocked.
|
|
952
|
+
*
|
|
953
|
+
* Calls `GET ${baseUrl}/moderation/blocks/profiles`. Results are most
|
|
954
|
+
* recently blocked first, 250 per page. The caller is identified
|
|
955
|
+
* server-side from the JWT sub claim carried in the Authorization header.
|
|
956
|
+
*
|
|
957
|
+
* @param options - Options bag.
|
|
958
|
+
* @param options.cursor - Cursor from the previous page. Omit for the first page.
|
|
959
|
+
* @returns The blocked profiles page.
|
|
960
|
+
*/
|
|
961
|
+
async fetchBlockedProfiles(options) {
|
|
962
|
+
const cursor = options?.cursor;
|
|
963
|
+
return await this.fetchQuery({
|
|
964
|
+
queryKey: [`${this.name}:fetchBlockedProfiles`, cursor ?? null],
|
|
965
|
+
staleTime: 0,
|
|
966
|
+
queryFn: async () => {
|
|
967
|
+
const url = new URL(`${this.#v1Url}/moderation/blocks/profiles`);
|
|
968
|
+
if (cursor) {
|
|
969
|
+
url.searchParams.append('cursor', cursor);
|
|
970
|
+
}
|
|
971
|
+
const authHeaders = await this.#getAuthHeaders();
|
|
972
|
+
const response = await fetch(url.toString(), {
|
|
973
|
+
headers: authHeaders,
|
|
974
|
+
});
|
|
975
|
+
_a.#throwIfNotOk(response, SocialServiceErrorMessage.FETCH_BLOCKED_PROFILES_FAILED);
|
|
976
|
+
const blockedProfiles = (await response.json());
|
|
977
|
+
if (!is(blockedProfiles, BlockedProfilesResponseStruct)) {
|
|
978
|
+
throw new Error(SocialServiceErrorMessage.FETCH_BLOCKED_PROFILES_INVALID_RESPONSE);
|
|
979
|
+
}
|
|
980
|
+
return blockedProfiles;
|
|
981
|
+
},
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Fetches comments and replies the current user has blocked.
|
|
986
|
+
*
|
|
987
|
+
* Calls `GET ${baseUrl}/moderation/blocks/content`. Results are most
|
|
988
|
+
* recently blocked first, 250 per page. The caller is identified
|
|
989
|
+
* server-side from the JWT sub claim carried in the Authorization header.
|
|
990
|
+
*
|
|
991
|
+
* @param options - Options bag.
|
|
992
|
+
* @param options.cursor - Cursor from the previous page. Omit for the first page.
|
|
993
|
+
* @returns The blocked content page.
|
|
994
|
+
*/
|
|
995
|
+
async fetchBlockedContent(options) {
|
|
996
|
+
const cursor = options?.cursor;
|
|
997
|
+
return await this.fetchQuery({
|
|
998
|
+
queryKey: [`${this.name}:fetchBlockedContent`, cursor ?? null],
|
|
999
|
+
staleTime: 0,
|
|
1000
|
+
queryFn: async () => {
|
|
1001
|
+
const url = new URL(`${this.#v1Url}/moderation/blocks/content`);
|
|
1002
|
+
if (cursor) {
|
|
1003
|
+
url.searchParams.append('cursor', cursor);
|
|
1004
|
+
}
|
|
1005
|
+
const authHeaders = await this.#getAuthHeaders();
|
|
1006
|
+
const response = await fetch(url.toString(), {
|
|
1007
|
+
headers: authHeaders,
|
|
1008
|
+
});
|
|
1009
|
+
_a.#throwIfNotOk(response, SocialServiceErrorMessage.FETCH_BLOCKED_CONTENT_FAILED);
|
|
1010
|
+
const blockedContent = (await response.json());
|
|
1011
|
+
if (!is(blockedContent, BlockedContentResponseStruct)) {
|
|
1012
|
+
throw new Error(SocialServiceErrorMessage.FETCH_BLOCKED_CONTENT_INVALID_RESPONSE);
|
|
1013
|
+
}
|
|
1014
|
+
return blockedContent;
|
|
1015
|
+
},
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
867
1018
|
/**
|
|
868
1019
|
* Shared helper for fetching open/closed positions.
|
|
869
1020
|
*
|