@metamask-previews/social-controllers 2.8.1-preview-6eff555ee → 3.0.0-preview-0a30e47

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 +17 -1
  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} +128 -131
  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 +17 -21
  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
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.0.0]
11
+
12
+ ### Changed
13
+
14
+ - **BREAKING:** Drop CommonJS support ([#9536](https://github.com/MetaMask/core/pull/9536))
15
+ - This package is now ESM-only, but can still be used in CommonJS projects via `require(esm)` in modern Node.js versions (22+), or dynamic imports in older Node.js versions.
16
+ - **BREAKING:** Bump minimum Node.js version to 22 ([#9976](https://github.com/MetaMask/core/pull/9976))
17
+ - **BREAKING:** Bump TypeScript target to ES2022 ([#10019](https://github.com/MetaMask/core/pull/10019))
18
+ - This package now ships ES2022 code, requiring a compatible modern environment or bundler configuration to consume.
19
+ - Bump `@metamask/base-controller` from `^9.1.0` to `^10.0.0` ([#10160](https://github.com/MetaMask/core/pull/10160))
20
+ - Bump `@metamask/base-data-service` from `^1.0.0` to `^2.0.0` ([#10160](https://github.com/MetaMask/core/pull/10160))
21
+ - Bump `@metamask/controller-utils` from `^12.3.0` to `^13.0.0` ([#10160](https://github.com/MetaMask/core/pull/10160))
22
+ - Bump `@metamask/messenger` from `^2.0.0` to `^3.0.0` ([#10160](https://github.com/MetaMask/core/pull/10160))
23
+ - Bump `@metamask/profile-sync-controller` from `^30.0.0` to `^31.0.0` ([#10160](https://github.com/MetaMask/core/pull/10160))
24
+
10
25
  ## [2.8.1]
11
26
 
12
27
  ### Changed
@@ -157,7 +172,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
157
172
  - `unfollowTrader` — unfollows traders and removes addresses from state
158
173
  - `updateFollowing` — fetches following list and replaces addresses in state
159
174
 
160
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@2.8.1...HEAD
175
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@3.0.0...HEAD
176
+ [3.0.0]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@2.8.1...@metamask/social-controllers@3.0.0
161
177
  [2.8.1]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@2.8.0...@metamask/social-controllers@2.8.1
162
178
  [2.8.0]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@2.7.2...@metamask/social-controllers@2.8.0
163
179
  [2.7.2]: https://github.com/MetaMask/core/compare/@metamask/social-controllers@2.7.1...@metamask/social-controllers@2.7.2
@@ -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,EACxB,0BAA0B,EAE3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3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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,uBAAuB,CAAC;AAqBvD,oBAAoB;AAEpB,MAAM,yBAAyB,GAAG;IAChC,mBAAmB;IACnB,cAAc;IACd,gBAAg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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,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;CAC7C,C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AC3B,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,EACV,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,E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