You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Added a new poll option to the watchEvent and watchContractEvent functions.
The poll option allows clients to use a polling mechanism to check for new logs instead of a WebSocket subscription.
The default value for poll is false for WebSocket clients and true for non-WebSocket clients.
When poll is true and the RPC Provider supports eth_newFilter, the functions will call eth_newFilter to create a filter and eth_getFilterChanges on a polling interval to get new logs.
When poll is true and the RPC Provider does not support eth_newFilter, the functions will call eth_getLogs for each block between the polling interval to get new logs.
When poll is false and the WebSocket Transport is used, the functions will use a WebSocket subscription via eth_subscribe and the "logs" event to get new logs.
Added the pollingInterval option to specify the polling frequency in milliseconds. The default value is the client's pollingInterval config.
Updated the documentation for watchEvent and watchContractEvent to include information about the new poll option and the different behaviors based on the RPC Provider support and WebSocket Transport usage.
The following files were skipped due to too many changes: src/actions/public/watchContractEvent.ts, src/actions/public/watchEvent.ts, src/actions/public/watchEvent.test.ts, src/actions/public/watchContractEvent.test.ts
✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Merging #1012 (cc33614) into main (e1032c7) will increase coverage by 0.06%.
Report is 1 commits behind head on main.
The diff coverage is 98.60%.
❗ Current head cc33614 differs from pull request most recent head aa84445. Consider uploading reports for the commit aa84445 to get more accurate results
…chContractEvent` (wevm#1012)
* Support eth_subscribe in watchContractEvent
* Complete test suite for watchContractEvent
* Support eth_subscribe in watchEvent and add tests
* Update docs
* chore: add tests
* chore: update docs
---------
Co-authored-by: Simone <simone@nemo.ventures>
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dupe of #985
PR-Codex overview
Detailed summary:
poll
option to thewatchEvent
andwatchContractEvent
functions.poll
option allows clients to use a polling mechanism to check for new logs instead of a WebSocket subscription.poll
isfalse
for WebSocket clients andtrue
for non-WebSocket clients.poll
istrue
and the RPC Provider supportseth_newFilter
, the functions will calleth_newFilter
to create a filter andeth_getFilterChanges
on a polling interval to get new logs.poll
istrue
and the RPC Provider does not supporteth_newFilter
, the functions will calleth_getLogs
for each block between the polling interval to get new logs.poll
isfalse
and the WebSocket Transport is used, the functions will use a WebSocket subscription viaeth_subscribe
and the "logs" event to get new logs.pollingInterval
option to specify the polling frequency in milliseconds. The default value is the client'spollingInterval
config.watchEvent
andwatchContractEvent
to include information about the newpoll
option and the different behaviors based on the RPC Provider support and WebSocket Transport usage.