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

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 +0 -1
  2. package/dist/SocialController-method-action-types.cjs +7 -0
  3. package/dist/SocialController-method-action-types.cjs.map +1 -0
  4. package/dist/{SocialController-method-action-types.d.ts → SocialController-method-action-types.d.cts} +2 -2
  5. package/dist/SocialController-method-action-types.d.cts.map +1 -0
  6. package/dist/SocialController-method-action-types.d.mts +71 -0
  7. package/dist/SocialController-method-action-types.d.mts.map +1 -0
  8. package/dist/{SocialController-method-action-types.js → SocialController-method-action-types.mjs} +1 -1
  9. package/dist/SocialController-method-action-types.mjs.map +1 -0
  10. package/dist/SocialController.cjs +160 -0
  11. package/dist/SocialController.cjs.map +1 -0
  12. package/dist/{SocialController.d.ts → SocialController.d.cts} +8 -8
  13. package/dist/SocialController.d.cts.map +1 -0
  14. package/dist/SocialController.d.mts +80 -0
  15. package/dist/SocialController.d.mts.map +1 -0
  16. package/dist/{SocialController.js → SocialController.mjs} +3 -3
  17. package/dist/SocialController.mjs.map +1 -0
  18. package/dist/SocialService-method-action-types.cjs +7 -0
  19. package/dist/SocialService-method-action-types.cjs.map +1 -0
  20. package/dist/{SocialService-method-action-types.d.ts → SocialService-method-action-types.d.cts} +2 -2
  21. package/dist/SocialService-method-action-types.d.cts.map +1 -0
  22. package/dist/SocialService-method-action-types.d.mts +194 -0
  23. package/dist/SocialService-method-action-types.d.mts.map +1 -0
  24. package/dist/{SocialService-method-action-types.js → SocialService-method-action-types.mjs} +1 -1
  25. package/dist/SocialService-method-action-types.mjs.map +1 -0
  26. package/dist/SocialService.cjs +635 -0
  27. package/dist/SocialService.cjs.map +1 -0
  28. package/dist/{SocialService.d.ts → SocialService.d.cts} +9 -9
  29. package/dist/SocialService.d.cts.map +1 -0
  30. package/dist/SocialService.d.mts +171 -0
  31. package/dist/SocialService.d.mts.map +1 -0
  32. package/dist/{SocialService.js → SocialService.mjs} +6 -6
  33. package/dist/SocialService.mjs.map +1 -0
  34. package/dist/index.cjs +14 -0
  35. package/dist/index.cjs.map +1 -0
  36. package/dist/{index.d.ts → index.d.cts} +10 -10
  37. package/dist/index.d.cts.map +1 -0
  38. package/dist/index.d.mts +10 -0
  39. package/dist/index.d.mts.map +1 -0
  40. package/dist/index.mjs +5 -0
  41. package/dist/index.mjs.map +1 -0
  42. package/dist/social-constants.cjs +31 -0
  43. package/dist/social-constants.cjs.map +1 -0
  44. package/dist/social-constants.d.cts +28 -0
  45. package/dist/social-constants.d.cts.map +1 -0
  46. package/dist/social-constants.d.mts +28 -0
  47. package/dist/social-constants.d.mts.map +1 -0
  48. package/dist/{social-constants.js → social-constants.mjs} +1 -1
  49. package/dist/social-constants.mjs.map +1 -0
  50. package/dist/social-types.cjs +27 -0
  51. package/dist/social-types.cjs.map +1 -0
  52. package/dist/{social-types.d.ts → social-types.d.cts} +14 -14
  53. package/dist/social-types.d.cts.map +1 -0
  54. package/dist/social-types.d.mts +343 -0
  55. package/dist/social-types.d.mts.map +1 -0
  56. package/dist/{social-types.js → social-types.mjs} +2 -2
  57. package/dist/social-types.mjs.map +1 -0
  58. package/package.json +16 -12
  59. package/dist/SocialController-method-action-types.d.ts.map +0 -1
  60. package/dist/SocialController-method-action-types.js.map +0 -1
  61. package/dist/SocialController.d.ts.map +0 -1
  62. package/dist/SocialController.js.map +0 -1
  63. package/dist/SocialService-method-action-types.d.ts.map +0 -1
  64. package/dist/SocialService-method-action-types.js.map +0 -1
  65. package/dist/SocialService.d.ts.map +0 -1
  66. package/dist/SocialService.js.map +0 -1
  67. package/dist/index.d.ts.map +0 -1
  68. package/dist/index.js +0 -5
  69. package/dist/index.js.map +0 -1
  70. package/dist/social-constants.d.ts +0 -28
  71. package/dist/social-constants.d.ts.map +0 -1
  72. package/dist/social-constants.js.map +0 -1
  73. package/dist/social-types.d.ts.map +0 -1
  74. package/dist/social-types.js.map +0 -1
