diff --git a/.gitignore b/.gitignore index 0a5751c5b2..697e03b03f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,9 @@ testdbs # production **/build +# rust wasm +**/pkg + # misc .DS_Store .env diff --git a/ironfish-rust-wasm/README.md b/ironfish-rust-wasm/README.md new file mode 100644 index 0000000000..8f0f23f9b2 --- /dev/null +++ b/ironfish-rust-wasm/README.md @@ -0,0 +1,37 @@ +# Ironfish Rust WASM + +This is a WASM build of the Ironfish Rust library. + +## Building on Linux + +```bash +wasm-pack build --target web --release +``` + +## Building on Mac + +### Using `wasm-pack` + +Reference: https://mikeder.net/blog/m1-mac-wasm/ + +```bash +AR=/opt/homebrew/opt/llvm/bin/llvm-ar CC=/opt/homebrew/opt/llvm/bin/clang wasm-pack build --release --target web +``` + +### Using `cargo` and `wasm-bindgen` + +In case building with `wasm-pack` fails, you can try building with `cargo` and `wasm-bindgen`: + +```bash +AR=/opt/homebrew/opt/llvm/bin/llvm-ar CC=/opt/homebrew/opt/llvm/bin/clang cargo build --release --target wasm32-unknown-unknown +``` + +```bash +wasm-bindgen ../target/wasm32-unknown-unknown/release/ironfish_wasm.wasm --out-dir ./pkg +``` + +Install `wasm-bindgen` + +```bash +cargo install -f wasm-bindgen-cli --version 0.2.95 +```