pub trait SignerSync<Sig = Signature> {
// Required methods
fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>;
fn chain_id_sync(&self) -> Option<ChainId>;
// Provided methods
fn sign_message_sync(&self, message: &[u8]) -> Result<Sig> { ... }
fn sign_typed_data_sync<T: SolStruct>(
&self,
payload: &T,
domain: &Eip712Domain,
) -> Result<Sig>
where Self: Sized { ... }
fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig> { ... }
}
Expand description
Synchronous Ethereum signer.
All provided implementations rely on sign_hash_sync
. A signer
may not always be able to implement this method, in which case it should return
UnsupportedOperation
, and implement all the signing
methods directly.
Synchronous signers should also implement Signer
, as they are always able to by delegating
the asynchronous methods to the synchronous ones.
Required Methods§
sourcefn sign_hash_sync(&self, hash: &B256) -> Result<Sig>
fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>
Signs the given hash.
sourcefn chain_id_sync(&self) -> Option<ChainId>
fn chain_id_sync(&self) -> Option<ChainId>
Returns the signer’s chain ID.
Provided Methods§
sourcefn sign_message_sync(&self, message: &[u8]) -> Result<Sig>
fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>
Signs the hash of the provided message after prefixing it, as specified in EIP-191.
sourcefn sign_typed_data_sync<T: SolStruct>(
&self,
payload: &T,
domain: &Eip712Domain,
) -> Result<Sig>where
Self: Sized,
Available on crate feature eip712
only.
fn sign_typed_data_sync<T: SolStruct>(
&self,
payload: &T,
domain: &Eip712Domain,
) -> Result<Sig>where
Self: Sized,
eip712
only.Encodes and signs the typed data according to EIP-712.
sourcefn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>
Available on crate feature eip712
only.
fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>
eip712
only.Encodes and signs the typed data according to EIP-712 for Signers that are not dynamically sized.
Implementations on Foreign Types§
source§impl<'a, Sig, U: 'a + SignerSync<Sig> + ?Sized> SignerSync<Sig> for &'a U
impl<'a, Sig, U: 'a + SignerSync<Sig> + ?Sized> SignerSync<Sig> for &'a U
fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>
fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>
source§fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>
fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>
Available on crate feature
eip712
only.fn chain_id_sync(&self) -> Option<ChainId>
source§impl<'a, Sig, U: 'a + SignerSync<Sig> + ?Sized> SignerSync<Sig> for &'a mut U
impl<'a, Sig, U: 'a + SignerSync<Sig> + ?Sized> SignerSync<Sig> for &'a mut U
fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>
fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>
source§fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>
fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>
Available on crate feature
eip712
only.fn chain_id_sync(&self) -> Option<ChainId>
source§impl<Sig, U: SignerSync<Sig> + ?Sized> SignerSync<Sig> for Box<U>
impl<Sig, U: SignerSync<Sig> + ?Sized> SignerSync<Sig> for Box<U>
fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>
fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>
source§fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>
fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>
Available on crate feature
eip712
only.fn chain_id_sync(&self) -> Option<ChainId>
source§impl<Sig, U: SignerSync<Sig> + ?Sized> SignerSync<Sig> for Rc<U>
impl<Sig, U: SignerSync<Sig> + ?Sized> SignerSync<Sig> for Rc<U>
fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>
fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>
source§fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>
fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>
Available on crate feature
eip712
only.fn chain_id_sync(&self) -> Option<ChainId>
source§impl<Sig, U: SignerSync<Sig> + ?Sized> SignerSync<Sig> for Arc<U>
impl<Sig, U: SignerSync<Sig> + ?Sized> SignerSync<Sig> for Arc<U>
fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>
fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>
source§fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>
fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>
Available on crate feature
eip712
only.