Reliable Solana getProgramAccounts ?
Back to All

Reliable Solana getProgramAccounts ?


Do anyone know why/how should I call getProgramAccounts() to retrieve all accounts from serum dex program?

This code takes almost a minute to return "{"jsonrpc":"2.0","id":"566965b3-7c1a-4338-b424-430b3240976e","error":{"code":-32603,"message":"Internal server error"}} " :

curl --location --request POST '<api-key>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "method": "getProgramAccounts",
    "jsonrpc": "2.0",
    "params": [
            "encoding": "jsonParsed",
            "commitment": "recent"
    "id": "566965b3-7c1a-4338-b424-430b3240976e"

I was also unlucky with the paginated query version from the main page on the solana documentation.. (I wasn't stopped by the problems in the example: 1. the script is javascript, not typescript, 2. the url is setup in a wrong variable, maybe there was some other problem too.. but these are what I retained in my mind).