status-im / status-desktop

Status Desktop client made in Nim & QML
https://status.app
Mozilla Public License 2.0
273 stars 76 forks source link

[EPIC] Implement the ability to search OpenSea Collectibles when creating a new permission #11462

Open John-44 opened 1 year ago

John-44 commented 1 year ago

See designs here: https://www.figma.com/design/qHfFm7C9LwtXpfdbxssCK3/Kuba%E2%8E%9CDesktop---Communities?node-id=53874-101256&t=hLXAVLh0o0CsZKWE-0

When creating or editing permission, it should be possible for the user to reference any collectable listed on OpenSea in the permission. Or we might want to consider using the Infura NFT API for this search, as it might have better functionality than the OpenSea API and be more reliable. Someone from the wallet team might be able to advise here, cc'ing @alaibe

After the user drills into 'All collectables':

2023-07-08_16-27-53

cc'ing @jrainville @iurimatias

Sub-tasks

John-44 commented 1 year ago

@micieslak just speaking to @dlipicar , we might need to Infura or Alchamy API for this. @dlipicar can help/do/advise on the backend here

John-44 commented 1 year ago

@benjthayer depending on what @dlipicar discovers is possible via whatever NFT search API(s) we choose to use, we might need to slightly update this design. Nothing to do for now though, the API research needs to be completed first.

dlipicar commented 1 year ago

Initial findings:

If we have some certainty that what the user entered is some specific piece of information (contract address, collection slug), we can make a search using specific endpoints in any of our providers. For example: https://docs.opensea.io/reference/retrieve-nfts-by-contract https://docs.opensea.io/reference/retrieve-nfts-by-collection https://docs.infura.io/infura-expansion-apis/nft-api/rest-apis/api-reference/collections#get-all-nfts-with-metadata-in-a-specific-collection https://docs.alchemy.com/reference/getnftsforcontract-v3

If we want to throw whatever the user enters to an API Endpoint and see if it matches any some field in the NFT metadata (For example enter "bored" and get the Bored Apes collection)

So, we could get contract address/collection slug search support using

And text-based search support using

Probably a good idea to make some tests before making any decision.

John-44 commented 1 year ago

thanks for looking at this @dlipicar

Agree that it would be a good idea to do some tests before making any decision.

For 'Contract address/collection slug search' using either: OpenSea with Infura as a fallback OR just Infura, both work from a product POV.

For 'text-based search', using either: Infura with Alchemy as a fallback OR just Infura, both work from a product POV.

dlipicar commented 11 months ago

Update: Infura's shutting down their NFT API

Hey 👋

We are writing to let you know that we will soon be sunsetting our NFT API + SDK. Infura’s mission is to provide web3 developers with reliable and cost-effective tools to make it easier to build web3 products and this strategic realignment will allow us to reprioritize our focus to develop products and services that we are uniquely positioned to create, and that we do better than anyone else.

We will be sunsetting these services in two phases:

Phase 1: September 1

The "search NFT" endpoint will no longer be valid
When getting transfers within a block range using the fromBlock/toBlock query parameters, the total field will no longer be returned 

Phase 2: November 1

All other NFT endpoints will be sunset, along with the SDK

