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:
ysq
2025-08-13 23:30:59 +08:00
parent c753c8418d
commit aee8921ad5
40 changed files with 1845 additions and 349 deletions
@@ -38,8 +38,8 @@ impl PumpSwapEventParser {
inner_instruction_discriminator: discriminators::BUY_EVENT,
instruction_discriminator: discriminators::BUY_IX,
event_type: EventType::PumpSwapBuy,
inner_instruction_parser: Self::parse_buy_inner_instruction,
instruction_parser: Self::parse_buy_instruction,
inner_instruction_parser: Some(Self::parse_buy_inner_instruction),
instruction_parser: Some(Self::parse_buy_instruction),
},
GenericEventParseConfig {
program_id: PUMPSWAP_PROGRAM_ID,
@@ -47,8 +47,8 @@ impl PumpSwapEventParser {
inner_instruction_discriminator: discriminators::SELL_EVENT,
instruction_discriminator: discriminators::SELL_IX,
event_type: EventType::PumpSwapSell,
inner_instruction_parser: Self::parse_sell_inner_instruction,
instruction_parser: Self::parse_sell_instruction,
inner_instruction_parser: Some(Self::parse_sell_inner_instruction),
instruction_parser: Some(Self::parse_sell_instruction),
},
GenericEventParseConfig {
program_id: PUMPSWAP_PROGRAM_ID,
@@ -56,8 +56,8 @@ impl PumpSwapEventParser {
inner_instruction_discriminator: discriminators::CREATE_POOL_EVENT,
instruction_discriminator: discriminators::CREATE_POOL_IX,
event_type: EventType::PumpSwapCreatePool,
inner_instruction_parser: Self::parse_create_pool_inner_instruction,
instruction_parser: Self::parse_create_pool_instruction,
inner_instruction_parser: Some(Self::parse_create_pool_inner_instruction),
instruction_parser: Some(Self::parse_create_pool_instruction),
},
GenericEventParseConfig {
program_id: PUMPSWAP_PROGRAM_ID,
@@ -65,8 +65,8 @@ impl PumpSwapEventParser {
inner_instruction_discriminator: discriminators::DEPOSIT_EVENT,
instruction_discriminator: discriminators::DEPOSIT_IX,
event_type: EventType::PumpSwapDeposit,
inner_instruction_parser: Self::parse_deposit_inner_instruction,
instruction_parser: Self::parse_deposit_instruction,
inner_instruction_parser: Some(Self::parse_deposit_inner_instruction),
instruction_parser: Some(Self::parse_deposit_instruction),
},
GenericEventParseConfig {
program_id: PUMPSWAP_PROGRAM_ID,
@@ -74,8 +74,8 @@ impl PumpSwapEventParser {
inner_instruction_discriminator: discriminators::WITHDRAW_EVENT,
instruction_discriminator: discriminators::WITHDRAW_IX,
event_type: EventType::PumpSwapWithdraw,
inner_instruction_parser: Self::parse_withdraw_inner_instruction,
instruction_parser: Self::parse_withdraw_instruction,
inner_instruction_parser: Some(Self::parse_withdraw_inner_instruction),
instruction_parser: Some(Self::parse_withdraw_instruction),
},
];