sui
sui copied to clipboard
View relevant NFT from same collection
On smart contracts page, browse NFT created by the smart contracts. What this means for the backend is to expose an API like getObjectsByType(package, Option<module_name>, Option<Struct_name>)
, e.g., 0x2::Coin::Coin<0x2::SUI::SUI>
Context: https://mysten-labs.slack.com/archives/C02DRAL32GN/p1652295738138789
In Gateway/Fullnode API, we should support indexing objects by Owner Address and type in general. The use cases are:
- For the Explorer use case, return all objects whose package_id == '0x3'
- For Gaming use case, return all objects whose owner == '0x32342' and package_id == '0x3'. For this we need a
getObjectsByOwnerAndType
method. We could also consider introducing something more general likegetObjectsWithFilter()
This has a preresquisite to actually have collections.
Collections are not strictly necessary.
This could be done today @bwann52 or soon in two steps:
- Query events (NewObject creations) by package, module name, function
- Query objects specified in those events
@velvia Does that solution enable the following?
Developer John wants to checkout latest NFT drops, so he click on a SUI NFT leaderboard and click on ShadowNinjas,taking him to either 1)The ShadowNinjas module page where all ShadowNinjas NFTs are listed, or 2)Some view where all the ShadowNinjas NFTs are listed
Similarly, marketplace would also like to be able to display, in gallery view, all NFTS from some collection.
@bwann52 if you assume that all the NFTs are created by a specific module/package, then yes:
- Querying events by that specific package/module tells you all the objects that are created by that module;
- Those objects can then be inspected and filtered to get the NFTs that have been created.
The only thing is that the events would be time oriented but you can specify a large time window.