@metamask-previews/social-controllers 3.10.0-preview-520b89c2f → 3.10.0-preview-4ed55e998
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 +8 -0
- package/dist/SocialRealtimeService.d.ts +2 -2
- package/dist/SocialRealtimeService.d.ts.map +1 -1
- package/dist/SocialRealtimeService.js +2 -2
- package/dist/SocialRealtimeService.js.map +1 -1
- package/dist/SocialService-method-action-types.d.ts +1 -3
- package/dist/SocialService-method-action-types.d.ts.map +1 -1
- package/dist/SocialService-method-action-types.js.map +1 -1
- package/dist/SocialService.d.ts +1 -3
- package/dist/SocialService.d.ts.map +1 -1
- package/dist/SocialService.js +1 -3
- package/dist/SocialService.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/realtime-feed-item.d.ts +5 -0
- package/dist/realtime-feed-item.d.ts.map +1 -0
- package/dist/realtime-feed-item.js +212 -0
- package/dist/realtime-feed-item.js.map +1 -0
- package/dist/structs.d.ts +2 -77
- package/dist/structs.d.ts.map +1 -1
- package/dist/structs.js +2 -26
- package/dist/structs.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Add support for Node.js 26 ([#10981](https://github.com/MetaMask/core/pull/10981))
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Normalize full hydrated Social feed events into `FeedItem` data for direct client hydration ([#10986](https://github.com/MetaMask/core/pull/10986)).
|
|
17
|
+
|
|
10
18
|
## [3.10.0]
|
|
11
19
|
|
|
12
20
|
### Added
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BackendWebSocketServiceMessenger } from '@metamask/core-backend';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RealtimeFeedEventData } from './realtime-feed-item.js';
|
|
3
3
|
export declare const SOCIAL_FEED_CHANNELS: {
|
|
4
4
|
readonly all: 'social.v1.feed.all';
|
|
5
5
|
readonly trending: 'social.v1.feed.trending';
|
|
@@ -13,7 +13,7 @@ export type SocialFeedEvent = {
|
|
|
13
13
|
feedItemId: string;
|
|
14
14
|
revision: number;
|
|
15
15
|
occurredAt: string;
|
|
16
|
-
data:
|
|
16
|
+
data: RealtimeFeedEventData;
|
|
17
17
|
};
|
|
18
18
|
export type SocialFeedEventListener = (event: SocialFeedEvent, scope: SocialFeedRealtimeScope) => void;
|
|
19
19
|
export type SocialFeedReconnectListener = () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SocialRealtimeService.d.ts","sourceRoot":"","sources":["../src/SocialRealtimeService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gCAAgC,EAGjC,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"SocialRealtimeService.d.ts","sourceRoot":"","sources":["../src/SocialRealtimeService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gCAAgC,EAGjC,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAErE,eAAO,MAAM,oBAAoB;aAC/B,GAAG,EAAE,oBAAoB;aACzB,QAAQ,EAAE,yBAAyB;CAC3B,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,MAAM,OAAO,oBAAoB,CAAC;AAExE,eAAO,MAAM,wBAAwB,EAAG,WAAoB,CAAC;AAE7D,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,CAAC,CAAC;IACX,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,qBAAqB,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,CACpC,KAAK,EAAE,eAAe,EACtB,KAAK,EAAE,uBAAuB,KAC3B,IAAI,CAAC;AACV,MAAM,MAAM,2BAA2B,GAAG,MAAM,IAAI,CAAC;AAErD,MAAM,MAAM,4BAA4B,GAAG;IACzC,SAAS,EAAE,gCAAgC,CAAC;IAC5C,MAAM,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;CAC3B,CAAC;AAmDF;;;;;GAKG;AACH,qBAAa,qBAAqB;;IAChC,QAAQ,CAAC,IAAI,EAAG,uBAAuB,CAAU;IA4BjD,YAAY,EACV,SAAS,EACT,MAAM,EACN,SAA+B,GAChC,EAAE,4BAA4B,EA6B9B;IAED,WAAW,CAAC,QAAQ,EAAE,uBAAuB,GAAG,MAAM,IAAI,CAGzD;IAED,oBAAoB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,MAAM,IAAI,CAGtE;IAEK,SAAS,CAAC,MAAM,EAAE,SAAS,uBAAuB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBzE;IA4BK,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAU9C;CAuJF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebSocketState } from '@metamask/core-backend';
|
|
2
|
-
import {
|
|
2
|
+
import { parseRealtimeFeedItem } from './realtime-feed-item.js';
|
|
3
3
|
export const SOCIAL_FEED_CHANNELS = {
|
|
4
4
|
all: 'social.v1.feed.all',
|
|
5
5
|
trending: 'social.v1.feed.trending',
|
|
@@ -18,7 +18,7 @@ const parseSocialFeedEvent = (data) => {
|
|
|
18
18
|
if (!isRecord(data)) {
|
|
19
19
|
return undefined;
|
|
20
20
|
}
|
|
21
|
-
const feedItem =
|
|
21
|
+
const feedItem = parseRealtimeFeedItem(data.data);
|
|
22
22
|
if (data.version !== 1 ||
|
|
23
23
|
data.kind !== 'feed-item' ||
|
|
24
24
|
typeof data.eventId !== 'string' ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SocialRealtimeService.js","sourceRoot":"","sources":["../src/SocialRealtimeService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAOxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAG3D,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,GAAG,EAAE,oBAAoB;IACzB,QAAQ,EAAE,yBAAyB;CAC3B,CAAC;AAIX,MAAM,CAAC,MAAM,wBAAwB,GAAG,WAAoB,CAAC;AAwB7D,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AAE9C,MAAM,eAAe,GAAG,CACtB,MAA0C,EACf,EAAE;IAC7B,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACxC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CACtB,OAAe,EACsB,EAAE,CACtC,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,IAAI,CACxC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,OAAO,CACjC,EAAE,CAAC,CAAC,CAAyC,IAAI,SAAS,CAAC;AAE9D,MAAM,oBAAoB,GAAG,CAAC,IAAa,EAA+B,EAAE;IAC1E,IAAI,CAAC,QAAQ,CAAC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CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACzD,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { WebSocketState } from '@metamask/core-backend';\nimport type {\n BackendWebSocketServiceMessenger,\n ServerNotificationMessage,\n WebSocketSubscription,\n} from '@metamask/core-backend';\n\nimport { parseSocialRealtimeFeedItem } from './structs.js';\nimport type { SocialRealtimeFeedItem } from './structs.js';\n\nexport const SOCIAL_FEED_CHANNELS = {\n all: 'social.v1.feed.all',\n trending: 'social.v1.feed.trending',\n} as const;\n\nexport type SocialFeedRealtimeScope = keyof typeof SOCIAL_FEED_CHANNELS;\n\nexport const SOCIAL_FEED_CHANNEL_TYPE = 'social.v1' as const;\n\nexport type SocialFeedEvent = {\n version: 1;\n kind: 'feed-item';\n eventId: string;\n feedItemId: string;\n revision: number;\n occurredAt: string;\n data: SocialRealtimeFeedItem;\n};\n\nexport type SocialFeedEventListener = (\n event: SocialFeedEvent,\n scope: SocialFeedRealtimeScope,\n) => void;\nexport type SocialFeedReconnectListener = () => void;\n\nexport type SocialRealtimeServiceOptions = {\n messenger: BackendWebSocketServiceMessenger;\n scopes: readonly SocialFeedRealtimeScope[];\n isEnabled?: () => boolean;\n};\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null;\n\nconst normalizeScopes = (\n scopes: readonly SocialFeedRealtimeScope[],\n): SocialFeedRealtimeScope[] => {\n const normalized = [...new Set(scopes)];\n if (normalized.length === 0) {\n throw new Error('At least one Social feed scope is required');\n }\n return normalized;\n};\n\nconst scopeForChannel = (\n channel: string,\n): SocialFeedRealtimeScope | undefined =>\n (Object.entries(SOCIAL_FEED_CHANNELS).find(\n ([, value]) => value === channel,\n )?.[0] as SocialFeedRealtimeScope | undefined) ?? undefined;\n\nconst parseSocialFeedEvent = (data: unknown): SocialFeedEvent | undefined => {\n if (!isRecord(data)) {\n return undefined;\n }\n\n const feedItem = parseSocialRealtimeFeedItem(data.data);\n if (\n data.version !== 1 ||\n data.kind !== 'feed-item' ||\n typeof data.eventId !== 'string' ||\n typeof data.feedItemId !== 'string' ||\n typeof data.revision !== 'number' ||\n typeof data.occurredAt !== 'string' ||\n feedItem === undefined\n ) {\n return undefined;\n }\n\n return { ...data, data: feedItem } as unknown as SocialFeedEvent;\n};\n\nconst parseSocialFeedEvents = (data: unknown): SocialFeedEvent[] => {\n const entries = Array.isArray(data) ? data : [data];\n\n return entries\n .map((entry) => parseSocialFeedEvent(entry))\n .filter((event): event is SocialFeedEvent => event !== undefined);\n};\n\n/**\n * Social realtime subscription service built on the shared backend WebSocket.\n *\n * Clients explicitly select one or more global feed scopes. Additional Social\n * channels can be added here without creating another WebSocket connection.\n */\nexport class SocialRealtimeService {\n readonly name = 'SocialRealtimeService' as const;\n\n readonly #messenger: BackendWebSocketServiceMessenger;\n\n readonly #listeners = new Set<SocialFeedEventListener>();\n\n readonly #reconnectListeners = new Set<SocialFeedReconnectListener>();\n\n readonly #isEnabled: () => boolean;\n\n #scopes: SocialFeedRealtimeScope[];\n\n #scopeUpdatePromise: Promise<void> | undefined;\n\n #active = false;\n\n #subscription: WebSocketSubscription | undefined;\n\n #subscriptionToken: symbol | undefined;\n\n #subscriptionPromise: Promise<void> | undefined;\n\n readonly #pendingUnsubscriptions = new Set<WebSocketSubscription>();\n\n #connectionVersion = 0;\n\n #wasDisconnected = false;\n\n constructor({\n messenger,\n scopes,\n isEnabled = (): boolean => true,\n }: SocialRealtimeServiceOptions) {\n this.#messenger = messenger;\n this.#scopes = normalizeScopes(scopes);\n this.#isEnabled = isEnabled;\n\n this.#messenger.subscribe(\n 'BackendWebSocketService:connectionStateChanged',\n ({ state }: { state: WebSocketState }): void => {\n if (state === WebSocketState.DISCONNECTED) {\n this.#connectionVersion += 1;\n this.#subscription = undefined;\n this.#subscriptionToken = undefined;\n this.#wasDisconnected = true;\n }\n\n if (state === WebSocketState.CONNECTED && this.#active) {\n const isReconnect = this.#wasDisconnected;\n this.#wasDisconnected = false;\n // eslint-disable-next-line no-void\n void this.#subscribeToFeed()\n .then(() => {\n if (isReconnect) {\n this.#reconnectListeners.forEach((listener) => listener());\n }\n })\n .catch(() => undefined);\n }\n },\n );\n }\n\n addListener(listener: SocialFeedEventListener): () => void {\n this.#listeners.add(listener);\n return () => this.#listeners.delete(listener);\n }\n\n addReconnectListener(listener: SocialFeedReconnectListener): () => void {\n this.#reconnectListeners.add(listener);\n return () => this.#reconnectListeners.delete(listener);\n }\n\n async setScopes(scopes: readonly SocialFeedRealtimeScope[]): Promise<void> {\n const normalizedScopes = normalizeScopes(scopes);\n\n const scopeUpdate = this.#scopeUpdatePromise\n ? this.#scopeUpdatePromise\n .catch(() => undefined)\n .then(() => this.#applyScopes(normalizedScopes))\n : this.#applyScopes(normalizedScopes);\n this.#scopeUpdatePromise = scopeUpdate;\n\n try {\n await scopeUpdate;\n } finally {\n if (this.#scopeUpdatePromise === scopeUpdate) {\n this.#scopeUpdatePromise = Promise.resolve();\n }\n }\n }\n\n async #applyScopes(\n normalizedScopes: SocialFeedRealtimeScope[],\n ): Promise<void> {\n if (!this.#active) {\n this.#scopes = normalizedScopes;\n return;\n }\n\n const previousScopes = this.#scopes;\n const connectionVersion = this.#connectionVersion;\n this.#scopes = normalizedScopes;\n\n try {\n await this.#resubscribeToFeed();\n } catch (error) {\n if (\n this.#active &&\n this.#connectionVersion === connectionVersion &&\n this.#subscription\n ) {\n this.#scopes = previousScopes;\n }\n throw error;\n }\n }\n\n async setActive(active: boolean): Promise<void> {\n this.#active = active && this.#isEnabled();\n\n if (!this.#active) {\n await this.#unsubscribeFromFeed();\n return;\n }\n\n await this.#retryPendingUnsubscriptions();\n await this.#subscribeToFeed();\n }\n\n async #subscribeToFeed(): Promise<void> {\n if (!this.#active || this.#subscription) {\n return;\n }\n\n while (this.#subscriptionPromise) {\n await this.#subscriptionPromise;\n\n if (!this.#active || this.#subscription) {\n return;\n }\n }\n\n const subscriptionPromise = Promise.resolve().then(\n async (): Promise<void> => {\n await this.#messenger.call('BackendWebSocketService:connect');\n\n const subscriptionToken = Symbol('social-feed-subscription');\n\n // Each service needs its own callback and subscription lifecycle.\n const subscription = await this.#messenger.call(\n 'BackendWebSocketService:subscribe',\n {\n channels: this.#scopes.map((scope) => SOCIAL_FEED_CHANNELS[scope]),\n channelType: SOCIAL_FEED_CHANNEL_TYPE,\n callback: (notification: ServerNotificationMessage) => {\n if (this.#subscriptionToken !== subscriptionToken) {\n return;\n }\n this.#handleNotification(notification);\n },\n },\n );\n\n if (!this.#active) {\n await subscription.unsubscribe();\n return;\n }\n\n this.#subscription = subscription;\n this.#subscriptionToken = subscriptionToken;\n },\n );\n this.#subscriptionPromise = subscriptionPromise;\n\n try {\n await subscriptionPromise;\n } finally {\n this.#subscriptionPromise = undefined;\n }\n }\n\n async #resubscribeToFeed(): Promise<void> {\n while (this.#subscriptionPromise) {\n await this.#subscriptionPromise;\n }\n\n await this.#retryPendingUnsubscriptions();\n\n const existingSubscription = this.#subscription;\n const existingSubscriptionToken = this.#subscriptionToken;\n const connectionVersion = this.#connectionVersion;\n this.#subscription = undefined;\n\n try {\n await this.#subscribeToFeed();\n } catch (error) {\n if (this.#active && this.#connectionVersion === connectionVersion) {\n this.#subscription = existingSubscription;\n this.#subscriptionToken = existingSubscriptionToken;\n } else {\n this.#subscription = undefined;\n this.#subscriptionToken = undefined;\n\n if (existingSubscription) {\n try {\n await existingSubscription.unsubscribe();\n } catch {\n this.#pendingUnsubscriptions.add(existingSubscription);\n }\n }\n }\n throw error;\n }\n\n const replacementSubscription = this.#subscription as\n | WebSocketSubscription\n | undefined;\n if (existingSubscription && existingSubscription !== this.#subscription) {\n try {\n await existingSubscription.unsubscribe();\n } catch (error) {\n if (this.#active && this.#connectionVersion === connectionVersion) {\n this.#subscription = existingSubscription;\n this.#subscriptionToken = existingSubscriptionToken;\n } else {\n this.#subscription = undefined;\n this.#subscriptionToken = undefined;\n this.#pendingUnsubscriptions.add(existingSubscription);\n }\n\n if (replacementSubscription) {\n try {\n await replacementSubscription.unsubscribe();\n } catch {\n this.#pendingUnsubscriptions.add(replacementSubscription);\n }\n }\n\n throw error;\n }\n }\n }\n\n async #unsubscribeFromFeed(): Promise<void> {\n const subscription = this.#subscription;\n this.#subscription = undefined;\n this.#subscriptionToken = undefined;\n\n try {\n if (subscription) {\n await subscription.unsubscribe();\n }\n } finally {\n await this.#retryPendingUnsubscriptions();\n }\n }\n\n async #retryPendingUnsubscriptions(): Promise<void> {\n for (const subscription of this.#pendingUnsubscriptions) {\n try {\n await subscription.unsubscribe();\n this.#pendingUnsubscriptions.delete(subscription);\n } catch {\n // Keep the subscription queued for a later cleanup attempt.\n }\n }\n }\n\n #handleNotification(notification: ServerNotificationMessage): void {\n const scope = scopeForChannel(notification.channel);\n if (!scope || !this.#scopes.includes(scope)) {\n return;\n }\n\n parseSocialFeedEvents(notification.data).forEach((event) => {\n this.#listeners.forEach((listener) => listener(event, scope));\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SocialRealtimeService.js","sourceRoot":"","sources":["../src/SocialRealtimeService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAOxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,GAAG,EAAE,oBAAoB;IACzB,QAAQ,EAAE,yBAAyB;CAC3B,CAAC;AAIX,MAAM,CAAC,MAAM,wBAAwB,GAAG,WAAoB,CAAC;AAwB7D,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AAE9C,MAAM,eAAe,GAAG,CACtB,MAA0C,EACf,EAAE;I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AAC;IAED,KAAK,CAAC,4BAA4B;QAChC,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,uBAAuB,EAAE,CAAC;YACxD,IAAI,CAAC;gBACH,MAAM,YAAY,CAAC,WAAW,EAAE,CAAC;gBACjC,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACpD,CAAC;YAAC,MAAM,CAAC;gBACP,4DAA4D;YAC9D,CAAC;QACH,CAAC;IACH,CAAC;IAED,mBAAmB,CAAC,YAAuC;QACzD,MAAM,KAAK,GAAG,eAAe,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5C,OAAO;QACT,CAAC;QAED,qBAAqB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACzD,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { WebSocketState } from '@metamask/core-backend';\nimport type {\n BackendWebSocketServiceMessenger,\n ServerNotificationMessage,\n WebSocketSubscription,\n} from '@metamask/core-backend';\n\nimport { parseRealtimeFeedItem } from './realtime-feed-item.js';\nimport type { RealtimeFeedEventData } from './realtime-feed-item.js';\n\nexport const SOCIAL_FEED_CHANNELS = {\n all: 'social.v1.feed.all',\n trending: 'social.v1.feed.trending',\n} as const;\n\nexport type SocialFeedRealtimeScope = keyof typeof SOCIAL_FEED_CHANNELS;\n\nexport const SOCIAL_FEED_CHANNEL_TYPE = 'social.v1' as const;\n\nexport type SocialFeedEvent = {\n version: 1;\n kind: 'feed-item';\n eventId: string;\n feedItemId: string;\n revision: number;\n occurredAt: string;\n data: RealtimeFeedEventData;\n};\n\nexport type SocialFeedEventListener = (\n event: SocialFeedEvent,\n scope: SocialFeedRealtimeScope,\n) => void;\nexport type SocialFeedReconnectListener = () => void;\n\nexport type SocialRealtimeServiceOptions = {\n messenger: BackendWebSocketServiceMessenger;\n scopes: readonly SocialFeedRealtimeScope[];\n isEnabled?: () => boolean;\n};\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null;\n\nconst normalizeScopes = (\n scopes: readonly SocialFeedRealtimeScope[],\n): SocialFeedRealtimeScope[] => {\n const normalized = [...new Set(scopes)];\n if (normalized.length === 0) {\n throw new Error('At least one Social feed scope is required');\n }\n return normalized;\n};\n\nconst scopeForChannel = (\n channel: string,\n): SocialFeedRealtimeScope | undefined =>\n (Object.entries(SOCIAL_FEED_CHANNELS).find(\n ([, value]) => value === channel,\n )?.[0] as SocialFeedRealtimeScope | undefined) ?? undefined;\n\nconst parseSocialFeedEvent = (data: unknown): SocialFeedEvent | undefined => {\n if (!isRecord(data)) {\n return undefined;\n }\n\n const feedItem = parseRealtimeFeedItem(data.data);\n if (\n data.version !== 1 ||\n data.kind !== 'feed-item' ||\n typeof data.eventId !== 'string' ||\n typeof data.feedItemId !== 'string' ||\n typeof data.revision !== 'number' ||\n typeof data.occurredAt !== 'string' ||\n feedItem === undefined\n ) {\n return undefined;\n }\n\n return { ...data, data: feedItem } as unknown as SocialFeedEvent;\n};\n\nconst parseSocialFeedEvents = (data: unknown): SocialFeedEvent[] => {\n const entries = Array.isArray(data) ? data : [data];\n\n return entries\n .map((entry) => parseSocialFeedEvent(entry))\n .filter((event): event is SocialFeedEvent => event !== undefined);\n};\n\n/**\n * Social realtime subscription service built on the shared backend WebSocket.\n *\n * Clients explicitly select one or more global feed scopes. Additional Social\n * channels can be added here without creating another WebSocket connection.\n */\nexport class SocialRealtimeService {\n readonly name = 'SocialRealtimeService' as const;\n\n readonly #messenger: BackendWebSocketServiceMessenger;\n\n readonly #listeners = new Set<SocialFeedEventListener>();\n\n readonly #reconnectListeners = new Set<SocialFeedReconnectListener>();\n\n readonly #isEnabled: () => boolean;\n\n #scopes: SocialFeedRealtimeScope[];\n\n #scopeUpdatePromise: Promise<void> | undefined;\n\n #active = false;\n\n #subscription: WebSocketSubscription | undefined;\n\n #subscriptionToken: symbol | undefined;\n\n #subscriptionPromise: Promise<void> | undefined;\n\n readonly #pendingUnsubscriptions = new Set<WebSocketSubscription>();\n\n #connectionVersion = 0;\n\n #wasDisconnected = false;\n\n constructor({\n messenger,\n scopes,\n isEnabled = (): boolean => true,\n }: SocialRealtimeServiceOptions) {\n this.#messenger = messenger;\n this.#scopes = normalizeScopes(scopes);\n this.#isEnabled = isEnabled;\n\n this.#messenger.subscribe(\n 'BackendWebSocketService:connectionStateChanged',\n ({ state }: { state: WebSocketState }): void => {\n if (state === WebSocketState.DISCONNECTED) {\n this.#connectionVersion += 1;\n this.#subscription = undefined;\n this.#subscriptionToken = undefined;\n this.#wasDisconnected = true;\n }\n\n if (state === WebSocketState.CONNECTED && this.#active) {\n const isReconnect = this.#wasDisconnected;\n this.#wasDisconnected = false;\n // eslint-disable-next-line no-void\n void this.#subscribeToFeed()\n .then(() => {\n if (isReconnect) {\n this.#reconnectListeners.forEach((listener) => listener());\n }\n })\n .catch(() => undefined);\n }\n },\n );\n }\n\n addListener(listener: SocialFeedEventListener): () => void {\n this.#listeners.add(listener);\n return () => this.#listeners.delete(listener);\n }\n\n addReconnectListener(listener: SocialFeedReconnectListener): () => void {\n this.#reconnectListeners.add(listener);\n return () => this.#reconnectListeners.delete(listener);\n }\n\n async setScopes(scopes: readonly SocialFeedRealtimeScope[]): Promise<void> {\n const normalizedScopes = normalizeScopes(scopes);\n\n const scopeUpdate = this.#scopeUpdatePromise\n ? this.#scopeUpdatePromise\n .catch(() => undefined)\n .then(() => this.#applyScopes(normalizedScopes))\n : this.#applyScopes(normalizedScopes);\n this.#scopeUpdatePromise = scopeUpdate;\n\n try {\n await scopeUpdate;\n } finally {\n if (this.#scopeUpdatePromise === scopeUpdate) {\n this.#scopeUpdatePromise = Promise.resolve();\n }\n }\n }\n\n async #applyScopes(\n normalizedScopes: SocialFeedRealtimeScope[],\n ): Promise<void> {\n if (!this.#active) {\n this.#scopes = normalizedScopes;\n return;\n }\n\n const previousScopes = this.#scopes;\n const connectionVersion = this.#connectionVersion;\n this.#scopes = normalizedScopes;\n\n try {\n await this.#resubscribeToFeed();\n } catch (error) {\n if (\n this.#active &&\n this.#connectionVersion === connectionVersion &&\n this.#subscription\n ) {\n this.#scopes = previousScopes;\n }\n throw error;\n }\n }\n\n async setActive(active: boolean): Promise<void> {\n this.#active = active && this.#isEnabled();\n\n if (!this.#active) {\n await this.#unsubscribeFromFeed();\n return;\n }\n\n await this.#retryPendingUnsubscriptions();\n await this.#subscribeToFeed();\n }\n\n async #subscribeToFeed(): Promise<void> {\n if (!this.#active || this.#subscription) {\n return;\n }\n\n while (this.#subscriptionPromise) {\n await this.#subscriptionPromise;\n\n if (!this.#active || this.#subscription) {\n return;\n }\n }\n\n const subscriptionPromise = Promise.resolve().then(\n async (): Promise<void> => {\n await this.#messenger.call('BackendWebSocketService:connect');\n\n const subscriptionToken = Symbol('social-feed-subscription');\n\n // Each service needs its own callback and subscription lifecycle.\n const subscription = await this.#messenger.call(\n 'BackendWebSocketService:subscribe',\n {\n channels: this.#scopes.map((scope) => SOCIAL_FEED_CHANNELS[scope]),\n channelType: SOCIAL_FEED_CHANNEL_TYPE,\n callback: (notification: ServerNotificationMessage) => {\n if (this.#subscriptionToken !== subscriptionToken) {\n return;\n }\n this.#handleNotification(notification);\n },\n },\n );\n\n if (!this.#active) {\n await subscription.unsubscribe();\n return;\n }\n\n this.#subscription = subscription;\n this.#subscriptionToken = subscriptionToken;\n },\n );\n this.#subscriptionPromise = subscriptionPromise;\n\n try {\n await subscriptionPromise;\n } finally {\n this.#subscriptionPromise = undefined;\n }\n }\n\n async #resubscribeToFeed(): Promise<void> {\n while (this.#subscriptionPromise) {\n await this.#subscriptionPromise;\n }\n\n await this.#retryPendingUnsubscriptions();\n\n const existingSubscription = this.#subscription;\n const existingSubscriptionToken = this.#subscriptionToken;\n const connectionVersion = this.#connectionVersion;\n this.#subscription = undefined;\n\n try {\n await this.#subscribeToFeed();\n } catch (error) {\n if (this.#active && this.#connectionVersion === connectionVersion) {\n this.#subscription = existingSubscription;\n this.#subscriptionToken = existingSubscriptionToken;\n } else {\n this.#subscription = undefined;\n this.#subscriptionToken = undefined;\n\n if (existingSubscription) {\n try {\n await existingSubscription.unsubscribe();\n } catch {\n this.#pendingUnsubscriptions.add(existingSubscription);\n }\n }\n }\n throw error;\n }\n\n const replacementSubscription = this.#subscription as\n | WebSocketSubscription\n | undefined;\n if (existingSubscription && existingSubscription !== this.#subscription) {\n try {\n await existingSubscription.unsubscribe();\n } catch (error) {\n if (this.#active && this.#connectionVersion === connectionVersion) {\n this.#subscription = existingSubscription;\n this.#subscriptionToken = existingSubscriptionToken;\n } else {\n this.#subscription = undefined;\n this.#subscriptionToken = undefined;\n this.#pendingUnsubscriptions.add(existingSubscription);\n }\n\n if (replacementSubscription) {\n try {\n await replacementSubscription.unsubscribe();\n } catch {\n this.#pendingUnsubscriptions.add(replacementSubscription);\n }\n }\n\n throw error;\n }\n }\n }\n\n async #unsubscribeFromFeed(): Promise<void> {\n const subscription = this.#subscription;\n this.#subscription = undefined;\n this.#subscriptionToken = undefined;\n\n try {\n if (subscription) {\n await subscription.unsubscribe();\n }\n } finally {\n await this.#retryPendingUnsubscriptions();\n }\n }\n\n async #retryPendingUnsubscriptions(): Promise<void> {\n for (const subscription of this.#pendingUnsubscriptions) {\n try {\n await subscription.unsubscribe();\n this.#pendingUnsubscriptions.delete(subscription);\n } catch {\n // Keep the subscription queued for a later cleanup attempt.\n }\n }\n }\n\n #handleNotification(notification: ServerNotificationMessage): void {\n const scope = scopeForChannel(notification.channel);\n if (!scope || !this.#scopes.includes(scope)) {\n return;\n }\n\n parseSocialFeedEvents(notification.data).forEach((event) => {\n this.#listeners.forEach((listener) => listener(event, scope));\n });\n }\n}\n"]}
|
|
@@ -234,9 +234,7 @@ export type SocialServiceRemoveCommentReactionAction = {
|
|
|
234
234
|
* `https://static.klipy.com/...gif` file URL; social-api rejects other links.
|
|
235
235
|
* @param options.source - Free-form origin label stored on the comment.
|
|
236
236
|
* @param options.positionUid - Position UUID (`positionId` / feed item id).
|
|
237
|
-
* @param options.tradeInFlight - Hash, chain, and token of a swap in flight
|
|
238
|
-
* or a Hyperliquid `orderId`, chain, and coin when the fill hash does not
|
|
239
|
-
* exist yet. Provide exactly one of `transactionHash` or `orderId`.
|
|
237
|
+
* @param options.tradeInFlight - Hash, chain, and token of a swap in flight.
|
|
240
238
|
* @returns The created swap comment.
|
|
241
239
|
*/
|
|
242
240
|
export type SocialServiceCreateSwapCommentAction = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SocialService-method-action-types.d.ts","sourceRoot":"","sources":["../src/SocialService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAA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,CAAC;IAC5C,OAAO,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;CACjD,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"SocialService-method-action-types.d.ts","sourceRoot":"","sources":["../src/SocialService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;CAC1C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CA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AAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAClC,mCAAmC,GACnC,qCAAqC,GACrC,qCAAqC,GACrC,uCAAuC,GACvC,iCAAiC,GACjC,uCAAuC,GACvC,oCAAoC,GACpC,4BAA4B,GAC5B,kCAAkC,GAClC,iCAAiC,GACjC,iCAAiC,GACjC,wCAAwC,GACxC,oCAAoC,GACpC,wCAAwC,GACxC,iCAAiC,GACjC,mCAAmC,GACnC,mCAAmC,GACnC,yBAAyB,GACzB,2BAA2B,GAC3B,sCAAsC,GACtC,qCAAqC,GACrC,sDAAsD,GACtD,wBAAwB,GACxB,uCAAuC,GACvC,sCAAsC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SocialService-method-action-types.js","sourceRoot":"","sources":["../src/SocialService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SocialService } from './SocialService.js';\n\n/**\n * Fetches the leaderboard of top traders.\n *\n * Calls `GET ${baseUrl}/leaderboard`.\n *\n * @param options - Optional query parameters for sorting, chain filtering, and limit.\n * @returns The leaderboard response with ranked traders.\n */\nexport type SocialServiceFetchLeaderboardAction = {\n type: `SocialService:fetchLeaderboard`;\n handler: SocialService['fetchLeaderboard'];\n};\n\n/**\n * Fetches a trader's profile by address or profile ID.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/profile`.\n *\n * `profile.createdAt` is optional. When present it is an ISO-8601 timestamp\n * for when the social-api profile row was inserted.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @returns The trader profile response.\n */\nexport type SocialServiceFetchTraderProfileAction = {\n type: `SocialService:fetchTraderProfile`;\n handler: SocialService['fetchTraderProfile'];\n};\n\n/**\n * Fetches a trader's open positions.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/positions/open`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.chain - Filter by chain.\n * @param options.sort - Sort by 'value' or 'latest'.\n * @param options.limit - Number of results per page.\n * @param options.page - Page number (1-based).\n * @returns The positions response.\n */\nexport type SocialServiceFetchOpenPositionsAction = {\n type: `SocialService:fetchOpenPositions`;\n handler: SocialService['fetchOpenPositions'];\n};\n\n/**\n * Fetches a trader's closed positions.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/positions/closed`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.chain - Filter by chain.\n * @param options.sort - Sort by 'value' or 'latest'.\n * @param options.limit - Number of results per page.\n * @param options.page - Page number (1-based).\n * @returns The positions response.\n */\nexport type SocialServiceFetchClosedPositionsAction = {\n type: `SocialService:fetchClosedPositions`;\n handler: SocialService['fetchClosedPositions'];\n};\n\n/**\n * Fetches a trader's MetaMask followers.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/followers`. Pass\n * `mutuals: true` to append `?mutuals=true` (profiles that follow both this\n * trader and the authenticated user; `count` is the mutual total). Requires a\n * bearer token; the trader is identified by `addressOrId`, not the JWT\n * subject (see {@link fetchMyFollowers} for the current user's inbound list).\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.mutuals - When true, request mutual followers only.\n * @returns The followers response.\n */\nexport type SocialServiceFetchFollowersAction = {\n type: `SocialService:fetchFollowers`;\n handler: SocialService['fetchFollowers'];\n};\n\n/**\n * Fetches the list of traders a profile follows.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/following`. Requires a bearer\n * token; the trader is identified by `addressOrId`, not the JWT subject (see\n * {@link fetchFollowing} for the current user's outbound list).\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @returns The following response.\n */\nexport type SocialServiceFetchTraderFollowingAction = {\n type: `SocialService:fetchTraderFollowing`;\n handler: SocialService['fetchTraderFollowing'];\n};\n\n/**\n * Fetches a single position by its unique ID.\n *\n * Calls `GET ${baseUrl}/traders/position/${positionId}`.\n *\n * @param options - Options bag.\n * @param options.positionId - Unique position ID (UUID).\n * @returns The position.\n */\nexport type SocialServiceFetchPositionByIdAction = {\n type: `SocialService:fetchPositionById`;\n handler: SocialService['fetchPositionById'];\n};\n\n/**\n * Fetches a page of the trader-activity feed.\n *\n * Calls `GET ${baseUrl}/feed`. For the `following` scope the current user is\n * identified server-side from the JWT sub claim carried in the Authorization\n * header; the `leaderboard` scope is generic and shared by all users.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.scope - `following` (default), `leaderboard`, `all`, or\n * `trending`.\n * @param options.chains - Filter by one or more chains.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\nexport type SocialServiceFetchFeedAction = {\n type: `SocialService:fetchFeed`;\n handler: SocialService['fetchFeed'];\n};\n\n/**\n * Fetches a page of one trader's activity as feed items.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/feed`. Unlike {@link fetchFeed},\n * this is scoped to a single profile (open and closed positions in the feed)\n * and does not accept `scope` or `chains`. Set `commentedOnly` to only return\n * positions that carry an author comment.\n *\n * The route is public, but the Authorization header is still sent so the\n * social-api can hydrate `authorComment.engagement.userReaction` for the\n * signed-in viewer.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.commentedOnly - When true, only positions with a comment.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\nexport type SocialServiceFetchTraderFeedAction = {\n type: `SocialService:fetchTraderFeed`;\n handler: SocialService['fetchTraderFeed'];\n};\n\n/**\n * Fetches a page of positions in one token, most recently traded first.\n *\n * Calls `GET ${baseUrl}/tokens/${chain}/${contractAddress}/feed`. Unlike\n * {@link fetchFeed}, this is scoped to a single token and does not accept\n * `scope` or `chains`. Omit `status` to include both open and recently\n * closed positions.\n *\n * The route is public, but the Authorization header is still sent so the\n * social-api can hydrate `authorComment.engagement.userReaction` for the\n * signed-in viewer.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.chain - Chain name where the token is deployed (`TokenFeedChain`).\n * @param options.contractAddress - Token contract address.\n * @param options.status - `open`, `closed`, or omit for both.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\nexport type SocialServiceFetchTokenFeedAction = {\n type: `SocialService:fetchTokenFeed`;\n handler: SocialService['fetchTokenFeed'];\n};\n\n/**\n * Adds or replaces the current user's reaction on a swap comment (Call).\n *\n * Calls `PUT ${baseUrl}/swap-comment/${commentId}/reaction`. One emotion per\n * user per comment: a later PUT replaces the previous emotion.\n *\n * @param options - Options bag.\n * @param options.commentId - `authorComment.uid` from a feed item.\n * @param options.emotion - Emoji or short code to store.\n * @returns Refreshed per-emotion counts and the caller's `userReaction`.\n */\nexport type SocialServiceReactToCommentAction = {\n type: `SocialService:reactToComment`;\n handler: SocialService['reactToComment'];\n};\n\n/**\n * Removes the current user's reaction on a swap comment (Call).\n *\n * Calls `DELETE ${baseUrl}/swap-comment/${commentId}/reaction`. Idempotent\n * when the caller has never reacted.\n *\n * @param options - Options bag.\n * @param options.commentId - `authorComment.uid` from a feed item.\n * @returns Refreshed per-emotion counts and a null `userReaction`.\n */\nexport type SocialServiceRemoveCommentReactionAction = {\n type: `SocialService:removeCommentReaction`;\n handler: SocialService['removeCommentReaction'];\n};\n\n/**\n * Creates an author Call (user post) on one of the current user's swaps.\n *\n * Calls `POST ${baseUrl}/swap-comments`. Identify the swap with\n * `positionUid` (the `positionId` of a feed item or position) or, for a\n * trade too recent to be indexed, `tradeInFlight`. Provide exactly one of\n * those two fields.\n *\n * @param options - Options bag.\n * @param options.commentText - Message body of the post. May include a\n * `https://static.klipy.com/...gif` file URL; social-api rejects other links.\n * @param options.source - Free-form origin label stored on the comment.\n * @param options.positionUid - Position UUID (`positionId` / feed item id).\n * @param options.tradeInFlight - Hash, chain, and token of a swap in flight,\n * or a Hyperliquid `orderId`, chain, and coin when the fill hash does not\n * exist yet. Provide exactly one of `transactionHash` or `orderId`.\n * @returns The created swap comment.\n */\nexport type SocialServiceCreateSwapCommentAction = {\n type: `SocialService:createSwapComment`;\n handler: SocialService['createSwapComment'];\n};\n\n/**\n * Records that the current user is copying a trade from a social post, so\n * the copy can be detected and attributed to the post's author.\n *\n * Calls `POST ${baseUrl}/copy-trade-intents`. Send swaps before submission\n * with the Bridge quote id, and perps right after submission with the\n * returned order id. The endpoint is idempotent per profile, origin, and\n * execution id: it answers 201 for a new intent and 200 with the existing\n * one on a retry.\n *\n * @param options - Options bag.\n * @param options.origin - Comment the trade was copied from.\n * @param options.copierAccount - CAIP-10 account placing the trade.\n * @param options.execution - Swap quote id or perps order id.\n * @returns The created or existing copy-trade intent.\n */\nexport type SocialServiceCreateCopyTradeIntentAction = {\n type: `SocialService:createCopyTradeIntent`;\n handler: SocialService['createCopyTradeIntent'];\n};\n\n/**\n * Fetches the list of traders the current user is following.\n *\n * Calls `GET ${baseUrl}/users/me/following`. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * Prefer {@link fetchMyFollowing} in new code (pairs with\n * {@link fetchMyFollowers}). This method is unchanged and remains the\n * `/users/me/following` read.\n *\n * @returns The following response.\n */\nexport type SocialServiceFetchFollowingAction = {\n type: `SocialService:fetchFollowing`;\n handler: SocialService['fetchFollowing'];\n};\n\n/**\n * Fetches the list of traders the current user is following.\n *\n * Alias of {@link fetchFollowing}. Calls `GET ${baseUrl}/users/me/following`.\n * Preferred name in new code so `/users/me` reads are both `fetchMy*`.\n *\n * @returns The following response.\n */\nexport type SocialServiceFetchMyFollowingAction = {\n type: `SocialService:fetchMyFollowing`;\n handler: SocialService['fetchMyFollowing'];\n};\n\n/**\n * Fetches the list of traders following the current user.\n *\n * Calls `GET ${baseUrl}/users/me/followers`. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @returns The followers response.\n */\nexport type SocialServiceFetchMyFollowersAction = {\n type: `SocialService:fetchMyFollowers`;\n handler: SocialService['fetchMyFollowers'];\n};\n\n/**\n * Follows one or more traders on behalf of the current user.\n *\n * Calls `PUT ${baseUrl}/users/me/follows`. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.targets - Array of wallet addresses or profile IDs to follow.\n * @returns The follow response with confirmed follows.\n */\nexport type SocialServiceFollowAction = {\n type: `SocialService:follow`;\n handler: SocialService['follow'];\n};\n\n/**\n * Unfollows one or more traders on behalf of the current user.\n *\n * Calls `DELETE ${baseUrl}/users/me/follows?targets=...`. Targets are sent\n * as query params because Fastify does not parse request bodies on DELETE\n * requests per RFC 9110. The caller is identified server-side from the JWT\n * sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.targets - Array of wallet addresses or profile IDs to unfollow.\n * @returns The unfollow response with confirmed unfollows.\n */\nexport type SocialServiceUnfollowAction = {\n type: `SocialService:unfollow`;\n handler: SocialService['unfollow'];\n};\n\n/**\n * Opts the current user out of the PnL leaderboard.\n */\nexport type SocialServiceOptOutOfLeaderboardAction = {\n type: `SocialService:optOutOfLeaderboard`;\n handler: SocialService['optOutOfLeaderboard'];\n};\n\n/**\n * Opts the current user back into the PnL leaderboard.\n */\nexport type SocialServiceOptInToLeaderboardAction = {\n type: `SocialService:optInToLeaderboard`;\n handler: SocialService['optInToLeaderboard'];\n};\n\n/**\n * Asks the social-api to refresh its cached copy of the current user's\n * notification preferences.\n *\n * Calls `POST ${baseUrl}/notifications/preferences/cache-refresh`. The caller\n * is identified server-side from the JWT sub claim carried in the\n * Authorization header, so it can only ever refresh its own entry.\n *\n * The client calls this immediately after writing a preference change to\n * Authenticated User Storage (AUS), which is the source of truth. The social\n * api re-reads from AUS and repopulates its cache so the change is honoured\n * near-instantly rather than after the cache TTL lapses. It is a pure\n * optimisation on top of that bounded TTL: the write has already succeeded by\n * the time this runs, so callers should treat it as best-effort and must not\n * roll back the AUS write if it fails.\n */\nexport type SocialServiceRefreshNotificationPreferencesCacheAction = {\n type: `SocialService:refreshNotificationPreferencesCache`;\n handler: SocialService['refreshNotificationPreferencesCache'];\n};\n\n/**\n * Blocks a trader, swap comment, or reply for the current user.\n *\n * Calls `PUT ${baseUrl}/moderation/block`. Provide exactly one of\n * `profileId`, `commentId`, or `replyId`. Blocking the same target again\n * replaces `reason` when one is given. The caller is identified server-side\n * from the JWT sub claim carried in the Authorization header.\n *\n * @param options - Options bag. Exactly one target, plus an optional reason.\n * @param options.profileId - Profile id (UUID) of the trader to block.\n * @param options.commentId - Swap comment to block.\n * @param options.replyId - Comment reply to block.\n * @param options.reason - Free-form reason stored on the block.\n */\nexport type SocialServiceBlockAction = {\n type: `SocialService:block`;\n handler: SocialService['block'];\n};\n\n/**\n * Fetches traders the current user has blocked.\n *\n * Calls `GET ${baseUrl}/moderation/blocks/profiles`. Results are most\n * recently blocked first, 250 per page. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.cursor - Cursor from the previous page. Omit for the first page.\n * @returns The blocked profiles page.\n */\nexport type SocialServiceFetchBlockedProfilesAction = {\n type: `SocialService:fetchBlockedProfiles`;\n handler: SocialService['fetchBlockedProfiles'];\n};\n\n/**\n * Fetches comments and replies the current user has blocked.\n *\n * Calls `GET ${baseUrl}/moderation/blocks/content`. Results are most\n * recently blocked first, 250 per page. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.cursor - Cursor from the previous page. Omit for the first page.\n * @returns The blocked content page.\n */\nexport type SocialServiceFetchBlockedContentAction = {\n type: `SocialService:fetchBlockedContent`;\n handler: SocialService['fetchBlockedContent'];\n};\n\n/**\n * Union of all SocialService action types.\n */\nexport type SocialServiceMethodActions =\n | SocialServiceFetchLeaderboardAction\n | SocialServiceFetchTraderProfileAction\n | SocialServiceFetchOpenPositionsAction\n | SocialServiceFetchClosedPositionsAction\n | SocialServiceFetchFollowersAction\n | SocialServiceFetchTraderFollowingAction\n | SocialServiceFetchPositionByIdAction\n | SocialServiceFetchFeedAction\n | SocialServiceFetchTraderFeedAction\n | SocialServiceFetchTokenFeedAction\n | SocialServiceReactToCommentAction\n | SocialServiceRemoveCommentReactionAction\n | SocialServiceCreateSwapCommentAction\n | SocialServiceCreateCopyTradeIntentAction\n | SocialServiceFetchFollowingAction\n | SocialServiceFetchMyFollowingAction\n | SocialServiceFetchMyFollowersAction\n | SocialServiceFollowAction\n | SocialServiceUnfollowAction\n | SocialServiceOptOutOfLeaderboardAction\n | SocialServiceOptInToLeaderboardAction\n | SocialServiceRefreshNotificationPreferencesCacheAction\n | SocialServiceBlockAction\n | SocialServiceFetchBlockedProfilesAction\n | SocialServiceFetchBlockedContentAction;\n"]}
|
|
1
|
+
{"version":3,"file":"SocialService-method-action-types.js","sourceRoot":"","sources":["../src/SocialService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SocialService } from './SocialService.js';\n\n/**\n * Fetches the leaderboard of top traders.\n *\n * Calls `GET ${baseUrl}/leaderboard`.\n *\n * @param options - Optional query parameters for sorting, chain filtering, and limit.\n * @returns The leaderboard response with ranked traders.\n */\nexport type SocialServiceFetchLeaderboardAction = {\n type: `SocialService:fetchLeaderboard`;\n handler: SocialService['fetchLeaderboard'];\n};\n\n/**\n * Fetches a trader's profile by address or profile ID.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/profile`.\n *\n * `profile.createdAt` is optional. When present it is an ISO-8601 timestamp\n * for when the social-api profile row was inserted.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @returns The trader profile response.\n */\nexport type SocialServiceFetchTraderProfileAction = {\n type: `SocialService:fetchTraderProfile`;\n handler: SocialService['fetchTraderProfile'];\n};\n\n/**\n * Fetches a trader's open positions.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/positions/open`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.chain - Filter by chain.\n * @param options.sort - Sort by 'value' or 'latest'.\n * @param options.limit - Number of results per page.\n * @param options.page - Page number (1-based).\n * @returns The positions response.\n */\nexport type SocialServiceFetchOpenPositionsAction = {\n type: `SocialService:fetchOpenPositions`;\n handler: SocialService['fetchOpenPositions'];\n};\n\n/**\n * Fetches a trader's closed positions.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/positions/closed`.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.chain - Filter by chain.\n * @param options.sort - Sort by 'value' or 'latest'.\n * @param options.limit - Number of results per page.\n * @param options.page - Page number (1-based).\n * @returns The positions response.\n */\nexport type SocialServiceFetchClosedPositionsAction = {\n type: `SocialService:fetchClosedPositions`;\n handler: SocialService['fetchClosedPositions'];\n};\n\n/**\n * Fetches a trader's MetaMask followers.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/followers`. Pass\n * `mutuals: true` to append `?mutuals=true` (profiles that follow both this\n * trader and the authenticated user; `count` is the mutual total). Requires a\n * bearer token; the trader is identified by `addressOrId`, not the JWT\n * subject (see {@link fetchMyFollowers} for the current user's inbound list).\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.mutuals - When true, request mutual followers only.\n * @returns The followers response.\n */\nexport type SocialServiceFetchFollowersAction = {\n type: `SocialService:fetchFollowers`;\n handler: SocialService['fetchFollowers'];\n};\n\n/**\n * Fetches the list of traders a profile follows.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/following`. Requires a bearer\n * token; the trader is identified by `addressOrId`, not the JWT subject (see\n * {@link fetchFollowing} for the current user's outbound list).\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @returns The following response.\n */\nexport type SocialServiceFetchTraderFollowingAction = {\n type: `SocialService:fetchTraderFollowing`;\n handler: SocialService['fetchTraderFollowing'];\n};\n\n/**\n * Fetches a single position by its unique ID.\n *\n * Calls `GET ${baseUrl}/traders/position/${positionId}`.\n *\n * @param options - Options bag.\n * @param options.positionId - Unique position ID (UUID).\n * @returns The position.\n */\nexport type SocialServiceFetchPositionByIdAction = {\n type: `SocialService:fetchPositionById`;\n handler: SocialService['fetchPositionById'];\n};\n\n/**\n * Fetches a page of the trader-activity feed.\n *\n * Calls `GET ${baseUrl}/feed`. For the `following` scope the current user is\n * identified server-side from the JWT sub claim carried in the Authorization\n * header; the `leaderboard` scope is generic and shared by all users.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.scope - `following` (default), `leaderboard`, `all`, or\n * `trending`.\n * @param options.chains - Filter by one or more chains.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\nexport type SocialServiceFetchFeedAction = {\n type: `SocialService:fetchFeed`;\n handler: SocialService['fetchFeed'];\n};\n\n/**\n * Fetches a page of one trader's activity as feed items.\n *\n * Calls `GET ${baseUrl}/traders/${addressOrId}/feed`. Unlike {@link fetchFeed},\n * this is scoped to a single profile (open and closed positions in the feed)\n * and does not accept `scope` or `chains`. Set `commentedOnly` to only return\n * positions that carry an author comment.\n *\n * The route is public, but the Authorization header is still sent so the\n * social-api can hydrate `authorComment.engagement.userReaction` for the\n * signed-in viewer.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.addressOrId - Wallet address or Clicker profile ID.\n * @param options.commentedOnly - When true, only positions with a comment.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\nexport type SocialServiceFetchTraderFeedAction = {\n type: `SocialService:fetchTraderFeed`;\n handler: SocialService['fetchTraderFeed'];\n};\n\n/**\n * Fetches a page of positions in one token, most recently traded first.\n *\n * Calls `GET ${baseUrl}/tokens/${chain}/${contractAddress}/feed`. Unlike\n * {@link fetchFeed}, this is scoped to a single token and does not accept\n * `scope` or `chains`. Omit `status` to include both open and recently\n * closed positions.\n *\n * The route is public, but the Authorization header is still sent so the\n * social-api can hydrate `authorComment.engagement.userReaction` for the\n * signed-in viewer.\n *\n * Cursor pagination supports infinite scroll: pass `pagination.olderCursor`\n * from a prior response back as `olderThan` to load older items, and\n * `pagination.newerCursor` as `newerThan` to fetch newer items.\n *\n * @param options - Options bag.\n * @param options.chain - Chain name where the token is deployed (`TokenFeedChain`).\n * @param options.contractAddress - Token contract address.\n * @param options.status - `open`, `closed`, or omit for both.\n * @param options.limit - Number of results per page.\n * @param options.olderThan - Cursor for older items (scroll down).\n * @param options.newerThan - Cursor for newer items (refresh).\n * @returns The feed response with items and pagination cursors.\n */\nexport type SocialServiceFetchTokenFeedAction = {\n type: `SocialService:fetchTokenFeed`;\n handler: SocialService['fetchTokenFeed'];\n};\n\n/**\n * Adds or replaces the current user's reaction on a swap comment (Call).\n *\n * Calls `PUT ${baseUrl}/swap-comment/${commentId}/reaction`. One emotion per\n * user per comment: a later PUT replaces the previous emotion.\n *\n * @param options - Options bag.\n * @param options.commentId - `authorComment.uid` from a feed item.\n * @param options.emotion - Emoji or short code to store.\n * @returns Refreshed per-emotion counts and the caller's `userReaction`.\n */\nexport type SocialServiceReactToCommentAction = {\n type: `SocialService:reactToComment`;\n handler: SocialService['reactToComment'];\n};\n\n/**\n * Removes the current user's reaction on a swap comment (Call).\n *\n * Calls `DELETE ${baseUrl}/swap-comment/${commentId}/reaction`. Idempotent\n * when the caller has never reacted.\n *\n * @param options - Options bag.\n * @param options.commentId - `authorComment.uid` from a feed item.\n * @returns Refreshed per-emotion counts and a null `userReaction`.\n */\nexport type SocialServiceRemoveCommentReactionAction = {\n type: `SocialService:removeCommentReaction`;\n handler: SocialService['removeCommentReaction'];\n};\n\n/**\n * Creates an author Call (user post) on one of the current user's swaps.\n *\n * Calls `POST ${baseUrl}/swap-comments`. Identify the swap with\n * `positionUid` (the `positionId` of a feed item or position) or, for a\n * trade too recent to be indexed, `tradeInFlight`. Provide exactly one of\n * those two fields.\n *\n * @param options - Options bag.\n * @param options.commentText - Message body of the post. May include a\n * `https://static.klipy.com/...gif` file URL; social-api rejects other links.\n * @param options.source - Free-form origin label stored on the comment.\n * @param options.positionUid - Position UUID (`positionId` / feed item id).\n * @param options.tradeInFlight - Hash, chain, and token of a swap in flight.\n * @returns The created swap comment.\n */\nexport type SocialServiceCreateSwapCommentAction = {\n type: `SocialService:createSwapComment`;\n handler: SocialService['createSwapComment'];\n};\n\n/**\n * Records that the current user is copying a trade from a social post, so\n * the copy can be detected and attributed to the post's author.\n *\n * Calls `POST ${baseUrl}/copy-trade-intents`. Send swaps before submission\n * with the Bridge quote id, and perps right after submission with the\n * returned order id. The endpoint is idempotent per profile, origin, and\n * execution id: it answers 201 for a new intent and 200 with the existing\n * one on a retry.\n *\n * @param options - Options bag.\n * @param options.origin - Comment the trade was copied from.\n * @param options.copierAccount - CAIP-10 account placing the trade.\n * @param options.execution - Swap quote id or perps order id.\n * @returns The created or existing copy-trade intent.\n */\nexport type SocialServiceCreateCopyTradeIntentAction = {\n type: `SocialService:createCopyTradeIntent`;\n handler: SocialService['createCopyTradeIntent'];\n};\n\n/**\n * Fetches the list of traders the current user is following.\n *\n * Calls `GET ${baseUrl}/users/me/following`. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * Prefer {@link fetchMyFollowing} in new code (pairs with\n * {@link fetchMyFollowers}). This method is unchanged and remains the\n * `/users/me/following` read.\n *\n * @returns The following response.\n */\nexport type SocialServiceFetchFollowingAction = {\n type: `SocialService:fetchFollowing`;\n handler: SocialService['fetchFollowing'];\n};\n\n/**\n * Fetches the list of traders the current user is following.\n *\n * Alias of {@link fetchFollowing}. Calls `GET ${baseUrl}/users/me/following`.\n * Preferred name in new code so `/users/me` reads are both `fetchMy*`.\n *\n * @returns The following response.\n */\nexport type SocialServiceFetchMyFollowingAction = {\n type: `SocialService:fetchMyFollowing`;\n handler: SocialService['fetchMyFollowing'];\n};\n\n/**\n * Fetches the list of traders following the current user.\n *\n * Calls `GET ${baseUrl}/users/me/followers`. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @returns The followers response.\n */\nexport type SocialServiceFetchMyFollowersAction = {\n type: `SocialService:fetchMyFollowers`;\n handler: SocialService['fetchMyFollowers'];\n};\n\n/**\n * Follows one or more traders on behalf of the current user.\n *\n * Calls `PUT ${baseUrl}/users/me/follows`. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.targets - Array of wallet addresses or profile IDs to follow.\n * @returns The follow response with confirmed follows.\n */\nexport type SocialServiceFollowAction = {\n type: `SocialService:follow`;\n handler: SocialService['follow'];\n};\n\n/**\n * Unfollows one or more traders on behalf of the current user.\n *\n * Calls `DELETE ${baseUrl}/users/me/follows?targets=...`. Targets are sent\n * as query params because Fastify does not parse request bodies on DELETE\n * requests per RFC 9110. The caller is identified server-side from the JWT\n * sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.targets - Array of wallet addresses or profile IDs to unfollow.\n * @returns The unfollow response with confirmed unfollows.\n */\nexport type SocialServiceUnfollowAction = {\n type: `SocialService:unfollow`;\n handler: SocialService['unfollow'];\n};\n\n/**\n * Opts the current user out of the PnL leaderboard.\n */\nexport type SocialServiceOptOutOfLeaderboardAction = {\n type: `SocialService:optOutOfLeaderboard`;\n handler: SocialService['optOutOfLeaderboard'];\n};\n\n/**\n * Opts the current user back into the PnL leaderboard.\n */\nexport type SocialServiceOptInToLeaderboardAction = {\n type: `SocialService:optInToLeaderboard`;\n handler: SocialService['optInToLeaderboard'];\n};\n\n/**\n * Asks the social-api to refresh its cached copy of the current user's\n * notification preferences.\n *\n * Calls `POST ${baseUrl}/notifications/preferences/cache-refresh`. The caller\n * is identified server-side from the JWT sub claim carried in the\n * Authorization header, so it can only ever refresh its own entry.\n *\n * The client calls this immediately after writing a preference change to\n * Authenticated User Storage (AUS), which is the source of truth. The social\n * api re-reads from AUS and repopulates its cache so the change is honoured\n * near-instantly rather than after the cache TTL lapses. It is a pure\n * optimisation on top of that bounded TTL: the write has already succeeded by\n * the time this runs, so callers should treat it as best-effort and must not\n * roll back the AUS write if it fails.\n */\nexport type SocialServiceRefreshNotificationPreferencesCacheAction = {\n type: `SocialService:refreshNotificationPreferencesCache`;\n handler: SocialService['refreshNotificationPreferencesCache'];\n};\n\n/**\n * Blocks a trader, swap comment, or reply for the current user.\n *\n * Calls `PUT ${baseUrl}/moderation/block`. Provide exactly one of\n * `profileId`, `commentId`, or `replyId`. Blocking the same target again\n * replaces `reason` when one is given. The caller is identified server-side\n * from the JWT sub claim carried in the Authorization header.\n *\n * @param options - Options bag. Exactly one target, plus an optional reason.\n * @param options.profileId - Profile id (UUID) of the trader to block.\n * @param options.commentId - Swap comment to block.\n * @param options.replyId - Comment reply to block.\n * @param options.reason - Free-form reason stored on the block.\n */\nexport type SocialServiceBlockAction = {\n type: `SocialService:block`;\n handler: SocialService['block'];\n};\n\n/**\n * Fetches traders the current user has blocked.\n *\n * Calls `GET ${baseUrl}/moderation/blocks/profiles`. Results are most\n * recently blocked first, 250 per page. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.cursor - Cursor from the previous page. Omit for the first page.\n * @returns The blocked profiles page.\n */\nexport type SocialServiceFetchBlockedProfilesAction = {\n type: `SocialService:fetchBlockedProfiles`;\n handler: SocialService['fetchBlockedProfiles'];\n};\n\n/**\n * Fetches comments and replies the current user has blocked.\n *\n * Calls `GET ${baseUrl}/moderation/blocks/content`. Results are most\n * recently blocked first, 250 per page. The caller is identified\n * server-side from the JWT sub claim carried in the Authorization header.\n *\n * @param options - Options bag.\n * @param options.cursor - Cursor from the previous page. Omit for the first page.\n * @returns The blocked content page.\n */\nexport type SocialServiceFetchBlockedContentAction = {\n type: `SocialService:fetchBlockedContent`;\n handler: SocialService['fetchBlockedContent'];\n};\n\n/**\n * Union of all SocialService action types.\n */\nexport type SocialServiceMethodActions =\n | SocialServiceFetchLeaderboardAction\n | SocialServiceFetchTraderProfileAction\n | SocialServiceFetchOpenPositionsAction\n | SocialServiceFetchClosedPositionsAction\n | SocialServiceFetchFollowersAction\n | SocialServiceFetchTraderFollowingAction\n | SocialServiceFetchPositionByIdAction\n | SocialServiceFetchFeedAction\n | SocialServiceFetchTraderFeedAction\n | SocialServiceFetchTokenFeedAction\n | SocialServiceReactToCommentAction\n | SocialServiceRemoveCommentReactionAction\n | SocialServiceCreateSwapCommentAction\n | SocialServiceCreateCopyTradeIntentAction\n | SocialServiceFetchFollowingAction\n | SocialServiceFetchMyFollowingAction\n | SocialServiceFetchMyFollowersAction\n | SocialServiceFollowAction\n | SocialServiceUnfollowAction\n | SocialServiceOptOutOfLeaderboardAction\n | SocialServiceOptInToLeaderboardAction\n | SocialServiceRefreshNotificationPreferencesCacheAction\n | SocialServiceBlockAction\n | SocialServiceFetchBlockedProfilesAction\n | SocialServiceFetchBlockedContentAction;\n"]}
|
package/dist/SocialService.d.ts
CHANGED
|
@@ -216,9 +216,7 @@ export declare class SocialService extends BaseDataService<typeof serviceName, S
|
|
|
216
216
|
* `https://static.klipy.com/...gif` file URL; social-api rejects other links.
|
|
217
217
|
* @param options.source - Free-form origin label stored on the comment.
|
|
218
218
|
* @param options.positionUid - Position UUID (`positionId` / feed item id).
|
|
219
|
-
* @param options.tradeInFlight - Hash, chain, and token of a swap in flight
|
|
220
|
-
* or a Hyperliquid `orderId`, chain, and coin when the fill hash does not
|
|
221
|
-
* exist yet. Provide exactly one of `transactionHash` or `orderId`.
|
|
219
|
+
* @param options.tradeInFlight - Hash, chain, and token of a swap in flight.
|
|
222
220
|
* @returns The created swap comment.
|
|
223
221
|
*/
|
|
224
222
|
createSwapComment(options: CreateSwapCommentOptions): Promise<SwapCommentResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SocialService.d.ts","sourceRoot":"","sources":["../src/SocialService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EACnC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAE7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC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IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAkBzC;IAED;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAkBxC;IAED;;;;;;;;;;;;;;;OAeG;IACG,mCAAmC,IAAI,OAAO,CAAC,IAAI,CAAC,CAkBzD;IAED;;;;;;;;;;;;;OAaG;IACG,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBhD;IAED;;;;;;;;;;OAUG;IACG,oBAAoB,CACxB,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,uBAAuB,CAAC,CA6BlC;IAED;;;;;;;;;;OAUG;IACG,mBAAmB,CACvB,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,sBAAsB,CAAC,CA6BjC;CAqEF"}
|
package/dist/SocialService.js
CHANGED
|
@@ -511,9 +511,7 @@ export class SocialService extends BaseDataService {
|
|
|
511
511
|
* `https://static.klipy.com/...gif` file URL; social-api rejects other links.
|
|
512
512
|
* @param options.source - Free-form origin label stored on the comment.
|
|
513
513
|
* @param options.positionUid - Position UUID (`positionId` / feed item id).
|
|
514
|
-
* @param options.tradeInFlight - Hash, chain, and token of a swap in flight
|
|
515
|
-
* or a Hyperliquid `orderId`, chain, and coin when the fill hash does not
|
|
516
|
-
* exist yet. Provide exactly one of `transactionHash` or `orderId`.
|
|
514
|
+
* @param options.tradeInFlight - Hash, chain, and token of a swap in flight.
|
|
517
515
|
* @returns The created swap comment.
|
|
518
516
|
*/
|
|
519
517
|
async createSwapComment(options) {
|