diff --git a/Cargo.toml b/Cargo.toml index 623ce9d..980b817 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "solana-streamer-sdk" -version = "1.5.10" +version = "1.5.11" 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.10", default-features = false } +sol-parser-sdk = { version = "0.5.11", 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 72504bb..c9e78a0 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.10" } +solana-streamer-sdk = { path = "./solana-streamer", version = "1.5.11" } ``` ### Use crates.io ```toml # Add to your Cargo.toml -solana-streamer-sdk = "1.5.10" +solana-streamer-sdk = "1.5.11" ``` Parser backend features: ```toml # Default: sol-parser-sdk parse-borsh backend -solana-streamer-sdk = "1.5.10" +solana-streamer-sdk = "1.5.11" # Zero-copy parser backend for latency-sensitive bots -solana-streamer-sdk = { version = "1.5.10", default-features = false, features = ["sdk-parse-zero-copy"] } +solana-streamer-sdk = { version = "1.5.11", 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.10+` uses the zero-copy backend. +If both `sdk-parse-borsh` and `sdk-parse-zero-copy` are enabled, `sol-parser-sdk 0.5.11+` uses the zero-copy backend. ## 🔄 Migration Guide +### Upgrading to v1.5.11 + +Version 1.5.11 uses `sol-parser-sdk 0.5.11` from crates.io. PumpSwap `PumpSwapCreatePoolEvent` now carries `is_cashback_coin` when it is available from the `create_pool` instruction args, including ShredStream outer-instruction parsing. Log-only `CreatePoolEvent` payloads still default this field to `false` because the on-chain log event IDL does not carry it. `AccountPumpSwapPool` remains the authoritative account-state source for the pool flag. + ### Upgrading to v1.5.10 Version 1.5.10 uses `sol-parser-sdk 0.5.10` from crates.io. PumpSwap `CreatePoolEvent` now matches the on-chain IDL: it exposes `is_mayhem_mode` but does not expose `is_cashback_coin`. To read the cashback flag, subscribe to `AccountPumpSwapPool` and use `PumpSwapPoolAccountEvent.pool.is_cashback_coin`. The PumpSwap CreatePool log payload length check now includes the final `is_mayhem_mode` byte. @@ -428,9 +432,11 @@ let event_type_filter = Some(EventTypeFilter::include_only(vec![ ])); ``` -`PumpSwapCreatePool` follows the on-chain `CreatePoolEvent` IDL and includes -`is_mayhem_mode`, but it does not include `is_cashback_coin`. To read the -cashback flag, subscribe to `AccountPumpSwapPool` and use +`PumpSwapCreatePool` includes `is_mayhem_mode`. For `is_cashback_coin`, +ShredStream/outer-instruction parsing reads the flag from the `create_pool` +instruction args, while log-only `CreatePoolEvent` payloads keep the default +`false` because the log event IDL does not carry this field. The authoritative +account value is also available from `PumpSwapPoolAccountEvent.pool.is_cashback_coin`. ## Dynamic Subscription Management diff --git a/README_CN.md b/README_CN.md index 022263a..64f9659 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.10" } +solana-streamer-sdk = { path = "./solana-streamer", version = "1.5.11" } ``` ### 使用 crates.io ```toml # 添加到您的 Cargo.toml -solana-streamer-sdk = "1.5.10" +solana-streamer-sdk = "1.5.11" ``` 解析后端 feature: ```toml # 默认:sol-parser-sdk parse-borsh 后端 -solana-streamer-sdk = "1.5.10" +solana-streamer-sdk = "1.5.11" # 面向低延迟 Bot 的 zero-copy 解析后端 -solana-streamer-sdk = { version = "1.5.10", default-features = false, features = ["sdk-parse-zero-copy"] } +solana-streamer-sdk = { version = "1.5.11", default-features = false, features = ["sdk-parse-zero-copy"] } ``` -如果同时启用 `sdk-parse-borsh` 和 `sdk-parse-zero-copy`,`sol-parser-sdk 0.5.10+` 会优先使用 zero-copy 后端。 +如果同时启用 `sdk-parse-borsh` 和 `sdk-parse-zero-copy`,`sol-parser-sdk 0.5.11+` 会优先使用 zero-copy 后端。 ## 🔄 迁移指南 +### 升级到 v1.5.11 + +v1.5.11 使用 crates.io 上的 `sol-parser-sdk 0.5.11`。PumpSwap `PumpSwapCreatePoolEvent` 现在会在 `create_pool` instruction args 可用时携带 `is_cashback_coin`,包括 ShredStream 外层指令解析。log-only 的 `CreatePoolEvent` payload 因为链上 log event IDL 不包含该字段,仍会保持默认 `false`。`AccountPumpSwapPool` 仍是读取池子账户状态里该标记的权威来源。 + ### 升级到 v1.5.10 v1.5.10 使用 crates.io 上的 `sol-parser-sdk 0.5.10`。PumpSwap `CreatePoolEvent` 现在与链上 IDL 对齐:暴露 `is_mayhem_mode`,但不暴露 `is_cashback_coin`。如果需要 cashback 标记,请订阅 `AccountPumpSwapPool`,并读取 `PumpSwapPoolAccountEvent.pool.is_cashback_coin`。PumpSwap CreatePool log payload 长度检查现在包含最后的 `is_mayhem_mode` 字节。 @@ -427,10 +431,11 @@ let event_type_filter = Some(EventTypeFilter::include_only(vec![ ])); ``` -`PumpSwapCreatePool` 对齐链上 `CreatePoolEvent` IDL,包含 -`is_mayhem_mode`,但不包含 `is_cashback_coin`。如果需要 cashback 标记, -请订阅 `AccountPumpSwapPool`,并读取 -`PumpSwapPoolAccountEvent.pool.is_cashback_coin`。 +`PumpSwapCreatePool` 包含 `is_mayhem_mode`。对于 `is_cashback_coin`, +ShredStream/外层指令解析会从 `create_pool` instruction args 读取; +log-only 的 `CreatePoolEvent` payload 因为 IDL 不包含该字段,会保持默认 +`false`。账户里的权威值也可通过 +`PumpSwapPoolAccountEvent.pool.is_cashback_coin` 读取。 ## 动态订阅管理 diff --git a/src/streaming/event_parser/core/merger_event.rs b/src/streaming/event_parser/core/merger_event.rs index d8f35fe..356218e 100644 --- a/src/streaming/event_parser/core/merger_event.rs +++ b/src/streaming/event_parser/core/merger_event.rs @@ -426,6 +426,7 @@ pub fn merge(instruction_event: &mut DexEvent, cpi_log_event: DexEvent) { e.user_quote_token_account = cpie.user_quote_token_account; e.coin_creator = cpie.coin_creator; e.is_mayhem_mode = cpie.is_mayhem_mode; + e.is_cashback_coin |= cpie.is_cashback_coin; } _ => {} }, diff --git a/src/streaming/event_parser/protocols/pumpswap/events.rs b/src/streaming/event_parser/protocols/pumpswap/events.rs index 2c94796..6764109 100755 --- a/src/streaming/event_parser/protocols/pumpswap/events.rs +++ b/src/streaming/event_parser/protocols/pumpswap/events.rs @@ -163,6 +163,9 @@ pub struct PumpSwapCreatePoolEvent { pub coin_creator: Pubkey, pub is_mayhem_mode: bool, #[borsh(skip)] + #[serde(default)] + pub is_cashback_coin: bool, + #[borsh(skip)] pub user_pool_token_account: Pubkey, #[borsh(skip)] pub pool_base_token_account: Pubkey, diff --git a/src/streaming/parser_sdk_bridge/mod.rs b/src/streaming/parser_sdk_bridge/mod.rs index b536b92..caa3373 100644 --- a/src/streaming/parser_sdk_bridge/mod.rs +++ b/src/streaming/parser_sdk_bridge/mod.rs @@ -217,6 +217,7 @@ mod tests { base_mint: Pubkey::new_unique(), quote_mint: Pubkey::new_unique(), is_mayhem_mode: true, + is_cashback_coin: true, ..Default::default() }; @@ -226,6 +227,7 @@ mod tests { DexEvent::PumpSwapCreatePoolEvent(st) => { assert_eq!(st.metadata.event_type, EventType::PumpSwapCreatePool); assert!(st.is_mayhem_mode); + assert!(st.is_cashback_coin); } _ => panic!("expected PumpSwapCreatePoolEvent"), } diff --git a/src/streaming/parser_sdk_bridge/pump_pumpswap.rs b/src/streaming/parser_sdk_bridge/pump_pumpswap.rs index b65975d..b2c32f4 100644 --- a/src/streaming/parser_sdk_bridge/pump_pumpswap.rs +++ b/src/streaming/parser_sdk_bridge/pump_pumpswap.rs @@ -613,6 +613,7 @@ pub(crate) fn pumpswap_create_pool_from_parser( user_quote_token_account: c.user_quote_token_account, coin_creator: c.coin_creator, is_mayhem_mode: c.is_mayhem_mode, + is_cashback_coin: c.is_cashback_coin, ..Default::default() } }