Skip to main content

SocialService Actions

32 actions registered.

NameDeprecated
block
createCopyTradeIntent
createSwapComment
fetchBlockedContent
fetchBlockedProfiles
fetchClosedPositions
fetchFeed
fetchFollowers
fetchFollowing
fetchLeaderboard
fetchModerationStatus
fetchMyFollowers
fetchMyFollowing
fetchOpenPositions
fetchPositionById
fetchQuoteTokens
fetchSupportedNetworks
fetchTokenFeed
fetchTraderFeed
fetchTraderFollowing
fetchTraderProfile
fetchTrendingGifs
follow
optInToLeaderboard
optOutOfLeaderboard
reactToComment
refreshNotificationPreferencesCache
removeCommentReaction
searchGifs
translateComment
unblockProfile
unfollow

SocialService:block​

Package: @metamask/social-controllers

Blocks a trader, swap comment, or reply for the current user.

Calls PUT ${baseUrl}/moderation/block. Provide exactly one of profileId, commentId, or replyId. Blocking the same target again replaces reason when one is given. The caller is identified server-side from the JWT sub claim carried in the Authorization header.

Parameters:

NameDescription
optionsOptions bag. Exactly one target, plus an optional reason.
options.profileIdProfile id (UUID) of the trader to block.
options.commentIdSwap comment to block.
options.replyIdComment reply to block.
options.reasonFree-form reason stored on the block.

Handler signature:

(options: BlockOptions) => Promise<void>

SocialService:createCopyTradeIntent​

Package: @metamask/social-controllers

Records that the current user is copying a trade from a social post, so the copy can be detected and attributed to the post's author.

Calls POST ${baseUrl}/copy-trade-intents. Send swaps before submission with the Bridge quote id, and perps right after submission with the returned order id. The endpoint is idempotent per profile, origin, and execution id: it answers 201 for a new intent and 200 with the existing one on a retry.

Parameters:

NameDescription
optionsOptions bag.
options.originComment the trade was copied from.
options.copierAccountCAIP-10 account placing the trade.
options.executionSwap quote id or perps order id.

Returns: The created or existing copy-trade intent.

Handler signature:

(options: CreateCopyTradeIntentOptions) => Promise<CopyTradeIntentResponse>

SocialService:createSwapComment​

Package: @metamask/social-controllers

Creates an author Call (user post) on one of the current user's swaps.

Calls POST ${baseUrl}/swap-comments. Identify the swap with positionUid (the positionId of a feed item or position) or, for a trade too recent to be indexed, tradeInFlight. Provide exactly one of those two fields.

Parameters:

NameDescription
optionsOptions bag.
options.commentTextMessage body of the post. May include a https://static.klipy.com/...gif file URL; social-api rejects other links.
options.sourceFree-form origin label stored on the comment.
options.positionUidPosition UUID (positionId / feed item id).
options.tradeInFlightHash, chain, and token of a swap in flight.

Returns: The created swap comment.

Handler signature:

(options: CreateSwapCommentOptions) => Promise<SwapCommentResponse>

SocialService:fetchBlockedContent​

Package: @metamask/social-controllers

Fetches comments and replies the current user has blocked.

Calls GET ${baseUrl}/moderation/blocks/content. Results are most recently blocked first, 250 per page. The caller is identified server-side from the JWT sub claim carried in the Authorization header.

Parameters:

NameDescription
optionsOptions bag.
options.cursorCursor from the previous page. Omit for the first page.

Returns: The blocked content page.

Handler signature:

(options?: FetchBlockedListOptions) => Promise<BlockedContentResponse>

SocialService:fetchBlockedProfiles​

Package: @metamask/social-controllers

Fetches traders the current user has blocked.

Calls GET ${baseUrl}/moderation/blocks/profiles. Results are most recently blocked first, 250 per page. The caller is identified server-side from the JWT sub claim carried in the Authorization header.

Parameters:

NameDescription
optionsOptions bag.
options.cursorCursor from the previous page. Omit for the first page.

Returns: The blocked profiles page.

Handler signature:

(options?: FetchBlockedListOptions) => Promise<BlockedProfilesResponse>

SocialService:fetchClosedPositions​

Package: @metamask/social-controllers

Fetches a trader's closed positions.

Calls GET ${baseUrl}/traders/${addressOrId}/positions/closed.

Parameters:

NameDescription
optionsOptions bag.
options.addressOrIdWallet address or Clicker profile ID.
options.chainFilter by chain.
options.sortSort by 'value' or 'latest'.
options.limitNumber of results per page.
options.pagePage number (1-based).

Returns: The positions response.

Handler signature:

