SocialController Actions
8 actions registered.
| Name | Deprecated |
|---|---|
followTrader | |
getState | |
optInToLeaderboard | |
optOutOfLeaderboard | |
translateComment | |
unfollowTrader | |
updateFollowing | |
updateLeaderboard |
SocialController:followTrader
Package: @metamask/social-controllers
Follows one or more traders on behalf of the current user and updates the following list in state. The caller is identified server-side from the JWT attached by the SocialService.
Parameters:
| Name | Description |
|---|---|
options | Options bag. |
options.targets | Addresses or profile IDs to follow. |
Returns: The follow response with confirmed follows.
Handler signature:
(options: FollowOptions) => Promise<FollowResponse>
SocialController:getState
Package: @metamask/social-controllers
Handler signature:
() => SocialControllerState
SocialController:optInToLeaderboard
Package: @metamask/social-controllers
Opts the current user back into the PnL leaderboard.
Handler signature:
() => Promise<void>
SocialController:optOutOfLeaderboard
Package: @metamask/social-controllers
Opts the current user out of the PnL leaderboard.
Handler signature:
() => Promise<void>
SocialController:translateComment
Package: @metamask/social-controllers
Requests a translation of a swap comment (Call).
Calls POST ${baseUrl}/swap-comment/${commentId}/translate through
SocialService. social-api does not expose this route yet: a 404 is logged
and rethrown.
Parameters:
| Name | Description |
|---|---|
options | Options bag. |
options.commentId | authorComment.uid from a feed item. |
options.targetLanguage | AWS language code to translate into, for example en. |
Returns: The detected source language and stored translations.
Handler signature:
(options: TranslateCommentOptions) => Promise<CommentTranslation>
SocialController:unfollowTrader
Package: @metamask/social-controllers
Unfollows one or more traders on behalf of the current user and updates the following list in state. The caller is identified server-side from the JWT attached by the SocialService.
Parameters:
| Name | Description |
|---|---|
options | Options bag. |
options.targets | Addresses or profile IDs to unfollow. |
Returns: The unfollow response with confirmed unfollows.
Handler signature:
(options: UnfollowOptions) => Promise<UnfollowResponse>
SocialController:updateFollowing
Package: @metamask/social-controllers
Fetches the list of traders the current user follows and replaces the following addresses in state. The caller is identified server-side from the JWT attached by the SocialService.
Returns: The following response.
Handler signature:
() => Promise<FollowingResponse>
SocialController:updateLeaderboard
Package: @metamask/social-controllers
Fetches the leaderboard and persists the entries to state.
Parameters:
| Name | Description |
|---|---|
options | Optional leaderboard query parameters. |
Returns: The leaderboard response from the social-api.
Handler signature:
(options?: FetchLeaderboardOptions) => Promise<LeaderboardResponse>