Owned NFTs

Learn how to query NFT ownership information associated with Lens profiles.

Owned NFTs

You can determine which NFTs a Profile or Wallet owns by querying via contract address, collection name, or symbol. The data for NFT tokens and collections is fetched on-chain and indexed by the API. If any NFTs are missing, it means they haven't been indexed yet.

  • On the Testnet, only Ethereum Goerli (chainId: 5) and Polygon Amoy (chainId: 80002) NFTs are available.

  • On the Mainnet, only Ethereum Mainnet (chainId: 1) and Polygon Mainnet (chainId: 137) NFTs are available.

You can perform queries without authentication using forProfileId or forAddress request inputs, or fetch owned NFTs by the active profile if authenticated. Refer to the Authentication section for more details.

You can use the client.nfts.fetch method to retrieve NFTs owned by the specified user.

// client instance is authenticatedconst result = await client.nfts.fetch();
// client instance is NOT authenticatedconst result = await client.nfts.fetch({  where: {    forAddress: '0x1234567890123456789012345678901234567890',  }});

NFT Owners

You can retrieve the Lens profiles that own NFTs from a specific collection.

You can utilize the client.nfts.collectionOwners method to retrieve profiles that own specific NFTs.

const result = await client.nfts.collectionOwners({  for: collection.contract.address,  chainId: collection.contract.chainId,});

Owned Collections

You can retrieve the NFT collections that a specific Wallet or Profile ID owns at least one NFT from. This feature only supports Ethereum and Polygon NFTs.

Please note that the excludeFollowers parameter is set to true by default. As a result, the returned collections will not include Lens Follower NFTs unless explicitly requested.

You can utilize the client.nfts.collections method to retrieve NFT collections owned by a specific user.

const result = await client.nfts.collections({  for: '0x06',});

Mutual Collections

Retrieve the NFT collections that are mutually owned by two specified profiles.

You can utilize the client.nfts.mutualCollections method to retrieve NFT collections that are mutually owned by two specified profiles.

const result = await client.nfts.mutualCollections({  observer: '0x01',  viewing: '0x02',});

Retrieve the most popular NFT collections. The popularity of a collection is determined by the number of Lens Profiles that own NFTs from that collection.

You can utilize the client.nfts.popularCollections method to retrieve the most popular NFT collections.

const result = await client.nfts.popularCollections({  onlyVerified: true,});