ITokenHandleRegistry

Git Source

Author: Lens Protocol

The interface for TokenHandleRegistry contract that is responsible for linking a handle NFT to a token NFT. Linking means a connection between the two NFTs is created, and the handle NFT can be used to resolve the token NFT or vice versa. The registry is responsible for keeping track of the links between the NFTs, and for resolving them. The first version of the registry is hard-coded to support only the .lens namespace and the Lens Protocol Profiles.

Functions

Lens V1 -> V2 migration function. Links a handle NFT to a profile NFT without additional checks to save gas. Will be called by the migration function (in MigrationLib) in LensHub, only for new handles being migrated.

function migrationLink(uint256 handleId, uint256 profileId) external;

Parameters

NameTypeDescription
handleIduint256ID of the .lens namespace handle NFT
profileIduint256ID of the Lens Protocol Profile NFT

Links a handle NFT with a profile NFT. Linking means a connection between the two NFTs is created, and the handle NFT can be used to resolve the profile NFT or vice versa.

*In the first version of the registry, the NFT contracts are hard-coded:

  • Handle is hard-coded to be of the .lens namespace
  • Token is hard-coded to be of the Lens Protocol Profile In future versions, the registry will be more flexible and allow for different namespaces and tokens, so this function might be deprecated and replaced with a new one accepting addresses of the handle and token contracts.*
function link(uint256 handleId, uint256 profileId) external;

Parameters

NameTypeDescription
handleIduint256ID of the .lens namespace handle NFT
profileIduint256ID of the Lens Protocol Profile NFT

Unlinks a handle NFT from a profile NFT.

*In the first version of the registry, the contracts are hard-coded:

  • Handle is hard-coded to be of the .lens namespace
  • Token is hard-coded to be of the Lens Protocol Profile In future versions, the registry will be more flexible and allow for different namespaces and tokens, so this function might be deprecated and replaced with a new one accepting addresses of the handle and token contracts.*
function unlink(uint256 handleId, uint256 profileId) external;

Parameters

NameTypeDescription
handleIduint256ID of the .lens namespace handle NFT
profileIduint256ID of the Lens Protocol Profile NFT

resolve

Resolves a handle NFT to a profile NFT.

*In the first version of the registry, the contracts are hard-coded:

  • Handle is hard-coded to be of the .lens namespace
  • Token is hard-coded to be of the Lens Protocol Profile In future versions, the registry will be more flexible and allow for different namespaces and tokens, so this function might be deprecated and replaced with a new one.*
function resolve(uint256 handleId) external view returns (uint256);

Parameters

NameTypeDescription
handleIduint256ID of the .lens namespace handle NFT

Returns

NameTypeDescription
<none>uint256tokenId ID of the Lens Protocol Profile NFT

getDefaultHandle

Gets a default handle for a profile NFT (aka reverse resolution).

*In the first version of the registry, the contracts are hard-coded:

  • Handle is hard-coded to be of the .lens namespace
  • Token is hard-coded to be of the Lens Protocol Profile In future versions, the registry will be more flexible and allow for different namespaces and tokens, so this function might be deprecated and replaced with a new one.*
function getDefaultHandle(uint256 tokenId) external view returns (uint256);

Parameters

NameTypeDescription
tokenIduint256ID of the Lens Protocol Profile NFT

Returns

NameTypeDescription
<none>uint256handleId ID of the .lens namespace handle NFT