mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-08 03:01:12 -04:00
feat: add transaction_receipt (#1919)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@@ -28,6 +28,24 @@ pub struct Log {
|
||||
pub removed: bool,
|
||||
}
|
||||
|
||||
impl Log {
|
||||
/// Creates a new rpc Log from a primitive log type from DB
|
||||
pub fn from_primitive(log: reth_primitives::Log) -> Self {
|
||||
Self {
|
||||
address: log.address,
|
||||
topics: log.topics,
|
||||
data: log.data,
|
||||
block_hash: None,
|
||||
block_number: None,
|
||||
transaction_hash: None,
|
||||
transaction_index: None,
|
||||
log_index: None,
|
||||
transaction_log_index: None,
|
||||
removed: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use reth_primitives::{rpc::Log, Address, Bloom, H256, U128, U256, U64};
|
||||
use crate::Log;
|
||||
use reth_primitives::{Address, Bloom, H256, U128, U256, U64};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Transaction receipt
|
||||
@@ -25,7 +26,7 @@ pub struct TransactionReceipt {
|
||||
pub contract_address: Option<Address>,
|
||||
/// Logs emitted by this transaction.
|
||||
pub logs: Vec<Log>,
|
||||
/// The state root
|
||||
/// The post-transaction stateroot (pre Byzantium)
|
||||
///
|
||||
/// EIP98 makes this optional field, if it's missing then skip serializing it
|
||||
#[serde(skip_serializing_if = "Option::is_none", rename = "root")]
|
||||
|
||||
Reference in New Issue
Block a user