mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-04 13:07:44 +00:00
chore: release v1.3.0
Made-with: Cursor
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "solana-streamer-sdk"
|
||||
version = "1.2.2"
|
||||
version = "1.3.0"
|
||||
edition = "2021"
|
||||
authors = ["William <byteblock6@gmail.com>", "sgxiang <sgxiang@gmail.com>", "wei <1415121722@qq.com>"]
|
||||
repository = "https://github.com/0xfnzero/solana-streamer"
|
||||
|
||||
@@ -109,14 +109,14 @@ Add the dependency to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
# Add to your Cargo.toml
|
||||
solana-streamer-sdk = { path = "./solana-streamer", version = "1.2.2" }
|
||||
solana-streamer-sdk = { path = "./solana-streamer", version = "1.3.0" }
|
||||
```
|
||||
|
||||
### Use crates.io
|
||||
|
||||
```toml
|
||||
# Add to your Cargo.toml
|
||||
solana-streamer-sdk = "1.2.2"
|
||||
solana-streamer-sdk = "1.3.0"
|
||||
```
|
||||
|
||||
## 🔄 Migration Guide
|
||||
|
||||
+2
-2
@@ -108,14 +108,14 @@ git clone https://github.com/0xfnzero/solana-streamer
|
||||
|
||||
```toml
|
||||
# 添加到您的 Cargo.toml
|
||||
solana-streamer-sdk = { path = "./solana-streamer", version = "1.2.2" }
|
||||
solana-streamer-sdk = { path = "./solana-streamer", version = "1.3.0" }
|
||||
```
|
||||
|
||||
### 使用 crates.io
|
||||
|
||||
```toml
|
||||
# 添加到您的 Cargo.toml
|
||||
solana-streamer-sdk = "1.2.2"
|
||||
solana-streamer-sdk = "1.3.0"
|
||||
```
|
||||
|
||||
## 🔄 迁移指南
|
||||
|
||||
@@ -50,6 +50,7 @@ pub struct PumpFunCreateTokenEvent {
|
||||
pub program: Pubkey,
|
||||
}
|
||||
|
||||
/// CreateV2 事件:与 create_v2 指令 16 个账户一致(见 parser 注释)。
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, BorshDeserialize)]
|
||||
pub struct PumpFunCreateV2TokenEvent {
|
||||
#[borsh(skip)]
|
||||
|
||||
@@ -188,10 +188,11 @@ fn parse_create_token_instruction(
|
||||
}
|
||||
|
||||
/// 解析创建 V2 代币指令事件 (SPL-22 Token, Mayhem Mode)
|
||||
/// 账户: 0: mint, 1: mint_authority, 2: bonding_curve, 3: associated_bonding_curve, 4: global,
|
||||
/// 5: user, 6: system_program, 7: token_program, 8: associated_token_program, 9: mayhem_program_id,
|
||||
/// 10: global_params, 11: sol_vault, 12: mayhem_state, 13: mayhem_token_vault, 14: event_authority, 15: program.
|
||||
/// 共 16 个固定账户,不足时返回 None 避免越界。
|
||||
/// 与 IDL create_v2 及区块浏览器一致,共 16 个固定账户:
|
||||
/// 0: mint, 1: mint_authority, 2: bonding_curve, 3: associated_bonding_curve, 4: global,
|
||||
/// 5: user, 6: system_program, 7: token_program, 8: associated_token_program, 9: mayhem_program_id,
|
||||
/// 10: global_params, 11: sol_vault, 12: mayhem_state, 13: mayhem_token_vault, 14: event_authority, 15: program.
|
||||
/// 不足 16 个账户时返回 None 避免越界。
|
||||
/// 注意:shredstream 路径仅传入 static_account_keys,若交易使用 Address Lookup Tables,
|
||||
/// 无法解析 loaded_addresses,部分账户会以 default 填充,导致 token_program/global 等错误。
|
||||
fn parse_create_v2_token_instruction(
|
||||
@@ -199,12 +200,13 @@ fn parse_create_v2_token_instruction(
|
||||
accounts: &[Pubkey],
|
||||
mut metadata: EventMetadata,
|
||||
) -> Option<DexEvent> {
|
||||
metadata.event_type = EventType::PumpFunCreateV2Token;
|
||||
|
||||
const CREATE_V2_MIN_ACCOUNTS: usize = 16;
|
||||
if data.len() < 16 || accounts.len() < CREATE_V2_MIN_ACCOUNTS {
|
||||
// Guard: avoid index out of bounds (e.g. ALT-loaded tx with fewer static accounts). See issue #63.
|
||||
if accounts.len() < CREATE_V2_MIN_ACCOUNTS || data.len() < 16 {
|
||||
return None;
|
||||
}
|
||||
metadata.event_type = EventType::PumpFunCreateV2Token;
|
||||
|
||||
let mut offset = 0;
|
||||
if offset + 4 > data.len() {
|
||||
return None;
|
||||
@@ -242,28 +244,30 @@ fn parse_create_v2_token_instruction(
|
||||
Pubkey::default()
|
||||
};
|
||||
|
||||
// Safe slice: already guaranteed accounts.len() >= 16 above; avoid any index panic (issue #63).
|
||||
let acc = &accounts[0..CREATE_V2_MIN_ACCOUNTS];
|
||||
Some(DexEvent::PumpFunCreateV2TokenEvent(PumpFunCreateV2TokenEvent {
|
||||
metadata,
|
||||
name: name.to_string(),
|
||||
symbol: symbol.to_string(),
|
||||
uri: uri.to_string(),
|
||||
creator,
|
||||
mint: accounts[0],
|
||||
mint_authority: accounts[1],
|
||||
bonding_curve: accounts[2],
|
||||
associated_bonding_curve: accounts[3],
|
||||
global: accounts[4],
|
||||
user: accounts[5],
|
||||
system_program: accounts[6],
|
||||
token_program: accounts[7],
|
||||
associated_token_program: accounts[8],
|
||||
mayhem_program_id: accounts[9],
|
||||
global_params: accounts[10],
|
||||
sol_vault: accounts[11],
|
||||
mayhem_state: accounts[12],
|
||||
mayhem_token_vault: accounts[13],
|
||||
event_authority: accounts[14],
|
||||
program: accounts[15],
|
||||
mint: acc[0],
|
||||
mint_authority: acc[1],
|
||||
bonding_curve: acc[2],
|
||||
associated_bonding_curve: acc[3],
|
||||
global: acc[4],
|
||||
user: acc[5],
|
||||
system_program: acc[6],
|
||||
token_program: acc[7],
|
||||
associated_token_program: acc[8],
|
||||
mayhem_program_id: acc[9],
|
||||
global_params: acc[10],
|
||||
sol_vault: acc[11],
|
||||
mayhem_state: acc[12],
|
||||
mayhem_token_vault: acc[13],
|
||||
event_authority: acc[14],
|
||||
program: acc[15],
|
||||
..Default::default()
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user