pub struct Web3Signer<P: Provider<N> + Clone, N: Network = Ethereum> { /* private fields */ }
Expand description
A remote signer that leverages the underlying provider to sign transactions using
"eth_signTransaction"
requests.
For more information, please see Web3Signer
Note:
"eth_signTransaction"
is not supported by regular nodes.
Implementations§
Source§impl<P: Provider<N> + Clone, N: Network> Web3Signer<P, N>
impl<P: Provider<N> + Clone, N: Network> Web3Signer<P, N>
Sourcepub const fn new(provider: P, address: Address) -> Self
pub const fn new(provider: P, address: Address) -> Self
Instantiates a new Web3Signer
with the given Provider
and the signer address.
The address
is used to set the from
field in the transaction requests.
The remote signer’s address must be the same as the signer address provided here.
Sourcepub fn provider(&self) -> P
pub fn provider(&self) -> P
Returns the underlying Provider
used by the Web3Signer
.
Sourcepub async fn sign_transaction(&self, tx: N::TransactionRequest) -> Result<Bytes>
pub async fn sign_transaction(&self, tx: N::TransactionRequest) -> Result<Bytes>
Signs a transaction request and return the raw signed transaction in the form of Bytes
.
The returned Bytes
can be used to broadcast the transaction to the network using
Provider::send_raw_transaction
.
Sets the from
field to the provided address
.
If you’d like to receive a Network::TxEnvelope
instead, use
Web3Signer::sign_and_decode
.
Sourcepub async fn sign_and_decode(
&self,
tx: N::TransactionRequest,
) -> Result<N::TxEnvelope>
pub async fn sign_and_decode( &self, tx: N::TransactionRequest, ) -> Result<N::TxEnvelope>
Signs a transaction request using Web3Signer::sign_transaction
and decodes the raw bytes
returning a Network::TxEnvelope
.
Trait Implementations§
Auto Trait Implementations§
impl<P, N> Freeze for Web3Signer<P, N>where
P: Freeze,
impl<P, N> RefUnwindSafe for Web3Signer<P, N>where
P: RefUnwindSafe,
N: RefUnwindSafe,
impl<P, N> Send for Web3Signer<P, N>
impl<P, N> Sync for Web3Signer<P, N>
impl<P, N> Unpin for Web3Signer<P, N>
impl<P, N> UnwindSafe for Web3Signer<P, N>where
P: UnwindSafe,
N: 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<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<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