Struct ethers_iqkms::types::transaction::request::TransactionRequest
source · [−]pub struct TransactionRequest {
pub from: Option<H160>,
pub to: Option<NameOrAddress>,
pub gas: Option<U256>,
pub gas_price: Option<U256>,
pub value: Option<U256>,
pub data: Option<Bytes>,
pub nonce: Option<U256>,
pub chain_id: Option<U64>,
}Expand description
Parameters for sending a transaction
Fields
from: Option<H160>Sender address or ENS name
to: Option<NameOrAddress>Recipient address (None for contract creation)
gas: Option<U256>Supplied gas (None for sensible default)
gas_price: Option<U256>Gas price (None for sensible default)
value: Option<U256>Transferred value (None for no transfer)
data: Option<Bytes>The compiled code of a contract OR the first 4 bytes of the hash of the invoked method signature and encoded parameters. For details see Ethereum Contract ABI
nonce: Option<U256>Transaction nonce (None for next available nonce)
chain_id: Option<U64>Chain ID (None for mainnet)
Implementations
sourceimpl TransactionRequest
impl TransactionRequest
sourcepub fn new() -> TransactionRequest
pub fn new() -> TransactionRequest
Creates an empty transaction request with all fields left empty
sourcepub fn pay<T, V>(to: T, value: V) -> TransactionRequestwhere
T: Into<NameOrAddress>,
V: Into<U256>,
pub fn pay<T, V>(to: T, value: V) -> TransactionRequestwhere
T: Into<NameOrAddress>,
V: Into<U256>,
Convenience function for sending a new payment transaction to the receiver.
sourcepub fn from<T>(self, from: T) -> TransactionRequestwhere
T: Into<H160>,
pub fn from<T>(self, from: T) -> TransactionRequestwhere
T: Into<H160>,
Sets the from field in the transaction to the provided value
sourcepub fn to<T>(self, to: T) -> TransactionRequestwhere
T: Into<NameOrAddress>,
pub fn to<T>(self, to: T) -> TransactionRequestwhere
T: Into<NameOrAddress>,
Sets the to field in the transaction to the provided value
sourcepub fn gas<T>(self, gas: T) -> TransactionRequestwhere
T: Into<U256>,
pub fn gas<T>(self, gas: T) -> TransactionRequestwhere
T: Into<U256>,
Sets the gas field in the transaction to the provided value
sourcepub fn gas_price<T>(self, gas_price: T) -> TransactionRequestwhere
T: Into<U256>,
pub fn gas_price<T>(self, gas_price: T) -> TransactionRequestwhere
T: Into<U256>,
Sets the gas_price field in the transaction to the provided value
sourcepub fn value<T>(self, value: T) -> TransactionRequestwhere
T: Into<U256>,
pub fn value<T>(self, value: T) -> TransactionRequestwhere
T: Into<U256>,
Sets the value field in the transaction to the provided value
sourcepub fn data<T>(self, data: T) -> TransactionRequestwhere
T: Into<Bytes>,
pub fn data<T>(self, data: T) -> TransactionRequestwhere
T: Into<Bytes>,
Sets the data field in the transaction to the provided value
sourcepub fn nonce<T>(self, nonce: T) -> TransactionRequestwhere
T: Into<U256>,
pub fn nonce<T>(self, nonce: T) -> TransactionRequestwhere
T: Into<U256>,
Sets the nonce field in the transaction to the provided value
sourcepub fn chain_id<T>(self, chain_id: T) -> TransactionRequestwhere
T: Into<U64>,
pub fn chain_id<T>(self, chain_id: T) -> TransactionRequestwhere
T: Into<U64>,
Sets the chain_id field in the transaction to the provided value
sourcepub fn rlp(&self) -> Bytes
pub fn rlp(&self) -> Bytes
Gets the transaction’s RLP encoding, prepared with the chain_id and extra fields for signing. Assumes the chainid exists.
sourcepub fn rlp_unsigned(&self) -> Bytes
pub fn rlp_unsigned(&self) -> Bytes
Gets the unsigned transaction’s RLP encoding
sourcepub fn rlp_signed(&self, signature: &Signature) -> Bytes
pub fn rlp_signed(&self, signature: &Signature) -> Bytes
Produces the RLP encoding of the transaction with the provided signature
sourcepub fn decode_unsigned_rlp(
rlp: &Rlp<'_>
) -> Result<TransactionRequest, DecoderError>
pub fn decode_unsigned_rlp(
rlp: &Rlp<'_>
) -> Result<TransactionRequest, DecoderError>
Decodes RLP into a transaction.
sourcepub fn decode_signed_rlp(
rlp: &Rlp<'_>
) -> Result<(TransactionRequest, Signature), RequestError>
pub fn decode_signed_rlp(
rlp: &Rlp<'_>
) -> Result<(TransactionRequest, Signature), RequestError>
Decodes the given RLP into a transaction, attempting to decode its signature as well.
sourceimpl TransactionRequest
impl TransactionRequest
sourcepub fn with_access_list<T>(self, access_list: T) -> Eip2930TransactionRequestwhere
T: Into<AccessList>,
pub fn with_access_list<T>(self, access_list: T) -> Eip2930TransactionRequestwhere
T: Into<AccessList>,
Sets the access_list field in the transaction (converts the TransactionRequest to
an Eip2930TransactionRequest)
Trait Implementations
sourceimpl Clone for TransactionRequest
impl Clone for TransactionRequest
sourcefn clone(&self) -> TransactionRequest
fn clone(&self) -> TransactionRequest
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read moresourceimpl Debug for TransactionRequest
impl Debug for TransactionRequest
sourceimpl Decodable for TransactionRequest
impl Decodable for TransactionRequest
sourcefn decode(rlp: &Rlp<'_>) -> Result<TransactionRequest, DecoderError>
fn decode(rlp: &Rlp<'_>) -> Result<TransactionRequest, DecoderError>
Decodes the given RLP into a transaction request, ignoring the signature if populated
sourceimpl Default for TransactionRequest
impl Default for TransactionRequest
sourcefn default() -> TransactionRequest
fn default() -> TransactionRequest
sourceimpl<'de> Deserialize<'de> for TransactionRequest
impl<'de> Deserialize<'de> for TransactionRequest
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<TransactionRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<TransactionRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
sourceimpl From<&Transaction> for TransactionRequest
impl From<&Transaction> for TransactionRequest
sourcefn from(tx: &Transaction) -> TransactionRequest
fn from(tx: &Transaction) -> TransactionRequest
sourceimpl From<Eip1559TransactionRequest> for TransactionRequest
impl From<Eip1559TransactionRequest> for TransactionRequest
sourcefn from(tx: Eip1559TransactionRequest) -> TransactionRequest
fn from(tx: Eip1559TransactionRequest) -> TransactionRequest
sourceimpl From<TransactionRequest> for TypedTransaction
impl From<TransactionRequest> for TypedTransaction
sourcefn from(src: TransactionRequest) -> TypedTransaction
fn from(src: TransactionRequest) -> TypedTransaction
sourceimpl From<TypedTransaction> for TransactionRequest
impl From<TypedTransaction> for TransactionRequest
sourcefn from(src: TypedTransaction) -> TransactionRequest
fn from(src: TypedTransaction) -> TransactionRequest
sourceimpl PartialEq<TransactionRequest> for TransactionRequest
impl PartialEq<TransactionRequest> for TransactionRequest
sourcefn eq(&self, other: &TransactionRequest) -> bool
fn eq(&self, other: &TransactionRequest) -> bool
sourceimpl Serialize for TransactionRequest
impl Serialize for TransactionRequest
sourcefn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for TransactionRequest
impl StructuralEq for TransactionRequest
impl StructuralPartialEq for TransactionRequest
Auto Trait Implementations
impl RefUnwindSafe for TransactionRequest
impl Send for TransactionRequest
impl Sync for TransactionRequest
impl Unpin for TransactionRequest
impl UnwindSafe for TransactionRequest
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> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request