goldrush_sdk/models/transactions.rs
1use serde::Deserialize;
2
3/// Represents a transaction item returned by the API.
4#[derive(Debug, Clone, Deserialize)]
5pub struct TransactionItem {
6 /// The transaction hash.
7 pub tx_hash: String,
8
9 /// The sender address.
10 pub from_address: String,
11
12 /// The recipient address.
13 pub to_address: Option<String>,
14
15 /// The transaction value as a string.
16 pub value: String,
17
18 /// Whether the transaction was successful.
19 pub successful: Option<bool>,
20
21 /// Block height where this transaction was included.
22 pub block_height: Option<u64>,
23
24 /// Block hash where this transaction was included.
25 pub block_hash: Option<String>,
26
27 /// Timestamp when the transaction was mined.
28 pub block_signed_at: Option<String>,
29
30 /// Gas price used for the transaction.
31 pub gas_price: Option<u64>,
32
33 /// Gas limit set for the transaction.
34 pub gas_limit: Option<u64>,
35
36 /// Gas used by the transaction.
37 pub gas_used: Option<u64>,
38
39 /// Transaction fee paid.
40 pub fees_paid: Option<String>,
41
42 /// Quote value of the transaction.
43 pub value_quote: Option<f64>,
44
45 /// Quote value of the gas fees.
46 pub gas_quote: Option<f64>,
47
48 /// Quote currency used for calculations.
49 pub gas_quote_rate: Option<f64>,
50
51 /// Log events associated with this transaction.
52 pub log_events: Option<Vec<LogEvent>>,
53}
54
55/// Represents a log event in a transaction.
56#[derive(Debug, Clone, Deserialize)]
57pub struct LogEvent {
58 /// The contract address that emitted this log.
59 pub sender_contract_address: String,
60
61 /// The log topic hash.
62 pub sender_contract_ticker_symbol: Option<String>,
63
64 /// The raw log data.
65 pub raw_log_data: Option<String>,
66
67 /// Decoded log parameters.
68 pub decoded: Option<serde_json::Value>,
69}
70
71/// Container for transaction items.
72#[derive(Debug, Clone, Deserialize)]
73pub struct TransactionsData {
74 /// The address these transactions belong to.
75 pub address: Option<String>,
76
77 /// The chain ID.
78 pub chain_id: Option<u64>,
79
80 /// The chain name.
81 pub chain_name: Option<String>,
82
83 /// List of transaction items.
84 pub items: Vec<TransactionItem>,
85
86 /// Quote currency used for calculations.
87 pub quote_currency: Option<String>,
88}
89
90/// Response structure for transaction list queries.
91pub type TransactionsResponse = crate::models::ApiResponse<TransactionsData>;
92
93/// Response structure for single transaction queries.
94pub type TransactionResponse = crate::models::ApiResponse<TransactionItem>;