defi_tracker_lifecycle/types.rs
1/// A decoded Solana instruction row as produced by the upstream indexer.
2#[derive(serde::Deserialize)]
3pub struct RawInstruction {
4 /// Database row id.
5 pub id: i64,
6 /// Transaction signature (base58).
7 pub signature: String,
8 /// Position of this instruction within the transaction.
9 pub instruction_index: i32,
10 /// Top-level program that was invoked.
11 pub program_id: String,
12 /// Innermost program if this is a CPI; equals `program_id` otherwise.
13 pub inner_program_id: String,
14 /// Carbon-decoded instruction discriminator name (e.g. `"OpenDca"`).
15 pub instruction_name: String,
16 /// Parsed account list, if available.
17 pub accounts: Option<serde_json::Value>,
18 /// Parsed instruction arguments, if available.
19 pub args: Option<serde_json::Value>,
20 /// Solana slot in which the transaction landed.
21 pub slot: i64,
22}
23
24/// A decoded Solana event (log) row as produced by the upstream indexer.
25#[derive(serde::Deserialize)]
26pub struct RawEvent {
27 /// Database row id.
28 pub id: i64,
29 /// Transaction signature (base58).
30 pub signature: String,
31 /// Position of this event within the transaction logs.
32 pub event_index: i32,
33 /// Top-level program that was invoked.
34 pub program_id: String,
35 /// Innermost program if this is a CPI; equals `program_id` otherwise.
36 pub inner_program_id: String,
37 /// Carbon-decoded event discriminator name (e.g. `"FilledEvent"`).
38 pub event_name: String,
39 /// Parsed event fields as `{"EventName": {..}}` JSON.
40 pub fields: Option<serde_json::Value>,
41 /// Solana slot in which the transaction landed.
42 pub slot: i64,
43}
44
45/// Caller-supplied context needed to resolve certain events.
46///
47/// Kamino `OrderDisplayEvent` carries no order PDA in its payload.
48/// The caller must pre-fetch order PDAs from the instruction-level account
49/// list and pass them here so the adapter can correlate the event.
50pub struct ResolveContext {
51 /// Order PDAs extracted from instruction accounts for the same transaction.
52 /// Required for Kamino `OrderDisplayEvent`; `None` causes `Uncorrelated`.
53 pub pre_fetched_order_pdas: Option<Vec<String>>,
54}