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

refactor: remove async_trait in tx builder #279

Merged
merged 1 commit into from
Mar 12, 2024
Merged

Conversation

onbjerg
Copy link
Member

@onbjerg onbjerg commented Mar 12, 2024

Motivation

Closes #268

Solution

We can't use async fn because we need the Send bound for NetworkSigner

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@onbjerg onbjerg added the debt Tech debt which needs to be addressed label Mar 12, 2024
fn build<S: NetworkSigner<N>>(
self,
signer: &S,
) -> impl std::future::Future<Output = BuilderResult<N::TxEnvelope>> + Send;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this work for wasm?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsure, but this entire crate does not yet work for wasm because of #262

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I assume it's not, wasm-bindgen does not generate Send futures. i assume we would need to conditionally compile this, but I'd leave that for the above issue perhaps, wdyt

Copy link
Member

@DaniPopes DaniPopes Mar 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related: impl_future! macro in alloy_transport

macro_rules! impl_future {
(<$($t:tt)+) => {
impl (::core::future::Future<$($t)+) + Send
};
}

@onbjerg onbjerg merged commit 54fd2fa into main Mar 12, 2024
15 checks passed
@onbjerg onbjerg deleted the onbjerg/rm-async-trait branch March 12, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debt Tech debt which needs to be addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Remove async_trait from TransactionBuilder
3 participants