-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cast): subscribe to logs using websockets #5743
Conversation
hey @bernard-wagner just merged #5571 — should be good to continue |
83e6f12
to
13ee448
Compare
@Evalir open question: Should this be a separate command or should it use a |
hmm i think |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will give a more thorough review later!
crates/cast/src/filters.rs
Outdated
use foundry_common::abi::{get_event, parse_tokens}; | ||
use itertools::Itertools; | ||
|
||
/// First tries to parse the `sig_or_topic` as an event signature. If successful, `topics_or_args` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do these docs go here? unsure if they correspond to build_filter
c3394ca
to
1bb5bde
Compare
1bb5bde
to
97cc692
Compare
@Evalir apologies for all the force pushes. Moved to |
82ec012
to
97cc692
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm bar failing tests—will rerun them as they seem like spurious network failures
* feat(cast): subscribe to logs * undo generic signal * fix tokio signal feature --------- Co-authored-by: Enrique Ortiz <hi@enriqueortiz.dev>
Follows on #5571
Motivation
It is useful to monitor for events emitted.
Solution
Introduces:
cast subscribe
Building on the introduction of websockets, allow subscribing to events using the same syntax as
cast logs
.Some additional changes
to_json
logic to support streaming.Moved filter logic from
logs.rs
tofilters.rs
to enable reuse.If
--to-block
is specified, subscribe tonewHeads
and exits loop when target block has been reached.