@@ -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.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social-constants.d.cts","sourceRoot":"","sources":["../src/social-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,kBAAkB,CAAC;AAE3C,eAAO,MAAM,cAAc,qBAAqB,CAAC;AAEjD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;CAmC5B,CAAC"}
@@ -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.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social-constants.d.mts","sourceRoot":"","sources":["../src/social-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,kBAAkB,CAAC;AAE3C,eAAO,MAAM,cAAc,qBAAqB,CAAC;AAEjD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;CAmC5B,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.js.map
28
+ //# sourceMappingURL=social-constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social-constants.mjs","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"]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TradeStruct = void 0;
4
+ const superstruct_1 = require("@metamask/superstruct");
5
+ exports.TradeStruct = (0, superstruct_1.type)({
6
+ direction: (0, superstruct_1.enums)(['buy', 'sell']),
7
+ intent: (0, superstruct_1.enums)(['enter', 'exit']),
8
+ /**
9
+ * Lifecycle stage of this fill. Absent on responses from a social-api that
10
+ * predates the field, so treat it as a hint and keep a client-side fallback.
11
+ */
12
+ action: (0, superstruct_1.optional)((0, superstruct_1.enums)(['opened', 'added', 'reduced', 'closed'])),
13
+ category: (0, superstruct_1.optional)((0, superstruct_1.string)()),
14
+ /** High-level trade classification. `null` when Clicker does not classify. */
15
+ classification: (0, superstruct_1.optional)((0, superstruct_1.nullable)((0, superstruct_1.enums)(['spot', 'perp', 'send', 'receive']))),
16
+ /** Perp side for this fill. `null` for spot trades. */
17
+ perpPositionType: (0, superstruct_1.optional)((0, superstruct_1.nullable)((0, superstruct_1.enums)(['long', 'short']))),
18
+ /** Leverage multiplier for perp trades (e.g. `5` for 5x). `null` for spot. */
19
+ perpLeverage: (0, superstruct_1.optional)((0, superstruct_1.nullable)((0, superstruct_1.number)())),
20
+ tokenAmount: (0, superstruct_1.number)(),
21
+ usdCost: (0, superstruct_1.number)(),
22
+ /** Token market cap in USD at trade time. `null` when Clicker has no mark. */
23
+ marketCap: (0, superstruct_1.optional)((0, superstruct_1.nullable)((0, superstruct_1.number)())),
24
+ timestamp: (0, superstruct_1.number)(),
25
+ transactionHash: (0, superstruct_1.string)(),
26
+ });
27
+ //# sourceMappingURL=social-types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social-types.cjs","sourceRoot":"","sources":["../src/social-types.ts"],"names":[],"mappings":";;;AACA,uDAO+B;AA0ClB,QAAA,WAAW,GAAG,IAAA,kBAAU,EAAC;IACpC,SAAS,EAAE,IAAA,mBAAK,EAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,EAAE,IAAA,mBAAK,EAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAChC;;;OAGG;IACH,MAAM,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjE,QAAQ,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;IAC5B,8EAA8E;IAC9E,cAAc,EAAE,IAAA,sBAAQ,EACtB,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CACrD;IACD,uDAAuD;IACvD,gBAAgB,EAAE,IAAA,sBAAQ,EAAC,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAC9D,8EAA8E;IAC9E,YAAY,EAAE,IAAA,sBAAQ,EAAC,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC,CAAC;IAC1C,WAAW,EAAE,IAAA,oBAAM,GAAE;IACrB,OAAO,EAAE,IAAA,oBAAM,GAAE;IACjB,8EAA8E;IAC9E,SAAS,EAAE,IAAA,sBAAQ,EAAC,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC,CAAC;IACvC,SAAS,EAAE,IAAA,oBAAM,GAAE;IACnB,eAAe,EAAE,IAAA,oBAAM,GAAE;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"]}
@@ -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
- action?: "added" | "closed" | "opened" | "reduced" | undefined;
39
- category?: string | undefined;
40
- classification?: "perp" | "receive" | "send" | "spot" | null | undefined;
41
- perpPositionType?: "long" | "short" | null | undefined;
42
- perpLeverage?: number | null | undefined;
43
38
  tokenAmount: number;
