diff --git a/crates/network/Cargo.toml b/crates/network/Cargo.toml index d77e48cabfb..d9142a496ae 100644 --- a/crates/network/Cargo.toml +++ b/crates/network/Cargo.toml @@ -22,5 +22,8 @@ async-trait.workspace = true serde = { workspace = true, features = ["derive"] } thiserror.workspace = true +[dev-dependencies] +tokio.workspace = true + [features] k256 = ["alloy-primitives/k256", "alloy-consensus/k256"] diff --git a/crates/network/src/ethereum/mod.rs b/crates/network/src/ethereum/mod.rs index ceea5642ea4..68a2f65dfc2 100644 --- a/crates/network/src/ethereum/mod.rs +++ b/crates/network/src/ethereum/mod.rs @@ -30,7 +30,8 @@ impl Network for Ethereum { type HeaderResponse = alloy_rpc_types::Header; } -#[async_trait] +#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] +#[cfg_attr(not(target_arch = "wasm32"), async_trait)] impl TransactionBuilder for alloy_rpc_types::TransactionRequest { fn chain_id(&self) -> Option { self.chain_id diff --git a/crates/network/src/transaction/builder.rs b/crates/network/src/transaction/builder.rs index f608fe916dc..0e5b9235c8d 100644 --- a/crates/network/src/transaction/builder.rs +++ b/crates/network/src/transaction/builder.rs @@ -43,7 +43,8 @@ pub type BuilderResult = std::result::Result: Default + Sized + Send + Sync + 'static { /// Get the chain ID for the transaction. fn chain_id(&self) -> Option; diff --git a/crates/network/src/transaction/signer.rs b/crates/network/src/transaction/signer.rs index 4db4b51e700..3c36b412dfa 100644 --- a/crates/network/src/transaction/signer.rs +++ b/crates/network/src/transaction/signer.rs @@ -4,7 +4,8 @@ use async_trait::async_trait; // todo: move /// A signer capable of signing any transaction for the given network. -#[async_trait] +#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] +#[cfg_attr(not(target_arch = "wasm32"), async_trait)] pub trait NetworkSigner: Sync { /// Asynchronously sign an unsigned transaction. async fn sign(&self, tx: N::UnsignedTx) -> alloy_signer::Result; @@ -12,7 +13,8 @@ pub trait NetworkSigner: Sync { // todo: move /// An async signer capable of signing any [SignableTransaction] for the given [Signature] type. -#[async_trait] +#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] +#[cfg_attr(not(target_arch = "wasm32"), async_trait)] pub trait TxSigner { /// Asynchronously sign an unsigned transaction. async fn sign_transaction(