pub trait Signer: Debug + Send + Sync {
    type Error: Error + Send + Sync;

    // Required methods
    fn sign_message<'life0, 'async_trait, S>(
        &'life0 self,
        message: S
    ) -> Pin<Box<dyn Future<Output = Result<Signature, Self::Error>> + Send + 'async_trait>>
       where S: 'async_trait + Send + Sync + AsRef<[u8]>,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn sign_transaction<'life0, 'life1, 'async_trait>(
        &'life0 self,
        message: &'life1 TypedTransaction
    ) -> Pin<Box<dyn Future<Output = Result<Signature, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn sign_typed_data<'life0, 'life1, 'async_trait, T>(
        &'life0 self,
        payload: &'life1 T
    ) -> Pin<Box<dyn Future<Output = Result<Signature, Self::Error>> + Send + 'async_trait>>
       where T: 'async_trait + Eip712 + Send + Sync,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn address(&self) -> Address;
    fn chain_id(&self) -> u64;
    fn with_chain_id<T: Into<u64>>(self, chain_id: T) -> Self;
}
Expand description

Trait for signing transactions and messages

Implement this trait to support different signing modes, e.g. Ledger, hosted etc.

Required Associated Types§

Required Methods§

source

fn sign_message<'life0, 'async_trait, S>( &'life0 self, message: S ) -> Pin<Box<dyn Future<Output = Result<Signature, Self::Error>> + Send + 'async_trait>>
where S: 'async_trait + Send + Sync + AsRef<[u8]>, Self: 'async_trait, 'life0: 'async_trait,

Signs the hash of the provided message after prefixing it

source

fn sign_transaction<'life0, 'life1, 'async_trait>( &'life0 self, message: &'life1 TypedTransaction ) -> Pin<Box<dyn Future<Output = Result<Signature, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Signs the transaction

source

fn sign_typed_data<'life0, 'life1, 'async_trait, T>( &'life0 self, payload: &'life1 T ) -> Pin<Box<dyn Future<Output = Result<Signature, Self::Error>> + Send + 'async_trait>>
where T: 'async_trait + Eip712 + Send + Sync, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

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

source

fn address(&self) -> Address

Returns the signer’s Ethereum Address

source

fn chain_id(&self) -> u64

Returns the signer’s chain id

source

fn with_chain_id<T: Into<u64>>(self, chain_id: T) -> Self

Sets the signer’s chain id

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Signer for AwsSigner

Available on crate feature aws only.
source§

impl Signer for LedgerEthereum

Available on crate feature ledger and non-WebAssembly only.
source§

impl Signer for TrezorEthereum

Available on crate feature trezor and non-WebAssembly only.
source§

impl<D: Sync + Send + PrehashSigner<(Signature, RecoveryId)>> Signer for Wallet<D>