From 87465cbfdbbd094be41389b765c27c3ca4748a92 Mon Sep 17 00:00:00 2001 From: ysq Date: Tue, 5 Aug 2025 18:23:01 +0800 Subject: [PATCH] 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 --- Cargo.toml | 34 +++++++++---------- README.md | 4 +-- README_CN.md | 4 +-- src/streaming/event_parser/core/traits.rs | 4 +-- .../event_parser/protocols/pumpfun/parser.rs | 4 +-- .../event_parser/protocols/pumpswap/parser.rs | 2 +- src/streaming/yellowstone_grpc.rs | 12 +++++-- 7 files changed, 35 insertions(+), 29 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 31f86e8..64aa143 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "solana-streamer-sdk" -version = "0.1.10" +version = "0.1.11" edition = "2021" authors = ["William ", "sgxiang ", "wei <1415121722@qq.com>"] repository = "https://github.com/0xfnzero/solana-streamer" @@ -13,19 +13,19 @@ readme = "README.md" crate-type = ["cdylib", "rlib"] [dependencies] -solana-sdk = "2.1.16" -solana-client = "2.1.16" -solana-program = "2.1.16" -solana-rpc-client = "2.1.16" -solana-rpc-client-api = "2.1.16" -solana-transaction-status = "2.1.16" -solana-account-decoder = "2.1.16" -solana-hash = "2.1.16" -solana-entry = "2.1.16" -solana-rpc-client-nonce-utils = "2.1.16" -solana-perf = "2.1.16" -solana-metrics = "2.1.16" -spl-associated-token-account = "6.0.0" +solana-sdk = "2.3.0" +solana-client = "2.3.6" +solana-program = "2.3.0" +solana-rpc-client = "2.3.6" +solana-rpc-client-api = "2.3.6" +solana-transaction-status = "2.3.6" +solana-account-decoder = "2.3.6" +solana-hash = "2.3.0" +solana-entry = "2.3.6" +solana-rpc-client-nonce-utils = "2.3.6" +solana-perf = "2.3.6" +solana-metrics = "2.3.6" +spl-associated-token-account = "7.0.0" borsh = { version = "1.5.3", features = ["derive"] } serde = { version = "1.0.215", features = ["derive"] } serde_json = "1.0.134" @@ -36,8 +36,8 @@ bs58 = "0.5.1" rand = "0.9.0" bincode = "1.3.3" anyhow = "1.0.90" -yellowstone-grpc-client = { version = "6.0.0" } -yellowstone-grpc-proto = { version = "6.0.0" } +yellowstone-grpc-client = { version = "8.0.0" } +yellowstone-grpc-proto = { version = "8.0.0" } tokio = { version = "1.42.0", features = ["full", "rt-multi-thread"]} tonic = { version = "0.12.3", features = ["tls", "tls-roots", "tls-webpki-roots"] } rustls = { version = "0.23.23", features = ["ring"] } @@ -60,6 +60,6 @@ hex = "0.4.3" bytemuck = { version = "1.4.0" } arrayref = "0.3.6" borsh-derive = "1.5.5" -indicatif = "0.17.11" +indicatif = "0.18.0" maplit = "1.0.2" env_logger = "0.11.8" diff --git a/README.md b/README.md index 5975762..3b3e7e5 100755 --- a/README.md +++ b/README.md @@ -41,14 +41,14 @@ Add the dependency to your `Cargo.toml`: ```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 ```toml # Add to your Cargo.toml -solana-streamer-sdk = "0.1.10" +solana-streamer-sdk = "0.1.11" ``` ## Usage Examples diff --git a/README_CN.md b/README_CN.md index c801a87..8ad6d81 100644 --- a/README_CN.md +++ b/README_CN.md @@ -41,14 +41,14 @@ git clone https://github.com/0xfnzero/solana-streamer ```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 ```toml # 添加到您的 Cargo.toml -solana-streamer-sdk = "0.1.10" +solana-streamer-sdk = "0.1.11" ``` ## 使用示例 diff --git a/src/streaming/event_parser/core/traits.rs b/src/streaming/event_parser/core/traits.rs index 926940e..b3cc6e1 100755 --- a/src/streaming/event_parser/core/traits.rs +++ b/src/streaming/event_parser/core/traits.rs @@ -358,7 +358,7 @@ pub trait EventParser: Send + Sync { slot, block_time, program_received_time_ms, - format!("{index}"), + format!("{}.{}", inner_instruction.index, index), ) .await { @@ -367,7 +367,7 @@ pub trait EventParser: Send + Sync { let transfer_datas = parse_transfer_datas_from_next_instructions( &inner_instruction, - -1_i8, + index as i8, &accounts, event.event_type(), ); diff --git a/src/streaming/event_parser/protocols/pumpfun/parser.rs b/src/streaming/event_parser/protocols/pumpfun/parser.rs index b128159..5fdc88a 100755 --- a/src/streaming/event_parser/protocols/pumpfun/parser.rs +++ b/src/streaming/event_parser/protocols/pumpfun/parser.rs @@ -159,7 +159,7 @@ impl PumpFunEventParser { accounts: &[Pubkey], metadata: EventMetadata, ) -> Option> { - if data.len() < 16 || accounts.len() < 11 { + if data.len() < 16 || accounts.len() < 13 { return None; } 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 { - vec![PUMPFUN_PROGRAM_ID] + self.inner.supported_program_ids() } } diff --git a/src/streaming/event_parser/protocols/pumpswap/parser.rs b/src/streaming/event_parser/protocols/pumpswap/parser.rs index 94e96bd..4dc4fd9 100755 --- a/src/streaming/event_parser/protocols/pumpswap/parser.rs +++ b/src/streaming/event_parser/protocols/pumpswap/parser.rs @@ -419,6 +419,6 @@ impl EventParser for PumpSwapEventParser { } fn supported_program_ids(&self) -> Vec { - vec![PUMPSWAP_PROGRAM_ID] + self.inner.supported_program_ids() } } diff --git a/src/streaming/yellowstone_grpc.rs b/src/streaming/yellowstone_grpc.rs index 769aef6..c6c027f 100755 --- a/src/streaming/yellowstone_grpc.rs +++ b/src/streaming/yellowstone_grpc.rs @@ -3,7 +3,7 @@ use std::{collections::HashMap, fmt, time::Duration}; use chrono::Local; use futures::{channel::mpsc, sink::Sink, SinkExt, Stream, StreamExt}; use log::{error, info}; -use prost_types::Timestamp; +use yellowstone_grpc_proto::prost_types::Timestamp; use rustls::crypto::{ring::default_provider, CryptoProvider}; use solana_sdk::{pubkey::Pubkey, signature::Signature}; use solana_transaction_status::{EncodedTransactionWithStatusMeta, UiTransactionEncoding}; @@ -1035,7 +1035,10 @@ impl YellowstoneGrpc { tx_clone, &signature_clone, 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, bot_wallet_clone, ) @@ -1111,7 +1114,10 @@ impl YellowstoneGrpc { tx_clone, &signature_clone, 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, bot_wallet_clone, )