release: prepare solana-streamer v1.4.0

This commit is contained in:
0xfnzero
2026-05-15 05:16:25 +08:00
parent ab84249f4a
commit ba86cfcd1b
3 changed files with 161 additions and 75 deletions
+2 -2
View File
@@ -1,10 +1,10 @@
[package]
name = "solana-streamer-sdk"
version = "1.3.0"
version = "1.4.0"
edition = "2021"
authors = ["William <byteblock6@gmail.com>", "sgxiang <sgxiang@gmail.com>", "wei <1415121722@qq.com>"]
repository = "https://github.com/0xfnzero/solana-streamer"
description = "A lightweight Rust library for real-time event streaming from Solana DEX trading programs. Supports PumpFun, PumpSwap, Bonk, and Raydium protocols with Yellowstone gRPC and ShredStream."
description = "A low-latency Solana DEX event streaming facade over sol-parser-sdk with Yellowstone gRPC, ShredStream, and RPC parsing helpers."
license = "MIT"
keywords = ["solana", "streaming", "events", "grpc", "shredstream"]
readme = "README.md"
+79 -36
View File
@@ -4,7 +4,7 @@
</div>
<p align="center">
<strong>A lightweight Rust library providing efficient event parsing and subscription capabilities for PumpFun, PumpSwap, Bonk, and Raydium protocols.</strong>
<strong>A lightweight Rust streaming facade over sol-parser-sdk, with low-latency subscriptions and a stable bot-facing API.</strong>
</p>
<p align="center">
@@ -68,6 +68,7 @@
### Core Capabilities
- **Real-time Event Streaming**: Subscribe to live trading events from multiple Solana DEX protocols
- **SDK-backed Parser Core**: Transaction, RPC, account, and ShredStream parsing are backed by `sol-parser-sdk`
- **Yellowstone gRPC Support**: High-performance event subscription using Yellowstone gRPC
- **ShredStream Support**: Alternative event streaming using ShredStream protocol
- **Unified Event Interface**: Consistent event handling across all supported protocols
@@ -79,6 +80,10 @@
- **Raydium CPMM**: Raydium's Concentrated Pool Market Maker events
- **Raydium CLMM**: Raydium's Concentrated Liquidity Market Maker events
- **Raydium AMM V4**: Raydium's Automated Market Maker V4 events
- **Meteora DAMM v2**: Meteora DAMM v2 swap and liquidity events
- **Orca Whirlpool**: Orca Whirlpool swap and liquidity events
- **Meteora Pools**: Meteora Pools swap, liquidity, bootstrap, and fee events
- **Meteora DLMM**: Meteora DLMM swap, liquidity, pool, bin-array, and fee events
### Advanced Features
- **Event Parsing System**: Automatic parsing and categorization of protocol-specific events
@@ -88,6 +93,8 @@
- **Multi-Filter Support**: Support for multiple transaction and account filters in a single subscription
- **Advanced Account Filtering**: Memcmp filters for precise account data matching and monitoring
- **Token2022 Support**: Enhanced support for SPL Token 2022 with extended state parsing
- **RPC Transaction Parsing**: Parse already-fetched RPC transactions or fetch by signature through streamer-compatible helpers
- **Advanced SDK Interop**: Access the raw `sol-parser-sdk` crate through `parser_sdk` or `sdk_bridge::raw`
### Performance & Optimization
- **High Performance**: Optimized for low-latency event processing
@@ -115,18 +122,41 @@ Add the dependency to your `Cargo.toml`:
```toml
# Add to your Cargo.toml
solana-streamer-sdk = { path = "./solana-streamer", version = "1.3.0" }
solana-streamer-sdk = { path = "./solana-streamer", version = "1.4.0" }
```
### Use crates.io
```toml
# Add to your Cargo.toml
solana-streamer-sdk = "1.3.0"
solana-streamer-sdk = "1.4.0"
```
Parser backend features:
```toml
# Default: sol-parser-sdk parse-borsh backend
solana-streamer-sdk = "1.4.0"
# Zero-copy parser backend for latency-sensitive bots
solana-streamer-sdk = { version = "1.4.0", default-features = false, features = ["sdk-parse-zero-copy"] }
```
If both `sdk-parse-borsh` and `sdk-parse-zero-copy` are enabled, `sol-parser-sdk 0.4.4+` uses the zero-copy backend.
## 🔄 Migration Guide
### Upgrading to v1.4.0
Version 1.4.0 moves the streamer parsing hot path onto `sol-parser-sdk 0.4.4` while preserving the existing subscription and callback API. Existing bots can usually upgrade by changing only the crate version.
New optional capabilities:
- `solana_streamer_sdk::parser_sdk` re-exports the raw `sol-parser-sdk` crate.
- `solana_streamer_sdk::sdk_bridge` adapts raw SDK events back into streamer `DexEvent`.
- `fetch_rpc_transaction_as_streamer_events` and `parse_encoded_rpc_transaction_as_streamer_events` parse RPC transactions into streamer events.
- `sdk-parse-zero-copy` enables the SDK zero-copy parser backend.
### Migrating from v0.5.x to v1.x.x
Version 1.0.0 introduces a major architectural change from trait-based event handling to enum-based events. This provides better type safety, improved performance, and simpler code patterns.
@@ -218,9 +248,13 @@ use solana_streamer_sdk::streaming::event_parser::common::{filter::EventTypeFilt
let event_type_filter = None;
// Filter specific event types - only receive PumpSwap buy/sell events
let event_type_filter = Some(EventTypeFilter {
include: vec![EventType::PumpSwapBuy, EventType::PumpSwapSell]
});
let event_type_filter = Some(EventTypeFilter::include_only(vec![
EventType::PumpSwapBuy,
EventType::PumpSwapSell,
]));
// Exclude noisy events while keeping everything else
let event_type_filter = Some(EventTypeFilter::exclude_only(vec![EventType::BlockMeta]));
```
#### Performance Impact
@@ -235,33 +269,33 @@ Event filtering can provide significant performance improvements:
**Trading Bot (Focus on Trade Events)**
```rust
let event_type_filter = Some(EventTypeFilter {
include: vec![
EventType::PumpSwapBuy,
EventType::PumpSwapSell,
EventType::PumpFunTrade,
EventType::RaydiumCpmmSwap,
EventType::RaydiumClmmSwap,
EventType::RaydiumAmmV4Swap,
......
]
});
let event_type_filter = Some(EventTypeFilter::include_only(vec![
EventType::PumpSwapBuy,
EventType::PumpSwapSell,
EventType::PumpFunBuy,
EventType::PumpFunSell,
EventType::RaydiumCpmmSwapBaseInput,
EventType::RaydiumClmmSwap,
EventType::RaydiumAmmV4SwapBaseIn,
EventType::OrcaWhirlpoolSwap,
EventType::MeteoraDlmmSwap,
]));
```
**Pool Monitoring (Focus on Liquidity Events)**
```rust
let event_type_filter = Some(EventTypeFilter {
include: vec![
EventType::PumpSwapCreatePool,
EventType::PumpSwapDeposit,
EventType::PumpSwapWithdraw,
EventType::RaydiumCpmmInitialize,
EventType::RaydiumCpmmDeposit,
EventType::RaydiumCpmmWithdraw,
EventType::RaydiumClmmCreatePool,
......
]
});
let event_type_filter = Some(EventTypeFilter::include_only(vec![
EventType::PumpSwapCreatePool,
EventType::PumpSwapDeposit,
EventType::PumpSwapWithdraw,
EventType::RaydiumCpmmInitialize,
EventType::RaydiumCpmmDeposit,
EventType::RaydiumCpmmWithdraw,
EventType::RaydiumClmmCreatePool,
EventType::MeteoraDammV2AddLiquidity,
EventType::MeteoraPoolsAddLiquidity,
EventType::MeteoraDlmmAddLiquidity,
]));
```
## Dynamic Subscription Management
@@ -299,6 +333,11 @@ Note: Multiple subscription attempts on the same client return an error.
- **Raydium CPMM**: Raydium's Concentrated Pool Market Maker protocol
- **Raydium CLMM**: Raydium's Concentrated Liquidity Market Maker protocol
- **Raydium AMM V4**: Raydium's Automated Market Maker V4 protocol
- **Meteora DAMM v2**: Meteora DAMM v2 protocol
- **Orca Whirlpool**: Orca Whirlpool protocol
- **Meteora Pools**: Meteora Pools protocol
- **Meteora DLMM**: Meteora Dynamic Liquidity Market Maker protocol
- **Common events**: Token accounts, token metadata, nonce accounts, block metadata, and ComputeBudget events
## 🌐 Event Streaming Services
@@ -311,13 +350,13 @@ Note: Multiple subscription attempts on the same client return an error.
- **DexEvent Enum**: Type-safe enum containing all protocol events
- **Protocol Enum**: Easy identification of event sources
- **Event Factory**: Automatic event parsing and categorization
- **SDK Bridge**: Adapts `sol-parser-sdk::DexEvent` into streamer `DexEvent`
### Event Parsing System
- **Protocol-specific Parsers**: Dedicated parsers for each supported protocol
- **Event Factory**: Centralized event creation and parsing
- **Extensible Design**: Easy to add new protocols and event types
- **sol-parser-sdk First**: Yellowstone gRPC, RPC transaction parsing, account parsing, and SDK ShredStream integration use the SDK implementation first
- **ComputeBudget Local Pass**: The local instruction pass is retained for ComputeBudget events and no-meta fallback cases
- **Extensible Bridge**: `streaming::sdk_bridge` exposes raw SDK access without forcing existing bots to change callbacks
### Streaming Infrastructure
@@ -334,15 +373,19 @@ src/
├── streaming/ # Event streaming system
│ ├── event_parser/ # Event parsing system
│ │ ├── common/ # Common event parsing tools
│ │ ├── core/ # Core parsing traits and interfaces
│ │ ├── core/ # gRPC and compiled transaction parser entry points
│ │ ├── protocols/# Protocol-specific parsers
│ │ │ ├── bonk/ # Bonk event parsing
│ │ │ ├── meteora_damm_v2/ # Meteora DAMM v2 event parsing
│ │ │ ├── pumpfun/ # PumpFun event parsing
│ │ │ ├── pumpswap/ # PumpSwap event parsing
│ │ │ ├── raydium_amm_v4/ # Raydium AMM V4 event parsing
│ │ │ ├── raydium_clmm/ # Raydium CLMM event parsing
│ │ │ ├── raydium_cpmm/ # Raydium CPMM event parsing
│ │ │ └── raydium_clmm/ # Raydium CLMM event parsing
│ └── factory.rs # Parser factory
│ │ │ └── sol_parser_forward/ # SDK-forwarded protocol event wrappers
├── parser_sdk_bridge/ # sol-parser-sdk event adapter
│ ├── rpc_parse.rs # RPC transaction parsing helpers
│ ├── sdk_bridge.rs # Public advanced SDK interop module
│ ├── shred_stream.rs # ShredStream client
│ ├── yellowstone_grpc.rs # Yellowstone gRPC client
│ └── yellowstone_sub_system.rs # Yellowstone subsystem
+80 -37
View File
@@ -4,7 +4,7 @@
</div>
<p align="center">
<strong>一个轻量级 Rust 库,为 PumpFun、PumpSwap、Bonk 和 Raydium 协议提供高效的事件解析和订阅功能。</strong>
<strong>一个基于 sol-parser-sdk 的轻量级 Rust 流式封装库,提供低延迟订阅能力,并保持面向 Bot 用户的稳定 API。</strong>
</p>
<p align="center">
@@ -67,6 +67,7 @@
### 核心功能
- **实时事件流**: 订阅多个 Solana DEX 协议的实时交易事件
- **SDK 底层解析核心**: 交易、RPC、账户和 ShredStream 解析都优先复用 `sol-parser-sdk`
- **Yellowstone gRPC 支持**: 使用 Yellowstone gRPC 进行高性能事件订阅
- **ShredStream 支持**: 使用 ShredStream 协议进行替代事件流传输
- **统一事件接口**: 在所有支持的协议中保持一致的事件处理
@@ -78,6 +79,10 @@
- **Raydium CPMM**: Raydium 集中池做市商事件
- **Raydium CLMM**: Raydium 集中流动性做市商事件
- **Raydium AMM V4**: Raydium 自动做市商 V4 事件
- **Meteora DAMM v2**: Meteora DAMM v2 交易和流动性事件
- **Orca Whirlpool**: Orca Whirlpool 交易和流动性事件
- **Meteora Pools**: Meteora Pools 交易、流动性、启动流动性和费用事件
- **Meteora DLMM**: Meteora DLMM 交易、流动性、池、bin array 和费用事件
### 高级功能
- **事件解析系统**: 自动解析和分类协议特定事件
@@ -87,6 +92,8 @@
- **多重过滤器支持**: 在单个订阅中支持多个交易和账户过滤器
- **高级账户过滤**: 使用 memcmp 过滤器进行精确的账户数据匹配和监控
- **Token2022 支持**: 增强对 SPL Token 2022 的支持,包含扩展状态解析
- **RPC 交易解析**: 可解析已获取的 RPC 交易,也可按签名拉取并转换为 streamer 事件
- **高级 SDK 互操作**: 通过 `parser_sdk``sdk_bridge::raw` 直接访问底层 `sol-parser-sdk`
### 性能与优化
- **高性能**: 针对低延迟事件处理进行优化
@@ -114,18 +121,41 @@ git clone https://github.com/0xfnzero/solana-streamer
```toml
# 添加到您的 Cargo.toml
solana-streamer-sdk = { path = "./solana-streamer", version = "1.3.0" }
solana-streamer-sdk = { path = "./solana-streamer", version = "1.4.0" }
```
### 使用 crates.io
```toml
# 添加到您的 Cargo.toml
solana-streamer-sdk = "1.3.0"
solana-streamer-sdk = "1.4.0"
```
解析后端 feature
```toml
# 默认:sol-parser-sdk parse-borsh 后端
solana-streamer-sdk = "1.4.0"
# 面向低延迟 Bot 的 zero-copy 解析后端
solana-streamer-sdk = { version = "1.4.0", default-features = false, features = ["sdk-parse-zero-copy"] }
```
如果同时启用 `sdk-parse-borsh``sdk-parse-zero-copy``sol-parser-sdk 0.4.4+` 会优先使用 zero-copy 后端。
## 🔄 迁移指南
### 升级到 v1.4.0
v1.4.0 将 streamer 的解析热路径迁移到 `sol-parser-sdk 0.4.4`,同时保留已有订阅和回调 API。大多数 Bot 只需要修改 crate 版本即可升级。
新增可选能力:
- `solana_streamer_sdk::parser_sdk` 重新导出原始 `sol-parser-sdk` crate。
- `solana_streamer_sdk::sdk_bridge` 可将原始 SDK 事件适配回 streamer `DexEvent`
- `fetch_rpc_transaction_as_streamer_events``parse_encoded_rpc_transaction_as_streamer_events` 可将 RPC 交易解析为 streamer 事件。
- `sdk-parse-zero-copy` 可启用 SDK zero-copy 解析后端。
### 从 v0.5.x 迁移到 v1.x.x
版本 1.0.0 引入了从基于 trait 的事件处理到基于 enum 的事件的重大架构变更。这提供了更好的类型安全性、改进的性能和更简单的代码模式。
@@ -217,9 +247,13 @@ use solana_streamer_sdk::streaming::event_parser::common::{filter::EventTypeFilt
let event_type_filter = None;
// 过滤特定事件类型 - 只接收 PumpSwap 买入/卖出事件
let event_type_filter = Some(EventTypeFilter {
include: vec![EventType::PumpSwapBuy, EventType::PumpSwapSell]
});
let event_type_filter = Some(EventTypeFilter::include_only(vec![
EventType::PumpSwapBuy,
EventType::PumpSwapSell,
]));
// 排除高频噪声事件,保留其他所有事件
let event_type_filter = Some(EventTypeFilter::exclude_only(vec![EventType::BlockMeta]));
```
#### 性能影响
@@ -234,33 +268,33 @@ let event_type_filter = Some(EventTypeFilter {
**交易机器人(专注交易事件)**
```rust
let event_type_filter = Some(EventTypeFilter {
include: vec![
EventType::PumpSwapBuy,
EventType::PumpSwapSell,
EventType::PumpFunTrade,
EventType::RaydiumCpmmSwap,
EventType::RaydiumClmmSwap,
EventType::RaydiumAmmV4Swap,
.....
]
});
let event_type_filter = Some(EventTypeFilter::include_only(vec![
EventType::PumpSwapBuy,
EventType::PumpSwapSell,
EventType::PumpFunBuy,
EventType::PumpFunSell,
EventType::RaydiumCpmmSwapBaseInput,
EventType::RaydiumClmmSwap,
EventType::RaydiumAmmV4SwapBaseIn,
EventType::OrcaWhirlpoolSwap,
EventType::MeteoraDlmmSwap,
]));
```
**池监控(专注流动性事件)**
```rust
let event_type_filter = Some(EventTypeFilter {
include: vec![
EventType::PumpSwapCreatePool,
EventType::PumpSwapDeposit,
EventType::PumpSwapWithdraw,
EventType::RaydiumCpmmInitialize,
EventType::RaydiumCpmmDeposit,
EventType::RaydiumCpmmWithdraw,
EventType::RaydiumClmmCreatePool,
......
]
});
let event_type_filter = Some(EventTypeFilter::include_only(vec![
EventType::PumpSwapCreatePool,
EventType::PumpSwapDeposit,
EventType::PumpSwapWithdraw,
EventType::RaydiumCpmmInitialize,
EventType::RaydiumCpmmDeposit,
EventType::RaydiumCpmmWithdraw,
EventType::RaydiumClmmCreatePool,
EventType::MeteoraDammV2AddLiquidity,
EventType::MeteoraPoolsAddLiquidity,
EventType::MeteoraDlmmAddLiquidity,
]));
```
## 动态订阅管理
@@ -298,6 +332,11 @@ grpc.update_subscription(
- **Raydium CPMM**: Raydium 集中池做市商协议
- **Raydium CLMM**: Raydium 集中流动性做市商协议
- **Raydium AMM V4**: Raydium 自动做市商 V4 协议
- **Meteora DAMM v2**: Meteora DAMM v2 协议
- **Orca Whirlpool**: Orca Whirlpool 协议
- **Meteora Pools**: Meteora Pools 协议
- **Meteora DLMM**: Meteora 动态流动性做市商协议
- **通用事件**: Token 账户、Token 元信息、Nonce 账户、区块元数据和 ComputeBudget 事件
## 🌐 事件流服务
@@ -310,13 +349,13 @@ grpc.update_subscription(
- **DexEvent 枚举**: 包含所有协议事件的类型安全枚举
- **Protocol Enum**: 轻松识别事件来源
- **Event Factory**: 自动事件解析和分类
- **SDK 桥接层**: 将 `sol-parser-sdk::DexEvent` 适配为 streamer `DexEvent`
### 事件解析系统
- **协议特定解析器**: 每个支持协议的专用解析器
- **事件工厂**: 集中式事件创建和解析
- **可扩展设计**: 易于添加新协议和事件类型
- **sol-parser-sdk 优先**: Yellowstone gRPC、RPC 交易解析、账户解析和 SDK ShredStream 集成都优先使用 SDK 实现
- **ComputeBudget 本地补充**: 本地指令解析保留用于 ComputeBudget 事件和无 meta 交易 fallback
- **可扩展桥接层**: `streaming::sdk_bridge` 暴露原始 SDK 能力,但不强迫已有 Bot 改回调 API
### 流基础设施
@@ -333,15 +372,19 @@ src/
├── streaming/ # 事件流系统
│ ├── event_parser/ # 事件解析系统
│ │ ├── common/ # 通用事件解析工具
│ │ ├── core/ # 核心解析特征和接
│ │ ├── core/ # gRPC 和 compiled transaction 解析入
│ │ ├── protocols/# 协议特定解析器
│ │ │ ├── bonk/ # Bonk 事件解析
│ │ │ ├── meteora_damm_v2/ # Meteora DAMM v2 事件解析
│ │ │ ├── pumpfun/ # PumpFun 事件解析
│ │ │ ├── pumpswap/ # PumpSwap 事件解析
│ │ │ ├── raydium_amm_v4/ # Raydium AMM V4 事件解析
│ │ │ ├── raydium_clmm/ # Raydium CLMM 事件解析
│ │ │ ├── raydium_cpmm/ # Raydium CPMM 事件解析
│ │ │ └── raydium_clmm/ # Raydium CLMM 事件解析
│ └── factory.rs # 解析器工厂
│ │ │ └── sol_parser_forward/ # SDK 转发协议事件封装
├── parser_sdk_bridge/ # sol-parser-sdk 事件适配层
│ ├── rpc_parse.rs # RPC 交易解析 helper
│ ├── sdk_bridge.rs # 公开的高级 SDK 互操作模块
│ ├── shred_stream.rs # ShredStream 客户端
│ ├── yellowstone_grpc.rs # Yellowstone gRPC 客户端
│ └── yellowstone_sub_system.rs # Yellowstone 子系统
@@ -380,4 +423,4 @@ MIT 许可证
## 语言版本
- [English](README.md)
- [中文](README_CN.md)
- [中文](README_CN.md)