pod_types/rpc/
receipt.rs

1use std::collections::HashMap;
2
3use alloy_network::ReceiptResponse;
4use alloy_primitives::{Address, B256, BlockHash, TxHash};
5use alloy_rpc_types::TransactionReceipt;
6use serde::{Deserialize, Serialize};
7
8use crate::AttestedTx;
9
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct PodReceiptResponse {
12    #[serde(flatten)]
13    pub receipt: TransactionReceipt,
14    pub attested_tx: AttestedTx,
15    pub signatures: HashMap<usize, secp256k1::ecdsa::Signature>,
16}
17
18impl std::ops::Deref for PodReceiptResponse {
19    type Target = TransactionReceipt;
20    fn deref(&self) -> &TransactionReceipt {
21        &self.receipt
22    }
23}
24
25impl ReceiptResponse for PodReceiptResponse {
26    fn contract_address(&self) -> Option<Address> {
27        // For now not allowing deployments
28        None
29    }
30
31    fn status(&self) -> bool {
32        self.receipt.status()
33    }
34
35    fn block_hash(&self) -> Option<BlockHash> {
36        // todo
37        Some(BlockHash::default())
38    }
39
40    fn block_number(&self) -> Option<u64> {
41        // todo
42        None
43    }
44
45    fn transaction_hash(&self) -> TxHash {
46        self.receipt.transaction_hash()
47    }
48
49    fn transaction_index(&self) -> Option<u64> {
50        // todo
51        None
52    }
53
54    fn gas_used(&self) -> u64 {
55        self.receipt.gas_used()
56    }
57
58    fn effective_gas_price(&self) -> u128 {
59        self.receipt.effective_gas_price()
60    }
61
62    fn blob_gas_used(&self) -> Option<u64> {
63        // todo
64        None
65    }
66
67    fn blob_gas_price(&self) -> Option<u128> {
68        // todo
69        None
70    }
71
72    fn from(&self) -> Address {
73        self.receipt.from()
74    }
75
76    fn to(&self) -> Option<Address> {
77        self.receipt.to()
78    }
79
80    fn cumulative_gas_used(&self) -> u64 {
81        // todo
82        self.receipt.cumulative_gas_used()
83    }
84
85    fn state_root(&self) -> Option<B256> {
86        // todo
87        None
88    }
89}