pub struct Signed<T, Sig = PrimitiveSignature> { /* private fields */ }
Expand description
A transaction with a signature and hash seal.
Implementations§
Source§impl<T, Sig> Signed<T, Sig>
impl<T, Sig> Signed<T, Sig>
Sourcepub fn new_unchecked(tx: T, signature: Sig, hash: B256) -> Self
pub fn new_unchecked(tx: T, signature: Sig, hash: B256) -> Self
Instantiate from a transaction and signature. Does not verify the signature.
Sourcepub const fn new_unhashed(tx: T, signature: Sig) -> Self
pub const fn new_unhashed(tx: T, signature: Sig) -> Self
Instantiate from a transaction and signature. Does not verify the signature.
Sourcepub fn strip_signature(self) -> T
pub fn strip_signature(self) -> T
Returns the transaction without signature.
Sourcepub fn convert<U>(self) -> Signed<U, Sig>where
U: From<T>,
pub fn convert<U>(self) -> Signed<U, Sig>where
U: From<T>,
Converts the transaction type to the given alternative that is From<T>
Caution: This is only intended for converting transaction types that are structurally equivalent (produce the same hash).
Sourcepub fn try_convert<U>(self) -> Result<Signed<U, Sig>, U::Error>where
U: TryFrom<T>,
pub fn try_convert<U>(self) -> Result<Signed<U, Sig>, U::Error>where
U: TryFrom<T>,
Converts the transaction to the given alternative that is TryFrom<T>
Returns the transaction with the new transaction type if all conversions were successful.
Caution: This is only intended for converting transaction types that are structurally equivalent (produce the same hash).
Source§impl<T: SignableTransaction<Sig>, Sig> Signed<T, Sig>
impl<T: SignableTransaction<Sig>, Sig> Signed<T, Sig>
Sourcepub fn signature_hash(&self) -> B256
pub fn signature_hash(&self) -> B256
Calculate the signing hash for the transaction.
Source§impl<T> Signed<T>where
T: RlpEcdsaEncodableTx,
impl<T> Signed<T>where
T: RlpEcdsaEncodableTx,
Sourcepub fn into_parts(self) -> (T, Signature, B256)
pub fn into_parts(self) -> (T, Signature, B256)
Splits the transaction into parts.
Sourcepub fn rlp_encoded_length(&self) -> usize
pub fn rlp_encoded_length(&self) -> usize
Get the length of the transaction when RLP encoded.
Sourcepub fn rlp_encode(&self, out: &mut dyn BufMut)
pub fn rlp_encode(&self, out: &mut dyn BufMut)
RLP encode the signed transaction.
Sourcepub fn eip2718_encoded_length(&self) -> usize
pub fn eip2718_encoded_length(&self) -> usize
Get the length of the transaction when EIP-2718 encoded.
Sourcepub fn eip2718_encode_with_type(&self, ty: u8, out: &mut dyn BufMut)
pub fn eip2718_encode_with_type(&self, ty: u8, out: &mut dyn BufMut)
EIP-2718 encode the signed transaction with a specified type flag.
Sourcepub fn eip2718_encode(&self, out: &mut dyn BufMut)
pub fn eip2718_encode(&self, out: &mut dyn BufMut)
EIP-2718 encode the signed transaction.
Sourcepub fn network_encoded_length(&self) -> usize
pub fn network_encoded_length(&self) -> usize
Get the length of the transaction when network encoded.
Sourcepub fn network_encode_with_type(&self, ty: u8, out: &mut dyn BufMut)
pub fn network_encode_with_type(&self, ty: u8, out: &mut dyn BufMut)
Network encode the signed transaction with a specified type flag.
Sourcepub fn network_encode(&self, out: &mut dyn BufMut)
pub fn network_encode(&self, out: &mut dyn BufMut)
Network encode the signed transaction.
Source§impl<T> Signed<T>where
T: RlpEcdsaDecodableTx,
impl<T> Signed<T>where
T: RlpEcdsaDecodableTx,
Sourcepub fn rlp_decode(buf: &mut &[u8]) -> Result<Self>
pub fn rlp_decode(buf: &mut &[u8]) -> Result<Self>
RLP decode the signed transaction.
Sourcepub fn eip2718_decode_with_type(buf: &mut &[u8], ty: u8) -> Eip2718Result<Self>
pub fn eip2718_decode_with_type(buf: &mut &[u8], ty: u8) -> Eip2718Result<Self>
EIP-2718 decode the signed transaction with a specified type flag.
Sourcepub fn eip2718_decode(buf: &mut &[u8]) -> Eip2718Result<Self>
pub fn eip2718_decode(buf: &mut &[u8]) -> Eip2718Result<Self>
EIP-2718 decode the signed transaction.
Sourcepub fn network_decode_with_type(buf: &mut &[u8], ty: u8) -> Eip2718Result<Self>
pub fn network_decode_with_type(buf: &mut &[u8], ty: u8) -> Eip2718Result<Self>
Network decode the signed transaction with a specified type flag.
Sourcepub fn network_decode(buf: &mut &[u8]) -> Eip2718Result<Self>
pub fn network_decode(buf: &mut &[u8]) -> Eip2718Result<Self>
Network decode the signed transaction.
Source§impl<T: SignableTransaction<PrimitiveSignature>> Signed<T, PrimitiveSignature>
impl<T: SignableTransaction<PrimitiveSignature>> Signed<T, PrimitiveSignature>
Sourcepub fn recover_signer(&self) -> Result<Address, SignatureError>
Available on crate feature k256
only.
pub fn recover_signer(&self) -> Result<Address, SignatureError>
k256
only.Recover the signer of the transaction
Sourcepub fn try_into_recovered(self) -> Result<Recovered<T>, SignatureError>
Available on crate feature k256
only.
pub fn try_into_recovered(self) -> Result<Recovered<T>, SignatureError>
k256
only.Attempts to recover signer and constructs a crate::transaction::Recovered
object.
Trait Implementations§
Source§impl<'a, T: SignableTransaction<PrimitiveSignature> + Arbitrary<'a>> Arbitrary<'a> for Signed<T, PrimitiveSignature>
Available on crate features arbitrary
and k256
only.
impl<'a, T: SignableTransaction<PrimitiveSignature> + Arbitrary<'a>> Arbitrary<'a> for Signed<T, PrimitiveSignature>
arbitrary
and k256
only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self
from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured
this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured
this type
needs to construct itself. Read moreSource§impl<'de, T, Sig> Deserialize<'de> for Signed<T, Sig>
Available on crate feature serde
only.
impl<'de, T, Sig> Deserialize<'de> for Signed<T, Sig>
serde
only.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 From<Signed<EthereumTypedTransaction<TxEip4844Variant>>> for TxEnvelope
impl From<Signed<EthereumTypedTransaction<TxEip4844Variant>>> for TxEnvelope
Source§fn from(v: Signed<TypedTransaction>) -> Self
fn from(v: Signed<TypedTransaction>) -> Self
Source§impl From<Signed<TxEip4844Variant>> for TxEnvelope
impl From<Signed<TxEip4844Variant>> for TxEnvelope
Source§fn from(v: Signed<TxEip4844Variant>) -> Self
fn from(v: Signed<TxEip4844Variant>) -> Self
Source§impl From<Signed<TxEip4844WithSidecar>> for PooledTransaction
impl From<Signed<TxEip4844WithSidecar>> for PooledTransaction
Source§fn from(v: Signed<TxEip4844WithSidecar>) -> Self
fn from(v: Signed<TxEip4844WithSidecar>) -> Self
Source§impl From<Signed<TxEip4844WithSidecar>> for Signed<TxEip4844Variant>
impl From<Signed<TxEip4844WithSidecar>> for Signed<TxEip4844Variant>
Source§fn from(value: Signed<TxEip4844WithSidecar>) -> Self
fn from(value: Signed<TxEip4844WithSidecar>) -> Self
Source§impl From<Signed<TxEip4844WithSidecar>> for TxEnvelope
impl From<Signed<TxEip4844WithSidecar>> for TxEnvelope
Source§fn from(v: Signed<TxEip4844WithSidecar>) -> Self
fn from(v: Signed<TxEip4844WithSidecar>) -> Self
Source§impl From<TxEnvelope> for Signed<TypedTransaction>
impl From<TxEnvelope> for Signed<TypedTransaction>
Source§fn from(value: TxEnvelope) -> Self
fn from(value: TxEnvelope) -> Self
Source§impl TryFrom<Signed<TxEip4844Variant>> for PooledTransaction
impl TryFrom<Signed<TxEip4844Variant>> for PooledTransaction
Source§type Error = ValueError<Signed<TxEip4844Variant>>
type Error = ValueError<Signed<TxEip4844Variant>>
impl<T: RlpEcdsaEncodableTx + PartialEq> Eq for Signed<T>
Auto Trait Implementations§
impl<T, Sig = PrimitiveSignature> !Freeze for Signed<T, Sig>
impl<T, Sig> RefUnwindSafe for Signed<T, Sig>where
T: RefUnwindSafe,
Sig: RefUnwindSafe,
impl<T, Sig> Send for Signed<T, Sig>
impl<T, Sig> Sync for Signed<T, Sig>
impl<T, Sig> Unpin for Signed<T, Sig>
impl<T, Sig> UnwindSafe for Signed<T, Sig>where
T: UnwindSafe,
Sig: UnwindSafe,
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,
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 moreSource§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.