mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-22 13:28:08 +00:00
feat: Add block metadata event support
- Implement BlockMetaEvent and SDKSystemEventParser - Support block metadata subscription and processing - Optimize event handling with separate tokio tasks - Add commitment parameter support - Upgrade version to 0.1.3
This commit is contained in:
@@ -33,14 +33,14 @@ Add the dependency to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
# Add to your Cargo.toml
|
||||
solana-streamer-sdk = { path = "./solana-streamer", version = "0.1.2" }
|
||||
solana-streamer-sdk = { path = "./solana-streamer", version = "0.1.3" }
|
||||
```
|
||||
|
||||
### Use crates.io
|
||||
|
||||
```toml
|
||||
# Add to your Cargo.toml
|
||||
solana-streamer-sdk = "0.1.2"
|
||||
solana-streamer-sdk = "0.1.3"
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
@@ -87,7 +87,7 @@ async fn test_grpc() -> Result<(), Box<dyn std::error::Error>> {
|
||||
];
|
||||
|
||||
println!("Listening for events, press Ctrl+C to stop...");
|
||||
grpc.subscribe_events(protocols, None, None, None, callback)
|
||||
grpc.subscribe_events(protocols, None, None, None, None, None, callback)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
@@ -117,6 +117,9 @@ async fn test_shreds() -> Result<(), Box<dyn std::error::Error>> {
|
||||
fn create_event_callback() -> impl Fn(Box<dyn UnifiedEvent>) {
|
||||
|event: Box<dyn UnifiedEvent>| {
|
||||
match_event!(event, {
|
||||
BlockMetaEvent => |e: BlockMetaEvent| {
|
||||
println!("BlockMetaEvent: {:?}", e.slot);
|
||||
},
|
||||
BonkPoolCreateEvent => |e: BonkPoolCreateEvent| {
|
||||
println!("BonkPoolCreateEvent: {:?}", e.base_mint_param.symbol);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user