mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-19 11:58:06 +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:
+4
-5
@@ -33,14 +33,14 @@ git clone https://github.com/0xfnzero/solana-streamer
|
||||
|
||||
```toml
|
||||
# 添加到您的 Cargo.toml
|
||||
solana-streamer-sdk = { path = "./solana-streamer", version = "0.1.3" }
|
||||
solana-streamer-sdk = { path = "./solana-streamer", version = "0.1.4" }
|
||||
```
|
||||
|
||||
### 使用 crates.io
|
||||
|
||||
```toml
|
||||
# 添加到您的 Cargo.toml
|
||||
solana-streamer-sdk = "0.1.3"
|
||||
solana-streamer-sdk = "0.1.4"
|
||||
```
|
||||
|
||||
## 使用示例
|
||||
@@ -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| {
|
||||
// 使用grpc的时候,可以从每个事件中获取到block_time
|
||||
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