pub struct MempoolListener { /* private fields */ }Expand description
Listener for monitoring mempool transactions
Implementations§
Source§impl MempoolListener
impl MempoolListener
Sourcepub fn with_config(evm: Arc<Evm>, config: MempoolConfig) -> Self
pub fn with_config(evm: Arc<Evm>, config: MempoolConfig) -> Self
Creates a new MempoolListener with custom configuration
Sourcepub async fn start(&self) -> Result<(), EvmError>
pub async fn start(&self) -> Result<(), EvmError>
Starts the mempool listener
§Example
let evm = Arc::new(Evm::new());
let listener = MempoolListener::new(evm);
listener.start().await?;Sourcepub async fn get_pending_transactions_list(&self) -> Vec<MempoolTransaction>
pub async fn get_pending_transactions_list(&self) -> Vec<MempoolTransaction>
Returns all pending transactions in the mempool
§Example
let transactions = listener.get_pending_transactions_list().await;
for tx in transactions {
println!("Transaction hash: {:?}", tx.hash);
}Sourcepub async fn get_transactions_by_sender(
&self,
address: Address,
) -> Vec<MempoolTransaction>
pub async fn get_transactions_by_sender( &self, address: Address, ) -> Vec<MempoolTransaction>
Returns pending transactions sent by a specific address
§Example
let address: Address = "0x...".parse().unwrap();
let sender_txs = listener.get_transactions_by_sender(address).await;Sourcepub async fn get_transactions_by_receiver(
&self,
address: Address,
) -> Vec<MempoolTransaction>
pub async fn get_transactions_by_receiver( &self, address: Address, ) -> Vec<MempoolTransaction>
Returns pending transactions sent to a specific address
§Example
let address: Address = "0x...".parse().unwrap();
let receiver_txs = listener.get_transactions_by_receiver(address).await;Sourcepub async fn get_high_gas_transactions(
&self,
threshold: U256,
) -> Vec<MempoolTransaction>
pub async fn get_high_gas_transactions( &self, threshold: U256, ) -> Vec<MempoolTransaction>
Returns transactions with gas price above the specified threshold
§Example
let threshold = U256::from(100_000_000_000u64); // 100 Gwei
let high_gas_txs = listener.get_high_gas_transactions(threshold).await;Sourcepub async fn get_large_value_transactions(
&self,
threshold: U256,
) -> Vec<MempoolTransaction>
pub async fn get_large_value_transactions( &self, threshold: U256, ) -> Vec<MempoolTransaction>
Returns transactions with value above the specified threshold
§Example
let threshold = U256::from(1_000_000_000_000_000_000u64); // 1 ETH
let large_txs = listener.get_large_value_transactions(threshold).await;Sourcepub async fn get_stats(&self) -> MempoolStats
pub async fn get_stats(&self) -> MempoolStats
Returns statistics about the current mempool state
§Example
let stats = listener.get_stats().await;
println!("Total transactions: {}", stats.total_transactions);
println!("Total value: {}", stats.total_value);Sourcepub async fn contains_transaction(&self, tx_hash: TxHash) -> bool
pub async fn contains_transaction(&self, tx_hash: TxHash) -> bool
Checks if a specific transaction is in the mempool
§Example
let tx_hash: TxHash = "0x...".parse().unwrap();
if listener.contains_transaction(tx_hash).await {
println!("Transaction is pending");
}Sourcepub async fn get_transaction_details(
&self,
tx_hash: TxHash,
) -> Option<MempoolTransaction>
pub async fn get_transaction_details( &self, tx_hash: TxHash, ) -> Option<MempoolTransaction>
Returns details for a specific transaction
§Example
let tx_hash: TxHash = "0x...".parse().unwrap();
if let Some(tx) = listener.get_transaction_details(tx_hash).await {
println!("From: {:?}, To: {:?}, Value: {}", tx.from, tx.to, tx.value);
}Sourcepub async fn get_eip1559_transactions(&self) -> Vec<MempoolTransaction>
pub async fn get_eip1559_transactions(&self) -> Vec<MempoolTransaction>
get eip1559 transactions
Sourcepub async fn get_mev_transactions(&self) -> Vec<MempoolTransaction>
pub async fn get_mev_transactions(&self) -> Vec<MempoolTransaction>
get mev transactions
pub async fn get_bundle_transactions( &self, bundle_hash: TxHash, ) -> Vec<MempoolTransaction>
pub async fn get_all_bundles(&self) -> HashMap<TxHash, Vec<TxHash>>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for MempoolListener
impl !UnwindSafe for MempoolListener
impl Freeze for MempoolListener
impl Send for MempoolListener
impl Sync for MempoolListener
impl Unpin for MempoolListener
impl UnsafeUnpin for MempoolListener
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> JsonSchemaMaybe for T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.