Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hide/unhide account manager mutations #1010

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions packages/client/src/actions/accountManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ import type {
AccountManagersRequest,
AddAccountManagerRequest,
AddAccountManagerResult,
HideManagedAccountRequest,
RemoveAccountManagerRequest,
RemoveAccountManagerResult,
UnhideManagedAccountRequest,
UpdateAccountManagerRequest,
UpdateAccountManagerResult,
} from '@lens-protocol/graphql';
import {
AccountManagersQuery,
AddAccountManagerMutation,
HideManagedAccountMutation,
RemoveAccountManagerMutation,
UnhideManagedAccountMutation,
UpdateAccountManagerMutation,
} from '@lens-protocol/graphql';
import type { ResultAsync } from '@lens-protocol/types';
Expand Down Expand Up @@ -103,3 +107,43 @@ export function updateAccountManager(
): ResultAsync<UpdateAccountManagerResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(UpdateAccountManagerMutation, { request });
}

/**
* Hide a managed account.
*
* ```ts
* const result = await muteAccount(sessionClient, {
* account: evmAddress("0xe5439696f4057aF073c0FB2dc6e5e755392922e1");
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns void.
*/
export function hideManagedAccount(
client: SessionClient,
request: HideManagedAccountRequest,
): ResultAsync<void, UnexpectedError | UnauthenticatedError> {
return client.mutation(HideManagedAccountMutation, { request });
}

/**
* Unhide a managed account.
*
* ```ts
* const result = await unhideManagedAccount(sessionClient, {
* account: evmAddress("0xe5439696f4057aF073c0FB2dc6e5e755392922e1");
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns void.
*/
export function unhideManagedAccount(
client: SessionClient,
request: UnhideManagedAccountRequest,
): ResultAsync<void, UnexpectedError | UnauthenticatedError> {
return client.mutation(UnhideManagedAccountMutation, { request });
}
14 changes: 14 additions & 0 deletions packages/graphql/src/accounts/managers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,17 @@ export const UpdateAccountManagerMutation = graphql(
[UpdateAccountManagerResult],
);
export type UpdateAccountManagerRequest = RequestOf<typeof UpdateAccountManagerMutation>;

export const HideManagedAccountMutation = graphql(
`mutation HideManagedAccount($request: HideManagedAccountRequest!) {
value: hideManagedAccount(request: $request)
}`,
);
export type HideManagedAccountRequest = RequestOf<typeof HideManagedAccountMutation>;

export const UnhideManagedAccountMutation = graphql(
`mutation UnhideManagedAccount($request: UnhideManagedAccountRequest!) {
value: unhideManagedAccount(request: $request)
}`,
);
export type UnhideManagedAccountRequest = RequestOf<typeof UnhideManagedAccountMutation>;
Loading