Skip to main content

sol_parser_sdk/core/events/
route_intent.rs

1//! Instructions observed before execution, never confirmed fills.
2use super::EventMetadata;
3use serde::{Deserialize, Serialize};
4use solana_sdk::pubkey::Pubkey;
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7pub enum PumpRouteKind {
8    MultiHopSwap,
9    MultiHopCurveSwap,
10    RapidBuy,
11    BuyPumpDelta,
12}
13
14#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
15pub struct PumpRouteHop {
16    pub base_mint: Pubkey,
17    pub quote_mint: Pubkey,
18    /// Pool or bonding curve; this does not assert which branch executed.
19    pub venue: Pubkey,
20    pub base_vault: Pubkey,
21    pub quote_vault: Pubkey,
22}
23
24/// A recognized outer instruction's route intent. Execution status, actual
25/// amounts, reserves and balances are deliberately absent. A wrapper may choose
26/// amounts or skip a CPI at runtime. Use execution metadata for confirmed fills.
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct PumpRouteIntentEvent {
29    pub metadata: EventMetadata,
30    pub kind: PumpRouteKind,
31    pub program: Pubkey,
32    /// Index within the signed message, distinct from metadata.tx_index.
33    pub instruction_index: usize,
34    pub user: Pubkey,
35    pub input_account: Pubkey,
36    pub output_account: Pubkey,
37    /// Explicit instruction input only; None for balance-dependent wrappers.
38    pub amount_in: Option<u64>,
39    /// Explicit output constraint, never actual output.
40    pub min_amount_out: Option<u64>,
41    pub hops: Vec<PumpRouteHop>,
42    /// Original instruction data, including discriminator. Unknown wrapper
43    /// parameters remain opaque instead of being guessed as trade amounts.
44    pub instruction_data: Vec<u8>,
45}