React + Rust WASM Order Book
The Rust engine ranks bids in a ReactiveCollection and exposes its committed balance, best bid and desk note through WireScope. The React client hydrates those values, subscribes through @zwire/react, and holds the reservation in a component-owned optimistic layer from @zwire/react/tx (useOptimisticLayer).
- Choose Reserve 150. The available balance changes from 1,000 to 850 in a TypeScript optimistic layer.
- Choose Apply market update. Rust raises the best bid to 125 and credits 500 in one batch. The displayed balance becomes 1,350 while the reservation is active.
- Choose Release reservation. The balance returns to the new committed value of 1,500.
- Enter a desk note and choose Save in Rust. The acknowledgement reads the value from the Rust engine.
From the repository root, install the pinned toolchains, the JS dependencies and the matching wasm-bindgen CLI:
pnpm install --frozen-lockfile --ignore-scripts(cd rust && rustup target add wasm32-unknown-unknown && cargo install wasm-bindgen-cli --version 0.2.130 --locked)mise run test:wasmpython3 -m http.server 8080 --bind 127.0.0.1 --directory examples/wasm-orderbook/distOpen http://127.0.0.1:8080. The test instantiates the same compiled WASM and bundled React view and drives the four interactions above.