Solnet icon indicating copy to clipboard operation
Solnet copied to clipboard

[Bug] SubscribeSlotInfo issue

Open nightrank opened this issue 2 years ago • 0 comments

I found that Solnet cannot subscribe Quicknode endpoints (cannot detect results), the difference is, in Quicknode endpoints, 'subscription' field comes first in params, but in api.mainnet-beta.solana.com, 'result' field comes first. I'm wondering if this is because Solnet relies on the order of the params.

Working version:

Data

{"jsonrpc":"2.0","method":"slotNotification","params":{"result":{"slot":303986310,"parent":303986309,"root":303986278},"subscription":4783444}}

Code

var streamingClient = ClientFactory.GetStreamingClient("wss://api.mainnet-beta.solana.com"); await streamingClient.ConnectAsync(); var subscription = await streamingClient.SubscribeSlotInfoAsync( (state, data) => { Log.Information("Slot {Slot} at {Time}", data.Slot, DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ")); });

Not working with Quicknode endpoints:

Data

{"jsonrpc":"2.0","method":"slotNotification","params":{"subscription":11263,"result":{"slot":343082753,"parent":343082752,"root":343082721}}}

Code

var streamingClient = ClientFactory.GetStreamingClient("wss://tame-cool-borough.solana-devnet.quiknode.pro/ca7e417575b2778a022f76bd72989cba039f2efe/"); await streamingClient.ConnectAsync(); var subscription = await streamingClient.SubscribeSlotInfoAsync( (state, data) => { Log.Information("Slot {Slot} at {Time}", data.Slot, DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ")); });

nightrank avatar Nov 27 '24 19:11 nightrank