Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add Unifying trait for TxSigner and Signer #2029

Closed
mattsse opened this issue Feb 7, 2025 · 4 comments · Fixed by #2035
Closed

[Feature] Add Unifying trait for TxSigner and Signer #2029

mattsse opened this issue Feb 7, 2025 · 4 comments · Fixed by #2035
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mattsse
Copy link
Member

mattsse commented Feb 7, 2025

Component

signers

Describe the feature you would like

ref #2027

these two traits are object-safe but there are usecases where we need the functionality of both

these traits are usually implemented for the same type:

impl<C> TxSigner<Signature> for LocalSigner<C>

impl<C: PrehashSigner<(ecdsa::Signature, RecoveryId)> + Send + Sync> Signer for LocalSigner<C> {

I'd be nice to use dyn with both, which can be achieved via a helper trait

trait AnySinger<S>: Singer<S> + TxSigner<S> {}

impl<T, S> AnySinger<Signer> for T where T: Signer<S> + TxSigner<S>

TODO

  • introduce helper trait, and one for Sync

Additional context

No response

@mattsse mattsse added enhancement New feature or request good first issue Good for newcomers labels Feb 7, 2025
@startup-dreamer
Copy link
Contributor

I's like to work on this.

@mattsse
Copy link
Member Author

mattsse commented Feb 8, 2025

assigned ty

@startup-dreamer
Copy link
Contributor

@mattsse Should I implement both the traits in a new single file (maybe any_signer.rs) or do you want it to be seperate files?

@mattsse
Copy link
Member Author

mattsse commented Feb 8, 2025

we can simply add this in the file this resides in

pub trait TxSigner<Signature> {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
2 participants