mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-16 18:38:05 +00:00
feat: refactor shred streaming with modular architecture
This commit is contained in:
+10
-3
@@ -43,7 +43,7 @@ use solana_streamer_sdk::{
|
||||
Protocol, UnifiedEvent,
|
||||
},
|
||||
grpc::ClientConfig,
|
||||
shred_stream::ShredClientConfig,
|
||||
shred::StreamClientConfig,
|
||||
yellowstone_grpc::{AccountFilter, TransactionFilter},
|
||||
ShredStreamGrpc, YellowstoneGrpc,
|
||||
},
|
||||
@@ -137,7 +137,7 @@ async fn test_shreds() -> Result<(), Box<dyn std::error::Error>> {
|
||||
println!("Subscribing to ShredStream events...");
|
||||
|
||||
// Create low-latency configuration
|
||||
let mut config = ShredClientConfig::low_latency();
|
||||
let mut config = StreamClientConfig::low_latency();
|
||||
// Enable performance monitoring, has performance overhead, disabled by default
|
||||
config.enable_metrics = true;
|
||||
let shred_stream =
|
||||
@@ -153,8 +153,15 @@ async fn test_shreds() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Protocol::RaydiumAmmV4,
|
||||
];
|
||||
|
||||
// Event filtering
|
||||
// No event filtering, includes all events
|
||||
let event_type_filter = None;
|
||||
// Only include PumpSwapBuy events and PumpSwapSell events
|
||||
// let event_type_filter =
|
||||
// EventTypeFilter { include: vec![EventType::PumpSwapBuy, EventType::PumpSwapSell] };
|
||||
|
||||
println!("Listening for events, press Ctrl+C to stop...");
|
||||
shred_stream.shredstream_subscribe(protocols, None, callback).await?;
|
||||
shred_stream.shredstream_subscribe(protocols, None, event_type_filter, callback).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user