I need to get the latest transactions that have Solana token transfers. For this I tried out the blockSubscribe
WSS method but it seems to be throwing errors. I am using Alchemy WSS on the mainnet for my purpose.
[Symbol(kType)]: 'message',[Symbol(kData)]: '{"id":"1","jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid/Unspported params for blockSubscribe."}}'
I am not sure what am doing wrong here as I am just following what the docs said here.
Below is my code -
const socket = new WebSocket(WSS_ENDPOINT);socket.addEventListener("open", () => { const subscribeMessage = { jsonrpc: "2.0", id: "1", method: "blockSubscribe", params: [{ filter: "all" }], }; console.log("WSS stream started"); const messageString = JSON.stringify(subscribeMessage); socket.send(messageString);});