pub struct Block {Show 14 fields
pub chain: Option<Blockchain>,
pub hash: String,
pub number: u64,
pub parent_hash: String,
pub miner: Ustr,
pub gas_limit: u64,
pub gas_used: u64,
pub base_fee_per_gas: Option<U256>,
pub blob_gas_used: Option<U256>,
pub excess_blob_gas: Option<U256>,
pub l1_gas_price: Option<U256>,
pub l1_gas_used: Option<u64>,
pub l1_fee_scalar: Option<u64>,
pub timestamp: UnixNanos,
}
Expand description
Represents an Ethereum-compatible blockchain block with essential metadata.
Fields§
§chain: Option<Blockchain>
The blockchain network this block is part of.
hash: String
The unique identifier hash of the block.
number: u64
The block height/number in the blockchain.
parent_hash: String
Hash of the parent block.
miner: Ustr
Address of the miner or validator who produced this block.
gas_limit: u64
Maximum amount of gas allowed in this block.
gas_used: u64
Total gas actually used by all transactions in this block.
base_fee_per_gas: Option<U256>
EIP-1559 base fee per gas (wei); absent on pre-1559 or non-EIP chains.
blob_gas_used: Option<U256>
Blob gas used in this block (EIP-4844); absent on chains without blobs.
excess_blob_gas: Option<U256>
Excess blob gas remaining after block execution (EIP-4844); None if not applicable.
l1_gas_price: Option<U256>
L1 gas price used for posting this block’s calldata (wei); Arbitrum only.
l1_gas_used: Option<u64>
L1 calldata gas units consumed when posting this block; Arbitrum only.
l1_fee_scalar: Option<u64>
Fixed-point (1e-6) scalar applied to the raw L1 fee; Arbitrum only.
timestamp: UnixNanos
Unix timestamp when the block was created.
Implementations§
Source§impl Block
impl Block
Sourcepub fn new(
hash: String,
parent_hash: String,
number: u64,
miner: Ustr,
gas_limit: u64,
gas_used: u64,
timestamp: UnixNanos,
chain: Option<Blockchain>,
) -> Self
pub fn new( hash: String, parent_hash: String, number: u64, miner: Ustr, gas_limit: u64, gas_used: u64, timestamp: UnixNanos, chain: Option<Blockchain>, ) -> Self
Creates a new Block
instance with the specified properties.
Sourcepub fn chain(&self) -> Blockchain
pub fn chain(&self) -> Blockchain
pub fn set_chain(&mut self, chain: Blockchain)
Sourcepub fn with_base_fee(self, fee: U256) -> Self
pub fn with_base_fee(self, fee: U256) -> Self
Sets the EIP-1559 base fee and returns self
for chaining.
Sourcepub fn with_blob_gas(self, used: U256, excess: U256) -> Self
pub fn with_blob_gas(self, used: U256, excess: U256) -> Self
Sets blob-gas metrics (EIP-4844) and returns self
for chaining.
Sourcepub fn with_l1_fee_components(
self,
price: U256,
gas_used: u64,
scalar: u64,
) -> Self
pub fn with_l1_fee_components( self, price: U256, gas_used: u64, scalar: u64, ) -> Self
Sets L1 fee components relevant for Arbitrum cost calculation and returns self
for chaining.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Block
impl<'de> Deserialize<'de> for Block
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'py> IntoPyObject<'py> for Block
impl<'py> IntoPyObject<'py> for Block
Source§impl PyClassImpl for Block
impl PyClassImpl for Block
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§type ThreadChecker = SendablePyClass<Block>
type ThreadChecker = SendablePyClass<Block>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyMethods<Block> for PyClassImplCollector<Block>
impl PyMethods<Block> for PyClassImplCollector<Block>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for Block
impl PyTypeInfo for Block
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type.impl DerefToPyAny for Block
impl Eq for Block
Auto Trait Implementations§
impl Freeze for Block
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnwindSafe for Block
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> FromPyObject<'_> for Twhere
T: PyClass + Clone,
impl<T> FromPyObject<'_> for Twhere
T: PyClass + Clone,
§fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>
fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>
§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
§fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>
fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self
into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self
into an owned Python object, dropping type information and unbinding it
from the 'py
lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self
into a Python object. Read moreSource§impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
Source§fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>
fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>
§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
Source§impl<T> Separable for Twhere
T: Display,
impl<T> Separable for Twhere
T: Display,
Source§fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
SeparatorPolicy
. Read more