Managed Profiles
Learn how to retrieve Profiles managed by a wallet.
A wallet can manage multiple Profiles, which can even be stored in different wallets. A manager can perform most social operations on behalf of a profile. This arrangement allows one to store the Lens Profile NFT in a secure wallet and manage it from a hot wallet. Alternatively, multiple people in an organization can operate a single shared Lens profile.
List All
One of the initial steps you may want to take is to surface all Profiles managed by a given address.
- React SDK
- JavaScript SDK
- API
The useProfilesManaged hook enables you to fetch profiles managed by a wallet.
Available in @lens-protocol/react-web and @lens-protocol/react-native
import { useProfilesManaged } from '@lens-protocol/react-web';
export function ProfilesManaged({ wallet }: { wallet: string }) { const { data: profiles, error, loading } = useProfilesManaged({ for: wallet, });
if (loading) { return <p>Loading...</p>; }
if (error) { return <p>{error}</p>; }
if (profiles.length === 0) { return <p>No profiles managed by this wallet.</p>; }
return ( <div> {profiles.map((profile) => ( // do something with the profiles ))} </div> );}
The useProfilesManaged hook yields a PaginatedReadResult<Profile[]>. For more information on pagination, refer to this guide.
Visibility
Given the permissionless nature of Lens, it's possible for any EVM address to be assigned as a manager to a profile. While this is generally done with good intentions, there could be situations where a profile is mistakenly, or without good intentions. In such cases, users may discover unexpected profiles appearing in their list of managed profiles.
This feature allows users to hide or unhide managed profiles, offering more control over their digital presence. The profile visibility status is stored off-chain.
You must be authenticated with the Profile or Wallet to use this feature. See Profile Login for more information.
Hide Managed Profile
This feature allows users to hide managed profiles.
Note: You can only hide managed profiles that you are NOT owner of.
- JavaScript SDK
- API
You can use the client.wallet.hideManagedProfile method to hide a managed profile.
The example below assume that you have a client.ts module that exports a LensClient instance, already authenticated with a Profile or Wallet.
import { client } from "./client";
await client.wallet.hideManagedProfile({ profileId: '0x123',});
Unhide Managed Profile
This feature allows users to unhide previously hidden managed profiles.
- JavaScript SDK
- API
You can use the client.wallet.unhideManagedProfile method to unhide a managed profile.
The examples below assume that you have a client.ts module that exports a LensClient instance, already authenticated with a Profile.
import { client } from "./client";
await client.wallet.unhideManagedProfile({ profileId: '0x123',});
To fetch only hidden managed profiles, you need to use the hiddenFilter parameter in the request. See the examples.
- React SDK
- JavaScript SDK
- API
import { useProfilesManaged, ManagedProfileVisibility } from '@lens-protocol/react-web';
export function ProfilesManaged({ wallet }: { wallet: string }) { const { data: profiles, error, loading } = useProfilesManaged({ for: wallet, hiddenFilter: ManagedProfileVisibility.HiddenOnly, });
// handle loading, error, and do something with hidden managed profiles}