mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-19 11:58: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:
@@ -39,8 +39,8 @@ impl BonkEventParser {
|
||||
inner_instruction_discriminator: discriminators::TRADE_EVENT,
|
||||
instruction_discriminator: discriminators::BUY_EXACT_IN,
|
||||
event_type: EventType::BonkBuyExactIn,
|
||||
inner_instruction_parser: Self::parse_trade_inner_instruction,
|
||||
instruction_parser: Self::parse_buy_exact_in_instruction,
|
||||
inner_instruction_parser: Some(Self::parse_trade_inner_instruction),
|
||||
instruction_parser: Some(Self::parse_buy_exact_in_instruction),
|
||||
},
|
||||
GenericEventParseConfig {
|
||||
program_id: BONK_PROGRAM_ID,
|
||||
@@ -48,8 +48,8 @@ impl BonkEventParser {
|
||||
inner_instruction_discriminator: discriminators::TRADE_EVENT,
|
||||
instruction_discriminator: discriminators::BUY_EXACT_OUT,
|
||||
event_type: EventType::BonkBuyExactOut,
|
||||
inner_instruction_parser: Self::parse_trade_inner_instruction,
|
||||
instruction_parser: Self::parse_buy_exact_out_instruction,
|
||||
inner_instruction_parser: Some(Self::parse_trade_inner_instruction),
|
||||
instruction_parser: Some(Self::parse_buy_exact_out_instruction),
|
||||
},
|
||||
GenericEventParseConfig {
|
||||
program_id: BONK_PROGRAM_ID,
|
||||
@@ -57,8 +57,8 @@ impl BonkEventParser {
|
||||
inner_instruction_discriminator: discriminators::TRADE_EVENT,
|
||||
instruction_discriminator: discriminators::SELL_EXACT_IN,
|
||||
event_type: EventType::BonkSellExactIn,
|
||||
inner_instruction_parser: Self::parse_trade_inner_instruction,
|
||||
instruction_parser: Self::parse_sell_exact_in_instruction,
|
||||
inner_instruction_parser: Some(Self::parse_trade_inner_instruction),
|
||||
instruction_parser: Some(Self::parse_sell_exact_in_instruction),
|
||||
},
|
||||
GenericEventParseConfig {
|
||||
program_id: BONK_PROGRAM_ID,
|
||||
@@ -66,8 +66,8 @@ impl BonkEventParser {
|
||||
inner_instruction_discriminator: discriminators::TRADE_EVENT,
|
||||
instruction_discriminator: discriminators::SELL_EXACT_OUT,
|
||||
event_type: EventType::BonkSellExactOut,
|
||||
inner_instruction_parser: Self::parse_trade_inner_instruction,
|
||||
instruction_parser: Self::parse_sell_exact_out_instruction,
|
||||
inner_instruction_parser: Some(Self::parse_trade_inner_instruction),
|
||||
instruction_parser: Some(Self::parse_sell_exact_out_instruction),
|
||||
},
|
||||
GenericEventParseConfig {
|
||||
program_id: BONK_PROGRAM_ID,
|
||||
@@ -75,8 +75,8 @@ impl BonkEventParser {
|
||||
inner_instruction_discriminator: discriminators::POOL_CREATE_EVENT,
|
||||
instruction_discriminator: discriminators::INITIALIZE,
|
||||
event_type: EventType::BonkInitialize,
|
||||
inner_instruction_parser: Self::parse_pool_create_inner_instruction,
|
||||
instruction_parser: Self::parse_initialize_instruction,
|
||||
inner_instruction_parser: Some(Self::parse_pool_create_inner_instruction),
|
||||
instruction_parser: Some(Self::parse_initialize_instruction),
|
||||
},
|
||||
GenericEventParseConfig {
|
||||
program_id: BONK_PROGRAM_ID,
|
||||
@@ -84,8 +84,8 @@ impl BonkEventParser {
|
||||
inner_instruction_discriminator: "",
|
||||
instruction_discriminator: discriminators::MIGRATE_TO_AMM,
|
||||
event_type: EventType::BonkMigrateToAmm,
|
||||
inner_instruction_parser: Self::parse_migrate_to_amm_inner_instruction,
|
||||
instruction_parser: Self::parse_migrate_to_amm_instruction,
|
||||
inner_instruction_parser: None,
|
||||
instruction_parser: Some(Self::parse_migrate_to_amm_instruction),
|
||||
},
|
||||
GenericEventParseConfig {
|
||||
program_id: BONK_PROGRAM_ID,
|
||||
@@ -93,8 +93,8 @@ impl BonkEventParser {
|
||||
inner_instruction_discriminator: "",
|
||||
instruction_discriminator: discriminators::MIGRATE_TO_CP_SWAP,
|
||||
event_type: EventType::BonkMigrateToCpswap,
|
||||
inner_instruction_parser: Self::parse_migrate_to_cpswap_inner_instruction,
|
||||
instruction_parser: Self::parse_migrate_to_cpswap_instruction,
|
||||
inner_instruction_parser: None,
|
||||
instruction_parser: Some(Self::parse_migrate_to_cpswap_instruction),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -117,22 +117,6 @@ impl BonkEventParser {
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse migrate to AMM event
|
||||
fn parse_migrate_to_amm_inner_instruction(
|
||||
_data: &[u8],
|
||||
_metadata: EventMetadata,
|
||||
) -> Option<Box<dyn UnifiedEvent>> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Parse migrate to CP Swap event
|
||||
fn parse_migrate_to_cpswap_inner_instruction(
|
||||
_data: &[u8],
|
||||
_metadata: EventMetadata,
|
||||
) -> Option<Box<dyn UnifiedEvent>> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Parse trade event
|
||||
fn parse_trade_inner_instruction(
|
||||
data: &[u8],
|
||||
|
||||
Reference in New Issue
Block a user