Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Support for other methods in subscribe (other than eth_subscribe) #2729

Open
danielharrisgsr opened this issue Feb 5, 2024 · 0 comments
Open

Comments

@danielharrisgsr
Copy link

Is your feature request related to a problem? Please describe.
For example, with the Reth client it is possible to define custom namespaces for extending functionality, such as adding RPC and subscription methods. Some call with method eth_subscribe and params ["newHeads"] might have a custom implementation (for some reason) in a custom namespace with method my_eth_subscribe and params ["myNewHeads"]

The current implementations of the JsonRpcClient trait bakes in the "eth_subscribe" string in a number of places, which makes it unable to support calling of these custom methods

  • subscribe() will call eth_subscribe under the hood. This can be avoided by making your own request() and passing the channel_id into a SubscriptionStream, although this is more fiddly...
  • ... and the above is actually not possible because the TransactionManager will only add a channel_id to its channel map field if the method is eth_subscribe. So attempting to listen to the stream you requested will error
  • reconnect() method also hardcodes the eth_subscribe method for its attempted reconnection to a stream

Describe the solution you'd like
Support for additional methods in the subscription case, through careful removal of reliance on the string "eth_subscribe"

Describe alternatives you've considered

  • Current workaround is to simply use the eth namespace in extending Reth, which allows the ethers calls to work
  • Additionally, one can not use ethers and instead roll their own websocket connection capabilities with tungstenite or other

Additional context

@danielharrisgsr danielharrisgsr changed the title Support for Custom Namespaces in eth_subscribe and eth_call Support for Custom Namespaces in subscribe (other than eth_subscribe) Feb 5, 2024
@danielharrisgsr danielharrisgsr changed the title Support for Custom Namespaces in subscribe (other than eth_subscribe) Support for other methods in subscribe (other than eth_subscribe) Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant