bmresearch / Solnet

Solana's .NET SDK and integration library.
https://blockmountain.io/Solnet
MIT License
324 stars 130 forks source link

[Bug] SubscribeSignatureAsync doesn't do anything #237

Closed nukec closed 3 years ago

nukec commented 3 years ago

Describe the bug When trying to subscribe to signature i do not get response while transaction is finalized on explorer.

To Reproduce

var subscription = await _streamingRpcClient.SubscribeSignatureAsync(transactionId, async(subscriptionState, response) => 
{
    Debug.Write("hit");
}

Expected behavior Get response and hit Debug. Also see there are no tests on this, so not really sure this was ever properly tested?

hoakbuilds commented 3 years ago

SubscribeSignature is working as we have used it in multiple places without any issue.

Are you connecting to the websocket after getting the streaming client instance and before using it?

nukec commented 3 years ago

ok seems like it's an issue with custom rpc, i have to add referrer header into the client. is that possible with clientfactory that you expose?

hoakbuilds commented 3 years ago

No it's not possible currently, it's something we already thought about adding but haven't had the time for it

nukec commented 3 years ago

no custom rpc can be used with solnet then as figment requires auth header, quicknode referrer and rpcpool same. ill see if i can do PR but dont have time more than a quick fix so might just use it for myself.

tiago18c commented 3 years ago

I haven't tested it yet, but you can inject your own HttpClient in one of the ClientFactory.GetClient methods, so you could add the headers / referrer in your own instanced HttpClient. I'm going to read the docs on the Websockets and how to do auth there

tiago18c commented 3 years ago

Further research: have you tried to use the custom link including the authentication parameters when calling GetClient? IT seems most RPC services just need to append the key/token to the URL, so it should work without any changes. And for figment, you can do just from the URL too - append /api_key//. The only one that seems unsupported is GenesysGo, but just in the websocket connection, as you can still inject headers on a IRpcClient created with a given HttpClient instance.

hoakbuilds commented 3 years ago

Closed by #240

nukec commented 3 years ago

I haven't tested it yet, but you can inject your own HttpClient in one of the ClientFactory.GetClient methods, so you could add the headers / referrer in your own instanced HttpClient. I'm going to read the docs on the Websockets and how to do auth there

Can this be released ?

Further research: have you tried to use the custom link including the authentication parameters when calling GetClient? IT seems most RPC services just need to append the key/token to the URL, so it should work without any changes. And for figment, you can do just from the URL too - append /api_key//. The only one that seems unsupported is GenesysGo, but just in the websocket connection, as you can still inject headers on a IRpcClient created with a given HttpClient instance.

This doens't work as I've tried putting url directly:

services.AddSingleton(ClientFactory.GetClient(chainConfiguration.Cluster));

And it spits error still: image

tiago18c commented 3 years ago

My bad, thought we had released that stuff. Gonna do it in the meantime. In the meantime, what custom RPC service are you using?

nukec commented 3 years ago

figment, quicknode

tiago18c commented 3 years ago

The new version is released, you can now inject your own HttpClient or ClientWebSocket and should be able to add any headers from there