(options: FetchPositionsOptions) => Promise<PositionsResponse>

SocialService:fetchFeed​

Package: @metamask/social-controllers

Fetches a page of the trader-activity feed.

Calls GET ${baseUrl}/feed. For the following scope the current user is identified server-side from the JWT sub claim carried in the Authorization header; the leaderboard scope is generic and shared by all users.

Cursor pagination supports infinite scroll: pass pagination.olderCursor from a prior response back as olderThan to load older items, and pagination.newerCursor as newerThan to fetch newer items.

Parameters:

NameDescription
optionsOptions bag.
options.scopefollowing (default), leaderboard, all, or trending.
options.chainsFilter by one or more chains.
options.assetIdsOnly items in any of these CAIP-19 assets. Invalid or unsupported asset ids are rejected with a 400.
options.profileIdOnly this trader's items.
options.commentedOnlyWhen true, only items with an author comment.
options.limitNumber of results per page.
options.olderThanCursor for older items (scroll down).
options.newerThanCursor for newer items (refresh).

Returns: The feed response with items and pagination cursors.

Handler signature:

(options?: FetchFeedOptions) => Promise<FeedResponse>

SocialService:fetchFollowers​

Package: @metamask/social-controllers

Fetches a trader's MetaMask followers.

Calls GET ${baseUrl}/traders/${addressOrId}/followers. Pass mutuals: true to append ?mutuals=true (profiles that follow both this trader and the authenticated user; count is the mutual total). Requires a bearer token; the trader is identified by addressOrId, not the JWT subject (see fetchMyFollowers for the current user's inbound list).

Parameters:

NameDescription
optionsOptions bag.
options.addressOrIdWallet address or Clicker profile ID.
options.mutualsWhen true, request mutual followers only.

Returns: The followers response.

Handler signature:

(options: FetchFollowersOptions) => Promise<FollowersResponse>

SocialService:fetchFollowing​

Package: @metamask/social-controllers

Fetches the list of traders the current user is following.

Calls GET ${baseUrl}/users/me/following. The caller is identified server-side from the JWT sub claim carried in the Authorization header.

Prefer fetchMyFollowing in new code (pairs with fetchMyFollowers). This method is unchanged and remains the /users/me/following read.

Returns: The following response.

Handler signature:

() => Promise<FollowingResponse>

SocialService:fetchLeaderboard​

Package: @metamask/social-controllers

Fetches the leaderboard of top traders.

Calls GET ${baseUrl}/leaderboard.

Parameters:

NameDescription
optionsOptional query parameters for sorting, chain filtering, and limit.

Returns: The leaderboard response with ranked traders.

Handler signature:

(options?: FetchLeaderboardOptions) => Promise<LeaderboardResponse>

SocialService:fetchModerationStatus​

Package: @metamask/social-controllers

Fetches whether the moderation team has banned the current user.

Calls GET ${baseUrl}/moderation/status. The caller is identified server-side from the JWT sub claim carried in the Authorization header.

Returns: The current user's ban status, with the reason they may be shown.

Handler signature:

() => Promise<ModerationStatusResponse>

SocialService:fetchMyFollowers​

Package: @metamask/social-controllers

Fetches the list of traders following the current user.

Calls GET ${baseUrl}/users/me/followers. The caller is identified server-side from the JWT sub claim carried in the Authorization header.

Returns: The followers response.

Handler signature:

() => Promise<FollowersResponse>

SocialService:fetchMyFollowing​

Package: @metamask/social-controllers

Fetches the list of traders the current user is following.

Alias of fetchFollowing. Calls GET ${baseUrl}/users/me/following. Preferred name in new code so /users/me reads are both fetchMy*.

Returns: The following response.

Handler signature:

() => Promise<FollowingResponse>

SocialService:fetchOpenPositions​

Package: @metamask/social-controllers

Fetches a trader's open positions.

Calls GET ${baseUrl}/traders/${addressOrId}/positions/open.

Parameters:

NameDescription
optionsOptions bag.
options.addressOrIdWallet address or Clicker profile ID.
options.chainFilter by chain.
options.sortSort by 'value' or 'latest'.
options.limitNumber of results per page.
options.pagePage number (1-based).

Returns: The positions response.

Handler signature:

(options: FetchPositionsOptions) => Promise<PositionsResponse>

SocialService:fetchPositionById​

Package: @metamask/social-controllers

Fetches a single position by its unique ID.

Calls GET ${baseUrl}/traders/position/${positionId}.

Parameters:

NameDescription
optionsOptions bag.
options.positionIdUnique position ID (UUID).

Returns: The position.

Handler signature:

(options: FetchPositionByIdOptions) => Promise<Position>

SocialService:fetchQuoteTokens​

Package: @metamask/social-controllers

Fetches native, wrapped native, and stablecoin assets that do not produce indexed positions.

Calls GET ${baseUrl}/tokens/quote-tokens.

Returns: CAIP-19 ids grouped by asset category.

Handler signature:

() => Promise<QuoteTokensResponse>

SocialService:fetchSupportedNetworks​

Package: @metamask/social-controllers

Fetches the networks social-api supports.

Calls GET ${baseUrl}/supportedNetworks.

Returns: CAIP-2 chain ids, split into fully and partially supported.

Handler signature:

() => Promise<SupportedNetworksResponse>

SocialService:fetchTokenFeed​

Package: @metamask/social-controllers

Fetches a page of positions in one token, most recently traded first.

Calls GET ${baseUrl}/tokens/${chain}/${contractAddress}/feed. Unlike fetchFeed, this is scoped to a single token and does not accept scope or chains. Omit status to include both open and recently closed positions.

The route is public, but the Authorization header is still sent so the social-api can hydrate authorComment.engagement.userReaction for the signed-in viewer.

Cursor pagination supports infinite scroll: pass pagination.olderCursor from a prior response back as olderThan to load older items, and pagination.newerCursor as newerThan to fetch newer items.

Parameters:

NameDescription
optionsOptions bag.
options.chainChain name where the token is deployed (TokenFeedChain).
options.contractAddressToken contract address.
options.statusopen, closed, or omit for both.
options.limitNumber of results per page.
options.olderThanCursor for older items (scroll down).
options.newerThanCursor for newer items (refresh).

Returns: The feed response with items and pagination cursors.

Handler signature:

(options: FetchTokenFeedOptions) => Promise<FeedResponse>

SocialService:fetchTraderFeed​

Package: @metamask/social-controllers

Fetches a page of one trader's activity as feed items.

Calls GET ${baseUrl}/traders/${addressOrId}/feed. Unlike fetchFeed, this is scoped to a single profile (open and closed positions in the feed) and does not accept scope or chains. Set commentedOnly to only return positions that carry an author comment.

The route is public, but the Authorization header is still sent so the social-api can hydrate authorComment.engagement.userReaction for the signed-in viewer.

Cursor pagination supports infinite scroll: pass pagination.olderCursor from a prior response back as olderThan to load older items, and pagination.newerCursor as newerThan to fetch newer items.

Parameters:

NameDescription
optionsOptions bag.
options.addressOrIdWallet address or Clicker profile ID.
options.commentedOnlyWhen true, only positions with a comment.
options.limitNumber of results per page.
options.olderThanCursor for older items (scroll down).
options.newerThanCursor for newer items (refresh).

Returns: The feed response with items and pagination cursors.

Handler signature:

(options: FetchTraderFeedOptions) => Promise<FeedResponse>

SocialService:fetchTraderFollowing​

Package: @metamask/social-controllers

Fetches the list of traders a profile follows.

Calls GET ${baseUrl}/traders/${addressOrId}/following. Requires a bearer token; the trader is identified by addressOrId, not the JWT subject (see fetchFollowing for the current user's outbound list).

Parameters:

NameDescription
optionsOptions bag.
options.addressOrIdWallet address or Clicker profile ID.

Returns: The following response.

Handler signature:

(options: FetchTraderFollowingOptions) => Promise<FollowingResponse>

SocialService:fetchTraderProfile​

Package: @metamask/social-controllers

Fetches a trader's profile by address or profile ID.

Calls GET ${baseUrl}/traders/${addressOrId}/profile.

profile.createdAt is optional. When present it is an ISO-8601 timestamp for when the social-api profile row was inserted.

Parameters:

NameDescription
optionsOptions bag.
options.addressOrIdWallet address or Clicker profile ID.

Returns: The trader profile response.

Handler signature:

(options: FetchTraderProfileOptions) => Promise<TraderProfileResponse>

SocialService:fetchTrendingGifs​

Package: @metamask/social-controllers

Fetches a page of trending GIFs through the social-api GIF proxy.

Calls GET ${baseUrl}/gifs/trending. Query parameters are forwarded unchanged, and the return value is the provider page itself.

Parameters:

NameDescription
paramsProvider query parameters (page, per_page, locale, content_filter, format_filter, and any others the caller sets).

Returns: The GIF page response.

Handler signature:

(params?: GifQueryParams) => Promise<GifPageResponse>

SocialService:follow​

Package: @metamask/social-controllers

Follows one or more traders on behalf of the current user.

Calls PUT ${baseUrl}/users/me/follows. The caller is identified server-side from the JWT sub claim carried in the Authorization header.

Parameters:

NameDescription
optionsOptions bag.
options.targetsArray of wallet addresses or profile IDs to follow.

Returns: The follow response with confirmed follows.

Handler signature:

(options: FollowOptions) => Promise<FollowResponse>

SocialService:optInToLeaderboard​

Package: @metamask/social-controllers

Opts the current user back into the PnL leaderboard.

Handler signature:

() => Promise<void>

SocialService:optOutOfLeaderboard​

Package: @metamask/social-controllers

Opts the current user out of the PnL leaderboard.

Handler signature:

() => Promise<void>

SocialService:reactToComment​

Package: @metamask/social-controllers

Adds or replaces the current user's reaction on a swap comment (Call).

Calls PUT ${baseUrl}/swap-comment/${commentId}/reaction. One emotion per user per comment: a later PUT replaces the previous emotion.

Parameters:

NameDescription
optionsOptions bag.
options.commentIdauthorComment.uid from a feed item.
options.emotionEmoji or short code to store.

Returns: Refreshed per-emotion counts and the caller's userReaction.

Handler signature:

(options: ReactToCommentOptions) => Promise<CommentEngagement>

SocialService:refreshNotificationPreferencesCache​

Package: @metamask/social-controllers

Asks the social-api to refresh its cached copy of the current user's notification preferences.

Calls POST ${baseUrl}/notifications/preferences/cache-refresh. The caller is identified server-side from the JWT sub claim carried in the Authorization header, so it can only ever refresh its own entry.

The client calls this immediately after writing a preference change to Authenticated User Storage (AUS), which is the source of truth. The social api re-reads from AUS and repopulates its cache so the change is honoured near-instantly rather than after the cache TTL lapses. It is a pure optimisation on top of that bounded TTL: the write has already succeeded by the time this runs, so callers should treat it as best-effort and must not roll back the AUS write if it fails.

Handler signature:

() => Promise<void>

SocialService:removeCommentReaction​

Package: @metamask/social-controllers

Removes the current user's reaction on a swap comment (Call).

Calls DELETE ${baseUrl}/swap-comment/${commentId}/reaction. Idempotent when the caller has never reacted.

Parameters:

NameDescription
optionsOptions bag.
options.commentIdauthorComment.uid from a feed item.

Returns: Refreshed per-emotion counts and a null userReaction.

Handler signature:

(options: RemoveCommentReactionOptions) => Promise<CommentEngagement>

SocialService:searchGifs​

Package: @metamask/social-controllers

Searches GIFs through the social-api GIF proxy.

Calls GET ${baseUrl}/gifs/search. Query parameters are forwarded unchanged, and the return value is the provider page itself.

Parameters:

NameDescription
paramsProvider query parameters. q is the search text.

Returns: The GIF page response.

Handler signature:

(params?: GifQueryParams) => Promise<GifPageResponse>

SocialService:translateComment​

Package: @metamask/social-controllers

Requests a translation of a swap comment (Call).

Calls POST ${baseUrl}/swap-comment/${commentId}/translate. social-api does not expose this route yet, so a missing route rejects with SocialServiceErrorMessage.TRANSLATE_COMMENT_FAILED. SocialController.translateComment logs that case.

Parameters:

NameDescription
optionsOptions bag.
options.commentIdauthorComment.uid from a feed item.
options.targetLanguageAWS language code to translate into, for example en.

Returns: The detected source language and stored translations.

Handler signature:

(options: TranslateCommentOptions) => Promise<CommentTranslation>

SocialService:unblockProfile​

Package: @metamask/social-controllers

Removes the current user's block on a trader.

Calls DELETE ${baseUrl}/moderation/blocks/profiles/${profileId}. Unblocking a trader who is not blocked is a no-op. The caller is identified server-side from the JWT sub claim carried in the Authorization header.

Parameters:

NameDescription
optionsOptions bag.
options.profileIdProfile id (UUID) of the trader to unblock.

Handler signature:

({ profileId }: UnblockProfileOptions) => Promise<void>

SocialService:unfollow​

Package: @metamask/social-controllers

Unfollows one or more traders on behalf of the current user.

Calls DELETE ${baseUrl}/users/me/follows?targets=.... Targets are sent as query params because Fastify does not parse request bodies on DELETE requests per RFC 9110. The caller is identified server-side from the JWT sub claim carried in the Authorization header.

Parameters:

NameDescription
optionsOptions bag.
options.targetsArray of wallet addresses or profile IDs to unfollow.

Returns: The unfollow response with confirmed unfollows.

Handler signature:

(options: UnfollowOptions) => Promise<UnfollowResponse>