To ensure a seamless transition and uninterrupted NFT services, we recommend migrating to Moralis, a reliable and feature-rich platform for NFT operations. Moralis (https://moralis.io/) provides a comprehensive set of tools and services, and their team is dedicated to delivering an exceptional user experience that we trust at MetaMask.

We apologize for any inconvenience this may cause and are here to support you during this transition. If you have any questions or need assistance, please don't hesitate to reach out to our support team at [support@infura.io.](mailto:support@infura.io)

To help with onboarding onto Moralis, Nicolai Melniciuc ([nicolai@moralis.io](mailto:nicolai@moralis.io)) from Moralis can help with all of your questions.

Thank you for your continued support. We are excited about the new opportunities this strategic shift will bring and look forward to serving you in new and innovative ways.

Best regards,

The Infura Team
John-44 commented 10 months ago

@dlipicar @alaibe Can we use Moralis instead as recommended by infura in their message above?

dlipicar commented 10 months ago

@John-44 I wouldn't recommend Moralis for the string-based search feature:

image

I'd go with Alchemy to begin with, need to look for a suitable backup provider.

John-44 commented 10 months ago

@John-44 I wouldn't recommend Moralis for the string-based search feature:

image

I'd go with Alchemy to begin with, need to look for a suitable backup provider.

Sounds good, let me know if I need to do anything in order for us to use Alchemy (e.g. if we have to pay them).

dlipicar commented 10 months ago

Additional note: Rarible seems to have something we could use, though they only support Ethereum (mainnet + testnet) https://multichain.redoc.ly/testnet/tag/item-controller#operation/searchItems

alaibe commented 4 months ago

Additional note: First search with alchemy: https://docs.alchemy.com/reference/searchcontractmetadata-v3 Then Rarible: https://docs.rarible.org/reference/searchitems

dlipicar commented 4 months ago

Summary of capabilities for the available providers:

Alchemy:

image

Results cannot be sorted in any special way, and there's no clear indication of how they're ordered by default, so there's a lot of contracts deployed by random people mixed with "big/known" collections from reputable orgs.

If we want to get individual items from each of these collections, then we need to call a separate API. There's no way to search individual items from a given collection.

Rarible:

As things are, Rarible's API is the only really useful one. I've sent Alchemy support a message about making they're API more similar to Rarible's, hopefully they'll take notice.

So yeah, for now text-based search only makes sense using Rarible. I'll be on the lookout for improvements to Alchemy's endpoint.

We could somehow integrate specifying contract address and (when desired) tokenID into our designs, which is the best way of knowing if you're hitting the "real" collection instead of a forgery.

dlipicar commented 4 months ago

Ugh... Rarible's API has a case-sensitive text field, so searching for lilpudgys returns a completely different list than Lilpudgys 🤦 Asked their support if we can get case-sensitivity disabled or at least configurable

dlipicar commented 3 months ago

Iterating over the designs with Ben

benjthayer commented 2 months ago

Iterated on with Dario and pending review with @John-44 and design team... https://www.figma.com/file/qHfFm7C9LwtXpfdbxssCK3/Kuba%E2%8E%9CDesktop---Communities?type=design&node-id=53449-148202&mode=design&t=sYCpMDPq54tgNmF8-4

cc @dlipicar

dlipicar commented 2 months ago

I'm guessing the priority for this is now quite low, won't resume work on it until further notice

John-44 commented 2 months ago

I'm guessing the priority for this is now quite low, won't resume work on it until further notice

We do need a way for users to create permissions tied to any arbitrary NFT, not just NFTs minted in status. How much work is remaining to complete the implementation of this, could anybody else pick this up?

dlipicar commented 2 months ago

@John-44 oh sorry, I thought this was considered a "new messenger feature" and had been de-prioritized. My bad!

The backend is mostly done, the UI is mostly not. I can finish the few missing pieces from the backend and see if somebody from the UI team can work on the rest. Do we want this in for 2.29?

John-44 commented 2 months ago

Do we want this in for 2.29?

If possible, yes cc'ing @noeliaSD

benjthayer commented 2 months ago

@dlipicar designs are now signed off an folded into main permissions flows in Figma :) https://www.figma.com/file/qHfFm7C9LwtXpfdbxssCK3/Kuba%E2%8E%9CDesktop---Communities?type=design&node-id=53874-101256&mode=design&t=dVuLDOqra39yKahC-4

noeliaSD commented 2 months ago

https://www.figma.com/file/qHfFm7C9LwtXpfdbxssCK3/Kuba%E2%8E%9CDesktop---Communities?type=design&node-id=53874-101256&mode=design&t=dVuLDOqra39yKahC-4

Do we want this in for 2.29?

If possible, yes cc'ing @noeliaSD

Hey @John-44 we cannot make it for 2.29 but we can work on it for 2.30. Is it ok?

John-44 commented 2 months ago

Hey @John-44 we cannot make it for 2.29 but we can work on it for 2.30. Is it ok?

This is fine, thanks for the heads up :-)