use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct EnhancedNativeTransfer {
pub from_user_account: String,
pub to_user_account: String,
pub amount: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct EnhancedTokenTransfer {
pub from_user_account: Option<String>,
pub to_user_account: Option<String>,
pub from_token_account: Option<String>,
pub to_token_account: Option<String>,
pub mint: String,
pub token_amount: u64,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub token_standard: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct EnhancedInstruction {
pub program_id: String,
pub accounts: Vec<String>,
pub data: String,
#[serde(default)]
pub inner_instructions: Vec<EnhancedInstruction>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct AccountData {
pub account: String,
pub native_balance_change: i64,
#[serde(default)]
pub token_balance_changes: Vec<serde_json::Value>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct EnhancedTransaction {
pub signature: String,
pub slot: u64,
#[serde(skip_serializing_if = "Option::is_none")]
pub timestamp: Option<i64>,
#[serde(rename = "type")]
pub tx_type: String,
pub source: String,
pub fee: u64,
pub fee_payer: String,
pub description: String,
pub native_transfers: Vec<EnhancedNativeTransfer>,
pub token_transfers: Vec<EnhancedTokenTransfer>,
pub instructions: Vec<EnhancedInstruction>,
#[serde(default)]
pub account_data: Vec<AccountData>,
pub events: EnhancedEvents,
#[serde(default)]
pub lighthouse_data: Option<serde_json::Value>,
#[serde(default)]
pub transaction_error: Option<serde_json::Value>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
pub struct EnhancedEvents {
#[serde(skip_serializing_if = "Option::is_none")]
pub nft: Option<NftEvent>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct NftEvent {
#[serde(rename = "type")]
pub event_type: String,
pub source: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub nfts: Option<Vec<NftEventMint>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub buyer: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub seller: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct NftEventMint {
pub mint: String,
pub token_standard: String,
}