mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-22 05:18:06 +00:00
feat: Add account event parser and protocol type definitions
- Add account event parser (account_event_parser.rs) for account-level event handling - Introduce type definitions for pumpfun, pumpswap, raydium_amm_v4, raydium_clmm, raydium_cpmm protocols - Enhance event processor to support account event processing alongside transactions - Improve subscription system with separate transaction and account filters - Optimize parser configuration using Option types for cleaner code structure - Update examples and documentation to reflect new capabilities Changes include: - 6 new types.rs files for protocol-specific data structures - Updated event processor for account, transaction, and block meta events - Refactored subscription manager with account filtering support - Enhanced metrics and batch processing logic
This commit is contained in:
@@ -4,6 +4,7 @@ use solana_sdk::pubkey::Pubkey;
|
||||
|
||||
use crate::impl_unified_event;
|
||||
use crate::streaming::event_parser::common::EventMetadata;
|
||||
use crate::streaming::event_parser::protocols::pumpfun::types::{BondingCurve, Global};
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, BorshDeserialize)]
|
||||
pub struct PumpFunCreateTokenEvent {
|
||||
@@ -177,6 +178,35 @@ impl_unified_event!(
|
||||
pool
|
||||
);
|
||||
|
||||
/// 铸币曲线
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, BorshDeserialize)]
|
||||
pub struct PumpFunBondingCurveAccountEvent {
|
||||
#[borsh(skip)]
|
||||
pub metadata: EventMetadata,
|
||||
pub pubkey: String,
|
||||
pub executable: bool,
|
||||
pub lamports: u64,
|
||||
pub owner: String,
|
||||
pub rent_epoch: u64,
|
||||
pub bonding_curve: BondingCurve,
|
||||
}
|
||||
|
||||
impl_unified_event!(PumpFunBondingCurveAccountEvent,);
|
||||
|
||||
/// 全局配置
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, BorshDeserialize)]
|
||||
pub struct PumpFunGlobalAccountEvent {
|
||||
#[borsh(skip)]
|
||||
pub metadata: EventMetadata,
|
||||
pub pubkey: String,
|
||||
pub executable: bool,
|
||||
pub lamports: u64,
|
||||
pub owner: String,
|
||||
pub rent_epoch: u64,
|
||||
pub global: Global,
|
||||
}
|
||||
impl_unified_event!(PumpFunGlobalAccountEvent,);
|
||||
|
||||
/// 事件鉴别器常量
|
||||
pub mod discriminators {
|
||||
// 事件鉴别器
|
||||
@@ -189,4 +219,8 @@ pub mod discriminators {
|
||||
pub const BUY_IX: &[u8] = &[102, 6, 61, 18, 1, 218, 235, 234];
|
||||
pub const SELL_IX: &[u8] = &[51, 230, 133, 164, 1, 127, 131, 173];
|
||||
pub const MIGRATE_IX: &[u8] = &[155, 234, 231, 146, 236, 158, 162, 30];
|
||||
|
||||
// 账户鉴别器
|
||||
pub const BONDING_CURVE_ACCOUNT: &[u8] = &[23, 183, 248, 55, 96, 216, 172, 96];
|
||||
pub const GLOBAL_ACCOUNT: &[u8] = &[167, 232, 232, 177, 200, 108, 114, 127];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user