alloy_signer

Trait SignerSync

Source
pub trait SignerSync<Sig = PrimitiveSignature> {
    // 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§