mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-22 13:28:08 +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:
@@ -38,8 +38,8 @@ impl RaydiumAmmV4EventParser {
|
||||
inner_instruction_discriminator: "",
|
||||
instruction_discriminator: discriminators::SWAP_BASE_IN,
|
||||
event_type: EventType::RaydiumAmmV4SwapBaseIn,
|
||||
inner_instruction_parser: Self::empty_parse,
|
||||
instruction_parser: Self::parse_swap_base_input_instruction,
|
||||
inner_instruction_parser: None,
|
||||
instruction_parser: Some(Self::parse_swap_base_input_instruction),
|
||||
},
|
||||
GenericEventParseConfig {
|
||||
program_id: RAYDIUM_AMM_V4_PROGRAM_ID,
|
||||
@@ -47,8 +47,8 @@ impl RaydiumAmmV4EventParser {
|
||||
inner_instruction_discriminator: "",
|
||||
instruction_discriminator: discriminators::SWAP_BASE_OUT,
|
||||
event_type: EventType::RaydiumAmmV4SwapBaseOut,
|
||||
inner_instruction_parser: Self::empty_parse,
|
||||
instruction_parser: Self::parse_swap_base_output_instruction,
|
||||
inner_instruction_parser: None,
|
||||
instruction_parser: Some(Self::parse_swap_base_output_instruction),
|
||||
},
|
||||
GenericEventParseConfig {
|
||||
program_id: RAYDIUM_AMM_V4_PROGRAM_ID,
|
||||
@@ -56,8 +56,8 @@ impl RaydiumAmmV4EventParser {
|
||||
inner_instruction_discriminator: "",
|
||||
instruction_discriminator: discriminators::DEPOSIT,
|
||||
event_type: EventType::RaydiumAmmV4Deposit,
|
||||
inner_instruction_parser: Self::empty_parse,
|
||||
instruction_parser: Self::parse_deposit_instruction,
|
||||
inner_instruction_parser: None,
|
||||
instruction_parser: Some(Self::parse_deposit_instruction),
|
||||
},
|
||||
GenericEventParseConfig {
|
||||
program_id: RAYDIUM_AMM_V4_PROGRAM_ID,
|
||||
@@ -65,8 +65,8 @@ impl RaydiumAmmV4EventParser {
|
||||
inner_instruction_discriminator: "",
|
||||
instruction_discriminator: discriminators::INITIALIZE2,
|
||||
event_type: EventType::RaydiumAmmV4Initialize2,
|
||||
inner_instruction_parser: Self::empty_parse,
|
||||
instruction_parser: Self::parse_initialize2_instruction,
|
||||
inner_instruction_parser: None,
|
||||
instruction_parser: Some(Self::parse_initialize2_instruction),
|
||||
},
|
||||
GenericEventParseConfig {
|
||||
program_id: RAYDIUM_AMM_V4_PROGRAM_ID,
|
||||
@@ -74,8 +74,8 @@ impl RaydiumAmmV4EventParser {
|
||||
inner_instruction_discriminator: "",
|
||||
instruction_discriminator: discriminators::WITHDRAW,
|
||||
event_type: EventType::RaydiumAmmV4Withdraw,
|
||||
inner_instruction_parser: Self::empty_parse,
|
||||
instruction_parser: Self::parse_withdraw_instruction,
|
||||
inner_instruction_parser: None,
|
||||
instruction_parser: Some(Self::parse_withdraw_instruction),
|
||||
},
|
||||
GenericEventParseConfig {
|
||||
program_id: RAYDIUM_AMM_V4_PROGRAM_ID,
|
||||
@@ -83,8 +83,8 @@ impl RaydiumAmmV4EventParser {
|
||||
inner_instruction_discriminator: "",
|
||||
instruction_discriminator: discriminators::WITHDRAW_PNL,
|
||||
event_type: EventType::RaydiumAmmV4WithdrawPnl,
|
||||
inner_instruction_parser: Self::empty_parse,
|
||||
instruction_parser: Self::parse_withdraw_pnl_instruction,
|
||||
inner_instruction_parser: None,
|
||||
instruction_parser: Some(Self::parse_withdraw_pnl_instruction),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -93,10 +93,6 @@ impl RaydiumAmmV4EventParser {
|
||||
Self { inner }
|
||||
}
|
||||
|
||||
fn empty_parse(_data: &[u8], _metadata: EventMetadata) -> Option<Box<dyn UnifiedEvent>> {
|
||||
None
|
||||
}
|
||||
|
||||
/// 解析提现指令事件
|
||||
fn parse_withdraw_pnl_instruction(
|
||||
_data: &[u8],
|
||||
|
||||
Reference in New Issue
Block a user