alloy_signer

Trait SignerSync

source
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§

source

fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>

Signs the given hash.

source

fn chain_id_sync(&self) -> Option<ChainId>

Returns the signer’s chain ID.

Provided Methods§

source

fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>

Signs the hash of the provided message after prefixing it, as specified in EIP-191.

source

fn sign_typed_data_sync<T: SolStruct>( &self, payload: &T, domain: &Eip712Domain, ) -> Result<Sig>
where Self: Sized,

Available on crate feature eip712 only.

Encodes and signs the typed data according to EIP-712.

source

fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>

Available on crate feature 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

source§

fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>

source§

fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>

source§

fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>

Available on crate feature eip712 only.
source§

fn chain_id_sync(&self) -> Option<ChainId>

source§

impl<'a, Sig, U: 'a + SignerSync<Sig> + ?Sized> SignerSync<Sig> for &'a mut U

source§

fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>

source§

fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>

source§

fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>

Available on crate feature eip712 only.
source§

fn chain_id_sync(&self) -> Option<ChainId>

source§

impl<Sig, U: SignerSync<Sig> + ?Sized> SignerSync<Sig> for Box<U>

source§

fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>

source§

fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>

source§

fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>

Available on crate feature eip712 only.
source§

fn chain_id_sync(&self) -> Option<ChainId>

source§

impl<Sig, U: SignerSync<Sig> + ?Sized> SignerSync<Sig> for Rc<U>

source§

fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>

source§

fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>

source§

fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>

Available on crate feature eip712 only.
source§

fn chain_id_sync(&self) -> Option<ChainId>

source§

impl<Sig, U: SignerSync<Sig> + ?Sized> SignerSync<Sig> for Arc<U>

source§

fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>

source§

fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>

source§

fn sign_dynamic_typed_data_sync(&self, payload: &TypedData) -> Result<Sig>

Available on crate feature eip712 only.
source§

fn chain_id_sync(&self) -> Option<ChainId>

Implementors§