Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions web-v2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ FROM rust:1.91-bookworm AS lwk-builder

ARG LWK_REF=wasm-0.16-expose-external-utxos
# ARG LWK_COMMIT=4786e456db6efc05413721f6489899a6426eaa47
ARG LWK_COMMIT=9f1faea1a6765b7591a8377834be38f4a8f090ae
ARG LWK_COMMIT=1ca9d0414baa599925b8b1d412159131dd76d87d

RUN apt-get update && apt-get install -y --no-install-recommends \
git pkg-config libssl-dev ca-certificates clang \
&& rm -rf /var/lib/apt/lists/*
RUN rustup target add wasm32-unknown-unknown
RUN cargo install wasm-pack --locked
# RUN git clone --depth 1 --branch "${LWK_REF}" https://github.com/Blockstream/lwk.git /tmp/lwk
RUN git clone --depth 1 --branch "${LWK_REF}" https://github.com/lilbonekit/lwk.git /tmp/lwk
RUN test "$(git -C /tmp/lwk rev-parse HEAD)" = "${LWK_COMMIT}"
# RUN git clone --filter=blob:none --branch "${LWK_REF}" https://github.com/Blockstream/lwk.git /tmp/lwk
RUN git clone --filter=blob:none --branch "${LWK_REF}" https://github.com/lilbonekit/lwk.git /tmp/lwk \
&& git -C /tmp/lwk checkout --detach "${LWK_COMMIT}" \
&& test "$(git -C /tmp/lwk rev-parse HEAD)" = "${LWK_COMMIT}"
WORKDIR /tmp/lwk/lwk_wasm
RUN RUSTFLAGS='--cfg web_sys_unstable_apis' wasm-pack build --target web --out-dir pkg_web --features simplicity,serial

Expand Down
12 changes: 11 additions & 1 deletion web-v2/docs/HOW_TO_BUILD_LWK_WASM.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ docker build -f web-v2/Dockerfile --target lwk-builder -t lwk-builder .
docker create --name tmp lwk-builder
docker cp tmp:/tmp/lwk/lwk_wasm/pkg_web ./pkg_web_from_docker
docker rm tmp
rm -rf ./lwk_wasm/pkg_web
mkdir -p ./lwk_wasm
mv ./pkg_web_from_docker ./lwk_wasm/pkg_web
```
Expand All @@ -23,6 +24,15 @@ mv ./pkg_web_from_docker ./lwk_wasm/pkg_web

```bash
cd web-v2
pnpm install
pnpm install --force
rm -rf node_modules/.vite
pnpm dev
```

If `node_modules` already existed, `pnpm install --force` is important because `lwk_web` is a local `file:` dependency. Clearing only `node_modules/.vite` refreshes Vite's prebundle cache, but it does not guarantee that the installed `lwk_web` package was refreshed.

## **4. Optional check after install**:

```bash
shasum -a 256 ../lwk_wasm/pkg_web/lwk_wasm_bg.wasm node_modules/lwk_web/lwk_wasm_bg.wasm
```
1 change: 1 addition & 0 deletions web-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"lwk_web": "file:../lwk_wasm/pkg_web",
"react": "^19.2.6",
"react-dom": "^19.2.6",
"react-hook-form": "^7.77.0",
"react-router-dom": "^7.15.0",
"zod": "^3.25.76"
},
Expand Down
Loading