Struct ethers_providers::PendingTransaction
source · pub struct PendingTransaction<'a, P> { /* private fields */ }Expand description
A pending transaction is a transaction which has been submitted but is not yet mined.
await’ing on a pending transaction will resolve to a transaction receipt
once the transaction has enough confirmations. The default number of confirmations
is 1, but may be adjusted with the confirmations method. If the transaction does not
have enough confirmations or is not mined, the future will stay in the pending state.
Example
use ethers_providers::Middleware;
use ethers_core::types::TransactionRequest;
let tx = TransactionRequest::new().to(to).value(1000).from(from);
let receipt = client
.send_transaction(tx, None)
.await? // PendingTransaction<_>
.log_msg("Pending transfer hash") // print pending tx hash with message
.await?; // Result<Option<TransactionReceipt>, _>Implementations
sourceimpl<'a, P: JsonRpcClient> PendingTransaction<'a, P>
impl<'a, P: JsonRpcClient> PendingTransaction<'a, P>
sourcepub fn new(tx_hash: TxHash, provider: &'a Provider<P>) -> Self
pub fn new(tx_hash: TxHash, provider: &'a Provider<P>) -> Self
Creates a new pending transaction poller from a hash and a provider
sourcepub fn provider(&self) -> Provider<P>where
P: Clone,
pub fn provider(&self) -> Provider<P>where
P: Clone,
Returns the Provider associated with the pending transaction
sourcepub fn confirmations(self, confs: usize) -> Self
pub fn confirmations(self, confs: usize) -> Self
Sets the number of confirmations for the pending transaction to resolve to a receipt
sourceimpl<'a, P> PendingTransaction<'a, P>
impl<'a, P> PendingTransaction<'a, P>
sourcepub fn inspect<F>(self, f: F) -> Selfwhere
F: FnMut(&Self),
pub fn inspect<F>(self, f: F) -> Selfwhere
F: FnMut(&Self),
Allows inspecting the content of a pending transaction in a builder-like way to avoid
more verbose calls, e.g.:
let mined = token.transfer(recipient, amt).send().await?.inspect(|tx| println!(".{}", *tx)).await?;
Methods from Deref<Target = TxHash>
pub fn as_fixed_bytes(&self) -> &[u8; 32]
pub fn as_fixed_bytes(&self) -> &[u8; 32]
Extracts a reference to the byte array containing the entire fixed hash.
pub fn to_low_u64_be(&self) -> u64
pub fn to_low_u64_be(&self) -> u64
Returns the lowest 8 bytes interpreted as big-endian.
Note
For hash type with less than 8 bytes the missing bytes are interpreted as being zero.
pub fn to_low_u64_le(&self) -> u64
pub fn to_low_u64_le(&self) -> u64
Returns the lowest 8 bytes interpreted as little-endian.
Note
For hash type with less than 8 bytes the missing bytes are interpreted as being zero.
pub fn to_low_u64_ne(&self) -> u64
pub fn to_low_u64_ne(&self) -> u64
Returns the lowest 8 bytes interpreted as native-endian.
Note
For hash type with less than 8 bytes the missing bytes are interpreted as being zero.
Trait Implementations
sourceimpl<'a, P> Debug for PendingTransaction<'a, P>
impl<'a, P> Debug for PendingTransaction<'a, P>
sourceimpl<'a, P> Deref for PendingTransaction<'a, P>
impl<'a, P> Deref for PendingTransaction<'a, P>
sourceimpl<'a, P: JsonRpcClient> Future for PendingTransaction<'a, P>
impl<'a, P: JsonRpcClient> Future for PendingTransaction<'a, P>
type Output = Result<Option<TransactionReceipt>, ProviderError>
type Output = Result<Option<TransactionReceipt>, ProviderError>
sourceimpl<'a, P> PartialEq<H256> for PendingTransaction<'a, P>
impl<'a, P> PartialEq<H256> for PendingTransaction<'a, P>
sourceimpl<'a, P> PartialEq<PendingTransaction<'a, P>> for PendingTransaction<'a, P>
impl<'a, P> PartialEq<PendingTransaction<'a, P>> for PendingTransaction<'a, P>
impl<'a, P> Eq for PendingTransaction<'a, P>
impl<'pin, 'a, P> Unpin for PendingTransaction<'a, P>where
__PendingTransaction<'pin, 'a, P>: Unpin,
Auto Trait Implementations
impl<'a, P> !RefUnwindSafe for PendingTransaction<'a, P>
impl<'a, P> Send for PendingTransaction<'a, P>where
P: Sync,
impl<'a, P> !Sync for PendingTransaction<'a, P>
impl<'a, P> !UnwindSafe for PendingTransaction<'a, P>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.sourceimpl<T> FutureExt for Twhere
T: Future + ?Sized,
impl<T> FutureExt for Twhere
T: Future + ?Sized,
sourcefn map<U, F>(self, f: F) -> Map<Self, F>where
F: FnOnce(Self::Output) -> U,
Self: Sized,
fn map<U, F>(self, f: F) -> Map<Self, F>where
F: FnOnce(Self::Output) -> U,
Self: Sized,
sourcefn map_into<U>(self) -> MapInto<Self, U>where
Self::Output: Into<U>,
Self: Sized,
fn map_into<U>(self) -> MapInto<Self, U>where
Self::Output: Into<U>,
Self: Sized,
sourcefn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>where
F: FnOnce(Self::Output) -> Fut,
Fut: Future,
Self: Sized,
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>where
F: FnOnce(Self::Output) -> Fut,
Fut: Future,
Self: Sized,
f. Read moresourcefn left_future<B>(self) -> Either<Self, B>where
B: Future<Output = Self::Output>,
Self: Sized,
fn left_future<B>(self) -> Either<Self, B>where
B: Future<Output = Self::Output>,
Self: Sized,
sourcefn right_future<A>(self) -> Either<A, Self>where
A: Future<Output = Self::Output>,
Self: Sized,
fn right_future<A>(self) -> Either<A, Self>where
A: Future<Output = Self::Output>,
Self: Sized,
sourcefn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
sourcefn flatten(self) -> Flatten<Self>where
Self::Output: Future,
Self: Sized,
fn flatten(self) -> Flatten<Self>where
Self::Output: Future,
Self: Sized,
sourcefn flatten_stream(self) -> FlattenStream<Self>where
Self::Output: Stream,
Self: Sized,
fn flatten_stream(self) -> FlattenStream<Self>where
Self::Output: Stream,
Self: Sized,
sourcefn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
poll will never again be called once it has
completed. This method can be used to turn any Future into a
FusedFuture. Read moresourcefn inspect<F>(self, f: F) -> Inspect<Self, F>where
F: FnOnce(&Self::Output),
Self: Sized,
fn inspect<F>(self, f: F) -> Inspect<Self, F>where
F: FnOnce(&Self::Output),
Self: Sized,
sourcefn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
sourcefn boxed<'a>(
self
) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a, Global>>where
Self: 'a + Sized + Send,
fn boxed<'a>(
self
) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a, Global>>where
Self: 'a + Sized + Send,
sourcefn boxed_local<'a>(
self
) -> Pin<Box<dyn Future<Output = Self::Output> + 'a, Global>>where
Self: 'a + Sized,
fn boxed_local<'a>(
self
) -> Pin<Box<dyn Future<Output = Self::Output> + 'a, Global>>where
Self: 'a + Sized,
sourcefn unit_error(self) -> UnitError<Self>where
Self: Sized,
fn unit_error(self) -> UnitError<Self>where
Self: Sized,
sourcefn never_error(self) -> NeverError<Self>where
Self: Sized,
fn never_error(self) -> NeverError<Self>where
Self: Sized,
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
type IntoFuture = F
type IntoFuture = F
sourcefn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
sourceimpl<Fut> TryFutureExt for Futwhere
Fut: TryFuture + ?Sized,
impl<Fut> TryFutureExt for Futwhere
Fut: TryFuture + ?Sized,
sourcefn flatten_sink<Item>(self) -> FlattenSink<Self, Self::Ok>where
Self::Ok: Sink<Item, Error = Self::Error>,
Self: Sized,
fn flatten_sink<Item>(self) -> FlattenSink<Self, Self::Ok>where
Self::Ok: Sink<Item, Error = Self::Error>,
Self: Sized,
Sink]. Read more