getContractNfts - sort by newest block first

Is there any way to fetch the results for getContractNfts so the newest (latest block) are returned first?

https://docs.moralis.io/reference/getcontractnfts-1

When I use it the first items in the results have the following block_number_minted:

  • 31668721
  • 25261379
  • 25431750
  • 28720435
  • 30046448, etc

Trying to understand how these results are ordered and if that can be changed?

You will need to sort all the results yourself manually.

How are you supposed to do that when there are 200,000 items in the results and you only get 100 results per page? One page is returned at a time.

You would need to get all the results from each page and then sort it manually. Not very feasible for a large collection like that I understand but I donโ€™t think thereโ€™s another way currently.

As an alternative, perhaps consider using getContractEvents to get new Transfer events and decipher if they are new tokens (and not just regular transfers) if you want the latest ones.