feat: add transaction_receipt (#1919)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
chirag-bgh
2023-03-23 16:16:07 +05:30
committed by GitHub
parent b44391776e
commit aaa99f6b4c
7 changed files with 126 additions and 8 deletions

View File

@@ -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::*;

View File

@@ -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")]