Skip to main content

EthSigner

Trait EthSigner 

Source
pub trait EthSigner<T, TxReq = TransactionRequest>:
    Send
    + Sync
    + DynClone {
    // Required methods
    fn accounts(&self) -> Vec<Address>;
    fn sign<'life0, 'life1, 'async_trait>(
        &'life0 self,
        address: Address,
        message: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<Signature, SignError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn sign_transaction<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: TxReq,
        address: &'life1 Address,
    ) -> Pin<Box<dyn Future<Output = Result<T, SignError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn sign_typed_data(
        &self,
        address: Address,
        payload: &TypedData,
    ) -> Result<Signature, SignError>;

    // Provided methods
    fn is_signer_for(&self, addr: &Address) -> bool { ... }
    fn nonce_lock(&self) -> Option<Arc<Mutex<()>>> { ... }
}
Available on crate feature rpc only.
Expand description

An Ethereum Signer used via RPC.

Required Methods§

Source

fn accounts(&self) -> Vec<Address>

Returns the available accounts for this signer.

Source

fn sign<'life0, 'life1, 'async_trait>( &'life0 self, address: Address, message: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<Signature, SignError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Returns the signature

Source

fn sign_transaction<'life0, 'life1, 'async_trait>( &'life0 self, request: TxReq, address: &'life1 Address, ) -> Pin<Box<dyn Future<Output = Result<T, SignError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

signs a transaction request using the given account in request

Source

fn sign_typed_data( &self, address: Address, payload: &TypedData, ) -> Result<Signature, SignError>

Encodes and signs the typed data according EIP-712. Payload must implement Eip712 trait.

Provided Methods§

Source

fn is_signer_for(&self, addr: &Address) -> bool

Returns true whether this signer can sign for this address

Source

fn nonce_lock(&self) -> Option<Arc<Mutex<()>>>

Returns the lock eth_sendTransaction holds for this signer’s accounts from filling the nonce until the signed transaction is in the pool, so concurrent requests from one account get distinct nonces.

None leaves those requests unserialized.

Trait Implementations§

Source§

impl<'clone, T, TxReq> Clone for Box<dyn EthSigner<T, TxReq> + 'clone>

Source§

fn clone(&self) -> Box<dyn EthSigner<T, TxReq> + 'clone>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'clone, T, TxReq> Clone for Box<dyn EthSigner<T, TxReq> + Send + 'clone>

Source§

fn clone(&self) -> Box<dyn EthSigner<T, TxReq> + Send + 'clone>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'clone, T, TxReq> Clone for Box<dyn EthSigner<T, TxReq> + Sync + 'clone>

Source§

fn clone(&self) -> Box<dyn EthSigner<T, TxReq> + Sync + 'clone>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'clone, T, TxReq> Clone for Box<dyn EthSigner<T, TxReq> + Sync + Send + 'clone>

Source§

fn clone(&self) -> Box<dyn EthSigner<T, TxReq> + Sync + Send + 'clone>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, TxReq> EthSigner<T, TxReq> for DevSigner
where T: Decodable2718, TxReq: SignableTxRequest<T>,