44
39
  usdCost: number;
45
- marketCap?: number | null | undefined;
46
40
  timestamp: number;
47
41
  transactionHash: string;
42
+ action?: "opened" | "added" | "reduced" | "closed" | undefined;
43
+ category?: string | undefined;
44
+ classification?: "spot" | "perp" | "send" | "receive" | null | undefined;
45
+ perpPositionType?: "long" | "short" | null | undefined;
46
+ perpLeverage?: number | null | undefined;
47
+ marketCap?: number | null | undefined;
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<"added" | "closed" | "opened" | "reduced" | undefined, {
62
- added: "added";
63
- closed: "closed";
61
+ action: import("@metamask/superstruct").Struct<"opened" | "added" | "reduced" | "closed" | undefined, {
64
62
  opened: "opened";
63
+ added: "added";
65
64
  reduced: "reduced";
65
+ closed: "closed";
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<"perp" | "receive" | "send" | "spot" | null | undefined, {
69
+ classification: import("@metamask/superstruct").Struct<"spot" | "perp" | "send" | "receive" | null | undefined, {
70
+ spot: "spot";
70
71
  perp: "perp";
71
- receive: "receive";
72
72
  send: "send";
73
- spot: "spot";
73
+ receive: "receive";
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.ts.map
343
+ //# sourceMappingURL=social-types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social-types.d.cts","sourceRoot":"","sources":["../src/social-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;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,IAAI,CAA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kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,wEAAwE;IACxE,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B,CAAC"}
@@ -0,0 +1,343 @@
1
+ import type { Infer } from "@metamask/superstruct";
2
+ /**
3
+ * Minimal profile summary used across follow/follower responses.
4
+ */
5
+ export type ProfileSummary = {
6
+ /** Clicker profile ID (UUID). */
7
+ profileId: string;
8
+ /** Primary wallet address. */
9
+ address: string;
10
+ /** Display name or truncated address. */
11
+ name: string;
12
+ /** Profile avatar URL. */
13
+ imageUrl?: string | null;
14
+ };
15
+ /**
16
+ * Social media handles attached to a trader profile.
17
+ */
18
+ export type SocialHandles = {
19
+ twitter?: string | null;
20
+ farcaster?: string | null;
21
+ ens?: string | null;
22
+ lens?: string | null;
23
+ };
24
+ /**
25
+ * Where a fill sits in its position's lifecycle.
26
+ *
27
+ * Deliberately asset-agnostic so the classification is computed once, upstream:
28
+ * clients render `opened / added / reduced / closed` for perps and
29
+ * `bought / bought more / sold some / sold all` for spot from the same value.
30
+ *
31
+ * Distinct from `intent`, which only says whether the fill grew or shrank the
32
+ * position — `intent: 'exit'` covers both a partial trim and a full close.
33
+ */
34
+ export type TradeAction = 'opened' | 'added' | 'reduced' | 'closed';
35
+ export declare const TradeStruct: import("@metamask/superstruct").Struct<{
36
+ direction: "buy" | "sell";
37
+ intent: "enter" | "exit";
38
+ tokenAmount: number;
39
+ usdCost: number;
40
+ timestamp: number;
41
+ transactionHash: string;
42
+ action?: "opened" | "added" | "reduced" | "closed" | undefined;
43
+ category?: string | undefined;
44
+ classification?: "spot" | "perp" | "send" | "receive" | null | undefined;
45
+ perpPositionType?: "long" | "short" | null | undefined;
46
+ perpLeverage?: number | null | undefined;
47
+ marketCap?: number | null | undefined;
48
+ }, {
49
+ direction: import("@metamask/superstruct").Struct<"buy" | "sell", {
50
+ buy: "buy";
51
+ sell: "sell";
52
+ }>;
53
+ intent: import("@metamask/superstruct").Struct<"enter" | "exit", {
54
+ enter: "enter";
55
+ exit: "exit";
56
+ }>;
57
+ /**
58
+ * Lifecycle stage of this fill. Absent on responses from a social-api that
59
+ * predates the field, so treat it as a hint and keep a client-side fallback.
60
+ */
61
+ action: import("@metamask/superstruct").Struct<"opened" | "added" | "reduced" | "closed" | undefined, {
62
+ opened: "opened";
63
+ added: "added";
64
+ reduced: "reduced";
65
+ closed: "closed";
66
+ }>;
67
+ category: import("@metamask/superstruct").Struct<string | undefined, null>;
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";
71
+ perp: "perp";
72
+ send: "send";
73
+ receive: "receive";
74
+ }>;
75
+ /** Perp side for this fill. `null` for spot trades. */
76
+ perpPositionType: import("@metamask/superstruct").Struct<"long" | "short" | null | undefined, {
77
+ long: "long";
78
+ short: "short";
79
+ }>;
80
+ /** Leverage multiplier for perp trades (e.g. `5` for 5x). `null` for spot. */
81
+ perpLeverage: import("@metamask/superstruct").Struct<number | null | undefined, null>;
82
+ tokenAmount: import("@metamask/superstruct").Struct<number, null>;
83
+ usdCost: import("@metamask/superstruct").Struct<number, null>;
84
+ /** Token market cap in USD at trade time. `null` when Clicker has no mark. */
85
+ marketCap: import("@metamask/superstruct").Struct<number | null | undefined, null>;
86
+ timestamp: import("@metamask/superstruct").Struct<number, null>;
87
+ transactionHash: import("@metamask/superstruct").Struct<string, null>;
88
+ }>;
89
+ export type Trade = Infer<typeof TradeStruct>;
90
+ /**
91
+ * A single entry in the leaderboard response.
92
+ */
93
+ export type LeaderboardEntry = {
94
+ rank: number;
95
+ addresses: string[];
96
+ profileId: string;
97
+ name: string;
98
+ imageUrl?: string | null;
99
+ pnl30d: number;
100
+ winRate30d?: number | null;
101
+ /** Renamed from roi30d. */
102
+ roiPercent30d?: number | null;
103
+ /** Renamed from tradeCount. */
104
+ tradeCount30d?: number | null;
105
+ pnl7d?: number | null;
106
+ winRate7d?: number | null;
107
+ roiPercent7d?: number | null;
108
+ tradeCount7d?: number | null;
109
+ pnlPerChain: Record<string, number>;
110
+ followerCount: number;
111
+ socialHandles: SocialHandles;
112
+ };
113
+ /**
114
+ * Response from `GET /v1/leaderboard`.
115
+ */
116
+ export type LeaderboardResponse = {
117
+ traders: LeaderboardEntry[];
118
+ };
119
+ export type TraderProfile = {
120
+ profileId: string;
121
+ address: string;
122
+ allAddresses: string[];
123
+ name: string;
124
+ imageUrl?: string | null;
125
+ };
126
+ export type TraderStats = {
127
+ pnl30d?: number | null;
128
+ winRate30d?: number | null;
129
+ /** Renamed from roi30d. */
130
+ roiPercent30d?: number | null;
131
+ /** Renamed from tradeCount. */
132
+ tradeCount30d?: number | null;
133
+ pnl7d?: number | null;
134
+ winRate7d?: number | null;
135
+ roiPercent7d?: number | null;
136
+ tradeCount7d?: number | null;
137
+ /** Median holding time in minutes. */
138
+ medianHoldMinutes?: number | null;
139
+ };
140
+ export type PerChainBreakdown = {
141
+ perChainPnl: Record<string, number>;
142
+ /** ROI can be null for chains with no trading activity (zero cost-basis). */
143
+ perChainRoi: Record<string, number | null>;
144
+ perChainVolume: Record<string, number>;
145
+ /**
146
+ * 7-day per-chain PnL in USD. Optional: older social-api versions only
147
+ * return the 30-day breakdown (`perChainPnl`). The unsuffixed fields above
148
+ * remain the 30-day window for backward compatibility.
149
+ */
150
+ perChainPnl7d?: Record<string, number>;
151
+ /** 7-day per-chain ROI. Null for chains with no trading activity. */
152
+ perChainRoi7d?: Record<string, number | null>;
153
+ /** 7-day per-chain volume in USD. */
154
+ perChainVolume7d?: Record<string, number>;
155
+ };
156
+ /**
157
+ * Response from `GET /v1/traders/:addressOrId/profile`.
158
+ */
159
+ export type TraderProfileResponse = {
160
+ profile: TraderProfile;
161
+ stats: TraderStats;
162
+ perChainBreakdown: PerChainBreakdown;
163
+ socialHandles: SocialHandles;
164
+ followerCount: number;
165
+ followingCount: number;
166
+ };
167
+ export type Position = {
168
+ positionId: string;
169
+ tokenSymbol: string;
170
+ tokenName: string;
171
+ tokenAddress: string;
172
+ chain: string;
173
+ positionAmount: number;
174
+ /**
175
+ * Whether the position still carries exposure. Clicker's own verdict, which
176
+ * beats a `positionAmount === 0` check: it survives precision dust and
177
+ * distinguishes "no position" from "a position of size ~0". Absent on
178
+ * responses from a social-api that predates the field.
179
+ */
180
+ isOpen?: boolean;
181
+ boughtUsd: number;
182
+ soldUsd: number;
183
+ realizedPnl: number;
184
+ costBasis: number;
185
+ trades: Trade[];
186
+ lastTradeAt: number;
187
+ /** Daylight-hosted token image URL. */
188
+ tokenImageUrl?: string | null;
189
+ /** Current USD value of the remaining position (open positions only). */
190
+ currentValueUSD?: number | null;
191
+ /** Unrealized + realized PnL in USD. */
192
+ pnlValueUsd?: number | null;
193
+ /** PnL as a percentage of cost basis. */
194
+ pnlPercent?: number | null;
195
+ /** Perp side of the position. `null`/absent for spot positions. */
196
+ perpPositionType?: 'long' | 'short' | null;
197
+ /** Leverage multiplier for perp positions. `null`/absent for spot. */
198
+ perpLeverage?: number | null;
199
+ /**
200
+ * Leveraged/notional position size as reported by Clicker. NOT necessarily
201
+ * `positionAmount` × `perpLeverage` — the ratio varies for positions built
202
+ * across fills at different leverage, so use this field directly rather than
203
+ * deriving it, and treat `perpLeverage` as the authoritative leverage. This is
204
+ * notional exposure, not capital at risk (the margin/capital at risk is
205
+ * `costBasis`). Hyperliquid/perp positions only; absent for spot.
206
+ */
207
+ positionAmountWithLeverage?: number | null;
208
+ };
209
+ export type Pagination = {
210
+ hasMore: boolean;
211
+ nextPage?: number;
212
+ };
213
+ /**
214
+ * Response from `GET /v1/traders/:addressOrId/positions/open`
215
+ * and `GET /v1/traders/:addressOrId/positions/closed`.
216
+ */
217
+ export type PositionsResponse = {
218
+ positions: Position[];
219
+ pagination: Pagination;
220
+ /** ISO 8601 timestamp indicating when the response was computed server-side. */
221
+ computedAt?: string | null;
222
+ };
223
+ /**
224
+ * A single trader-activity feed item: a {@link Position} the trade belongs to,
225
+ * plus the {@link ProfileSummary} of the trader who made it (`actor`) and the
226
+ * item's creation `timestamp` (Unix seconds).
227
+ */
228
+ export type FeedItem = Position & {
229
+ /** The trader who made this trade. */
230
+ actor: ProfileSummary;
231
+ /** Unix timestamp (seconds) when the feed item was created. */
232
+ timestamp: number;
233
+ };
234
+ /**
235
+ * Cursor pagination for the feed. Pass `olderCursor` back as `olderThan` to
236
+ * load older items (infinite scroll), and `newerCursor` as `newerThan` to
237
+ * fetch newer items. `null` when there are no items in that direction.
238
+ */
239
+ export type FeedPagination = {
240
+ olderCursor: string | null;
241
+ newerCursor: string | null;
242
+ };
243
+ /**
244
+ * Response from `GET /v1/feed`.
245
+ */
246
+ export type FeedResponse = {
247
+ items: FeedItem[];
248
+ pagination: FeedPagination;
249
+ };
250
+ /**
251
+ * Response from `GET /v1/traders/:addressOrId/followers`.
252
+ */
253
+ export type FollowersResponse = {
254
+ followers: ProfileSummary[];
255
+ count: number;
256
+ };
257
+ /**
258
+ * Response from `GET /v1/users/me/following`.
259
+ */
260
+ export type FollowingResponse = {
261
+ following: ProfileSummary[];
262
+ count: number;
263
+ };
264
+ /**
265
+ * Response from `PUT /v1/users/me/follows`.
266
+ */
267
+ export type FollowResponse = {
268
+ followed: ProfileSummary[];
269
+ };
270
+ /**
271
+ * Response from `DELETE /v1/users/me/follows`.
272
+ */
273
+ export type UnfollowResponse = {
274
+ unfollowed: ProfileSummary[];
275
+ };
276
+ export type FetchLeaderboardOptions = {
277
+ sort?: 'pnl' | 'winRate' | 'roi';
278
+ chains?: string[];
279
+ limit?: number;
280
+ };
281
+ export type FetchTraderProfileOptions = {
282
+ /** Wallet address or Clicker profile ID. */
283
+ addressOrId: string;
284
+ };
285
+ export type FetchPositionsOptions = {
286
+ /** Wallet address or Clicker profile ID. */
287
+ addressOrId: string;
288
+ chain?: string;
289
+ sort?: 'value' | 'latest';
290
+ limit?: number;
291
+ page?: number;
292
+ };
293
+ export type FetchFollowersOptions = {
294
+ /** Wallet address or Clicker profile ID. */
295
+ addressOrId: string;
296
+ };
297
+ export type FetchFeedOptions = {
298
+ /**
299
+ * Which feed to fetch: `following` (personalized to the current user,
300
+ * identified server-side from the JWT) or `leaderboard` (generic, shared by
301
+ * all users). Defaults to `following` server-side when omitted.
302
+ */
303
+ scope?: 'following' | 'leaderboard';
304
+ /**
305
+ * Filter by one or more chains, given as CAIP-2 chain ids (e.g.
306
+ * `eip155:8453`). Omit for the server defaults.
307
+ */
308
+ chains?: string[];
309
+ /** Number of results to return. */
310
+ limit?: number;
311
+ /** Cursor for older items (infinite scroll). Use `pagination.olderCursor`. */
312
+ olderThan?: string;
313
+ /** Cursor for newer items (pull to refresh). Use `pagination.newerCursor`. */
314
+ newerThan?: string;
315
+ };
316
+ export type FetchPositionByIdOptions = {
317
+ /** Unique position ID (UUID). */
318
+ positionId: string;
319
+ };
320
+ export type FollowOptions = {
321
+ /** Array of wallet addresses or profile IDs to follow. */
322
+ targets: string[];
323
+ };
324
+ export type UnfollowOptions = {
325
+ /** Array of wallet addresses or profile IDs to unfollow. */
326
+ targets: string[];
327
+ };
328
+ /**
329
+ * State managed by the SocialController.
330
+ *
331
+ * The controller acts as a simple store — no TTL or eviction logic.
332
+ * The UI decides when to re-fetch; the social-api's own cache layer
333
+ * handles upstream rate-limiting.
334
+ */
335
+ export type SocialControllerState = {
336
+ /** Cached ranked trader list from the last `updateLeaderboard` call. */
337
+ leaderboardEntries: LeaderboardEntry[];
338
+ /** Wallet addresses the current user follows. */
339
+ followingAddresses: string[];
340
+ /** Clicker profile IDs the current user follows — used by mobile UI. */
341
+ followingProfileIds: string[];
342
+ };
343
+ //# sourceMappingURL=social-types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social-types.d.mts","sourceRoot":"","sources":["../src/social-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC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;IACrC,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,0DAA0D;IAC1D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,4DAA4D;IAC5D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAMF;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,wEAAwE;IACxE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC;IACvC,iDAAiD;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.js.map
24
+ //# sourceMappingURL=social-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social-types.mjs","sourceRoot":"","sources":["../src/social-types.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,IAAI,UAAU,EACnB,8BAA8B;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"]}