From bec14d9fd8b70d7451fef8c7b346811f6df96b39 Mon Sep 17 00:00:00 2001 From: Yash Atreya <44857776+yash-atreya@users.noreply.github.com> Date: Fri, 10 Jan 2025 16:10:38 +0530 Subject: [PATCH] fix: add `js` to getrandom for wasm32 --- crates/alloy/Cargo.toml | 2 +- crates/contract/Cargo.toml | 3 +++ crates/network/Cargo.toml | 3 +++ crates/node-bindings/Cargo.toml | 3 +++ crates/provider/Cargo.toml | 1 + crates/signer-local/Cargo.toml | 3 +++ crates/signer/Cargo.toml | 3 +++ 7 files changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/alloy/Cargo.toml b/crates/alloy/Cargo.toml index 5300c841450..b6546ab9493 100644 --- a/crates/alloy/Cargo.toml +++ b/crates/alloy/Cargo.toml @@ -76,7 +76,7 @@ std = [ "alloy-consensus?/std", ] -# essential features that enable bare minimal network interactions out of the box. +# essential features that enable basic network interactions out of the box. essentials = ["contract", "provider-http", "rpc-types", "signer-local"] # full diff --git a/crates/contract/Cargo.toml b/crates/contract/Cargo.toml index a65be56b6d6..6431d45650e 100644 --- a/crates/contract/Cargo.toml +++ b/crates/contract/Cargo.toml @@ -40,6 +40,9 @@ thiserror.workspace = true alloy-pubsub = { workspace = true, optional = true } +[target.'cfg(target_arch = "wasm32")'.dependencies] +getrandom = { version = "0.2", features = ["js"] } + [dev-dependencies] alloy-consensus.workspace = true alloy-rpc-client = { workspace = true, features = ["pubsub", "ws"] } diff --git a/crates/network/Cargo.toml b/crates/network/Cargo.toml index df86ae88ded..ddc56f76323 100644 --- a/crates/network/Cargo.toml +++ b/crates/network/Cargo.toml @@ -42,6 +42,9 @@ serde.workspace = true serde_json.workspace = true thiserror.workspace = true +[target.'cfg(target_arch = "wasm32")'.dependencies] +getrandom = { version = "0.2", features = ["js"] } + [dev-dependencies] [features] diff --git a/crates/node-bindings/Cargo.toml b/crates/node-bindings/Cargo.toml index 588ceae2644..8057267f43e 100644 --- a/crates/node-bindings/Cargo.toml +++ b/crates/node-bindings/Cargo.toml @@ -33,6 +33,9 @@ thiserror.workspace = true tracing.workspace = true url.workspace = true +[target.'cfg(target_arch = "wasm32")'.dependencies] +getrandom = { version = "0.2", features = ["js"] } + [dev-dependencies] ci_info.workspace = true tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } diff --git a/crates/provider/Cargo.toml b/crates/provider/Cargo.toml index c91ca38cd46..d4242014b50 100644 --- a/crates/provider/Cargo.toml +++ b/crates/provider/Cargo.toml @@ -71,6 +71,7 @@ url = { workspace = true, optional = true } parking_lot.workspace = true [target.'cfg(target_arch = "wasm32")'.dependencies] wasmtimer.workspace = true +getrandom = { version = "0.2", features = ["js"] } [dev-dependencies] alloy-consensus = { workspace = true, features = ["kzg"] } diff --git a/crates/signer-local/Cargo.toml b/crates/signer-local/Cargo.toml index f2052f6da68..81234916cb5 100644 --- a/crates/signer-local/Cargo.toml +++ b/crates/signer-local/Cargo.toml @@ -50,6 +50,9 @@ yubihsm = { version = "0.42", features = [ "usb", ], optional = true } +[target.'cfg(target_arch = "wasm32")'.dependencies] +getrandom = { version = "0.2", features = ["js"] } + [dev-dependencies] alloy-dyn-abi.workspace = true alloy-sol-types.workspace = true diff --git a/crates/signer/Cargo.toml b/crates/signer/Cargo.toml index 66498290295..ee9fff36e28 100644 --- a/crates/signer/Cargo.toml +++ b/crates/signer/Cargo.toml @@ -38,6 +38,9 @@ alloy-dyn-abi = { workspace = true, optional = true, features = [ "eip712", ] } +[target.'cfg(target_arch = "wasm32")'.dependencies] +getrandom = { version = "0.2", features = ["js"] } + [dev-dependencies] assert_matches.workspace = true serde.workspace = true