Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ironfish-wasm build instructions #5698

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ testdbs
# production
**/build

# rust wasm
**/pkg

# misc
.DS_Store
.env
Expand Down
37 changes: 37 additions & 0 deletions ironfish-rust-wasm/README.md
Original file line number Diff line number Diff line change
@@ -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
```