Skip to content

Commit

Permalink
Merge pull request #1010 from lens-protocol/T-23254/js-actions-add-mi…
Browse files Browse the repository at this point in the history
…ssing-account-manager-mutations

Add hide/unhide account manager mutations
  • Loading branch information
juangm authored Dec 12, 2024
2 parents 3fec089 + a9f6526 commit bb4fbe5
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
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>;

0 comments on commit bb4fbe5

Please sign in to comment.