feat(event_parser): add requires_inner_instruction field to skip incomplete events

- Add requires_inner_instruction field to GenericEventParseConfig
  - Skip events that require but lack inner instruction data during processing
  - Set PumpFun migrate events to require inner instructions (prevents parsing failed migrations)
This commit is contained in:
ioxde
2025-09-08 20:19:13 -07:00
parent d219433466
commit 8ec1457858
7 changed files with 50 additions and 0 deletions
@@ -40,6 +40,7 @@ impl PumpFunEventParser {
event_type: EventType::PumpFunCreateToken,
inner_instruction_parser: Some(Self::parse_create_token_inner_instruction),
instruction_parser: Some(Self::parse_create_token_instruction),
requires_inner_instruction: false,
},
GenericEventParseConfig {
program_id: PUMPFUN_PROGRAM_ID,
@@ -49,6 +50,7 @@ impl PumpFunEventParser {
event_type: EventType::PumpFunBuy,
inner_instruction_parser: Some(Self::parse_trade_inner_instruction),
instruction_parser: Some(Self::parse_buy_instruction),
requires_inner_instruction: false,
},
GenericEventParseConfig {
program_id: PUMPFUN_PROGRAM_ID,
@@ -58,6 +60,7 @@ impl PumpFunEventParser {
event_type: EventType::PumpFunSell,
inner_instruction_parser: Some(Self::parse_trade_inner_instruction),
instruction_parser: Some(Self::parse_sell_instruction),
requires_inner_instruction: false,
},
GenericEventParseConfig {
program_id: PUMPFUN_PROGRAM_ID,
@@ -67,6 +70,8 @@ impl PumpFunEventParser {
event_type: EventType::PumpFunMigrate,
inner_instruction_parser: Some(Self::parse_migrate_inner_instruction),
instruction_parser: Some(Self::parse_migrate_instruction),
// Failed migrations lack inner instruction data (typically "Bonding curve already migrated")
requires_inner_instruction: true,
},
];