valida-basic-api-wasm
v1.0.0
Published
This package exposes WASM module for Valida runner, prover and verifier.
Readme
This package exposes WASM module for Valida runner, prover and verifier.
Installation of dependencies
- Install
wasm32support:rustup target add wasm32-unknown-unknown - Install
wasm-pack
cargo install wasm-pack- or
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sudo sh
- Install
node.jsversion v22.13.1 (LTS).
- Download
node.js- on
x86:wget https://nodejs.org/dist/v22.13.1/node-v22.13.1-linux-x64.tar.xz - on
arm:wget https://nodejs.org/dist/v22.13.1/node-v22.13.1-linux-arm64.tar.xz
- on
- then untar and add its
bindirectory toPATH. - Alternatively, install
node.jsv22.13.1 using nvm.
wasm-pack is required to build WASM bindings.
node.js is required to run the tests.
Building
In the package main directory:
wasm-pack build --releaseTesting
In the package main directory:
wasm-pack test --release --nodeTests are built in the release mode to save CI time. Tests are run in node.js.
Releasing
To release this package on npm, follow these steps:
- Increment the package version in the
Cargo.tomlfile to match the main Valida release version. - Build the package as specified above in the Building section
wasm-pack logincd pkgnpm publish --access=public
Resources
For more information on WASM, Rust to WASM compilation and testing see:
- https://rustwasm.github.io/docs/wasm-bindgen/
- https://rustwasm.github.io/docs/book/game-of-life/hello-world.html
- https://rustwasm.github.io/docs/wasm-pack/
- https://doc.rust-lang.org/rustc/platform-support/wasm32-unknown-unknown.html
- https://rustwasm.github.io/wasm-pack/book/tutorials/npm-browser-packages/building-your-project.html
