Skip to content

Commit

Permalink
Merge pull request #2268 from dusk-network/embed-walletcore-2256
Browse files Browse the repository at this point in the history
rusk: HTTP - add `/static/drivers/wallet-core.wasm` endpoint
  • Loading branch information
herr-seppia authored Sep 4, 2024
2 parents 538a4ef + 4e400a0 commit 0f003cf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rusk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,14 @@ criterion = "0.5"
rustc_tools_util = "0.3"

[features]
default = ["ephemeral", "recovery-state", "recovery-keys", "prover", "node"]
default = ["ephemeral", "recovery-state", "recovery-keys", "prover", "node", "http-wasm"]
ephemeral = ["dep:rusk-recovery", "dep:tempfile", "recovery-state", "node"]
recovery-state = ["rusk-recovery/state", "dep:tempfile"]
recovery-keys = ["rusk-recovery/keys"]
prover = ["dep:rusk-prover"]
testwallet = ["dep:futures"]
node = ["dep:node", "dep:dusk-consensus", "dep:node-data"]
http-wasm = []

[[bench]]
name = "block_ingestion"
Expand Down
14 changes: 14 additions & 0 deletions rusk/src/lib/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,20 @@ where
.await;
}

#[cfg(feature = "http-wasm")]
if path == "/static/drivers/wallet-core.wasm" {
let wallet_wasm = include_bytes!(
"../../../target/wasm32-unknown-unknown/release/wallet_core.wasm"
);
let mut response =
Response::new(Full::from(wallet_wasm.to_vec()).into());
response.headers_mut().append(
"Content-Type",
HeaderValue::from_static("application/wasm"),
);
return Ok(response);
}

if hyper_tungstenite::is_upgrade_request(&req) {
let target = req.uri().path().try_into()?;

Expand Down

0 comments on commit 0f003cf

Please sign in to comment.