feat: upgrade to Solana 2.3.x and fix event parsing

- Bump version to 0.1.11
- Upgrade Solana deps to 2.3.x, yellowstone-grpc to 8.0.0
- Fix inner instruction indexing and timestamp handling
- Improve PumpFun/PumpSwap parser program ID support
This commit is contained in:
ysq
2025-08-05 18:23:01 +08:00
parent f700481f1f
commit 87465cbfdb
7 changed files with 35 additions and 29 deletions
+17 -17
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "solana-streamer-sdk" name = "solana-streamer-sdk"
version = "0.1.10" version = "0.1.11"
edition = "2021" edition = "2021"
authors = ["William <byteblock6@gmail.com>", "sgxiang <sgxiang@gmail.com>", "wei <1415121722@qq.com>"] authors = ["William <byteblock6@gmail.com>", "sgxiang <sgxiang@gmail.com>", "wei <1415121722@qq.com>"]
repository = "https://github.com/0xfnzero/solana-streamer" repository = "https://github.com/0xfnzero/solana-streamer"
@@ -13,19 +13,19 @@ readme = "README.md"
crate-type = ["cdylib", "rlib"] crate-type = ["cdylib", "rlib"]
[dependencies] [dependencies]
solana-sdk = "2.1.16" solana-sdk = "2.3.0"
solana-client = "2.1.16" solana-client = "2.3.6"
solana-program = "2.1.16" solana-program = "2.3.0"
solana-rpc-client = "2.1.16" solana-rpc-client = "2.3.6"
solana-rpc-client-api = "2.1.16" solana-rpc-client-api = "2.3.6"
solana-transaction-status = "2.1.16" solana-transaction-status = "2.3.6"
solana-account-decoder = "2.1.16" solana-account-decoder = "2.3.6"
solana-hash = "2.1.16" solana-hash = "2.3.0"
solana-entry = "2.1.16" solana-entry = "2.3.6"
solana-rpc-client-nonce-utils = "2.1.16" solana-rpc-client-nonce-utils = "2.3.6"
solana-perf = "2.1.16" solana-perf = "2.3.6"
solana-metrics = "2.1.16" solana-metrics = "2.3.6"
spl-associated-token-account = "6.0.0" spl-associated-token-account = "7.0.0"
borsh = { version = "1.5.3", features = ["derive"] } borsh = { version = "1.5.3", features = ["derive"] }
serde = { version = "1.0.215", features = ["derive"] } serde = { version = "1.0.215", features = ["derive"] }
serde_json = "1.0.134" serde_json = "1.0.134"
@@ -36,8 +36,8 @@ bs58 = "0.5.1"
rand = "0.9.0" rand = "0.9.0"
bincode = "1.3.3" bincode = "1.3.3"
anyhow = "1.0.90" anyhow = "1.0.90"
yellowstone-grpc-client = { version = "6.0.0" } yellowstone-grpc-client = { version = "8.0.0" }
yellowstone-grpc-proto = { version = "6.0.0" } yellowstone-grpc-proto = { version = "8.0.0" }
tokio = { version = "1.42.0", features = ["full", "rt-multi-thread"]} tokio = { version = "1.42.0", features = ["full", "rt-multi-thread"]}
tonic = { version = "0.12.3", features = ["tls", "tls-roots", "tls-webpki-roots"] } tonic = { version = "0.12.3", features = ["tls", "tls-roots", "tls-webpki-roots"] }
rustls = { version = "0.23.23", features = ["ring"] } rustls = { version = "0.23.23", features = ["ring"] }
@@ -60,6 +60,6 @@ hex = "0.4.3"
bytemuck = { version = "1.4.0" } bytemuck = { version = "1.4.0" }
arrayref = "0.3.6" arrayref = "0.3.6"
borsh-derive = "1.5.5" borsh-derive = "1.5.5"
indicatif = "0.17.11" indicatif = "0.18.0"
maplit = "1.0.2" maplit = "1.0.2"
env_logger = "0.11.8" env_logger = "0.11.8"
+2 -2
View File
@@ -41,14 +41,14 @@ Add the dependency to your `Cargo.toml`:
```toml ```toml
# Add to your Cargo.toml # Add to your Cargo.toml
solana-streamer-sdk = { path = "./solana-streamer", version = "0.1.10" } solana-streamer-sdk = { path = "./solana-streamer", version = "0.1.11" }
``` ```
### Use crates.io ### Use crates.io
```toml ```toml
# Add to your Cargo.toml # Add to your Cargo.toml
solana-streamer-sdk = "0.1.10" solana-streamer-sdk = "0.1.11"
``` ```
## Usage Examples ## Usage Examples
+2 -2
View File
@@ -41,14 +41,14 @@ git clone https://github.com/0xfnzero/solana-streamer
```toml ```toml
# 添加到您的 Cargo.toml # 添加到您的 Cargo.toml
solana-streamer-sdk = { path = "./solana-streamer", version = "0.1.10" } solana-streamer-sdk = { path = "./solana-streamer", version = "0.1.11" }
``` ```
### 使用 crates.io ### 使用 crates.io
```toml ```toml
# 添加到您的 Cargo.toml # 添加到您的 Cargo.toml
solana-streamer-sdk = "0.1.10" solana-streamer-sdk = "0.1.11"
``` ```
## 使用示例 ## 使用示例
+2 -2
View File
@@ -358,7 +358,7 @@ pub trait EventParser: Send + Sync {
slot, slot,
block_time, block_time,
program_received_time_ms, program_received_time_ms,
format!("{index}"), format!("{}.{}", inner_instruction.index, index),
) )
.await .await
{ {
@@ -367,7 +367,7 @@ pub trait EventParser: Send + Sync {
let transfer_datas = let transfer_datas =
parse_transfer_datas_from_next_instructions( parse_transfer_datas_from_next_instructions(
&inner_instruction, &inner_instruction,
-1_i8, index as i8,
&accounts, &accounts,
event.event_type(), event.event_type(),
); );
@@ -159,7 +159,7 @@ impl PumpFunEventParser {
accounts: &[Pubkey], accounts: &[Pubkey],
metadata: EventMetadata, metadata: EventMetadata,
) -> Option<Box<dyn UnifiedEvent>> { ) -> Option<Box<dyn UnifiedEvent>> {
if data.len() < 16 || accounts.len() < 11 { if data.len() < 16 || accounts.len() < 13 {
return None; return None;
} }
let amount = u64::from_le_bytes(data[0..8].try_into().unwrap()); let amount = u64::from_le_bytes(data[0..8].try_into().unwrap());
@@ -273,6 +273,6 @@ impl EventParser for PumpFunEventParser {
} }
fn supported_program_ids(&self) -> Vec<Pubkey> { fn supported_program_ids(&self) -> Vec<Pubkey> {
vec![PUMPFUN_PROGRAM_ID] self.inner.supported_program_ids()
} }
} }
@@ -419,6 +419,6 @@ impl EventParser for PumpSwapEventParser {
} }
fn supported_program_ids(&self) -> Vec<Pubkey> { fn supported_program_ids(&self) -> Vec<Pubkey> {
vec![PUMPSWAP_PROGRAM_ID] self.inner.supported_program_ids()
} }
} }
+9 -3
View File
@@ -3,7 +3,7 @@ use std::{collections::HashMap, fmt, time::Duration};
use chrono::Local; use chrono::Local;
use futures::{channel::mpsc, sink::Sink, SinkExt, Stream, StreamExt}; use futures::{channel::mpsc, sink::Sink, SinkExt, Stream, StreamExt};
use log::{error, info}; use log::{error, info};
use prost_types::Timestamp; use yellowstone_grpc_proto::prost_types::Timestamp;
use rustls::crypto::{ring::default_provider, CryptoProvider}; use rustls::crypto::{ring::default_provider, CryptoProvider};
use solana_sdk::{pubkey::Pubkey, signature::Signature}; use solana_sdk::{pubkey::Pubkey, signature::Signature};
use solana_transaction_status::{EncodedTransactionWithStatusMeta, UiTransactionEncoding}; use solana_transaction_status::{EncodedTransactionWithStatusMeta, UiTransactionEncoding};
@@ -1035,7 +1035,10 @@ impl YellowstoneGrpc {
tx_clone, tx_clone,
&signature_clone, &signature_clone,
Some(slot), Some(slot),
transaction_pretty.block_time, transaction_pretty.block_time.map(|ts| prost_types::Timestamp {
seconds: ts.seconds,
nanos: ts.nanos,
}),
program_received_time_ms, program_received_time_ms,
bot_wallet_clone, bot_wallet_clone,
) )
@@ -1111,7 +1114,10 @@ impl YellowstoneGrpc {
tx_clone, tx_clone,
&signature_clone, &signature_clone,
Some(slot), Some(slot),
transaction_pretty.block_time, transaction_pretty.block_time.map(|ts| prost_types::Timestamp {
seconds: ts.seconds,
nanos: ts.nanos,
}),
program_received_time_ms, program_received_time_ms,
bot_wallet_clone, bot_wallet_clone,
) )