Release solana-streamer-sdk 1.5.10

This commit is contained in:
0xfnzero
2026-06-07 02:00:14 +08:00
parent 28ffd0f566
commit 89bf36148f
8 changed files with 115 additions and 13 deletions
@@ -425,6 +425,7 @@ pub fn merge(instruction_event: &mut DexEvent, cpi_log_event: DexEvent) {
e.user_base_token_account = cpie.user_base_token_account;
e.user_quote_token_account = cpie.user_quote_token_account;
e.coin_creator = cpie.coin_creator;
e.is_mayhem_mode = cpie.is_mayhem_mode;
}
_ => {}
},
@@ -161,6 +161,7 @@ pub struct PumpSwapCreatePoolEvent {
pub user_base_token_account: Pubkey,
pub user_quote_token_account: Pubkey,
pub coin_creator: Pubkey,
pub is_mayhem_mode: bool,
#[borsh(skip)]
pub user_pool_token_account: Pubkey,
#[borsh(skip)]
@@ -169,7 +170,7 @@ pub struct PumpSwapCreatePoolEvent {
pub pool_quote_token_account: Pubkey,
}
pub const PUMP_SWAP_CREATE_POOL_EVENT_LOG_SIZE: usize = 325;
pub const PUMP_SWAP_CREATE_POOL_EVENT_LOG_SIZE: usize = 326;
/// 存款事件
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, BorshDeserialize)]
+77
View File
@@ -43,6 +43,8 @@ mod tests {
use sol_parser_sdk::core::events::{
EventMetadata, MeteoraDlmmSwapEvent as PbDlmmSwap, OrcaWhirlpoolSwapEvent as PbOrcaSwap,
PumpFunCreateV2TokenEvent as PbPumpCreateV2, PumpFunTradeEvent as PbPumpTrade,
PumpSwapCreatePoolEvent as PbPumpSwapCreatePool, PumpSwapPool as PbPumpSwapPool,
PumpSwapPoolAccountEvent as PbPumpSwapPoolAccount,
RaydiumLaunchlabTradeEvent as PbBonkTrade, TokenInfoEvent as PbTokenInfo,
TradeDirection as PbBonkDir,
};
@@ -200,6 +202,81 @@ mod tests {
}
}
#[test]
fn converts_pumpswap_create_pool_flags() {
let c = PbPumpSwapCreatePool {
metadata: EventMetadata {
signature: Signature::default(),
slot: 42,
tx_index: 7,
block_time_us: 1_000_000,
grpc_recv_us: 88,
recent_blockhash: None,
},
pool: Pubkey::new_unique(),
base_mint: Pubkey::new_unique(),
quote_mint: Pubkey::new_unique(),
is_mayhem_mode: true,
..Default::default()
};
let ev =
convert_parser_event(PbDexEvent::PumpSwapCreatePool(c), None, 999).expect("convert");
match ev {
DexEvent::PumpSwapCreatePoolEvent(st) => {
assert_eq!(st.metadata.event_type, EventType::PumpSwapCreatePool);
assert!(st.is_mayhem_mode);
}
_ => panic!("expected PumpSwapCreatePoolEvent"),
}
}
#[test]
fn converts_pumpswap_pool_account_cashback_flag() {
let pool_pubkey = Pubkey::new_unique();
let e = PbPumpSwapPoolAccount {
metadata: EventMetadata {
signature: Signature::default(),
slot: 42,
tx_index: 7,
block_time_us: 1_000_000,
grpc_recv_us: 88,
recent_blockhash: None,
},
pubkey: pool_pubkey,
executable: false,
lamports: 123,
owner: Pubkey::new_unique(),
rent_epoch: 0,
pool: PbPumpSwapPool {
pool_bump: 7,
index: 42,
creator: Pubkey::new_unique(),
base_mint: Pubkey::new_unique(),
quote_mint: Pubkey::new_unique(),
lp_mint: Pubkey::new_unique(),
pool_base_token_account: Pubkey::new_unique(),
pool_quote_token_account: Pubkey::new_unique(),
lp_supply: 999,
coin_creator: Pubkey::new_unique(),
is_mayhem_mode: true,
is_cashback_coin: true,
},
};
let ev =
convert_parser_event(PbDexEvent::PumpSwapPoolAccount(e), None, 999).expect("convert");
match ev {
DexEvent::PumpSwapPoolAccountEvent(st) => {
assert_eq!(st.metadata.event_type, EventType::AccountPumpSwapPool);
assert_eq!(st.pubkey, pool_pubkey);
assert!(st.pool.is_mayhem_mode);
assert!(st.pool.is_cashback_coin);
}
_ => panic!("expected PumpSwapPoolAccountEvent"),
}
}
#[test]
fn protocol_filter_keeps_pumpfun_only_when_requested() {
let mut t = PbPumpTrade::default();
@@ -612,6 +612,7 @@ pub(crate) fn pumpswap_create_pool_from_parser(
user_base_token_account: c.user_base_token_account,
user_quote_token_account: c.user_quote_token_account,
coin_creator: c.coin_creator,
is_mayhem_mode: c.is_mayhem_mode,
..Default::default()
}
}