rust-web3
rust-web3 copied to clipboard
Missing `impl From<Block> for BlockHeader`
trafficstars
Surprisingly, there is no way to get the header for a block. This is useful to homogenize values between Eth::block to EthSubscribe::subscribe_new_heads.
impl From<Block<H256>> for BlockHeader {
fn from(block: Block<H256>) -> BlockHeader {
BlockHeader {
hash: block.hash,
parent_hash: block.parent_hash,
uncles_hash: block.uncles_hash,
author: block.author,
state_root: block.state_root,
transactions_root: block.transactions_root,
receipts_root: block.receipts_root,
number: block.number,
gas_used: block.gas_used,
gas_limit: block.gas_limit,
extra_data: block.extra_data,
logs_bloom: block.logs_bloom.unwrap_or_default(),
timestamp: block.timestamp,
difficulty: block.difficulty,
mix_hash: block.mix_hash,
nonce: block.nonce,
}
}
}
PRs welcome :)