Skip to content

Commit

Permalink
feat(rpc-testing-utils) : trace_filter test (#5293)
Browse files Browse the repository at this point in the history
  • Loading branch information
DoTheBestToGetTheBest authored Nov 6, 2023
1 parent f8ceda9 commit d090803
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions crates/rpc/rpc-testing-util/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ mod tests {
use super::*;
use jsonrpsee::http_client::HttpClientBuilder;
use reth_primitives::BlockNumberOrTag;
use reth_rpc_types::trace::filter::TraceFilterMode;
use std::collections::HashSet;

fn assert_is_stream<St: Stream>(_: &St) {}
Expand Down Expand Up @@ -459,4 +460,34 @@ mod tests {
}
}
}

#[tokio::test]
#[ignore]
async fn can_create_trace_filter() {
let client = HttpClientBuilder::default().build("http://localhost:8545").unwrap();

let filter = TraceFilter {
from_block: None,
to_block: None,
from_address: Vec::new(),
to_address: Vec::new(),
mode: TraceFilterMode::Union,
after: None,
count: None,
};

let filters = vec![filter];
let mut stream = client.trace_filter_stream(filters);

while let Some(result) = stream.next().await {
match result {
Ok(trace) => {
println!("Received trace: {:?}", trace);
}
Err(e) => {
println!("Error fetching trace: {:?}", e);
}
}
}
}
}

0 comments on commit d090803

Please sign in to comment.