@metamask-previews/social-controllers 2.8.0-preview-b13d916 → 2.8.0-preview-4f4c98e

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/dist/{SocialController-method-action-types.d.mts → SocialController-method-action-types.d.ts} +2 -2
  3. package/dist/SocialController-method-action-types.d.ts.map +1 -0
  4. package/dist/{SocialController-method-action-types.mjs → SocialController-method-action-types.js} +1 -1
  5. package/dist/SocialController-method-action-types.js.map +1 -0
  6. package/dist/{SocialController.d.mts → SocialController.d.ts} +8 -8
  7. package/dist/SocialController.d.ts.map +1 -0
  8. package/dist/{SocialController.mjs → SocialController.js} +3 -3
  9. package/dist/SocialController.js.map +1 -0
  10. package/dist/{SocialService-method-action-types.d.cts → SocialService-method-action-types.d.ts} +2 -2
  11. package/dist/SocialService-method-action-types.d.ts.map +1 -0
  12. package/dist/{SocialService-method-action-types.mjs → SocialService-method-action-types.js} +1 -1
  13. package/dist/SocialService-method-action-types.js.map +1 -0
  14. package/dist/{SocialService.d.cts → SocialService.d.ts} +9 -9
  15. package/dist/SocialService.d.ts.map +1 -0
  16. package/dist/{SocialService.mjs → SocialService.js} +6 -6
  17. package/dist/SocialService.js.map +1 -0
  18. package/dist/{index.d.cts → index.d.ts} +10 -10
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +5 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/social-constants.d.ts +28 -0
  23. package/dist/social-constants.d.ts.map +1 -0
  24. package/dist/{social-constants.mjs → social-constants.js} +1 -1
  25. package/dist/social-constants.js.map +1 -0
  26. package/dist/{social-types.d.mts → social-types.d.ts} +14 -14
  27. package/dist/social-types.d.ts.map +1 -0
  28. package/dist/{social-types.mjs → social-types.js} +2 -2
  29. package/dist/social-types.js.map +1 -0
  30. package/package.json +12 -16
  31. package/dist/SocialController-method-action-types.cjs +0 -7
  32. package/dist/SocialController-method-action-types.cjs.map +0 -1
  33. package/dist/SocialController-method-action-types.d.cts +0 -71
  34. package/dist/SocialController-method-action-types.d.cts.map +0 -1
  35. package/dist/SocialController-method-action-types.d.mts.map +0 -1
  36. package/dist/SocialController-method-action-types.mjs.map +0 -1
  37. package/dist/SocialController.cjs +0 -160
  38. package/dist/SocialController.cjs.map +0 -1
  39. package/dist/SocialController.d.cts +0 -80
  40. package/dist/SocialController.d.cts.map +0 -1
  41. package/dist/SocialController.d.mts.map +0 -1
  42. package/dist/SocialController.mjs.map +0 -1
  43. package/dist/SocialService-method-action-types.cjs +0 -7
  44. package/dist/SocialService-method-action-types.cjs.map +0 -1
  45. package/dist/SocialService-method-action-types.d.cts.map +0 -1
  46. package/dist/SocialService-method-action-types.d.mts +0 -194
  47. package/dist/SocialService-method-action-types.d.mts.map +0 -1
  48. package/dist/SocialService-method-action-types.mjs.map +0 -1
  49. package/dist/SocialService.cjs +0 -635
  50. package/dist/SocialService.cjs.map +0 -1
  51. package/dist/SocialService.d.cts.map +0 -1
  52. package/dist/SocialService.d.mts +0 -171
  53. package/dist/SocialService.d.mts.map +0 -1
  54. package/dist/SocialService.mjs.map +0 -1
  55. package/dist/index.cjs +0 -14
  56. package/dist/index.cjs.map +0 -1
  57. package/dist/index.d.cts.map +0 -1
  58. package/dist/index.d.mts +0 -10
  59. package/dist/index.d.mts.map +0 -1
  60. package/dist/index.mjs +0 -5
  61. package/dist/index.mjs.map +0 -1
  62. package/dist/social-constants.cjs +0 -31
  63. package/dist/social-constants.cjs.map +0 -1
  64. package/dist/social-constants.d.cts +0 -28
  65. package/dist/social-constants.d.cts.map +0 -1
  66. package/dist/social-constants.d.mts +0 -28
  67. package/dist/social-constants.d.mts.map +0 -1
  68. package/dist/social-constants.mjs.map +0 -1
  69. package/dist/social-types.cjs +0 -27
  70. package/dist/social-types.cjs.map +0 -1
  71. package/dist/social-types.d.cts +0 -343
  72. package/dist/social-types.d.cts.map +0 -1
  73. package/dist/social-types.d.mts.map +0 -1
  74. package/dist/social-types.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
19
19
 
20
20
  ### Changed
21
21
 
