@metamask/social-controllers 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/LICENSE +20 -0
- package/README.md +15 -0
- package/dist/SocialController-method-action-types.cjs +7 -0
- package/dist/SocialController-method-action-types.cjs.map +1 -0
- package/dist/SocialController-method-action-types.d.cts +56 -0
- package/dist/SocialController-method-action-types.d.cts.map +1 -0
- package/dist/SocialController-method-action-types.d.mts +56 -0
- package/dist/SocialController-method-action-types.d.mts.map +1 -0
- package/dist/SocialController-method-action-types.mjs +6 -0
- package/dist/SocialController-method-action-types.mjs.map +1 -0
- package/dist/SocialController.cjs +129 -0
- package/dist/SocialController.cjs.map +1 -0
- package/dist/SocialController.d.cts +71 -0
- package/dist/SocialController.d.cts.map +1 -0
- package/dist/SocialController.d.mts +71 -0
- package/dist/SocialController.d.mts.map +1 -0
- package/dist/SocialController.mjs +124 -0
- package/dist/SocialController.mjs.map +1 -0
- package/dist/SocialService-method-action-types.cjs +7 -0
- package/dist/SocialService-method-action-types.cjs.map +1 -0
- package/dist/SocialService-method-action-types.d.cts +125 -0
- package/dist/SocialService-method-action-types.d.cts.map +1 -0
- package/dist/SocialService-method-action-types.d.mts +125 -0
- package/dist/SocialService-method-action-types.d.mts.map +1 -0
- package/dist/SocialService-method-action-types.mjs +6 -0
- package/dist/SocialService-method-action-types.mjs.map +1 -0
- package/dist/SocialService.cjs +434 -0
- package/dist/SocialService.cjs.map +1 -0
- package/dist/SocialService.d.cts +113 -0
- package/dist/SocialService.d.cts.map +1 -0
- package/dist/SocialService.d.mts +113 -0
- package/dist/SocialService.d.mts.map +1 -0
- package/dist/SocialService.mjs +430 -0
- package/dist/SocialService.mjs.map +1 -0
- package/dist/index.cjs +12 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +9 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -0
- package/dist/social-constants.cjs +24 -0
- package/dist/social-constants.cjs.map +1 -0
- package/dist/social-constants.d.cts +21 -0
- package/dist/social-constants.d.cts.map +1 -0
- package/dist/social-constants.d.mts +21 -0
- package/dist/social-constants.d.mts.map +1 -0
- package/dist/social-constants.mjs +21 -0
- package/dist/social-constants.mjs.map +1 -0
- package/dist/social-types.cjs +6 -0
- package/dist/social-types.cjs.map +1 -0
- package/dist/social-types.d.cts +212 -0
- package/dist/social-types.d.cts.map +1 -0
- package/dist/social-types.d.mts +212 -0
- package/dist/social-types.d.mts.map +1 -0
- package/dist/social-types.mjs +5 -0
- package/dist/social-types.mjs.map +1 -0
- package/package.json +75 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { SocialControllerActions, SocialControllerEvents, SocialControllerGetStateAction, SocialControllerMessenger, SocialControllerOptions, SocialControllerStateChangeEvent, } from "./SocialController.mjs";
|
|
2
|
+
export { SocialController, getDefaultSocialControllerState, } from "./SocialController.mjs";
|
|
3
|
+
export type { SocialControllerFollowTraderAction, SocialControllerUnfollowTraderAction, SocialControllerUpdateFollowingAction, SocialControllerUpdateLeaderboardAction, } from "./SocialController-method-action-types.mjs";
|
|
4
|
+
export type { SocialServiceActions, SocialServiceEvents, SocialServiceMessenger, } from "./SocialService.mjs";
|
|
5
|
+
export { SocialService } from "./SocialService.mjs";
|
|
6
|
+
export type { SocialServiceFetchClosedPositionsAction, SocialServiceFetchFollowersAction, SocialServiceFetchFollowingAction, SocialServiceFetchLeaderboardAction, SocialServiceFetchOpenPositionsAction, SocialServiceFetchTraderProfileAction, SocialServiceFollowAction, SocialServiceUnfollowAction, } from "./SocialService-method-action-types.mjs";
|
|
7
|
+
export type { FetchFollowersOptions, FetchFollowingOptions, FetchLeaderboardOptions, FetchPositionsOptions, FetchTraderProfileOptions, FollowersResponse, FollowingResponse, FollowOptions, FollowResponse, LeaderboardEntry, LeaderboardResponse, Pagination, PerChainBreakdown, Position, PositionsResponse, ProfileSummary, SocialControllerState, SocialHandles, Trade, TraderProfile, TraderProfileResponse, TraderStats, UnfollowOptions, UnfollowResponse, } from "./social-types.mjs";
|
|
8
|
+
export { serviceName as socialServiceName, SocialServiceErrorMessage, } from "./social-constants.mjs";
|
|
9
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,8BAA8B,EAC9B,yBAAyB,EACzB,uBAAuB,EACvB,gCAAgC,GACjC,+BAA2B;AAC5B,OAAO,EACL,gBAAgB,EAChB,+BAA+B,GAChC,+BAA2B;AAE5B,YAAY,EACV,kCAAkC,EAClC,oCAAoC,EACpC,qCAAqC,EACrC,uCAAuC,GACxC,mDAA+C;AAEhD,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,GACvB,4BAAwB;AACzB,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAEhD,YAAY,EACV,uCAAuC,EACvC,iCAAiC,EACjC,iCAAiC,EACjC,mCAAmC,EACnC,qCAAqC,EACrC,qCAAqC,EACrC,yBAAyB,EACzB,2BAA2B,GAC5B,gDAA4C;AAE7C,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,KAAK,EACL,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,eAAe,EACf,gBAAgB,GACjB,2BAAuB;AAExB,OAAO,EACL,WAAW,IAAI,iBAAiB,EAChC,yBAAyB,GAC1B,+BAA2B"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { SocialController, getDefaultSocialControllerState } from "./SocialController.mjs";
|
|
2
|
+
export { SocialService } from "./SocialService.mjs";
|
|
3
|
+
export { serviceName as socialServiceName, SocialServiceErrorMessage } from "./social-constants.mjs";
|
|
4
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,gBAAgB,EAChB,+BAA+B,EAChC,+BAA2B;AAc5B,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAwChD,OAAO,EACL,WAAW,IAAI,iBAAiB,EAChC,yBAAyB,EAC1B,+BAA2B","sourcesContent":["export type {\n SocialControllerActions,\n SocialControllerEvents,\n SocialControllerGetStateAction,\n SocialControllerMessenger,\n SocialControllerOptions,\n SocialControllerStateChangeEvent,\n} from './SocialController';\nexport {\n SocialController,\n getDefaultSocialControllerState,\n} from './SocialController';\n\nexport type {\n SocialControllerFollowTraderAction,\n SocialControllerUnfollowTraderAction,\n SocialControllerUpdateFollowingAction,\n SocialControllerUpdateLeaderboardAction,\n} from './SocialController-method-action-types';\n\nexport type {\n SocialServiceActions,\n SocialServiceEvents,\n SocialServiceMessenger,\n} from './SocialService';\nexport { SocialService } from './SocialService';\n\nexport type {\n SocialServiceFetchClosedPositionsAction,\n SocialServiceFetchFollowersAction,\n SocialServiceFetchFollowingAction,\n SocialServiceFetchLeaderboardAction,\n SocialServiceFetchOpenPositionsAction,\n SocialServiceFetchTraderProfileAction,\n SocialServiceFollowAction,\n SocialServiceUnfollowAction,\n} from './SocialService-method-action-types';\n\nexport type {\n FetchFollowersOptions,\n FetchFollowingOptions,\n FetchLeaderboardOptions,\n FetchPositionsOptions,\n FetchTraderProfileOptions,\n FollowersResponse,\n FollowingResponse,\n FollowOptions,\n FollowResponse,\n LeaderboardEntry,\n LeaderboardResponse,\n Pagination,\n PerChainBreakdown,\n Position,\n PositionsResponse,\n ProfileSummary,\n SocialControllerState,\n SocialHandles,\n Trade,\n TraderProfile,\n TraderProfileResponse,\n TraderStats,\n UnfollowOptions,\n UnfollowResponse,\n} from './social-types';\n\nexport {\n serviceName as socialServiceName,\n SocialServiceErrorMessage,\n} from './social-constants';\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SocialServiceErrorMessage = exports.controllerName = exports.serviceName = void 0;
|
|
4
|
+
exports.serviceName = 'SocialService';
|
|
5
|
+
exports.controllerName = 'SocialController';
|
|
6
|
+
exports.SocialServiceErrorMessage = {
|
|
7
|
+
FETCH_LEADERBOARD_FAILED: 'SocialService: Leaderboard request failed',
|
|
8
|
+
FETCH_LEADERBOARD_INVALID_RESPONSE: 'SocialService: Leaderboard returned invalid response',
|
|
9
|
+
FETCH_TRADER_PROFILE_FAILED: 'SocialService: Trader profile request failed',
|
|
10
|
+
FETCH_TRADER_PROFILE_INVALID_RESPONSE: 'SocialService: Trader profile returned invalid response',
|
|
11
|
+
FETCH_OPEN_POSITIONS_FAILED: 'SocialService: Open positions request failed',
|
|
12
|
+
FETCH_OPEN_POSITIONS_INVALID_RESPONSE: 'SocialService: Open positions returned invalid response',
|
|
13
|
+
FETCH_CLOSED_POSITIONS_FAILED: 'SocialService: Closed positions request failed',
|
|
14
|
+
FETCH_CLOSED_POSITIONS_INVALID_RESPONSE: 'SocialService: Closed positions returned invalid response',
|
|
15
|
+
FETCH_FOLLOWERS_FAILED: 'SocialService: Followers request failed',
|
|
16
|
+
FETCH_FOLLOWERS_INVALID_RESPONSE: 'SocialService: Followers returned invalid response',
|
|
17
|
+
FETCH_FOLLOWING_FAILED: 'SocialService: Following request failed',
|
|
18
|
+
FETCH_FOLLOWING_INVALID_RESPONSE: 'SocialService: Following returned invalid response',
|
|
19
|
+
FOLLOW_FAILED: 'SocialService: Follow request failed',
|
|
20
|
+
FOLLOW_INVALID_RESPONSE: 'SocialService: Follow returned invalid response',
|
|
21
|
+
UNFOLLOW_FAILED: 'SocialService: Unfollow request failed',
|
|
22
|
+
UNFOLLOW_INVALID_RESPONSE: 'SocialService: Unfollow returned invalid response',
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=social-constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"social-constants.cjs","sourceRoot":"","sources":["../src/social-constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,eAAe,CAAC;AAE9B,QAAA,cAAc,GAAG,kBAAkB,CAAC;AAEpC,QAAA,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;CAC7C,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} as const;\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
};
|
|
21
|
+
//# 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;;;;;;;;;;;;;;;;;CAyB5B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
};
|
|
21
|
+
//# 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;;;;;;;;;;;;;;;;;CAyB5B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const serviceName = 'SocialService';
|
|
2
|
+
export const controllerName = 'SocialController';
|
|
3
|
+
export const SocialServiceErrorMessage = {
|
|
4
|
+
FETCH_LEADERBOARD_FAILED: 'SocialService: Leaderboard request failed',
|
|
5
|
+
FETCH_LEADERBOARD_INVALID_RESPONSE: 'SocialService: Leaderboard returned invalid response',
|
|
6
|
+
FETCH_TRADER_PROFILE_FAILED: 'SocialService: Trader profile request failed',
|
|
7
|
+
FETCH_TRADER_PROFILE_INVALID_RESPONSE: 'SocialService: Trader profile returned invalid response',
|
|
8
|
+
FETCH_OPEN_POSITIONS_FAILED: 'SocialService: Open positions request failed',
|
|
9
|
+
FETCH_OPEN_POSITIONS_INVALID_RESPONSE: 'SocialService: Open positions returned invalid response',
|
|
10
|
+
FETCH_CLOSED_POSITIONS_FAILED: 'SocialService: Closed positions request failed',
|
|
11
|
+
FETCH_CLOSED_POSITIONS_INVALID_RESPONSE: 'SocialService: Closed positions returned invalid response',
|
|
12
|
+
FETCH_FOLLOWERS_FAILED: 'SocialService: Followers request failed',
|
|
13
|
+
FETCH_FOLLOWERS_INVALID_RESPONSE: 'SocialService: Followers returned invalid response',
|
|
14
|
+
FETCH_FOLLOWING_FAILED: 'SocialService: Following request failed',
|
|
15
|
+
FETCH_FOLLOWING_INVALID_RESPONSE: 'SocialService: Following returned invalid response',
|
|
16
|
+
FOLLOW_FAILED: 'SocialService: Follow request failed',
|
|
17
|
+
FOLLOW_INVALID_RESPONSE: 'SocialService: Follow returned invalid response',
|
|
18
|
+
UNFOLLOW_FAILED: 'SocialService: Unfollow request failed',
|
|
19
|
+
UNFOLLOW_INVALID_RESPONSE: 'SocialService: Unfollow returned invalid response',
|
|
20
|
+
};
|
|
21
|
+
//# 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;CAC7C,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} as const;\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Shared sub-types
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
//# sourceMappingURL=social-types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"social-types.cjs","sourceRoot":"","sources":["../src/social-types.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E","sourcesContent":["// ---------------------------------------------------------------------------\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 * A single trade within a position.\n */\nexport type Trade = {\n /** \"buy\" or \"sell\". */\n direction: string;\n /** Quantity traded. */\n tokenAmount: number;\n /** USD value of the trade. */\n usdCost: number;\n /** Unix timestamp. */\n timestamp: number;\n /** On-chain transaction hash. */\n transactionHash: string;\n};\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};\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\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 tokenSymbol: string;\n tokenName: string;\n tokenAddress: string;\n chain: string;\n positionAmount: number;\n boughtUsd: number;\n soldUsd: number;\n realizedPnl: number;\n costBasis: number;\n trades: Trade[];\n lastTradeAt: number;\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};\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// 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/:addressOrUid/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/:addressOrUid/follows`.\n */\nexport type FollowResponse = {\n followed: ProfileSummary[];\n};\n\n/**\n * Response from `DELETE /v1/users/:addressOrUid/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 FetchFollowingOptions = {\n /** Wallet address or Clicker profile ID. */\n addressOrUid: string;\n};\n\nexport type FollowOptions = {\n /** Wallet address or Clicker profile ID of the user. */\n addressOrUid: string;\n /** Array of wallet addresses or profile IDs to follow. */\n targets: string[];\n};\n\nexport type UnfollowOptions = {\n /** Wallet address or Clicker profile ID of the user. */\n addressOrUid: string;\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 /** Addresses the current user follows — drives Follow/Following button state. */\n followingAddresses: string[];\n};\n"]}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal profile summary used across follow/follower responses.
|
|
3
|
+
*/
|
|
4
|
+
export type ProfileSummary = {
|
|
5
|
+
/** Clicker profile ID (UUID). */
|
|
6
|
+
profileId: string;
|
|
7
|
+
/** Primary wallet address. */
|
|
8
|
+
address: string;
|
|
9
|
+
/** Display name or truncated address. */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Profile avatar URL. */
|
|
12
|
+
imageUrl?: string | null;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Social media handles attached to a trader profile.
|
|
16
|
+
*/
|
|
17
|
+
export type SocialHandles = {
|
|
18
|
+
twitter?: string | null;
|
|
19
|
+
farcaster?: string | null;
|
|
20
|
+
ens?: string | null;
|
|
21
|
+
lens?: string | null;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A single trade within a position.
|
|
25
|
+
*/
|
|
26
|
+
export type Trade = {
|
|
27
|
+
/** "buy" or "sell". */
|
|
28
|
+
direction: string;
|
|
29
|
+
/** Quantity traded. */
|
|
30
|
+
tokenAmount: number;
|
|
31
|
+
/** USD value of the trade. */
|
|
32
|
+
usdCost: number;
|
|
33
|
+
/** Unix timestamp. */
|
|
34
|
+
timestamp: number;
|
|
35
|
+
/** On-chain transaction hash. */
|
|
36
|
+
transactionHash: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* A single entry in the leaderboard response.
|
|
40
|
+
*/
|
|
41
|
+
export type LeaderboardEntry = {
|
|
42
|
+
rank: number;
|
|
43
|
+
addresses: string[];
|
|
44
|
+
profileId: string;
|
|
45
|
+
name: string;
|
|
46
|
+
imageUrl?: string | null;
|
|
47
|
+
pnl30d: number;
|
|
48
|
+
winRate30d?: number | null;
|
|
49
|
+
/** Renamed from roi30d. */
|
|
50
|
+
roiPercent30d?: number | null;
|
|
51
|
+
/** Renamed from tradeCount. */
|
|
52
|
+
tradeCount30d?: number | null;
|
|
53
|
+
pnl7d?: number | null;
|
|
54
|
+
winRate7d?: number | null;
|
|
55
|
+
roiPercent7d?: number | null;
|
|
56
|
+
tradeCount7d?: number | null;
|
|
57
|
+
pnlPerChain: Record<string, number>;
|
|
58
|
+
followerCount: number;
|
|
59
|
+
socialHandles: SocialHandles;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Response from `GET /v1/leaderboard`.
|
|
63
|
+
*/
|
|
64
|
+
export type LeaderboardResponse = {
|
|
65
|
+
traders: LeaderboardEntry[];
|
|
66
|
+
};
|
|
67
|
+
export type TraderProfile = {
|
|
68
|
+
profileId: string;
|
|
69
|
+
address: string;
|
|
70
|
+
allAddresses: string[];
|
|
71
|
+
name: string;
|
|
72
|
+
imageUrl?: string | null;
|
|
73
|
+
};
|
|
74
|
+
export type TraderStats = {
|
|
75
|
+
pnl30d?: number | null;
|
|
76
|
+
winRate30d?: number | null;
|
|
77
|
+
/** Renamed from roi30d. */
|
|
78
|
+
roiPercent30d?: number | null;
|
|
79
|
+
/** Renamed from tradeCount. */
|
|
80
|
+
tradeCount30d?: number | null;
|
|
81
|
+
pnl7d?: number | null;
|
|
82
|
+
winRate7d?: number | null;
|
|
83
|
+
roiPercent7d?: number | null;
|
|
84
|
+
tradeCount7d?: number | null;
|
|
85
|
+
};
|
|
86
|
+
export type PerChainBreakdown = {
|
|
87
|
+
perChainPnl: Record<string, number>;
|
|
88
|
+
/** ROI can be null for chains with no trading activity (zero cost-basis). */
|
|
89
|
+
perChainRoi: Record<string, number | null>;
|
|
90
|
+
perChainVolume: Record<string, number>;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Response from `GET /v1/traders/:addressOrId/profile`.
|
|
94
|
+
*/
|
|
95
|
+
export type TraderProfileResponse = {
|
|
96
|
+
profile: TraderProfile;
|
|
97
|
+
stats: TraderStats;
|
|
98
|
+
perChainBreakdown: PerChainBreakdown;
|
|
99
|
+
socialHandles: SocialHandles;
|
|
100
|
+
followerCount: number;
|
|
101
|
+
followingCount: number;
|
|
102
|
+
};
|
|
103
|
+
export type Position = {
|
|
104
|
+
tokenSymbol: string;
|
|
105
|
+
tokenName: string;
|
|
106
|
+
tokenAddress: string;
|
|
107
|
+
chain: string;
|
|
108
|
+
positionAmount: number;
|
|
109
|
+
boughtUsd: number;
|
|
110
|
+
soldUsd: number;
|
|
111
|
+
realizedPnl: number;
|
|
112
|
+
costBasis: number;
|
|
113
|
+
trades: Trade[];
|
|
114
|
+
lastTradeAt: number;
|
|
115
|
+
/** Current USD value of the remaining position (open positions only). */
|
|
116
|
+
currentValueUSD?: number | null;
|
|
117
|
+
/** Unrealized + realized PnL in USD. */
|
|
118
|
+
pnlValueUsd?: number | null;
|
|
119
|
+
/** PnL as a percentage of cost basis. */
|
|
120
|
+
pnlPercent?: number | null;
|
|
121
|
+
};
|
|
122
|
+
export type Pagination = {
|
|
123
|
+
hasMore: boolean;
|
|
124
|
+
nextPage?: number;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Response from `GET /v1/traders/:addressOrId/positions/open`
|
|
128
|
+
* and `GET /v1/traders/:addressOrId/positions/closed`.
|
|
129
|
+
*/
|
|
130
|
+
export type PositionsResponse = {
|
|
131
|
+
positions: Position[];
|
|
132
|
+
pagination: Pagination;
|
|
133
|
+
/** ISO 8601 timestamp indicating when the response was computed server-side. */
|
|
134
|
+
computedAt?: string | null;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Response from `GET /v1/traders/:addressOrId/followers`.
|
|
138
|
+
*/
|
|
139
|
+
export type FollowersResponse = {
|
|
140
|
+
followers: ProfileSummary[];
|
|
141
|
+
count: number;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Response from `GET /v1/users/:addressOrUid/following`.
|
|
145
|
+
*/
|
|
146
|
+
export type FollowingResponse = {
|
|
147
|
+
following: ProfileSummary[];
|
|
148
|
+
count: number;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Response from `PUT /v1/users/:addressOrUid/follows`.
|
|
152
|
+
*/
|
|
153
|
+
export type FollowResponse = {
|
|
154
|
+
followed: ProfileSummary[];
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Response from `DELETE /v1/users/:addressOrUid/follows`.
|
|
158
|
+
*/
|
|
159
|
+
export type UnfollowResponse = {
|
|
160
|
+
unfollowed: ProfileSummary[];
|
|
161
|
+
};
|
|
162
|
+
export type FetchLeaderboardOptions = {
|
|
163
|
+
sort?: 'pnl' | 'winRate' | 'roi';
|
|
164
|
+
chains?: string[];
|
|
165
|
+
limit?: number;
|
|
166
|
+
};
|
|
167
|
+
export type FetchTraderProfileOptions = {
|
|
168
|
+
/** Wallet address or Clicker profile ID. */
|
|
169
|
+
addressOrId: string;
|
|
170
|
+
};
|
|
171
|
+
export type FetchPositionsOptions = {
|
|
172
|
+
/** Wallet address or Clicker profile ID. */
|
|
173
|
+
addressOrId: string;
|
|
174
|
+
chain?: string;
|
|
175
|
+
sort?: 'value' | 'latest';
|
|
176
|
+
limit?: number;
|
|
177
|
+
page?: number;
|
|
178
|
+
};
|
|
179
|
+
export type FetchFollowersOptions = {
|
|
180
|
+
/** Wallet address or Clicker profile ID. */
|
|
181
|
+
addressOrId: string;
|
|
182
|
+
};
|
|
183
|
+
export type FetchFollowingOptions = {
|
|
184
|
+
/** Wallet address or Clicker profile ID. */
|
|
185
|
+
addressOrUid: string;
|
|
186
|
+
};
|
|
187
|
+
export type FollowOptions = {
|
|
188
|
+
/** Wallet address or Clicker profile ID of the user. */
|
|
189
|
+
addressOrUid: string;
|
|
190
|
+
/** Array of wallet addresses or profile IDs to follow. */
|
|
191
|
+
targets: string[];
|
|
192
|
+
};
|
|
193
|
+
export type UnfollowOptions = {
|
|
194
|
+
/** Wallet address or Clicker profile ID of the user. */
|
|
195
|
+
addressOrUid: string;
|
|
196
|
+
/** Array of wallet addresses or profile IDs to unfollow. */
|
|
197
|
+
targets: string[];
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* State managed by the SocialController.
|
|
201
|
+
*
|
|
202
|
+
* The controller acts as a simple store — no TTL or eviction logic.
|
|
203
|
+
* The UI decides when to re-fetch; the social-api's own cache layer
|
|
204
|
+
* handles upstream rate-limiting.
|
|
205
|
+
*/
|
|
206
|
+
export type SocialControllerState = {
|
|
207
|
+
/** Cached ranked trader list from the last `updateLeaderboard` call. */
|
|
208
|
+
leaderboardEntries: LeaderboardEntry[];
|
|
209
|
+
/** Addresses the current user follows — drives Follow/Following button state. */
|
|
210
|
+
followingAddresses: string[];
|
|
211
|
+
};
|
|
212
|
+
//# 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":"AAIA;;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,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC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AAG,KAAK,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,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,iFAAiF;IACjF,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B,CAAC"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal profile summary used across follow/follower responses.
|
|
3
|
+
*/
|
|
4
|
+
export type ProfileSummary = {
|
|
5
|
+
/** Clicker profile ID (UUID). */
|
|
6
|
+
profileId: string;
|
|
7
|
+
/** Primary wallet address. */
|
|
8
|
+
address: string;
|
|
9
|
+
/** Display name or truncated address. */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Profile avatar URL. */
|
|
12
|
+
imageUrl?: string | null;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Social media handles attached to a trader profile.
|
|
16
|
+
*/
|
|
17
|
+
export type SocialHandles = {
|
|
18
|
+
twitter?: string | null;
|
|
19
|
+
farcaster?: string | null;
|
|
20
|
+
ens?: string | null;
|
|
21
|
+
lens?: string | null;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A single trade within a position.
|
|
25
|
+
*/
|
|
26
|
+
export type Trade = {
|
|
27
|
+
/** "buy" or "sell". */
|
|
28
|
+
direction: string;
|
|
29
|
+
/** Quantity traded. */
|
|
30
|
+
tokenAmount: number;
|
|
31
|
+
/** USD value of the trade. */
|
|
32
|
+
usdCost: number;
|
|
33
|
+
/** Unix timestamp. */
|
|
34
|
+
timestamp: number;
|
|
35
|
+
/** On-chain transaction hash. */
|
|
36
|
+
transactionHash: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* A single entry in the leaderboard response.
|
|
40
|
+
*/
|
|
41
|
+
export type LeaderboardEntry = {
|
|
42
|
+
rank: number;
|
|
43
|
+
addresses: string[];
|
|
44
|
+
profileId: string;
|
|
45
|
+
name: string;
|
|
46
|
+
imageUrl?: string | null;
|
|
47
|
+
pnl30d: number;
|
|
48
|
+
winRate30d?: number | null;
|
|
49
|
+
/** Renamed from roi30d. */
|
|
50
|
+
roiPercent30d?: number | null;
|
|
51
|
+
/** Renamed from tradeCount. */
|
|
52
|
+
tradeCount30d?: number | null;
|
|
53
|
+
pnl7d?: number | null;
|
|
54
|
+
winRate7d?: number | null;
|
|
55
|
+
roiPercent7d?: number | null;
|
|
56
|
+
tradeCount7d?: number | null;
|
|
57
|
+
pnlPerChain: Record<string, number>;
|
|
58
|
+
followerCount: number;
|
|
59
|
+
socialHandles: SocialHandles;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Response from `GET /v1/leaderboard`.
|
|
63
|
+
*/
|
|
64
|
+
export type LeaderboardResponse = {
|
|
65
|
+
traders: LeaderboardEntry[];
|
|
66
|
+
};
|
|
67
|
+
export type TraderProfile = {
|
|
68
|
+
profileId: string;
|
|
69
|
+
address: string;
|
|
70
|
+
allAddresses: string[];
|
|
71
|
+
name: string;
|
|
72
|
+
imageUrl?: string | null;
|
|
73
|
+
};
|
|
74
|
+
export type TraderStats = {
|
|
75
|
+
pnl30d?: number | null;
|
|
76
|
+
winRate30d?: number | null;
|
|
77
|
+
/** Renamed from roi30d. */
|
|
78
|
+
roiPercent30d?: number | null;
|
|
79
|
+
/** Renamed from tradeCount. */
|
|
80
|
+
tradeCount30d?: number | null;
|
|
81
|
+
pnl7d?: number | null;
|
|
82
|
+
winRate7d?: number | null;
|
|
83
|
+
roiPercent7d?: number | null;
|
|
84
|
+
tradeCount7d?: number | null;
|
|
85
|
+
};
|
|
86
|
+
export type PerChainBreakdown = {
|
|
87
|
+
perChainPnl: Record<string, number>;
|
|
88
|
+
/** ROI can be null for chains with no trading activity (zero cost-basis). */
|
|
89
|
+
perChainRoi: Record<string, number | null>;
|
|
90
|
+
perChainVolume: Record<string, number>;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Response from `GET /v1/traders/:addressOrId/profile`.
|
|
94
|
+
*/
|
|
95
|
+
export type TraderProfileResponse = {
|
|
96
|
+
profile: TraderProfile;
|
|
97
|
+
stats: TraderStats;
|
|
98
|
+
perChainBreakdown: PerChainBreakdown;
|
|
99
|
+
socialHandles: SocialHandles;
|
|
100
|
+
followerCount: number;
|
|
101
|
+
followingCount: number;
|
|
102
|
+
};
|
|
103
|
+
export type Position = {
|
|
104
|
+
tokenSymbol: string;
|
|
105
|
+
tokenName: string;
|
|
106
|
+
tokenAddress: string;
|
|
107
|
+
chain: string;
|
|
108
|
+
positionAmount: number;
|
|
109
|
+
boughtUsd: number;
|
|
110
|
+
soldUsd: number;
|
|
111
|
+
realizedPnl: number;
|
|
112
|
+
costBasis: number;
|
|
113
|
+
trades: Trade[];
|
|
114
|
+
lastTradeAt: number;
|
|
115
|
+
/** Current USD value of the remaining position (open positions only). */
|
|
116
|
+
currentValueUSD?: number | null;
|
|
117
|
+
/** Unrealized + realized PnL in USD. */
|
|
118
|
+
pnlValueUsd?: number | null;
|
|
119
|
+
/** PnL as a percentage of cost basis. */
|
|
120
|
+
pnlPercent?: number | null;
|
|
121
|
+
};
|
|
122
|
+
export type Pagination = {
|
|
123
|
+
hasMore: boolean;
|
|
124
|
+
nextPage?: number;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Response from `GET /v1/traders/:addressOrId/positions/open`
|
|
128
|
+
* and `GET /v1/traders/:addressOrId/positions/closed`.
|
|
129
|
+
*/
|
|
130
|
+
export type PositionsResponse = {
|
|
131
|
+
positions: Position[];
|
|
132
|
+
pagination: Pagination;
|
|
133
|
+
/** ISO 8601 timestamp indicating when the response was computed server-side. */
|
|
134
|
+
computedAt?: string | null;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Response from `GET /v1/traders/:addressOrId/followers`.
|
|
138
|
+
*/
|
|
139
|
+
export type FollowersResponse = {
|
|
140
|
+
followers: ProfileSummary[];
|
|
141
|
+
count: number;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Response from `GET /v1/users/:addressOrUid/following`.
|
|
145
|
+
*/
|
|
146
|
+
export type FollowingResponse = {
|
|
147
|
+
following: ProfileSummary[];
|
|
148
|
+
count: number;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Response from `PUT /v1/users/:addressOrUid/follows`.
|
|
152
|
+
*/
|
|
153
|
+
export type FollowResponse = {
|
|
154
|
+
followed: ProfileSummary[];
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Response from `DELETE /v1/users/:addressOrUid/follows`.
|
|
158
|
+
*/
|
|
159
|
+
export type UnfollowResponse = {
|
|
160
|
+
unfollowed: ProfileSummary[];
|
|
161
|
+
};
|
|
162
|
+
export type FetchLeaderboardOptions = {
|
|
163
|
+
sort?: 'pnl' | 'winRate' | 'roi';
|
|
164
|
+
chains?: string[];
|
|
165
|
+
limit?: number;
|
|
166
|
+
};
|
|
167
|
+
export type FetchTraderProfileOptions = {
|
|
168
|
+
/** Wallet address or Clicker profile ID. */
|
|
169
|
+
addressOrId: string;
|
|
170
|
+
};
|
|
171
|
+
export type FetchPositionsOptions = {
|
|
172
|
+
/** Wallet address or Clicker profile ID. */
|
|
173
|
+
addressOrId: string;
|
|
174
|
+
chain?: string;
|
|
175
|
+
sort?: 'value' | 'latest';
|
|
176
|
+
limit?: number;
|
|
177
|
+
page?: number;
|
|
178
|
+
};
|
|
179
|
+
export type FetchFollowersOptions = {
|
|
180
|
+
/** Wallet address or Clicker profile ID. */
|
|
181
|
+
addressOrId: string;
|
|
182
|
+
};
|
|
183
|
+
export type FetchFollowingOptions = {
|
|
184
|
+
/** Wallet address or Clicker profile ID. */
|
|
185
|
+
addressOrUid: string;
|
|
186
|
+
};
|
|
187
|
+
export type FollowOptions = {
|
|
188
|
+
/** Wallet address or Clicker profile ID of the user. */
|
|
189
|
+
addressOrUid: string;
|
|
190
|
+
/** Array of wallet addresses or profile IDs to follow. */
|
|
191
|
+
targets: string[];
|
|
192
|
+
};
|
|
193
|
+
export type UnfollowOptions = {
|
|
194
|
+
/** Wallet address or Clicker profile ID of the user. */
|
|
195
|
+
addressOrUid: string;
|
|
196
|
+
/** Array of wallet addresses or profile IDs to unfollow. */
|
|
197
|
+
targets: string[];
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* State managed by the SocialController.
|
|
201
|
+
*
|
|
202
|
+
* The controller acts as a simple store — no TTL or eviction logic.
|
|
203
|
+
* The UI decides when to re-fetch; the social-api's own cache layer
|
|
204
|
+
* handles upstream rate-limiting.
|
|
205
|
+
*/
|
|
206
|
+
export type SocialControllerState = {
|
|
207
|
+
/** Cached ranked trader list from the last `updateLeaderboard` call. */
|
|
208
|
+
leaderboardEntries: LeaderboardEntry[];
|
|
209
|
+
/** Addresses the current user follows — drives Follow/Following button state. */
|
|
210
|
+
followingAddresses: string[];
|
|
211
|
+
};
|
|
212
|
+
//# 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":"AAIA;;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,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG;IAClB,uBAAuB;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAMF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,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,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,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,iFAAiF;IACjF,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"social-types.mjs","sourceRoot":"","sources":["../src/social-types.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E","sourcesContent":["// ---------------------------------------------------------------------------\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 * A single trade within a position.\n */\nexport type Trade = {\n /** \"buy\" or \"sell\". */\n direction: string;\n /** Quantity traded. */\n tokenAmount: number;\n /** USD value of the trade. */\n usdCost: number;\n /** Unix timestamp. */\n timestamp: number;\n /** On-chain transaction hash. */\n transactionHash: string;\n};\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};\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\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 tokenSymbol: string;\n tokenName: string;\n tokenAddress: string;\n chain: string;\n positionAmount: number;\n boughtUsd: number;\n soldUsd: number;\n realizedPnl: number;\n costBasis: number;\n trades: Trade[];\n lastTradeAt: number;\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};\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// 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/:addressOrUid/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/:addressOrUid/follows`.\n */\nexport type FollowResponse = {\n followed: ProfileSummary[];\n};\n\n/**\n * Response from `DELETE /v1/users/:addressOrUid/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 FetchFollowingOptions = {\n /** Wallet address or Clicker profile ID. */\n addressOrUid: string;\n};\n\nexport type FollowOptions = {\n /** Wallet address or Clicker profile ID of the user. */\n addressOrUid: string;\n /** Array of wallet addresses or profile IDs to follow. */\n targets: string[];\n};\n\nexport type UnfollowOptions = {\n /** Wallet address or Clicker profile ID of the user. */\n addressOrUid: string;\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 /** Addresses the current user follows — drives Follow/Following button state. */\n followingAddresses: string[];\n};\n"]}
|