Struct common_types::views::HeaderView
source · [−]pub struct HeaderView<'a> { /* private fields */ }
Expand description
View onto block header rlp.
Implementations
sourceimpl<'a> HeaderView<'a>
impl<'a> HeaderView<'a>
sourcepub fn new(rlp: ViewRlp<'a>) -> HeaderView<'a>
pub fn new(rlp: ViewRlp<'a>) -> HeaderView<'a>
Creates a new Header view from valid ViewRlp
Use the view!
macro to create this view in order to capture debugging info.
Example
#[macro_use]
extern crate common_types as types;
use types::views::{HeaderView};
fn main() {
let bytes : &[u8] = &[];
let tx_view = view!(HeaderView, bytes);
}
sourcepub fn parent_hash(&self) -> H256
pub fn parent_hash(&self) -> H256
Returns parent hash.
sourcepub fn uncles_hash(&self) -> H256
pub fn uncles_hash(&self) -> H256
Returns uncles hash.
Returns author.
sourcepub fn state_root(&self) -> H256
pub fn state_root(&self) -> H256
Returns state root.
sourcepub fn transactions_root(&self) -> H256
pub fn transactions_root(&self) -> H256
Returns transactions root.
sourcepub fn receipts_root(&self) -> H256
pub fn receipts_root(&self) -> H256
Returns block receipts root.
sourcepub fn difficulty(&self) -> U256
pub fn difficulty(&self) -> U256
Returns block difficulty.
sourcepub fn number(&self) -> BlockNumber
pub fn number(&self) -> BlockNumber
Returns block number.
sourcepub fn extra_data(&self) -> Bytes
pub fn extra_data(&self) -> Bytes
Returns block extra data.
sourcepub fn seal(&self, eip1559: bool) -> Vec<Bytes>
pub fn seal(&self, eip1559: bool) -> Vec<Bytes>
Returns a vector of post-RLP-encoded seal fields. If eip1559 is true, seal contains also base_fee_per_gas. Otherwise, it contains only seal fields.
sourcepub fn base_fee(&self) -> U256
pub fn base_fee(&self) -> U256
Returns block base fee. Should be called only for EIP1559 headers. If called for non EIP1559 header, returns garbage
sourcepub fn decode_seal(&self, eip1559: bool) -> Result<Vec<Bytes>, DecoderError>
pub fn decode_seal(&self, eip1559: bool) -> Result<Vec<Bytes>, DecoderError>
Returns a vector of seal fields (RLP-decoded). If eip1559 is true, seal contains also base_fee_per_gas. Otherwise, it contains only seal fields.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for HeaderView<'a>
impl<'a> Send for HeaderView<'a>
impl<'a> !Sync for HeaderView<'a>
impl<'a> Unpin for HeaderView<'a>
impl<'a> UnwindSafe for HeaderView<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more