1

I'm encountering an issue with the JSON-RPC API when trying to use the getAccountInfo method. Despite using the correct method structure (as I have successfully used similar structures for other methods), I receive the following error message:

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "Method not found"
  },
  "id": 1
}

I've double-checked the method name and parameters, and everything seems correct according to the documentation. Here's the code snippet I used:

 uri = "wss://mainnet.helius-rpc.com/?api-key=..."
    while True:
        try:
            async with websockets.connect(uri, ping_interval=12000, ping_timeout=60) as websocket:
                subscribe_message = {
                    "jsonrpc": "2.0",
                    "id": 1,
                    "method": "getAccountInfo",
                    "params": [
                        "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm",
                        {"encoding": "base64"}
                    ]
                }
                await websocket.send(json.dumps(subscribe_message))
});

In addition to resolving this error, I'm also looking to monitor all transactions related to a specific token. Could anyone suggest an approach or modifications to my current method to efficiently fetch this transaction-related information?

Any insights or suggestions on what might be causing this error and how to track token-related transactions would be greatly appreciated!

1 Answer 1

2

getAccountInfo only exists on the JSON RPC HTTP endpoint, not the websocket wss endpoint.

If you want to get updates anytime an account is updated, be sure to use the accountSubscribe endpoint: https://solana.com/docs/rpc/websocket/accountsubscribe

And for your other question, be sure to ask it separately to make it easier for people to search in the future!

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.