Guides

Unblock Profiles

🚧

This request is protected by authentication

hint: this means it requires an x-access-token header put in the request with your authentication token.

📘

Lens Profile Manager Compatible: Gasless & Signless

This action can be used through the Lens Profile Manager to enable a gasless and signless experience.

Unblock a Lens Profile to allow the authenticated user to interact with it again.

There are two different approaches you can use to unblock a profile. Depending on the whitelist status of your app and the settings of the profile you would like to set metadata for, you can use:

  • a) Unblock Profile via Lens Profile Manager (Gasless & Signless)
  • b) Unblock Profile Using TypedData and Broadcasting Onchain via the API (Gasless & Signed)

To decide which approach to use, you can use the following table. Please note that a profile may also have another Profile Manager enabled that is not powered by the Lens API, this is not covered below. To learn more about checking a profile's Profile Manager settings, see Profile Manager.

Is Your App Whitelisted?Profile has Lens Profiles Manager Enabled?Approach To Use
1truetrueLens Profile Manager
2truefalseTypedData & Broadcast via API
3falsetrueTypedData & Self-Funded
4falsefalseTypedData & Self-Funded

a) Unblock Profile via Lens Profile Manager (Gasless & Signless)

Request

  • profiles: ProfileId[] (required)
    • The profile IDs to unblock. ProfileId is a string.

Invocation

const result = await lensClient.profile.unblock({
  profiles: ["PROFILE_ID_TO_BLOCK"],
});
mutation Unblock {
  unblock(request: { profiles: ["PROFILE_ID_TO_BLOCK"] }) {
    ... on RelaySuccess {
      ...RelaySuccess
    }
    ... on LensProfileManagerRelayError {
      ...LensProfileManagerRelayError
    }
  }
}

Response

{
  "txHash": "0x000000",
  "txId": "0x01"
}
{
  "reason": "PROFILE_NOT_BLOCKED"
}

Full Lens Client Example

const result = await lensClient.profile.unblock({
  profiles: ["PROFILE_ID_TO_BLOCK"],
});

const data = result.unwrap();

if (!isRelaySuccess(data)) {
  console.log(`Something went wrong`, data);
  return;
}

await lensClient.transaction.waitUntilComplete({ txId: data.txId });

b) Unblock Profile Using TypedData and Broadcasting Onchain via the API (Gasless & Signed)

Request

  • profiles: ProfileId[] (required)
    • The profile IDs to unblock. ProfileId is a string.

Invocation

const unblockProfilesTypedData =
  await lensClient.profile.createUnblockProfileTypedData({
    profiles: ["PROFILE_ID_TO_BLOCK"],
  });
mutation CreateUnblockProfilesTypedData {
  createUnblockProfilesTypedData(
    request: { profiles: ["PROFILE_ID_TO_UNBLOCK"] }
  ) {
    id
    expiresAt
    typedData {
      types {
        SetBlockStatus {
          name
          type
        }
      }
      domain {
        name
        chainId
        version
        verifyingContract
      }
      value {
        nonce
        deadline
      }
    }
  }
}

Response

{
  "id": "0x01",
  "expiresAt": "2023-10-01T00:00:00Z",
  "typedData": {
    "types": {
      "SetBlockStatus": [
        { "name": "nonce", "type": "uint256" },
        { "name": "deadline", "type": "uint256" },
        { "name": "profileIds", "type": "uint256[]" },
        { "name": "blockStatus", "type": "bool" }
      ]
    },
    "domain": {
      "name": "Lens",
      "chainId": "1",
      "version": "1",
      "verifyingContract": "0x0000000"
    },
    "value": {
      "nonce": "0x01",
      "deadline": "2023-10-01T01:00:00Z",
      "profileIds": ["0x01"],
      "blockStatus": false
    }
  }
}

Full GraphQL API Example

📘

Unblock Profiles: GraphQL API Full Example