22
+ - **BREAKING:** Bump minimum Node.js version to 22 ([#9168](https://github.com/MetaMask/core/pull/9168))
22
23
  - Bump `@metamask/superstruct` from `^3.1.0` to `^3.4.1` ([#9754](https://github.com/MetaMask/core/pull/9754))
23
24
  - Bump `@metamask/base-data-service` from `^0.1.3` to `^1.0.0` ([#9972](https://github.com/MetaMask/core/pull/9972))
24
25
 
@@ -2,7 +2,7 @@
2
2
  * This file is auto generated.
3
3
  * Do not edit manually.
4
4
  */
5
- import type { SocialController } from "./SocialController.mjs";
5
+ import type { SocialController } from './SocialController.js';
6
6
  /**
7
7
  * Fetches the leaderboard and persists the entries to state.
8
8
  *
@@ -68,4 +68,4 @@ export type SocialControllerOptInToLeaderboardAction = {
68
68
  * Union of all SocialController action types.
69
69
  */
70
70
  export type SocialControllerMethodActions = SocialControllerUpdateLeaderboardAction | SocialControllerFollowTraderAction | SocialControllerUnfollowTraderAction | SocialControllerUpdateFollowingAction | SocialControllerOptOutOfLeaderboardAction | SocialControllerOptInToLeaderboardAction;
71
- //# sourceMappingURL=SocialController-method-action-types.d.mts.map
71
+ //# sourceMappingURL=SocialController-method-action-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SocialController-method-action-types.d.ts","sourceRoot":"","sources":["../src/SocialController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;CAC9C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD,IAAI,EAAE,sCAAsC,CAAC;IAC7C,OAAO,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;CAClD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GACrC,uCAAuC,GACvC,kCAAkC,GAClC,oCAAoC,GACpC,qCAAqC,GACrC,yCAAyC,GACzC,wCAAwC,CAAC"}
@@ -3,4 +3,4 @@
3
3
  * Do not edit manually.
4
4
  */
5
5
  export {};
6
- //# sourceMappingURL=SocialController-method-action-types.mjs.map
6
+ //# sourceMappingURL=SocialController-method-action-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SocialController-method-action-types.js","sourceRoot":"","sources":["../src/SocialController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SocialController } from './SocialController.js';\n\n/**\n * Fetches the leaderboard and persists the entries to state.\n *\n * @param options - Optional leaderboard query parameters.\n * @returns The leaderboard response from the social-api.\n */\nexport type SocialControllerUpdateLeaderboardAction = {\n type: `SocialController:updateLeaderboard`;\n handler: SocialController['updateLeaderboard'];\n};\n\n/**\n * Follows one or more traders on behalf of the current user and updates\n * the following list in state. The caller is identified server-side from\n * the JWT attached by the SocialService.\n *\n * @param options - Options bag.\n * @param options.targets - Addresses or profile IDs to follow.\n * @returns The follow response with confirmed follows.\n */\nexport type SocialControllerFollowTraderAction = {\n type: `SocialController:followTrader`;\n handler: SocialController['followTrader'];\n};\n\n/**\n * Unfollows one or more traders on behalf of the current user and updates\n * the following list in state. The caller is identified server-side from\n * the JWT attached by the SocialService.\n *\n * @param options - Options bag.\n * @param options.targets - Addresses or profile IDs to unfollow.\n * @returns The unfollow response with confirmed unfollows.\n */\nexport type SocialControllerUnfollowTraderAction = {\n type: `SocialController:unfollowTrader`;\n handler: SocialController['unfollowTrader'];\n};\n\n/**\n * Fetches the list of traders the current user follows and replaces\n * the following addresses in state. The caller is identified server-side\n * from the JWT attached by the SocialService.\n *\n * @returns The following response.\n */\nexport type SocialControllerUpdateFollowingAction = {\n type: `SocialController:updateFollowing`;\n handler: SocialController['updateFollowing'];\n};\n\n/**\n * Opts the current user out of the PnL leaderboard.\n */\nexport type SocialControllerOptOutOfLeaderboardAction = {\n type: `SocialController:optOutOfLeaderboard`;\n handler: SocialController['optOutOfLeaderboard'];\n};\n\n/**\n * Opts the current user back into the PnL leaderboard.\n */\nexport type SocialControllerOptInToLeaderboardAction = {\n type: `SocialController:optInToLeaderboard`;\n handler: SocialController['optInToLeaderboard'];\n};\n\n/**\n * Union of all SocialController action types.\n */\nexport type SocialControllerMethodActions =\n | SocialControllerUpdateLeaderboardAction\n | SocialControllerFollowTraderAction\n | SocialControllerUnfollowTraderAction\n | SocialControllerUpdateFollowingAction\n | SocialControllerOptOutOfLeaderboardAction\n | SocialControllerOptInToLeaderboardAction;\n"]}
@@ -1,10 +1,10 @@
1
- import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
2
- import { BaseController } from "@metamask/base-controller";
3
- import type { Messenger } from "@metamask/messenger";
4
- import { controllerName } from "./social-constants.mjs";
5
- import type { FetchLeaderboardOptions, FollowOptions, FollowResponse, FollowingResponse, LeaderboardResponse, SocialControllerState, UnfollowOptions, UnfollowResponse } from "./social-types.mjs";
6
- import type { SocialControllerMethodActions } from "./SocialController-method-action-types.mjs";
7
- import type { SocialServiceFetchFollowingAction, SocialServiceFetchLeaderboardAction, SocialServiceFollowAction, SocialServiceOptInToLeaderboardAction, SocialServiceOptOutOfLeaderboardAction, SocialServiceUnfollowAction } from "./SocialService-method-action-types.mjs";
1
+ import type { ControllerGetStateAction, ControllerStateChangeEvent } from '@metamask/base-controller';
2
+ import { BaseController } from '@metamask/base-controller';
3
+ import type { Messenger } from '@metamask/messenger';
4
+ import { controllerName } from './social-constants.js';
5
+ import type { FetchLeaderboardOptions, FollowOptions, FollowResponse, FollowingResponse, LeaderboardResponse, SocialControllerState, UnfollowOptions, UnfollowResponse } from './social-types.js';
6
+ import type { SocialControllerMethodActions } from './SocialController-method-action-types.js';
7
+ import type { SocialServiceFetchFollowingAction, SocialServiceFetchLeaderboardAction, SocialServiceFollowAction, SocialServiceOptInToLeaderboardAction, SocialServiceOptOutOfLeaderboardAction, SocialServiceUnfollowAction } from './SocialService-method-action-types.js';
8
8
  export type SocialControllerGetStateAction = ControllerGetStateAction<typeof controllerName, SocialControllerState>;
9
9
  export type SocialControllerActions = SocialControllerGetStateAction | SocialControllerMethodActions;
10
10
  export type SocialControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, SocialControllerState>;
@@ -77,4 +77,4 @@ export declare class SocialController extends BaseController<typeof controllerNa
77
77
  optInToLeaderboard(): Promise<void>;
78
78
  }
79
79
  export {};
80
- //# sourceMappingURL=SocialController.d.mts.map
80
+ //# sourceMappingURL=SocialController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SocialController.d.ts","sourceRoot":"","sources":["../src/SocialController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,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IF;;;;GAIG;AACH,wBAAgB,+BAA+B,IAAI,qBAAqB,CAMvE;AA2BD;;;;;;;GAOG;AACH,qBAAa,gBAAiB,SAAQ,cAAc,CAClD,OAAO,cAAc,EACrB,qBAAqB,EACrB,yBAAyB,CAC1B;IACC,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,uBAAuB,EAexD;IAED;;;;;OAKG;IACG,iBAAiB,CACrB,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,mBAAmB,CAAC,CAW9B;IAED;;;;;;;;OAQG;IACG,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CA0BlE;IAED;;;;;;;;OAQG;IACG,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAuBxE;IAED;;;;;;OAMG;IACG,eAAe,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAelD;IAED;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAEzC;IAED;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAExC;CACF"}
@@ -1,5 +1,5 @@
1
- import { BaseController } from "@metamask/base-controller";
2
- import { controllerName } from "./social-constants.mjs";
1
+ import { BaseController } from '@metamask/base-controller';
2
+ import { controllerName } from './social-constants.js';
3
3
  // === MESSENGER ===
4
4
  const MESSENGER_EXPOSED_METHODS = [
5
5
  'updateLeaderboard',
@@ -152,4 +152,4 @@ export class SocialController extends BaseController {
152
152
  await this.messenger.call('SocialService:optInToLeaderboard');
153
153
  }
154
154
  }
155
- //# sourceMappingURL=SocialController.mjs.map
155
+ //# sourceMappingURL=SocialController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SocialController.js","sourceRoot":"","sources":["../src/SocialController.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,EAAE,cAAc,EAAE,MAAM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B,KAAK,CAAC,kBAAkB,GAAG,iBAAiB,CAAC,SAAS,CAAC,GAAG,CACxD,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAC7B,CAAC;YACF,KAAK,CAAC,mBAAmB,GAAG,iBAAiB,CAAC,SAAS,CAAC,GAAG,CACzD,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAC/B,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB;QACvB,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB;QACtB,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;IAChE,CAAC;CACF","sourcesContent":["import type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type { Messenger } from '@metamask/messenger';\n\nimport { controllerName } from './social-constants.js';\nimport type {\n FetchLeaderboardOptions,\n FollowOptions,\n FollowResponse,\n FollowingResponse,\n LeaderboardResponse,\n SocialControllerState,\n UnfollowOptions,\n UnfollowResponse,\n} from './social-types.js';\nimport type { SocialControllerMethodActions } from './SocialController-method-action-types.js';\nimport type {\n SocialServiceFetchFollowingAction,\n SocialServiceFetchLeaderboardAction,\n SocialServiceFollowAction,\n SocialServiceOptInToLeaderboardAction,\n SocialServiceOptOutOfLeaderboardAction,\n SocialServiceUnfollowAction,\n} from './SocialService-method-action-types.js';\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'updateLeaderboard',\n 'followTrader',\n 'unfollowTrader',\n 'updateFollowing',\n 'optOutOfLeaderboard',\n 'optInToLeaderboard',\n] as const;\n\n// === ACTION TYPES ===\n\nexport type SocialControllerGetStateAction = ControllerGetStateAction<\n typeof controllerName,\n SocialControllerState\n>;\n\nexport type SocialControllerActions =\n | SocialControllerGetStateAction\n | SocialControllerMethodActions;\n\n// === EVENT TYPES ===\n\nexport type SocialControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof controllerName,\n SocialControllerState\n>;\n\nexport type SocialControllerEvents = SocialControllerStateChangeEvent;\n\n// === ALLOWED ACTIONS/EVENTS ===\n\ntype AllowedActions =\n | SocialServiceFetchLeaderboardAction\n | SocialServiceFollowAction\n | SocialServiceUnfollowAction\n | SocialServiceFetchFollowingAction\n | SocialServiceOptOutOfLeaderboardAction\n | SocialServiceOptInToLeaderboardAction;\n\ntype AllowedEvents = never;\n\n// === MESSENGER TYPE ===\n\nexport type SocialControllerMessenger = Messenger<\n typeof controllerName,\n SocialControllerActions | AllowedActions,\n SocialControllerEvents | AllowedEvents\n>;\n\n// === OPTIONS ===\n\nexport type SocialControllerOptions = {\n messenger: SocialControllerMessenger;\n state?: Partial<SocialControllerState>;\n};\n\n// === DEFAULT STATE ===\n\n/**\n * Returns the default state for the SocialController.\n *\n * @returns A fresh default state object.\n */\nexport function getDefaultSocialControllerState(): SocialControllerState {\n return {\n leaderboardEntries: [],\n followingAddresses: [],\n followingProfileIds: [],\n };\n}\n\n// === STATE METADATA ===\n\nconst socialControllerMetadata: StateMetadata<SocialControllerState> = {\n leaderboardEntries: {\n persist: true,\n includeInDebugSnapshot: false,\n includeInStateLogs: false,\n usedInUi: true,\n },\n followingAddresses: {\n persist: true,\n includeInDebugSnapshot: false,\n includeInStateLogs: false,\n usedInUi: true,\n },\n followingProfileIds: {\n persist: true,\n includeInDebugSnapshot: false,\n includeInStateLogs: false,\n usedInUi: true,\n },\n};\n\n// === CONTROLLER ===\n\n/**\n * Controller that manages social trading state for the extension UI.\n *\n * Acts as a simple store with no TTL or eviction — the UI decides when\n * to re-fetch, and the social-api's own cache layer handles upstream\n * rate-limiting. State is persisted across sessions so the UI can render\n * immediately on startup while a fresh fetch is in flight.\n */\nexport class SocialController extends BaseController<\n typeof controllerName,\n SocialControllerState,\n SocialControllerMessenger\n> {\n constructor({ messenger, state }: SocialControllerOptions) {\n super({\n name: controllerName,\n metadata: socialControllerMetadata,\n state: {\n ...getDefaultSocialControllerState(),\n ...state,\n },\n messenger,\n });\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Fetches the leaderboard and persists the entries to state.\n *\n * @param options - Optional leaderboard query parameters.\n * @returns The leaderboard response from the social-api.\n */\n async updateLeaderboard(\n options?: FetchLeaderboardOptions,\n ): Promise<LeaderboardResponse> {\n const leaderboardResponse = await this.messenger.call(\n 'SocialService:fetchLeaderboard',\n options,\n );\n\n this.update((state) => {\n state.leaderboardEntries = leaderboardResponse.traders;\n });\n\n return leaderboardResponse;\n }\n\n /**\n * Follows one or more traders on behalf of the current user and updates\n * the following list in state. The caller is identified server-side from\n * the JWT attached by the SocialService.\n *\n * @param options - Options bag.\n * @param options.targets - Addresses or profile IDs to follow.\n * @returns The follow response with confirmed follows.\n */\n async followTrader(options: FollowOptions): Promise<FollowResponse> {\n const followResponse = await this.messenger.call(\n 'SocialService:follow',\n options,\n );\n\n const newAddresses = [\n ...new Set(followResponse.followed.map((profile) => profile.address)),\n ];\n const newProfileIds = [\n ...new Set(followResponse.followed.map((profile) => profile.profileId)),\n ];\n\n this.update((state) => {\n const existing = new Set(state.followingAddresses);\n const uniqueNewAddresses = newAddresses.filter(\n (address) => !existing.has(address),\n );\n state.followingAddresses.push(...uniqueNewAddresses);\n\n const existingIds = new Set(state.followingProfileIds);\n const uniqueNewIds = newProfileIds.filter((id) => !existingIds.has(id));\n state.followingProfileIds.push(...uniqueNewIds);\n });\n\n return followResponse;\n }\n\n /**\n * Unfollows one or more traders on behalf of the current user and updates\n * the following list in state. The caller is identified server-side from\n * the JWT attached by the SocialService.\n *\n * @param options - Options bag.\n * @param options.targets - Addresses or profile IDs to unfollow.\n * @returns The unfollow response with confirmed unfollows.\n */\n async unfollowTrader(options: UnfollowOptions): Promise<UnfollowResponse> {\n const unfollowResponse = await this.messenger.call(\n 'SocialService:unfollow',\n options,\n );\n\n const removedAddresses = new Set(\n unfollowResponse.unfollowed.map((profile) => profile.address),\n );\n const removedProfileIds = new Set(\n unfollowResponse.unfollowed.map((profile) => profile.profileId),\n );\n\n this.update((state) => {\n state.followingAddresses = state.followingAddresses.filter(\n (address) => !removedAddresses.has(address),\n );\n state.followingProfileIds = state.followingProfileIds.filter(\n (id) => !removedProfileIds.has(id),\n );\n });\n\n return unfollowResponse;\n }\n\n /**\n * Fetches the list of traders the current user follows and replaces\n * the following addresses in state. The caller is identified server-side\n * from the JWT attached by the SocialService.\n *\n * @returns The following response.\n */\n async updateFollowing(): Promise<FollowingResponse> {\n const followingResponse = await this.messenger.call(\n 'SocialService:fetchFollowing',\n );\n\n this.update((state) => {\n state.followingAddresses = followingResponse.following.map(\n (profile) => profile.address,\n );\n state.followingProfileIds = followingResponse.following.map(\n (profile) => profile.profileId,\n );\n });\n\n return followingResponse;\n }\n\n /**\n * Opts the current user out of the PnL leaderboard.\n */\n async optOutOfLeaderboard(): Promise<void> {\n await this.messenger.call('SocialService:optOutOfLeaderboard');\n }\n\n /**\n * Opts the current user back into the PnL leaderboard.\n */\n async optInToLeaderboard(): Promise<void> {\n await this.messenger.call('SocialService:optInToLeaderboard');\n }\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * This file is auto generated.
3
3
  * Do not edit manually.
4
4
  */
5
- import type { SocialService } from "./SocialService.cjs";
5
+ import type { SocialService } from './SocialService.js';
6
6
  /**
7
7
  * Fetches the leaderboard of top traders.
8
8
  *
@@ -191,4 +191,4 @@ export type SocialServiceRefreshNotificationPreferencesCacheAction = {
191
191
  * Union of all SocialService action types.
192
192
  */
193
193
  export type SocialServiceMethodActions = SocialServiceFetchLeaderboardAction | SocialServiceFetchTraderProfileAction | SocialServiceFetchOpenPositionsAction | SocialServiceFetchClosedPositionsAction | SocialServiceFetchFollowersAction | SocialServiceFetchPositionByIdAction | SocialServiceFetchFeedAction | SocialServiceFetchFollowingAction | SocialServiceFollowAction | SocialServiceUnfollowAction | SocialServiceOptOutOfLeaderboardAction | SocialServiceOptInToLeaderboardAction | SocialServiceRefreshNotificationPreferencesCacheAction;
194
- //# sourceMappingURL=SocialService-method-action-types.d.cts.map
194
+ //# sourceMappingURL=SocialService-method-action-types.d.ts.map
@@ -0,0 +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,CAAC;IAC3C,OAAO,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;CAC1C,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,oCAAoC,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uCAAuC,GACvC,iCAAiC,GACjC,oCAAoC,GACpC,4BAA4B,GAC5B,iCAAiC,GACjC,yBAAyB,GACzB,2BAA2B,GAC3B,sCAAsC,GACtC,qCAAqC,GACrC,sDAAsD,CAAC"}
@@ -3,4 +3,4 @@
3
3
  * Do not edit manually.
4
4
  */
5
5
  export {};
6
- //# sourceMappingURL=SocialService-method-action-types.mjs.map
6
+ //# sourceMappingURL=SocialService-method-action-types.js.map
@@ -0,0 +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 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 | SocialServiceFetchFollowingAction\n | SocialServiceFollowAction\n | SocialServiceUnfollowAction\n | SocialServiceOptOutOfLeaderboardAction\n | SocialServiceOptInToLeaderboardAction\n | SocialServiceRefreshNotificationPreferencesCacheAction;\n"]}
@@ -1,11 +1,11 @@
1
- import type { DataServiceCacheUpdatedEvent, DataServiceGranularCacheUpdatedEvent, DataServiceInvalidateQueriesAction } from "@metamask/base-data-service";
2
- import { BaseDataService } from "@metamask/base-data-service";
3
- import type { CreateServicePolicyOptions } from "@metamask/controller-utils";
4
- import type { Messenger } from "@metamask/messenger";
5
- import type { AuthenticationController } from "@metamask/profile-sync-controller";
6
- import { serviceName } from "./social-constants.cjs";
7
- import type { FeedResponse, FetchFeedOptions, FetchFollowersOptions, FetchLeaderboardOptions, FetchPositionByIdOptions, FetchPositionsOptions, FetchTraderProfileOptions, FollowersResponse, FollowingResponse, FollowOptions, FollowResponse, LeaderboardResponse, Position, PositionsResponse, TraderProfileResponse, UnfollowOptions, UnfollowResponse } from "./social-types.cjs";
8
- import type { SocialServiceMethodActions } from "./SocialService-method-action-types.cjs";
1
+ import type { DataServiceCacheUpdatedEvent, DataServiceGranularCacheUpdatedEvent, DataServiceInvalidateQueriesAction } from '@metamask/base-data-service';
2
+ import { BaseDataService } from '@metamask/base-data-service';
3
+ import type { CreateServicePolicyOptions } from '@metamask/controller-utils';
4
+ import type { Messenger } from '@metamask/messenger';
5
+ import type { AuthenticationController } from '@metamask/profile-sync-controller';
6
+ import { serviceName } from './social-constants.js';
7
+ import type { FeedResponse, FetchFeedOptions, FetchFollowersOptions, FetchLeaderboardOptions, FetchPositionByIdOptions, FetchPositionsOptions, FetchTraderProfileOptions, FollowersResponse, FollowingResponse, FollowOptions, FollowResponse, LeaderboardResponse, Position, PositionsResponse, TraderProfileResponse, UnfollowOptions, UnfollowResponse } from './social-types.js';
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>;
11
11
  type AllowedActions = AuthenticationController.AuthenticationControllerGetBearerTokenAction;
@@ -168,4 +168,4 @@ export declare class SocialService extends BaseDataService<typeof serviceName, S
168
168
  refreshNotificationPreferencesCache(): Promise<void>;
169
169
  }
170
170
  export {};
171
- //# sourceMappingURL=SocialService.d.cts.map
171
+ //# sourceMappingURL=SocialService.d.ts.map
@@ -0,0 +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,E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,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,iBAAiB,CAAC,CAE5B;IAED;;;;;;;;;;;;OAYG;IACG,oBAAoB,CACxB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,iBAAiB,CAAC,CAE5B;IAED;;;;;;;;OAQG;IACG,cAAc,CAClB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,iBAAiB,CAAC,CAwB5B;IAED;;;;;;;;OAQG;IACG,iBAAiB,CACrB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,QAAQ,CAAC,CAwBnB;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACG,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CA4CjE;IAED;;;;;;;OAOG;IACG,cAAc,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAuBjD;IAED;;;;;;;;;OASG;IACG,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CA2B5D;IAED;;;;;;;;;;;OAWG;IACG,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA6BlE;IAED;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAkBzC;IAED;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAkBxC;IAED;;;;;;;;;;;;;;;OAeG;IACG,mCAAmC,IAAI,OAAO,CAAC,IAAI,CAAC,CAkBzD;CAqEF"}
@@ -10,11 +10,11 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
10
10
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
11
  };
12
12
  var _SocialService_instances, _a, _SocialService_baseUrl, _SocialService_v1Url_get, _SocialService_v2Url_get, _SocialService_throwIfNotOk, _SocialService_getAuthHeaders, _SocialService_fetchPositions;
13
- import { BaseDataService } from "@metamask/base-data-service";
14
- import { HttpError } from "@metamask/controller-utils";
15
- import { array, assign, boolean, enums, is, nullable, number, optional, record, string, type as structType } from "@metamask/superstruct";
16
- import { serviceName, SocialServiceErrorMessage } from "./social-constants.mjs";
17
- import { TradeStruct } from "./social-types.mjs";
13
+ import { BaseDataService } from '@metamask/base-data-service';
14
+ import { HttpError } from '@metamask/controller-utils';
15
+ import { array, assign, boolean, enums, is, nullable, number, optional, record, string, type as structType, } from '@metamask/superstruct';
16
+ import { serviceName, SocialServiceErrorMessage } from './social-constants.js';
17
+ import { TradeStruct } from './social-types.js';
18
18
  // ---------------------------------------------------------------------------
19
19
  // Superstruct validation schemas
20
20
  // ---------------------------------------------------------------------------
@@ -628,4 +628,4 @@ async function _SocialService_fetchPositions(status, options) {
628
628
  });
629
629
  return positionsResponse;
630
630
  };
631
- //# sourceMappingURL=SocialService.mjs.map
631
+ //# sourceMappingURL=SocialService.js.map
@@ -0,0 +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;AAoB/E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,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,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,CAAC,QAAQ,EAAE,EAAE;gBAC3C,OAAO,EAAE,WAAW;aACrB,CAAC,CAAC;YACH,uBAAA,EAAa,uCAAc,MAA3B,EAAa,EAAe,QAAQ,EAAE,aAAa,CAAC,CAAC;YACrD,MAAM,aAAa,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC5C,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,uBAAuB,CAAC,EAAE,CAAC;gBAChD,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;YAClC,CAAC;YACD,OAAO,aAAkC,CAAC;QAC5C,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,iBAAiB,CAAC;AAC3B,CAAC","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 FeedResponse,\n FetchFeedOptions,\n FetchFollowersOptions,\n FetchLeaderboardOptions,\n FetchPositionByIdOptions,\n FetchPositionsOptions,\n FetchTraderProfileOptions,\n FollowersResponse,\n FollowingResponse,\n FollowOptions,\n FollowResponse,\n LeaderboardResponse,\n Position,\n PositionsResponse,\n TraderProfileResponse,\n UnfollowOptions,\n UnfollowResponse,\n} from './social-types.js';\nimport { 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 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 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 TraderProfileResponseStruct = structType({\n profile: TraderProfileStruct,\n stats: TraderStatsStruct,\n perChainBreakdown: PerChainBreakdownStruct,\n socialHandles: SocialHandlesStruct,\n followerCount: number(),\n followingCount: number(),\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 FeedItemStruct = assign(\n PositionStruct,\n structType({\n actor: ProfileSummaryStruct,\n timestamp: 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 '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 as LeaderboardResponse;\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 as TraderProfileResponse;\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 as FollowersResponse;\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 as Position;\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 as FeedResponse;\n },\n });\n\n return feedResponse;\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 as FollowingResponse;\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 as FollowResponse;\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 as UnfollowResponse;\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 as PositionsResponse;\n },\n });\n\n return positionsResponse;\n }\n}\n"]}
@@ -1,10 +1,10 @@
1
- export type { SocialControllerActions, SocialControllerEvents, SocialControllerGetStateAction, SocialControllerMessenger, SocialControllerOptions, SocialControllerStateChangeEvent, } from "./SocialController.cjs";
2
- export { SocialController, getDefaultSocialControllerState, } from "./SocialController.cjs";
3
- export type { SocialControllerFollowTraderAction, SocialControllerOptInToLeaderboardAction, SocialControllerOptOutOfLeaderboardAction, SocialControllerUnfollowTraderAction, SocialControllerUpdateFollowingAction, SocialControllerUpdateLeaderboardAction, } from "./SocialController-method-action-types.cjs";
4
- export type { SocialServiceActions, SocialServiceEvents, SocialServiceMessenger, } from "./SocialService.cjs";
5
- export { SocialService } from "./SocialService.cjs";
6
- export type { SocialServiceFetchClosedPositionsAction, SocialServiceFetchFeedAction, SocialServiceFetchFollowersAction, SocialServiceFetchFollowingAction, SocialServiceFetchLeaderboardAction, SocialServiceFetchOpenPositionsAction, SocialServiceFetchPositionByIdAction, SocialServiceFetchTraderProfileAction, SocialServiceFollowAction, SocialServiceOptInToLeaderboardAction, SocialServiceOptOutOfLeaderboardAction, SocialServiceRefreshNotificationPreferencesCacheAction, SocialServiceUnfollowAction, } from "./SocialService-method-action-types.cjs";
7
- export { TradeStruct } from "./social-types.cjs";
8
- export type { FeedItem, FeedPagination, FeedResponse, FetchFeedOptions, FetchFollowersOptions, FetchLeaderboardOptions, FetchPositionByIdOptions, FetchPositionsOptions, FetchTraderProfileOptions, FollowersResponse, FollowingResponse, FollowOptions, FollowResponse, LeaderboardEntry, LeaderboardResponse, Pagination, PerChainBreakdown, Position, PositionsResponse, ProfileSummary, SocialControllerState, SocialHandles, Trade, TradeAction, TraderProfile, TraderProfileResponse, TraderStats, UnfollowOptions, UnfollowResponse, } from "./social-types.cjs";
9
- export { serviceName as socialServiceName, SocialServiceErrorMessage, } from "./social-constants.cjs";
10
- //# sourceMappingURL=index.d.cts.map
1
+ export type { SocialControllerActions, SocialControllerEvents, SocialControllerGetStateAction, SocialControllerMessenger, SocialControllerOptions, SocialControllerStateChangeEvent, } from './SocialController.js';
2
+ export { SocialController, getDefaultSocialControllerState, } from './SocialController.js';
3
+ export type { SocialControllerFollowTraderAction, SocialControllerOptInToLeaderboardAction, SocialControllerOptOutOfLeaderboardAction, SocialControllerUnfollowTraderAction, SocialControllerUpdateFollowingAction, SocialControllerUpdateLeaderboardAction, } from './SocialController-method-action-types.js';
4
+ export type { SocialServiceActions, SocialServiceEvents, SocialServiceMessenger, } from './SocialService.js';
5
+ export { SocialService } from './SocialService.js';
6
+ export type { SocialServiceFetchClosedPositionsAction, SocialServiceFetchFeedAction, SocialServiceFetchFollowersAction, SocialServiceFetchFollowingAction, SocialServiceFetchLeaderboardAction, SocialServiceFetchOpenPositionsAction, SocialServiceFetchPositionByIdAction, SocialServiceFetchTraderProfileAction, SocialServiceFollowAction, SocialServiceOptInToLeaderboardAction, SocialServiceOptOutOfLeaderboardAction, SocialServiceRefreshNotificationPreferencesCacheAction, SocialServiceUnfollowAction, } from './SocialService-method-action-types.js';
7
+ export { TradeStruct } from './social-types.js';
8
+ export type { FeedItem, FeedPagination, FeedResponse, FetchFeedOptions, FetchFollowersOptions, FetchLeaderboardOptions, FetchPositionByIdOptions, FetchPositionsOptions, FetchTraderProfileOptions, FollowersResponse, FollowingResponse, FollowOptions, FollowResponse, LeaderboardEntry, LeaderboardResponse, Pagination, PerChainBreakdown, Position, PositionsResponse, ProfileSummary, SocialControllerState, SocialHandles, Trade, TradeAction, TraderProfile, TraderProfileResponse, TraderStats, UnfollowOptions, UnfollowResponse, } from './social-types.js';
9
+ export { serviceName as socialServiceName, SocialServiceErrorMessage, } from './social-constants.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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,mCAAmC,EACnC,qCAAqC,EACrC,oCAAoC,EACpC,qCAAqC,EACrC,yBAAyB,EACzB,qCAAqC,EACrC,sCAAsC,EACtC,sDAAsD,EACtD,2BAA2B,GAC5B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,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,aAAa,EACb,KAAK,EACL,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,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 ADDED
@@ -0,0 +1,5 @@
1
+ export { SocialController, getDefaultSocialControllerState, } from './SocialController.js';
2
+ export { SocialService } from './SocialService.js';
3
+ export { TradeStruct } from './social-types.js';
4
+ export { serviceName as socialServiceName, SocialServiceErrorMessage, } from './social-constants.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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;AAkBnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAiChD,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 SocialServiceFetchFollowingAction,\n SocialServiceFetchLeaderboardAction,\n SocialServiceFetchOpenPositionsAction,\n SocialServiceFetchPositionByIdAction,\n SocialServiceFetchTraderProfileAction,\n SocialServiceFollowAction,\n SocialServiceOptInToLeaderboardAction,\n SocialServiceOptOutOfLeaderboardAction,\n SocialServiceRefreshNotificationPreferencesCacheAction,\n SocialServiceUnfollowAction,\n} from './SocialService-method-action-types.js';\n\nexport { TradeStruct } from './social-types.js';\nexport type {\n FeedItem,\n FeedPagination,\n FeedResponse,\n FetchFeedOptions,\n FetchFollowersOptions,\n FetchLeaderboardOptions,\n FetchPositionByIdOptions,\n FetchPositionsOptions,\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 SocialControllerState,\n SocialHandles,\n Trade,\n TradeAction,\n TraderProfile,\n TraderProfileResponse,\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"]}
@@ -0,0 +1,28 @@
1
+ export declare const serviceName = "SocialService";
2
+ export declare const controllerName = "SocialController";
3
+ export declare const SocialServiceErrorMessage: {
4
+ readonly FETCH_LEADERBOARD_FAILED: 'SocialService: Leaderboard request failed';
5
+ readonly FETCH_LEADERBOARD_INVALID_RESPONSE: 'SocialService: Leaderboard returned invalid response';
6
+ readonly FETCH_TRADER_PROFILE_FAILED: 'SocialService: Trader profile request failed';
7
+ readonly FETCH_TRADER_PROFILE_INVALID_RESPONSE: 'SocialService: Trader profile returned invalid response';
8
+ readonly FETCH_OPEN_POSITIONS_FAILED: 'SocialService: Open positions request failed';
9
+ readonly FETCH_OPEN_POSITIONS_INVALID_RESPONSE: 'SocialService: Open positions returned invalid response';
10
+ readonly FETCH_CLOSED_POSITIONS_FAILED: 'SocialService: Closed positions request failed';
11
+ readonly FETCH_CLOSED_POSITIONS_INVALID_RESPONSE: 'SocialService: Closed positions returned invalid response';
12
+ readonly FETCH_FOLLOWERS_FAILED: 'SocialService: Followers request failed';
13
+ readonly FETCH_FOLLOWERS_INVALID_RESPONSE: 'SocialService: Followers returned invalid response';
14
+ readonly FETCH_FOLLOWING_FAILED: 'SocialService: Following request failed';
15
+ readonly FETCH_FOLLOWING_INVALID_RESPONSE: 'SocialService: Following returned invalid response';
16
+ readonly FOLLOW_FAILED: 'SocialService: Follow request failed';
17
+ readonly FOLLOW_INVALID_RESPONSE: 'SocialService: Follow returned invalid response';
18
+ readonly UNFOLLOW_FAILED: 'SocialService: Unfollow request failed';
19
+ readonly UNFOLLOW_INVALID_RESPONSE: 'SocialService: Unfollow returned invalid response';
20
+ readonly FETCH_POSITION_BY_ID_FAILED: 'SocialService: Position request failed';
21
+ readonly FETCH_POSITION_BY_ID_INVALID_RESPONSE: 'SocialService: Position returned invalid response';
22
+ readonly LEADERBOARD_OPT_OUT_FAILED: 'SocialService: Leaderboard opt-out request failed';
23
+ readonly LEADERBOARD_OPT_IN_FAILED: 'SocialService: Leaderboard opt-in request failed';
24
+ readonly FETCH_FEED_FAILED: 'SocialService: Feed request failed';
25
+ readonly FETCH_FEED_INVALID_RESPONSE: 'SocialService: Feed returned invalid response';
26
+ readonly NOTIFICATION_PREFERENCES_CACHE_REFRESH_FAILED: 'SocialService: Notification preferences cache refresh request failed';
27
+ };
28
+ //# sourceMappingURL=social-constants.d.ts.map
@@ -0,0 +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,6CAA6C,EAC3C,sEAAsE;CAChE,CAAC"}
@@ -25,4 +25,4 @@ export const SocialServiceErrorMessage = {
25
25
  FETCH_FEED_INVALID_RESPONSE: 'SocialService: Feed returned invalid response',
26
26
  NOTIFICATION_PREFERENCES_CACHE_REFRESH_FAILED: 'SocialService: Notification preferences cache refresh request failed',
27
27
  };
28
- //# sourceMappingURL=social-constants.mjs.map
28
+ //# sourceMappingURL=social-constants.js.map
@@ -0,0 +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,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 NOTIFICATION_PREFERENCES_CACHE_REFRESH_FAILED:\n 'SocialService: Notification preferences cache refresh request failed',\n} as const;\n"]}
@@ -1,4 +1,4 @@
1
- import type { Infer } from "@metamask/superstruct";
1
+ import type { Infer } from '@metamask/superstruct';
2
2
  /**
3
3
  * Minimal profile summary used across follow/follower responses.
4
4
  */
@@ -35,16 +35,16 @@ export type TradeAction = 'opened' | 'added' | 'reduced' | 'closed';
35
35
  export declare const TradeStruct: import("@metamask/superstruct").Struct<{
36
36
  direction: "buy" | "sell";
37
37
  intent: "enter" | "exit";
38
- tokenAmount: number;
39
- usdCost: number;
40
- timestamp: number;
41
- transactionHash: string;
42
- action?: "opened" | "added" | "reduced" | "closed" | undefined;
38
+ action?: "added" | "closed" | "opened" | "reduced" | undefined;
43
39
  category?: string | undefined;
44
- classification?: "spot" | "perp" | "send" | "receive" | null | undefined;
40
+ classification?: "perp" | "receive" | "send" | "spot" | null | undefined;
45
41
  perpPositionType?: "long" | "short" | null | undefined;
46
42
  perpLeverage?: number | null | undefined;
43
+ tokenAmount: number;
44
+ usdCost: number;
47
45
  marketCap?: number | null | undefined;
46
+ timestamp: number;
47
+ transactionHash: string;
48
48
  }, {
49
49
  direction: import("@metamask/superstruct").Struct<"buy" | "sell", {
50
50
  buy: "buy";
@@ -58,19 +58,19 @@ export declare const TradeStruct: import("@metamask/superstruct").Struct<{
58
58
  * Lifecycle stage of this fill. Absent on responses from a social-api that
59
59
  * predates the field, so treat it as a hint and keep a client-side fallback.
60
60
  */
61
- action: import("@metamask/superstruct").Struct<"opened" | "added" | "reduced" | "closed" | undefined, {
62
- opened: "opened";
61
+ action: import("@metamask/superstruct").Struct<"added" | "closed" | "opened" | "reduced" | undefined, {
63
62
  added: "added";
64
- reduced: "reduced";
65
63
  closed: "closed";
64
+ opened: "opened";
65
+ reduced: "reduced";
66
66
  }>;
67
67
  category: import("@metamask/superstruct").Struct<string | undefined, null>;
68
68
  /** High-level trade classification. `null` when Clicker does not classify. */
69
- classification: import("@metamask/superstruct").Struct<"spot" | "perp" | "send" | "receive" | null | undefined, {
70
- spot: "spot";
69
+ classification: import("@metamask/superstruct").Struct<"perp" | "receive" | "send" | "spot" | null | undefined, {
71
70
  perp: "perp";
72
- send: "send";
73
71
  receive: "receive";
72
+ send: "send";
73
+ spot: "spot";
74
74
  }>;
75
75
  /** Perp side for this fill. `null` for spot trades. */
76
76
  perpPositionType: import("@metamask/superstruct").Struct<"long" | "short" | null | undefined, {
@@ -340,4 +340,4 @@ export type SocialControllerState = {
340
340
  /** Clicker profile IDs the current user follows — used by mobile UI. */
341
341
  followingProfileIds: string[];
342
342
  };
343
- //# sourceMappingURL=social-types.d.mts.map
343
+ //# sourceMappingURL=social-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social-types.d.ts","sourceRoot":"","sources":["../src/social-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAcnD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,I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D;IACjD,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,wEAAwE;IACxE,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { enums, nullable, number, optional, string, type as structType } from "@metamask/superstruct";
1
+ import { enums, nullable, number, optional, string, type as structType, } from '@metamask/superstruct';
2
2
  export const TradeStruct = structType({
3
3
  direction: enums(['buy', 'sell']),
4
4
  intent: enums(['enter', 'exit']),
@@ -21,4 +21,4 @@ export const TradeStruct = structType({
21
21
  timestamp: number(),
22
22
  transactionHash: string(),
23
23
  });
24
- //# sourceMappingURL=social-types.mjs.map
24
+ //# sourceMappingURL=social-types.js.map
@@ -0,0 +1 @@
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;AA0C/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","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 * 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\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 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 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\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 * A single trader-activity feed item: a {@link Position} the trade belongs to,\n * plus the {@link ProfileSummary} 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: ProfileSummary;\n /** Unix timestamp (seconds) when the feed item was created. */\n timestamp: number;\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 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"]}