unisat-wallet / dev-support

30 stars 19 forks source link

How to get collection detail from any Inscription Id ? #7

Closed disco-quotidie closed 5 months ago

disco-quotidie commented 6 months ago

It is common case that many Ordinal nft collections are verified off-chain through leading marketplaces like ME or so. But is there a way to get collection info from an inscription id ? Like, if a user connects wallet, we get the list of inscriptions and if there are any collection items, we display them. Is it completely impossible to get this data from on-chain ? If so, what is the most reliable way to get the information ?

abangZ commented 6 months ago

Sorry, there is currently no widely accepted on-chain aggregation. But you can get collection information from this repository.

https://github.com/unisat-wallet/ordinals-collections

disco-quotidie commented 6 months ago

Thank you very much for your kind reply, @abangZ

I also found out that most of Ordinal collections are verified off-chain through marketplaces. ( I personally feel sad about this. I have been building on Atomicals, and they have vivid schema for collection metadata on-chain. ) So I had some problems getting all the collection data and the inscription metadatas inside each collection.

Finally, I found a solution at BestInSlot API. They offered good API which allowed me to fetch all of these. In this time of writing, there are over 3661 Ordinal collections on Bitcoin. I have fetched them all and uploaded onto google drive because it takes quite a lot of time to fetch them all. Relevant collection metadata and inscription metadatas inside each collection are at

https://drive.google.com/file/d/1RApO3zkcSz8J771Wk67R38uVE0245zyC/view?usp=sharing (collection metadata) https://drive.google.com/file/d/1Gt0jx5ZzZesEaEg9u29bF3Af_1SLtR9e/view?usp=sharing (inscriptions metadata)

Codebase for fetching is at

https://github.com/disco-quotidie/insc-app

If someone has the same problem as me, please download the metadata from cloud, extract and copy them inside /generated-jsons and do npm run dev on the shared repo. Then it will continue fetching newly added collections and inscriptions inside it after the time of writing this comment. One point you have to keep in mind is that the ownerAddress of inscription may be different because as you know, Ordinals are quite hot-traded... But inscriptionIds never change.

Hope it helps anyone who has those problems.

abangZ commented 5 months ago

thanks for your work