feat(cast): support websockets#5571
Conversation
|
hey @bernard-wagner will we get this over the line? happy to review—just need to rebase |
84f5770 to
b83d4ce
Compare
|
@Evalir reworked it a bit and rebased. Depends on the following change for the moment: gakonst/ethers-rs@master...bernard-wagner:ethers-rs:retry-pubsub Seemed like the cleanest way to add a layer to the onion. Also allows the creation of a RetryPolicy for Websockets and IPC. Also testing it with bernard-wagner/foundry@websocket...subscribe, which is why the PubsubClient is needed. Happy to remove the PubsubClient requirement for now, but want to validate that this is the correct approach going forward. Will then follow up with the changes to ether-rs and PubsubClient in a subsequent PR. |
587cc4a to
be348b7
Compare
|
@Evalir reworked it to enable PubSub and not need any changes to Happy to start on the work for |
|
|
||
| Ok(InnerClient::Ws(client)) | ||
| } | ||
| "file" => { |
There was a problem hiding this comment.
are we sure this is a infallible way to detect ipc? i'm unsure—couldn't it be just a path?
There was a problem hiding this comment.
Can definitely change it to just be a path, but will need some modification in ProviderBuilder as plain path is not supported by intoUrl.
There was a problem hiding this comment.
@Evalir rebased on master, which added HTTP auth to the provider. So needed to make a few other changes.
Supports ETH_RPC_URL=../../some/path/test.ipc URL format now.
Also made anvil reuse the provider for tests to increase test coverage. Added a few tests that explicitly test the websocket provider against Alchemy as well.
fb7656a to
b1c968a
Compare
b1c968a to
815b601
Compare
* feat(cast): support websockets * add tests and rework ipc path
Super early attempt at supporting websockets and IPC for cast. (See #5022 )
Needs a lot more work and the DynamicProvider logic might be more suited to
ethers-rs.Would appreciate any general approach feedback. Happy to continue the development, but anyone else is welcome to take it further (hopefully this gives a starting point).
Tested with Alchemy websocket endpoint.
Main hurdles are that the Provider type is not known at compile time and that
build()is synchronous, so need to connect if no client has been established. Using aRwLock, not sure if it absolutely necessary.