From 45cce0f4b40c2d8889b1b5559473183976b8dcf0 Mon Sep 17 00:00:00 2001 From: Rohit Narurkar Date: Mon, 18 Apr 2022 18:55:45 +0200 Subject: [PATCH] feat: impl rlp encodable for log and receipt (#1153) --- ethers-core/src/types/log.rs | 9 +++++++++ ethers-core/src/types/transaction/response.rs | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/ethers-core/src/types/log.rs b/ethers-core/src/types/log.rs index 934ef466..dd70fa79 100644 --- a/ethers-core/src/types/log.rs +++ b/ethers-core/src/types/log.rs @@ -65,6 +65,15 @@ pub struct Log { pub removed: Option, } +impl rlp::Encodable for Log { + fn rlp_append(&self, s: &mut rlp::RlpStream) { + s.begin_list(3); + s.append(&self.address); + s.append_list(&self.topics); + s.append(&self.data.0); + } +} + #[derive(Copy, Clone, Debug, PartialEq)] pub enum FilterBlockOption { Range { from_block: Option, to_block: Option }, diff --git a/ethers-core/src/types/transaction/response.rs b/ethers-core/src/types/transaction/response.rs index 1c4fc76c..2968dc71 100644 --- a/ethers-core/src/types/transaction/response.rs +++ b/ethers-core/src/types/transaction/response.rs @@ -414,6 +414,16 @@ pub struct TransactionReceipt { pub effective_gas_price: Option, } +impl rlp::Encodable for TransactionReceipt { + fn rlp_append(&self, s: &mut RlpStream) { + s.begin_list(4); + s.append(&self.status); + s.append(&self.cumulative_gas_used); + s.append(&self.logs_bloom); + s.append_list(&self.logs); + } +} + #[cfg(test)] #[cfg(not(feature = "celo"))] mod tests {