go-bitsong icon indicating copy to clipboard operation
go-bitsong copied to clipboard

Return metadata in collection query

Open giorgionocera opened this issue 3 years ago • 2 comments

In the nft module, four queries are provided, namely NFTInfo, NFTsByOwner, Metadata, Collection.

  • In NFTInfo, the NFT id is provided in the request, and nft and NFT metadata are provided as the response

https://github.com/bitsongofficial/go-bitsong/blob/84691c819214a1f9b9dd844ea2b49b7ccc8ece1b/proto/bitsong/nft/v1beta1/query.proto#L33-L39

  • In NFTByOwner, the owner is provided in the request, and a nft list together with a NFT metadata list are provided as the response

https://github.com/bitsongofficial/go-bitsong/blob/84691c819214a1f9b9dd844ea2b49b7ccc8ece1b/proto/bitsong/nft/v1beta1/query.proto#L42-L49

  • In Metadata, the metadata coll_id and id are provided in the request, and the metadata are provided as the response All these queries provide the metadata set. This is important since NFTs without metadata are missing a lot of information.

https://github.com/bitsongofficial/go-bitsong/blob/84691c819214a1f9b9dd844ea2b49b7ccc8ece1b/proto/bitsong/nft/v1beta1/query.proto#L52-L60

For this reason, it seems strange that in Collection, id is provided in the request, and collection together with a nft list are provided as a response, without a NFT metadata list.

https://github.com/bitsongofficial/go-bitsong/blob/84691c819214a1f9b9dd844ea2b49b7ccc8ece1b/proto/bitsong/nft/v1beta1/query.proto#L63-L69

IMHO, the metadata should be returned together with the nft list. What do you think about it?

giorgionocera avatar Sep 28 '22 15:09 giorgionocera

I think we can add metadata info on collection query.

ryusmo avatar Sep 28 '22 17:09 ryusmo

Moreover, I would change the method name from Collection to NFTByCollection. For sure these modifications affect these lines https://github.com/bitsongofficial/go-bitsong/blob/84691c819214a1f9b9dd844ea2b49b7ccc8ece1b/x/nft/keeper/grpc_query.go#L84-L101

giorgionocera avatar Oct 01 '22 16:10 giorgionocera