mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
moving Log::from_primitive to rpc compat crate (#4968)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -17,3 +17,5 @@ pub mod transaction;
|
||||
pub use transaction::*;
|
||||
pub mod engine;
|
||||
pub use engine::*;
|
||||
pub mod log;
|
||||
pub use log::*;
|
||||
|
||||
16
crates/rpc/rpc-types-compat/src/log.rs
Normal file
16
crates/rpc/rpc-types-compat/src/log.rs
Normal file
@ -0,0 +1,16 @@
|
||||
//! Compatibility functions for rpc `Log` type.
|
||||
|
||||
/// Creates a new rpc Log from a primitive log type from DB
|
||||
pub fn from_primitive_log(log: reth_primitives::Log) -> reth_rpc_types::Log {
|
||||
reth_rpc_types::Log {
|
||||
address: log.address,
|
||||
topics: log.topics,
|
||||
data: log.data,
|
||||
block_hash: None,
|
||||
block_number: None,
|
||||
transaction_hash: None,
|
||||
transaction_index: None,
|
||||
log_index: None,
|
||||
removed: false,
|
||||
}
|
||||
}
|
||||
@ -26,23 +26,6 @@ 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,
|
||||
removed: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user