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_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§
source§impl<'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
source§impl<'a, P> PendingTransaction<'a, P>
impl<'a, P> PendingTransaction<'a, P>
sourcepub fn inspect<F>(self, f: F) -> Self
pub fn inspect<F>(self, f: F) -> 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>§
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub 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§
source§impl<'a, P> Debug for PendingTransaction<'a, P>
impl<'a, P> Debug for PendingTransaction<'a, P>
source§impl<'a, P> Deref for PendingTransaction<'a, P>
impl<'a, P> Deref for PendingTransaction<'a, P>
source§impl<'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>
source§impl<'a, P> PartialEq<H256> for PendingTransaction<'a, P>
impl<'a, P> PartialEq<H256> for PendingTransaction<'a, P>
source§impl<'a, P> PartialEq for PendingTransaction<'a, P>
impl<'a, P> PartialEq 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§
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn map<U, F>(self, f: F) -> Map<Self, F>
fn map<U, F>(self, f: F) -> Map<Self, F>
source§fn map_into<U>(self) -> MapInto<Self, U>
fn map_into<U>(self) -> MapInto<Self, U>
source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
f
. Read moresource§fn left_future<B>(self) -> Either<Self, B>
fn left_future<B>(self) -> Either<Self, B>
source§fn right_future<A>(self) -> Either<A, Self>
fn right_future<A>(self) -> Either<A, Self>
source§fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
source§fn flatten_stream(self) -> FlattenStream<Self>
fn flatten_stream(self) -> FlattenStream<Self>
source§fn 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 moresource§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
source§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
std
only.std
only.source§fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
alloc
only.source§fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
alloc
only.source§fn unit_error(self) -> UnitError<Self>where
Self: Sized,
fn unit_error(self) -> UnitError<Self>where
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = ()
>.source§fn never_error(self) -> NeverError<Self>where
Self: Sized,
fn never_error(self) -> NeverError<Self>where
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = Never
>.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>
source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
§type IntoFuture = F
type IntoFuture = F
source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
source§impl<Fut> TryFutureExt for Fut
impl<Fut> TryFutureExt for Fut
source§fn flatten_sink<Item>(self) -> FlattenSink<Self, Self::Ok>
fn flatten_sink<Item>(self) -> FlattenSink<Self, Self::Ok>
sink
only.