signet_types/seq/
mod.rs

1mod req;
2pub use req::SignRequest;
3
4mod resp;
5pub use resp::SignResponse;
6
7/// A [`RequestSigner`] signs [`SignRequest`]s by delegating to an
8/// [`alloy::signers::Signer`].
9pub trait RequestSigner {
10    /// Signs a [`SignRequest`] and returns the [`alloy::primitives::Signature`].
11    fn sign_request(
12        &self,
13        request: &SignRequest,
14    ) -> impl std::future::Future<Output = Result<alloy::signers::Signature, alloy::signers::Error>> + Send;
15}
16
17impl<T> RequestSigner for T
18where
19    T: alloy::signers::Signer + Send + Sync,
20{
21    async fn sign_request(
22        &self,
23        request: &SignRequest,
24    ) -> Result<alloy::signers::Signature, alloy::signers::Error> {
25        let hash = request.signing_hash();
26        self.sign_hash(&hash).await
27    }
28}