#[derive(serde::Deserialize)]
pub struct RawInstruction {
pub id: i64,
pub signature: String,
pub instruction_index: i32,
#[serde(default)]
pub instruction_path: Option<String>,
pub program_id: String,
pub inner_program_id: String,
pub instruction_name: String,
pub accounts: Option<serde_json::Value>,
pub args: Option<serde_json::Value>,
pub slot: i64,
}
#[derive(serde::Deserialize)]
pub struct RawEvent {
pub id: i64,
pub signature: String,
pub event_index: i32,
#[serde(default)]
pub event_path: Option<String>,
pub program_id: String,
pub inner_program_id: String,
pub event_name: String,
pub fields: Option<serde_json::Value>,
pub slot: i64,
}
impl RawEvent {
pub fn parent_instruction_path(&self) -> Option<&str> {
self.event_path
.as_deref()
.map(Self::parent_instruction_path_from)
}
pub fn parent_instruction_path_from(event_path: &str) -> &str {
event_path
.rsplit_once('.')
.map_or(event_path, |(instruction_path, _)| instruction_path)
}
}
pub struct ResolveContext {
pub pre_fetched_order_pdas: Option<Vec<String>>,
}