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 | |
---|---|---|---|
1 | true | true | Lens Profile Manager |
2 | true | false | TypedData & Broadcast via API |
3 | false | true | TypedData & Self-Funded |
4 | false | false | TypedData & Self-Funded |
a) Unblock Profile via Lens Profile Manager (Gasless & Signless)
Request
profiles: ProfileId[]
(required)- The profile IDs to unblock.
ProfileId
is a string.
- The profile IDs to unblock.
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.
- The profile IDs to unblock.
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
Updated about 1 month ago