fix: derive serde Ser and De for log metadata (#823)

This commit is contained in:
Rohit Narurkar 2022-01-21 13:30:57 +01:00 committed by GitHub
parent f9fadf06c4
commit af94479d81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@ use ethers_core::{
abi::{Error, RawLog}, abi::{Error, RawLog},
types::{Address, Log, TxHash, H256, U256, U64}, types::{Address, Log, TxHash, H256, U256, U64},
}; };
use serde::{Deserialize, Serialize};
/// A trait for types (events) that can be decoded from a `RawLog` /// A trait for types (events) that can be decoded from a `RawLog`
pub trait EthLogDecode: Send + Sync { pub trait EthLogDecode: Send + Sync {
@ -18,7 +19,7 @@ pub fn decode_logs<T: EthLogDecode>(logs: &[RawLog]) -> Result<Vec<T>, Error> {
} }
/// Metadata inside a log /// Metadata inside a log
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct LogMeta { pub struct LogMeta {
/// Address from which this log originated /// Address from which this log originated
pub address: Address, pub address: Address,