tempo_alloy/rpc/
receipt.rs

1use alloy_consensus::ReceiptWithBloom;
2use alloy_network::ReceiptResponse;
3use alloy_primitives::{Address, B256, BlockHash, TxHash};
4use alloy_rpc_types_eth::{Log, TransactionReceipt};
5use serde::{Deserialize, Serialize};
6use tempo_primitives::TempoReceipt;
7
8/// Tempo RPC receipt type.
9#[derive(Debug, Clone, Serialize, Deserialize, derive_more::Deref, derive_more::DerefMut)]
10#[serde(rename_all = "camelCase")]
11pub struct TempoTransactionReceipt {
12    /// Inner [`TransactionReceipt`].
13    #[serde(flatten)]
14    #[deref]
15    #[deref_mut]
16    pub inner: TransactionReceipt<ReceiptWithBloom<TempoReceipt<Log>>>,
17
18    /// Token that was used to pay fees for the transaction.
19    ///
20    /// None if the transaction was free.
21    #[serde(default, skip_serializing_if = "Option::is_none")]
22    pub fee_token: Option<Address>,
23
24    /// Address that paid the fees for the transaction.
25    pub fee_payer: Address,
26}
27
28impl ReceiptResponse for TempoTransactionReceipt {
29    fn contract_address(&self) -> Option<Address> {
30        self.inner.contract_address()
31    }
32
33    fn status(&self) -> bool {
34        self.inner.status()
35    }
36
37    fn block_hash(&self) -> Option<BlockHash> {
38        self.inner.block_hash()
39    }
40
41    fn block_number(&self) -> Option<u64> {
42        self.inner.block_number()
43    }
44
45    fn transaction_hash(&self) -> TxHash {
46        self.inner.transaction_hash()
47    }
48
49    fn transaction_index(&self) -> Option<u64> {
50        self.inner.transaction_index()
51    }
52
53    fn gas_used(&self) -> u64 {
54        self.inner.gas_used()
55    }
56
57    fn effective_gas_price(&self) -> u128 {
58        self.inner.effective_gas_price()
59    }
60
61    fn blob_gas_used(&self) -> Option<u64> {
62        self.inner.blob_gas_used()
63    }
64
65    fn blob_gas_price(&self) -> Option<u128> {
66        self.inner.blob_gas_price()
67    }
68
69    fn from(&self) -> Address {
70        self.inner.from()
71    }
72
73    fn to(&self) -> Option<Address> {
74        self.inner.to()
75    }
76
77    fn cumulative_gas_used(&self) -> u64 {
78        self.inner.cumulative_gas_used()
79    }
80
81    fn state_root(&self) -> Option<B256> {
82        self.inner.state_root()
83    }
84}