feat: add convenience impl From Log (#2087)

This commit is contained in:
Matthias Seitz 2023-01-30 21:06:46 +01:00 committed by GitHub
parent 60e1779626
commit 71c6fd4928
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -1,3 +1,4 @@
use ethabi::RawLog;
// Adapted from https://github.com/tomusdrw/rust-web3/blob/master/src/types/log.rs
use crate::types::{Address, Bytes, H256, U256, U64};
use serde::{Deserialize, Serialize};
@ -68,4 +69,10 @@ impl rlp::Encodable for Log {
}
}
impl From<Log> for RawLog {
fn from(val: Log) -> Self {
(val.topics, val.data.to_vec()).into()
}
}
// TODO: Implement more common types - or adjust this to work with all Tokenizable items