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