4

Good morning. I'm looking to make a small coinmarketcap, but from solana nfts, like solsniper or matricnft. I have tried with the magic eden api but it does not give many options, get /collections can only return 500 collections and in general, the api falls short. I have also tried with the moralis and quicknode api, but they have few methods compared to eth and they don't work for this.

https://api-mainnet.magiceden.dev/v2/collections?offset=0&limit=500

https://api.magiceden.dev/

Do you know any api that can help me for this project? Any way to read the onchain data? Thank you very much!

2 Answers 2

5

so you can make a function that requests the 500 and then adds them all to a list. you then add 500 to the offset of the request and keep repeating until the request returns empty. here's an example in python

async def all_projects() -> dict:
    async with aiohttp.ClientSession() as session:
        output = {}
        offset = 0
        while True:
            url = f"http://api-mainnet.magiceden.dev/v2/collections?offset={offset}&limit=500"
            async with session.get(url) as response:
                resp = await response.json()
            if resp == []:
                return output
            else:
                for obj in resp:
                    output.update({obj["name"].lower(): obj["symbol"].lower()})
                offset += 500
1

Did you looked at this API: https://docs.hyperspace.xyz/hype/developer-guide/overview

I didn't use it yet, but it looks like a good option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.