Invites

Learn about onboarding new users to your app through claiming and inviting profiles.


Developers interested in creating new profiles should refer to the onboarding guide instead.

During the initial closed beta period, access to Lens was exclusively through invites. However, it's now possible to create new Profiles on the Mainnet without an invite.

This guide remains available for applications that continue to use invites.

Claiming Profile

A wallet that has received an invite can claim a Lens Profile, which will then be owned by that wallet.

You must be authenticated with the invited wallet. See Wallet-Only Login for more information.

The useClaimHandle hook allows you to claim a Lens Profile.

To verify a wallet's eligibility for claiming handles, use the useCanClaimHandle hook.

Upon successful claim, the useUpgradeCredentials hook can be used to upgrade from wallet-only authentication to profile authentication.

Claiming a Reserved Handle

Some invites are tied to a list of reserved handles. In such cases, the wallet can only claim one of these reserved handles.

import {  useCanClaimHandle,  useClaimHandle,  useUpgradeCredentials,} from '@lens-protocol/react-web';
export function ClaimProfileOfReservedHandle() {  const { execute, loading: claiming } = useClaimHandle();  const { data, loading, error } = useCanClaimHandle();  const { execute: upgrade } = useUpgradeCredentials();
  const claimReservedHandle = async (reserved: ReservedClaimable) => {    const result = await execute({ reserved });
    // handle TransactionError | ClaimHandleError error cases    if (result.isFailure()) {      window.alert(result.error.message);      return;    }
    // upgrade to profile session    const upgraded = await upgrade({      profileId: result.value.id,    });
    // handle errors in upgrading session    if (upgraded.isFailure()) {      window.alert(`Error upgrading session: ${upgraded.error.message}`);      return;    }
    window.alert(`Successfully claimed: ${reserved.withHandle}`);  };
  if (loading) return <p>Loading....</p>;
  if (error) return <p>Error: {error.message}</p>;
  if (data.reserved.length === 0) return <p>No reserved handles</p>;
  return (    <div>      {data.reserved.map((reserved) => (        <button key={reserved.id} disabled={claiming} onClick={() => claimReservedHandle(reserved)}>          Claim {reserved.withHandle}        </button>      ))}    </div>  );}

Claiming a Free-Text Handle

Some invites allow the wallet to claim a handle of the user's choice.

import {  useCanClaimHandle,  useClaimHandle,  useUpgradeCredentials,} from '@lens-protocol/react-web';
export function ClaimFreeTextHandle({ handle }: { handle: string }) {  const { execute, loading: claiming } = useClaimHandle();  const { data, loading, error } = useCanClaimHandle();  const { execute: upgrade } = useUpgradeCredentials();
  const claimFreeTextHandle = async (localName: string) => {    const result = await execute({ localName });
    // handle TransactionError | ClaimHandleError error cases    if (result.isFailure()) {      window.alert(result.error.message);      return;    }
    const upgraded = await upgrade({      profileId: result.value.id,    });
    // handle errors in upgrading session    if (upgraded.isFailure()) {      window.alert(`Error upgrading session: ${upgraded.error.message}`);      return;    }
    window.alert(`Successfully claimed: ${localName}`);  };
  if (loading) return <p>Loading....</p>;
  if (error) return <p>Error: {error.message}</p>;
  if (data.canMintProfileWithFreeTextHandle === false) return <p>Cannot claim free text handle</p>;
  return (    <button disabled={claiming} onClick={() => claimFreeTextHandle(handle)}>      Claim {handle}    </button>  );}

Invites

If your have been allocated a number of invites, you can use these to invite other wallets to join Lens.

You must be authenticated with the Profile that has been allocated invites. See Profile Login for more information.

The useInviteWallets hook enables you to invite one or more wallets to join Lens.

export function InviteWallet({ walletAddress }: { walletAddress: string }) {  const { execute, loading } = useInviteWallets();
  const invite = async () => {    const result = await execute({ wallets: [walletAddress] });
    if (result.isFailure()) {      window.alert(result.error.message);      return;    }
    window.alert('Wallet invited!');  };
  return (    <button onClick={invite} disabled={loading}>      Invite    </button>  );}

This methods return void or WalletAlreadyInvitedError in case of failure.