-
Notifications
You must be signed in to change notification settings - Fork 236
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
feat: helpers for AnyNetwork #476
Conversation
crates/network/src/any/signer.rs
Outdated
|
||
/// A signer capable of signing any transaction for the [AnyNetwork] network. | ||
#[derive(Clone)] | ||
pub struct AnyNetworkSigner(Arc<dyn TxSigner<Signature> + Send + Sync>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense to make this Arc
so we can share the same signer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if it makes sense to duplicate the signer type,
Perhaps for forward compatibility we can do that, in case we want to support more tx types that are don't exist on ehtereum (currently there aren't any)
so I think for now we can simply use the ethereumsigner for AnyNetwork as well but add impl NetworkSigner<AnyNetwork> for EthereumSigner {
because both networks have the same UnsignedTx
I believe we could even do
impl<N> NetworkSigner<N> for EthereumSigner
where N: Network<UnsignedTx= TypedTransaction, TxEnvelope = TxEnvelope >
{
wdyt @prestwich
crates/network/src/any/mod.rs
Outdated
/// Alias for a catch-all receipt type. | ||
pub type AnyReceipt = WithOtherFields<TransactionReceipt<AnyReceiptEnvelope<Log>>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could move or reexport this to/from rpc types and rename AnyTransactionReceipt
?
crates/network/src/any/signer.rs
Outdated
|
||
/// A signer capable of signing any transaction for the [AnyNetwork] network. | ||
#[derive(Clone)] | ||
pub struct AnyNetworkSigner(Arc<dyn TxSigner<Signature> + Send + Sync>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the same as:
pub struct EthereumSigner(Arc<dyn TxSigner<Signature> + Send + Sync>); |
so I assume we can reuse EthereumSigner
but
also implement impl NetworkSigner<AnyNetwork> for EthereumSigner {
?
supportive of type-reuse and the blanket impl The reason that |
basically the idea of |
* feat: helpers for AnyNetwork * fmt * Fixes * fix * fmt
Motivation
Small changes for foundry-rs/foundry#7106
Adds
AnyNetworkSigner
and alias forAnyNetwork::ReceiptResponse
as it's pretty longSolution
PR Checklist