diff --git a/Cargo.toml b/Cargo.toml index 251d860..1b994cc 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "solana-streamer-sdk" -version = "1.5.7" +version = "1.5.8" edition = "2021" authors = ["William ", "sgxiang ", "wei <1415121722@qq.com>"] repository = "https://github.com/0xfnzero/solana-streamer" @@ -21,7 +21,7 @@ sdk-perf-stats = ["sol-parser-sdk/perf-stats"] sdk-ultra-perf = ["sol-parser-sdk/ultra-perf"] [dependencies] -sol-parser-sdk = { version = "0.5.7", default-features = false } +sol-parser-sdk = { version = "0.5.8", default-features = false } solana-sdk = "3.0.0" solana-client = "3.1.12" solana-transaction-status = "3.1.12" diff --git a/README.md b/README.md index bc9e453..795992c 100755 --- a/README.md +++ b/README.md @@ -124,30 +124,34 @@ Add the dependency to your `Cargo.toml`: ```toml # Add to your Cargo.toml -solana-streamer-sdk = { path = "./solana-streamer", version = "1.5.5" } +solana-streamer-sdk = { path = "./solana-streamer", version = "1.5.8" } ``` ### Use crates.io ```toml # Add to your Cargo.toml -solana-streamer-sdk = "1.5.5" +solana-streamer-sdk = "1.5.8" ``` Parser backend features: ```toml # Default: sol-parser-sdk parse-borsh backend -solana-streamer-sdk = "1.5.5" +solana-streamer-sdk = "1.5.8" # Zero-copy parser backend for latency-sensitive bots -solana-streamer-sdk = { version = "1.5.5", default-features = false, features = ["sdk-parse-zero-copy"] } +solana-streamer-sdk = { version = "1.5.8", default-features = false, features = ["sdk-parse-zero-copy"] } ``` -If both `sdk-parse-borsh` and `sdk-parse-zero-copy` are enabled, `sol-parser-sdk 0.5.5+` uses the zero-copy backend. +If both `sdk-parse-borsh` and `sdk-parse-zero-copy` are enabled, `sol-parser-sdk 0.5.8+` uses the zero-copy backend. ## 🔄 Migration Guide +### Upgrading to v1.5.8 + +Version 1.5.8 uses `sol-parser-sdk 0.5.8` from crates.io. It inherits the Pump.fun ShredStream filter-family semantics from the parser SDK: `PumpFunBuy` covers `buy`, `buy_v2`, `buy_exact_sol_in`, and `buy_exact_quote_in_v2`; `PumpFunSell` covers `sell` and `sell_v2`; and `PumpFunTrade` covers all buy/sell instructions while the parser can emit unified trade events when only the generic trade filter is requested. + ### Upgrading to v1.5.5 Version 1.5.5 uses `sol-parser-sdk 0.5.5` from crates.io. The SDK now exposes Raydium LaunchLab as `RaydiumLaunchlab*`; streamer keeps the existing `Bonk*` event structs and `Protocol::Bonk` / `Protocol::RaydiumLaunchpad` aliases for source compatibility, while routing parser calls and upstream gRPC event filters to the new LaunchLab SDK variants. This release also syncs the CLMM/CPMM/Orca account bridges, Meteora DAMM v2 initialize-pool events, Meteora DBC events, and parser warmup on client creation. diff --git a/README_CN.md b/README_CN.md index 78d9c67..4563397 100644 --- a/README_CN.md +++ b/README_CN.md @@ -123,30 +123,34 @@ git clone https://github.com/0xfnzero/solana-streamer ```toml # 添加到您的 Cargo.toml -solana-streamer-sdk = { path = "./solana-streamer", version = "1.5.5" } +solana-streamer-sdk = { path = "./solana-streamer", version = "1.5.8" } ``` ### 使用 crates.io ```toml # 添加到您的 Cargo.toml -solana-streamer-sdk = "1.5.5" +solana-streamer-sdk = "1.5.8" ``` 解析后端 feature: ```toml # 默认:sol-parser-sdk parse-borsh 后端 -solana-streamer-sdk = "1.5.5" +solana-streamer-sdk = "1.5.8" # 面向低延迟 Bot 的 zero-copy 解析后端 -solana-streamer-sdk = { version = "1.5.5", default-features = false, features = ["sdk-parse-zero-copy"] } +solana-streamer-sdk = { version = "1.5.8", default-features = false, features = ["sdk-parse-zero-copy"] } ``` -如果同时启用 `sdk-parse-borsh` 和 `sdk-parse-zero-copy`,`sol-parser-sdk 0.5.5+` 会优先使用 zero-copy 后端。 +如果同时启用 `sdk-parse-borsh` 和 `sdk-parse-zero-copy`,`sol-parser-sdk 0.5.8+` 会优先使用 zero-copy 后端。 ## 🔄 迁移指南 +### 升级到 v1.5.8 + +v1.5.8 使用 crates.io 上的 `sol-parser-sdk 0.5.8`。该版本继承 parser SDK 的 Pump.fun ShredStream 过滤大类语义:`PumpFunBuy` 覆盖 `buy`、`buy_v2`、`buy_exact_sol_in`、`buy_exact_quote_in_v2`;`PumpFunSell` 覆盖 `sell`、`sell_v2`;`PumpFunTrade` 覆盖所有 buy/sell 指令,并且当只请求通用 trade filter 时,parser 可统一输出 trade 事件。 + ### 升级到 v1.5.5 v1.5.5 使用 crates.io 上的 `sol-parser-sdk 0.5.5`。底层 SDK 已将 Raydium LaunchLab 事件统一暴露为 `RaydiumLaunchlab*`;streamer 仍保留现有 `Bonk*` 事件结构以及 `Protocol::Bonk` / `Protocol::RaydiumLaunchpad` 兼容别名,同时把解析调用和上游 gRPC 事件过滤映射到新的 LaunchLab SDK variant。该版本也同步了 CLMM/CPMM/Orca account bridge、Meteora DAMM v2 initialize-pool、Meteora DBC 事件,以及客户端创建时的 parser warmup。 diff --git a/src/streaming/event_parser/common/filter.rs b/src/streaming/event_parser/common/filter.rs index 6383dc9..9d44759 100644 --- a/src/streaming/event_parser/common/filter.rs +++ b/src/streaming/event_parser/common/filter.rs @@ -178,7 +178,7 @@ enum FilterMapMode { fn push_streamer_event_sdk_grpc_types( t: &EventType, out: &mut Vec, - mode: FilterMapMode, + _mode: FilterMapMode, ) -> bool { use EventType as St; use SdkGrpcEventType as Sdk; @@ -194,27 +194,14 @@ fn push_streamer_event_sdk_grpc_types( } St::PumpFunTrade => { out.push(Sdk::PumpFunTrade); - out.push(Sdk::PumpFunBuy); - out.push(Sdk::PumpFunSell); - out.push(Sdk::PumpFunBuyExactSolIn); } St::PumpFunBuy => { - if matches!(mode, FilterMapMode::Include) { - out.push(Sdk::PumpFunTrade); - } out.push(Sdk::PumpFunBuy); - out.push(Sdk::PumpFunBuyExactSolIn); } St::PumpFunBuyExactSolIn => { - if matches!(mode, FilterMapMode::Include) { - out.push(Sdk::PumpFunTrade); - } out.push(Sdk::PumpFunBuyExactSolIn); } St::PumpFunSell => { - if matches!(mode, FilterMapMode::Include) { - out.push(Sdk::PumpFunTrade); - } out.push(Sdk::PumpFunSell); } St::PumpFunMigrate => out.push(Sdk::PumpFunMigrate), @@ -459,11 +446,7 @@ fn event_type_matches(filter_type: &EventType, event_type: &EventType) -> bool { | (EventType::PumpFunTrade, EventType::PumpFunBuy) | (EventType::PumpFunTrade, EventType::PumpFunSell) | (EventType::PumpFunTrade, EventType::PumpFunBuyExactSolIn) - | (EventType::PumpFunBuy, EventType::PumpFunTrade) - | (EventType::PumpFunSell, EventType::PumpFunTrade) - | (EventType::PumpFunBuyExactSolIn, EventType::PumpFunTrade) | (EventType::PumpFunBuy, EventType::PumpFunBuyExactSolIn) - | (EventType::PumpFunBuyExactSolIn, EventType::PumpFunBuy) | (EventType::TokenAccount, EventType::TokenInfo) | (EventType::RaydiumClmmSwap, EventType::RaydiumClmmSwapV2) | (EventType::RaydiumClmmSwapV2, EventType::RaydiumClmmSwap) @@ -584,11 +567,12 @@ mod tests { fn build_sdk_filter_pumpfun_buy_only() { let f = EventTypeFilter { include: vec![EventType::PumpFunBuy], ..Default::default() }; let sdk_f = build_sdk_parse_event_filter(Some(&f)).expect("mapped"); - assert!(sdk_f.should_include(SdkGrpcEventType::PumpFunTrade)); assert!(sdk_f.should_include(SdkGrpcEventType::PumpFunBuy)); assert!(sdk_f.should_include(SdkGrpcEventType::PumpFunBuyExactSolIn)); - assert!(sdk_f.should_include(SdkGrpcEventType::PumpFunSell)); + assert!(!sdk_f.should_include(SdkGrpcEventType::PumpFunTrade)); + assert!(!sdk_f.should_include(SdkGrpcEventType::PumpFunSell)); assert!(f.passes_event_type(&EventType::PumpFunBuy)); + assert!(f.passes_event_type(&EventType::PumpFunBuyExactSolIn)); assert!(!f.passes_event_type(&EventType::PumpFunSell)); } @@ -600,6 +584,7 @@ mod tests { assert!(sdk_f.should_include(SdkGrpcEventType::PumpFunBuy)); assert!(sdk_f.should_include(SdkGrpcEventType::PumpFunSell)); assert!(sdk_f.should_include(SdkGrpcEventType::PumpFunBuyExactSolIn)); + assert!(f.passes_event_type(&EventType::PumpFunTrade)); assert!(f.passes_event_type(&EventType::PumpFunBuy)); assert!(f.passes_event_type(&EventType::PumpFunSell)); assert!(f.passes_event_type(&EventType::PumpFunBuyExactSolIn)); @@ -639,7 +624,7 @@ mod tests { include: vec![EventType::PumpFunBuyExactSolIn], ..Default::default() }; - assert!(f.passes_event_type(&EventType::PumpFunBuy)); + assert!(!f.passes_event_type(&EventType::PumpFunBuy)); assert!(f.passes_event_type(&EventType::PumpFunBuyExactSolIn)); } @@ -672,11 +657,11 @@ mod tests { ..Default::default() }; let sdk_f = build_sdk_parse_event_filter(Some(&f)).expect("mapped"); - assert!(sdk_f.should_include(SdkGrpcEventType::PumpFunBuy)); - assert!(sdk_f.should_include(SdkGrpcEventType::PumpFunTrade)); assert!(sdk_f.should_include(SdkGrpcEventType::PumpFunBuyExactSolIn)); - assert!(sdk_f.should_include(SdkGrpcEventType::PumpFunSell)); - assert!(f.passes_event_type(&EventType::PumpFunBuy)); + assert!(!sdk_f.should_include(SdkGrpcEventType::PumpFunBuy)); + assert!(!sdk_f.should_include(SdkGrpcEventType::PumpFunTrade)); + assert!(!sdk_f.should_include(SdkGrpcEventType::PumpFunSell)); + assert!(!f.passes_event_type(&EventType::PumpFunBuy)); assert!(!f.passes_event_type(&EventType::PumpFunSell)); assert!(f.passes_event_type(&EventType::PumpFunBuyExactSolIn)); } diff --git a/src/streaming/parser_sdk_bridge/convert.rs b/src/streaming/parser_sdk_bridge/convert.rs index cc4a736..6b495cd 100644 --- a/src/streaming/parser_sdk_bridge/convert.rs +++ b/src/streaming/parser_sdk_bridge/convert.rs @@ -23,7 +23,12 @@ pub(crate) fn convert_parser_event( recv_wall_us: i64, ) -> Option { match ev { - PbDexEvent::PumpFunTrade(t) => Some(pumpfun_trade_from_parser(t, bt, recv_wall_us)), + PbDexEvent::PumpFunTrade(t) => Some(pumpfun_trade_from_parser_with_event_type( + t, + bt, + recv_wall_us, + EventType::PumpFunTrade, + )), PbDexEvent::PumpFunBuy(t) => Some(pumpfun_trade_from_parser_with_event_type( t, bt, diff --git a/src/streaming/parser_sdk_bridge/mod.rs b/src/streaming/parser_sdk_bridge/mod.rs index ce21068..26673dc 100644 --- a/src/streaming/parser_sdk_bridge/mod.rs +++ b/src/streaming/parser_sdk_bridge/mod.rs @@ -93,6 +93,7 @@ mod tests { match ev { DexEvent::PumpFunTradeEvent(st) => { assert_eq!(st.metadata.slot, 42); + assert_eq!(st.metadata.event_type, EventType::PumpFunTrade); assert_eq!(st.metadata.recv_us, 999); assert_eq!(st.sol_amount, 100); assert_eq!(st.token_amount, 200); diff --git a/src/streaming/parser_sdk_bridge/pump_pumpswap.rs b/src/streaming/parser_sdk_bridge/pump_pumpswap.rs index 1c0d165..3bea8d4 100644 --- a/src/streaming/parser_sdk_bridge/pump_pumpswap.rs +++ b/src/streaming/parser_sdk_bridge/pump_pumpswap.rs @@ -667,25 +667,6 @@ pub(crate) fn pumpswap_liquidity_removed_to_withdraw( ..Default::default() } } -pub(crate) fn pumpfun_trade_from_parser( - t: sol_parser_sdk::core::events::PumpFunTradeEvent, - bt: Option<&Timestamp>, - recv_wall_us: i64, -) -> DexEvent { - let event_type = pumpfun_trade_event_type(&t); - pumpfun_trade_from_parser_with_event_type(t, bt, recv_wall_us, event_type) -} - -pub(crate) fn pumpfun_trade_event_type( - t: &sol_parser_sdk::core::events::PumpFunTradeEvent, -) -> EventType { - match t.ix_name.as_str() { - "buy_exact_sol_in" => EventType::PumpFunBuyExactSolIn, - _ if t.is_buy => EventType::PumpFunBuy, - _ => EventType::PumpFunSell, - } -} - pub(crate) fn pumpfun_trade_from_parser_with_event_type( t: sol_parser_sdk::core::events::PumpFunTradeEvent, bt: Option<&Timestamp>,