diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index 8d194935d7..c6f3c1a360 100644 --- a/.github/workflows/cont_integration.yml +++ b/.github/workflows/cont_integration.yml @@ -101,7 +101,7 @@ jobs: run: cargo check --target wasm32-unknown-unknown --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown,dev-getrandom-wasm - name: Check esplora working-directory: ./crates/esplora - run: cargo check --target wasm32-unknown-unknown --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown,async + run: cargo check --target wasm32-unknown-unknown --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown,async,dev-getrandom-wasm fmt: name: Rust fmt diff --git a/crates/esplora/Cargo.toml b/crates/esplora/Cargo.toml index 49af68a991..a399c05094 100644 --- a/crates/esplora/Cargo.toml +++ b/crates/esplora/Cargo.toml @@ -21,6 +21,9 @@ futures = { version = "0.3.26", optional = true } bitcoin = { version = "0.30.0", optional = true, default-features = false } miniscript = { version = "10.0.0", optional = true, default-features = false } +[target.'cfg(target_arch = "wasm32")'.dev-dependencies] +getrandom = "0.2" + [dev-dependencies] electrsd = { version= "0.25.0", features = ["bitcoind_25_0", "esplora_a33e97e1", "legacy"] } tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros"] } @@ -31,3 +34,8 @@ std = ["bdk_chain/std"] async = ["async-trait", "futures", "esplora-client/async"] async-https = ["async", "esplora-client/async-https"] blocking = ["esplora-client/blocking"] + +# This feature is used to run `cargo check` in our CI targeting wasm. It's not recommended +# for libraries to explicitly include the "getrandom/js" feature, so we only do it when +# necessary for running our CI. See: https://docs.rs/getrandom/0.2.8/getrandom/#webassembly-support +dev-getrandom-wasm = ["getrandom/js"]