feat(pumpswap): align pool account and events with cashback IDL

- Extend on-chain Pool layout (is_cashback_coin, 7-byte reserved, 244 bytes)
  with backward-compatible decode for 236-byte legacy accounts
- Decode Buy/Sell program logs manually: min_base_amount_out, ix_name,
  cashback fields; optional sell cashback when payload >= 368 bytes
- Set ix_name on buy / buy_exact_quote_in instructions; merge new fields
  in CPI log merger
- Add read_i64_le helper and pool layout unit test

Made-with: Cursor
This commit is contained in:
0xfnzero
2026-04-03 14:38:06 +08:00
parent b593605dbd
commit 7f505f0da5
5 changed files with 281 additions and 12 deletions
@@ -24,6 +24,15 @@ pub fn extract_program_log<'a>(log: &'a str, prefix: &str) -> Option<&'a str> {
log.strip_prefix(prefix)
}
/// 安全地从字节数组中读取 i64
pub fn read_i64_le(data: &[u8], offset: usize) -> Option<i64> {
if data.len() < offset + 8 {
return None;
}
let bytes: [u8; 8] = data[offset..offset + 8].try_into().ok()?;
Some(i64::from_le_bytes(bytes))
}
/// 安全地从字节数组中读取u64
pub fn read_u64_le(data: &[u8], offset: usize) -> Option<u64> {
if data.len() < offset + 8 {