pub struct Block {
pub ver: i32,
pub hash: Vec<u8>,
pub number: u64,
pub size: u64,
pub header: Option<BlockHeader>,
pub uncles: Vec<BlockHeader>,
pub transaction_traces: Vec<TransactionTrace>,
pub balance_changes: Vec<BalanceChange>,
pub code_changes: Vec<CodeChange>,
}Fields§
§ver: i32§hash: Vec<u8>§number: u64§size: u64§header: Option<BlockHeader>§uncles: Vec<BlockHeader>Uncles represents block produced with a valid solution but were not actually choosen as the canonical block for the given height so they are mostly “forked” blocks.
If the Block has been produced using the Proof of Stake consensus algorithm, this field will actually be always empty.
transaction_traces: Vec<TransactionTrace>§balance_changes: Vec<BalanceChange>§code_changes: Vec<CodeChange>Implementations§
source§impl Block
impl Block
sourcepub fn transactions(&self) -> impl Iterator<Item = &TransactionTrace>
pub fn transactions(&self) -> impl Iterator<Item = &TransactionTrace>
Iterates over succesful transactions.
sourcepub fn receipts(&self) -> impl Iterator<Item = ReceiptView<'_>>
pub fn receipts(&self) -> impl Iterator<Item = ReceiptView<'_>>
Iterates over transaction receipts of successful transactions.
sourcepub fn logs(&self) -> impl Iterator<Item = LogView<'_>>
pub fn logs(&self) -> impl Iterator<Item = LogView<'_>>
Iterates over logs in receipts of succesful transactions.
sourcepub fn calls(&self) -> impl Iterator<Item = CallView<'_>>
pub fn calls(&self) -> impl Iterator<Item = CallView<'_>>
Iterates over calls of succesful transactions.
sourcepub fn events<'a, E: Event>(
&'a self,
addresses: &'a [&[u8]]
) -> impl Iterator<Item = (E, LogView<'_>)>
pub fn events<'a, E: Event>(
&'a self,
addresses: &'a [&[u8]]
) -> impl Iterator<Item = (E, LogView<'_>)>
A convenience for handlers that process a single type of event. Returns an iterator over
pairs of (event, log).
If you need to process multiple event types in a single handler, try something like:
ⓘ
for log in block.logs() {
if !addresses.contains(&log.address()) {
continue;
}
if let Some(event) = E1::match_and_decode(log) {
// Process events of type E1
} else if let Some(event) = E2::match_and_decode(log) {
// Process events of type E2
}
}pub fn timestamp_seconds(&self) -> u64
Trait Implementations§
source§impl Message for Block
impl Message for Block
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
Encodes the message to a buffer. Read more
source§fn encode_to_vec(&self) -> Vec<u8, Global> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8, Global> ⓘwhere
Self: Sized,
Encodes the message to a newly allocated buffer.
source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
Encodes the message with a length-delimiter to a buffer. Read more
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8, Global> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8, Global> ⓘwhere
Self: Sized,
Encodes the message with a length-delimiter to a newly allocated buffer.
source§fn decode<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
fn decode<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
Decodes an instance of the message from a buffer. Read more
source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
Decodes a length-delimited instance of the message from the buffer.
source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
Decodes an instance of the message from a buffer, and merges it into
self. Read moresource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
Decodes a length-delimited instance of the message from buffer, and
merges it into
self.