pub enum SendOutcome {
NotSent,
Rejected,
MaybeBroadcast,
InFlight(B256),
Reverted(B256),
Confirmed(B256),
}Expand description
What a send_for_receipt call did on-chain, recorded through its out-param
independently of the Result it returns.
send_for_receipt still fails on every non-success path; this says which
non-success, and carries the tx hash on every arm that captured one — so a
machine-readable receipt need not scrape the hash out of the human error
text. That gap is the bug behind #1550 (a confirmed revert lost its hash) and
#1577 (a lost send response was reported as a definite “nothing happened”).
The six states are mutually exclusive and cover every path:
NotSent— the initial value; also what a dry run leaves.Rejected—send()failed with a JSON-RPC error response (a pre-flight gas-estimate revert, a stale nonce, an under-funded account). The node answered, and nothing entered the mempool.MaybeBroadcast—send()failed with a transport-class error. The request may have reached the node and broadcast the transaction, but no hash was captured. The outcome is UNKNOWN.InFlight— broadcast, but the receipt could not be fetched. In flight, may still confirm. Carries the hash.Reverted— broadcast and mined, but reverted: it burned gas and had no effect. Carries the hash as a permanent on-chain handle.Confirmed— confirmed success. Carries the hash.
Variants§
NotSent
No send has resolved into this slot — the initial value, and the value a dry run leaves.
Rejected
The node rejected the call before broadcast (a JSON-RPC error response). Nothing entered the mempool.
MaybeBroadcast
send() failed with a transport-class error (timeout, connection reset, a
5xx from an RPC load balancer). The transaction may have been broadcast;
no hash was captured, so the outcome is genuinely unknown and re-sending
can double-submit.
InFlight(B256)
Broadcast; the receipt could not be read. May still confirm.
Reverted(B256)
Broadcast and mined, but reverted. No effect; the hash is a handle for reconciling the gas spend.
Confirmed(B256)
Confirmed success.
Implementations§
Source§impl SendOutcome
impl SendOutcome
Sourcepub const fn tx(self) -> Option<B256>
pub const fn tx(self) -> Option<B256>
The tx hash for any arm that captured one — Confirmed,
Reverted, or InFlight.
MaybeBroadcast has none by construction: a
transport error surfaces before send() returns a handle, so there is no
hash to give even though a transaction may exist.
Sourcepub const fn maybe_effected(self) -> bool
pub const fn maybe_effected(self) -> bool
Whether the transaction may have taken effect on-chain.
True for a confirmed success, an in-flight broadcast, and a transport failure whose broadcast is unknown; false for a definitive rejection and a confirmed revert. Asserting “nothing was transferred” when this is true is how an operator gets told to re-run a transaction that is still pending.
Trait Implementations§
Source§impl Clone for SendOutcome
impl Clone for SendOutcome
impl Copy for SendOutcome
Source§impl Debug for SendOutcome
impl Debug for SendOutcome
Source§impl Default for SendOutcome
impl Default for SendOutcome
impl Eq for SendOutcome
Source§impl PartialEq for SendOutcome
impl PartialEq for SendOutcome
impl StructuralPartialEq for SendOutcome
Auto Trait Implementations§
impl Freeze for SendOutcome
impl RefUnwindSafe for SendOutcome
impl Send for SendOutcome
impl Sync for SendOutcome
impl Unpin for SendOutcome
impl UnsafeUnpin for SendOutcome
impl UnwindSafe for SendOutcome
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> 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