mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-18 03:18:05 +00:00
refactor: convert EventParser to static methods and optimize caching
- Replace instance-based EventParser with static method design - Introduce ParserCache module for protocol config caching - Simplify EventProcessor to pure functional handlers - Optimize metrics: remove min/max tracking, keep last + avg only - Reduce atomic operations in hot path for better performance
This commit is contained in:
+10
-10
@@ -96,16 +96,16 @@ async fn get_single_transaction_details(signature_str: &str) -> Result<()> {
|
||||
Protocol::RaydiumCpmm,
|
||||
Protocol::RaydiumAmmV4,
|
||||
];
|
||||
let parser: Arc<EventParser> = Arc::new(EventParser::new(protocols, None));
|
||||
parser
|
||||
.parse_encoded_confirmed_transaction_with_status_meta(
|
||||
signature,
|
||||
transaction,
|
||||
Arc::new(move |event: &UnifiedEvent| {
|
||||
println!("{:?}\n", event);
|
||||
}),
|
||||
)
|
||||
.await?;
|
||||
EventParser::parse_encoded_confirmed_transaction_with_status_meta(
|
||||
&protocols,
|
||||
None,
|
||||
signature,
|
||||
transaction,
|
||||
Arc::new(move |event: &UnifiedEvent| {
|
||||
println!("{:?}\n", event);
|
||||
}),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
Err(e) => {
|
||||
println!("Failed to get transaction: {}", e);
|
||||
|
||||
Reference in New Issue
Block a user