Trait ethers_signers::Signer [−][src]
pub trait Signer: Debug + Send + Sync {
type Error: Error + Send + Sync;
fn sign_message<'life0, 'async_trait, S: Send + Sync + AsRef<[u8]>>(
&'life0 self,
message: S
) -> Pin<Box<dyn Future<Output = Result<Signature, Self::Error>> + Send + 'async_trait>>
where
S: 'async_trait,
'life0: 'async_trait,
Self: '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
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn sign_typed_data<'life0, 'life1, 'async_trait, T: Eip712 + Send + Sync>(
&'life0 self,
payload: &'life1 T
) -> Pin<Box<dyn Future<Output = Result<Signature, Self::Error>> + Send + 'async_trait>>
where
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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.
Associated Types
Required methods
Signs the hash of the provided message after prefixing it
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
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Signs the transaction
Encodes and signs the typed data according EIP-712. Payload must implement Eip712 trait.
fn with_chain_id<T: Into<u64>>(self, chain_id: T) -> Self
fn with_chain_id<T: Into<u64>>(self, chain_id: T) -> Self
Sets the signer’s chain id