mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-15 18:08:05 +00:00
feat: Upgrade SDK to version 0.1.4 and optimize event handling mechanism
1. Version upgrade: SDK version updated from 0.1.3 to 0.1.4 2. Remove BlockMetaEvent: Delete unnecessary block metadata event type and related code 3. Optimize event handling: Add block_time and block_time_ms fields to each event 4. Code optimization: Improve code formatting and structure 5. Example updates: Update example code and usage instructions in README
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.3" }
|
||||
solana-streamer-sdk = { path = "./solana-streamer", version = "0.1.4" }
|
||||
```
|
||||
|
||||
### Use crates.io
|
||||
|
||||
```toml
|
||||
# Add to your Cargo.toml
|
||||
solana-streamer-sdk = "0.1.3"
|
||||
solana-streamer-sdk = "0.1.4"
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
@@ -117,10 +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| {
|
||||
// When using grpc, you can get block_time from each event
|
||||
println!("block_time: {:?}, block_time_ms: {:?}", e.metadata.block_time, e.metadata.block_time_ms);
|
||||
println!("BonkPoolCreateEvent: {:?}", e.base_mint_param.symbol);
|
||||
},
|
||||
BonkTradeEvent => |e: BonkTradeEvent| {
|
||||
|
||||
Reference in New Issue
Block a user