Skip to content
Merged
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
7 changes: 7 additions & 0 deletions .github/workflows/shared-build-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ jobs:
with:
version: "0.2.108"

# Install wasm-opt from binaryen repository.
- name: Install binaryen
uses: sigoden/install-binary@v1
with:
repo: WebAssembly/binaryen
name: wasm-opt

- name: Setup sccache
uses: "./.github/actions/rust/sccache/setup"
with:
Expand Down
48 changes: 47 additions & 1 deletion bindings/wasm/audit_trail_wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,56 @@ const state = await trail.get();
console.log(state.sequenceNumber);
```

## Build
## Build the Library

Alternatively, you can build the bindings yourself if you have Rust installed. If not, refer
to [rustup.rs](https://rustup.rs) for the installation.

### Requirements

- [Node.js](https://nodejs.org/en) (>= `v20`)
- [Rust](https://www.rust-lang.org/) (>= 1.65)
- [Cargo](https://doc.rust-lang.org/cargo/) (>= 1.65)
- for running example: a local network node with the IOTA Audit Trails package deployed as described in [Local Network Setup](https://docs.iota.org/developer/iota-notarization/audit-trails/getting-started/local-network-setup)

### 1. Install Local Tooling

If you want to build the library from source you have to install additional build tools locally.

#### Install `wasm-bindgen-cli`

First you need to install [`wasm-bindgen-cli`](https://github.com/rustwasm/wasm-bindgen).
A manual installation is required because we use the [Weak References](https://rustwasm.github.io/wasm-bindgen/reference/weak-references.html) feature,
which [`wasm-pack` does not expose](https://github.com/rustwasm/wasm-pack/issues/930).

```bash
cargo install --force wasm-bindgen-cli
```

#### Install `wasm-opt`

To reduce the size of the wasm package, it is optimized with `wasm-opt`, which is part of [`binaryen`](https://github.com/WebAssembly/binaryen).

You can either download a [release of binaryen](https://github.com/WebAssembly/binaryen/releases) and make the bin folder available in your PATH or check if your operating system tooling offers a more convenient way of installing the binaries like APT, Homebrew, etc.

Some examples:

- Linux via APT: `sudo apt-get update && sudo apt-get -y install binaryen` (taken from [here](https://installati.one/install-binaryen-ubuntu-22-04/))
- MacOS via Homebrew: `brew install binaryen` (see [Homebrew entry](https://formulae.brew.sh/formula/binaryen))

### 2. Install Dependencies

After installing local tooling, you can install the necessary dependencies using the following command:

```bash
npm install
```

### 3. Build

You can build the bindings for `node.js` using the following command:

```bash npm2yarn
Comment thread
wulfraem marked this conversation as resolved.
npm run build
```

Expand Down
176 changes: 1 addition & 175 deletions bindings/wasm/audit_trail_wasm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions bindings/wasm/audit_trail_wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@
"tsconfig-paths": "^4.1.0",
"typedoc": "^0.28.5",
"typedoc-plugin-markdown": "^4.4.1",
"typescript": "^5.7.3",
"wasm-opt": "^1.4.0"
"typescript": "^5.7.3"
},
"dependencies": {
"@iota/iota-interaction-ts": "^0.14.0"
Expand Down
24 changes: 19 additions & 5 deletions bindings/wasm/notarization_wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,36 @@ to [rustup.rs](https://rustup.rs) for the installation.
- [Rust](https://www.rust-lang.org/) (>= 1.65)
- [Cargo](https://doc.rust-lang.org/cargo/) (>= 1.65)
- for running example: a local network node with the IOTA notarization package deployed as being described
[here](https://docs.iota.org/developer/iota-notarization/getting-started/local-network-setup)
[here](https://docs.iota.org/developer/iota-notarization/single-notarization/getting-started/local-network-setup)

### 1. Install `wasm-bindgen-cli`
### 1. Install Local Tooling

If you want to build the library from source,
you will first need to manually install [`wasm-bindgen-cli`](https://github.com/rustwasm/wasm-bindgen).
If you want to build the library from source you have to install additional build tools locally.

#### Install `wasm-bindgen-cli`

First you need to install [`wasm-bindgen-cli`](https://github.com/rustwasm/wasm-bindgen).
A manual installation is required because we use the [Weak References](https://rustwasm.github.io/wasm-bindgen/reference/weak-references.html) feature,
which [`wasm-pack` does not expose](https://github.com/rustwasm/wasm-pack/issues/930).

```bash
cargo install --force wasm-bindgen-cli
```

#### Install `wasm-opt`

To reduce the size of the wasm package, it is optimized with `wasm-opt`, which is part of [`binaryen`](https://github.com/WebAssembly/binaryen).

You can either download a [release of binaryen](https://github.com/WebAssembly/binaryen/releases) and make the bin folder available in your PATH or check if your operating system tooling offers a more convenient way of installing the binaries like APT, Homebrew, etc.

Some examples:

- Linux via APT: `sudo apt-get update && sudo apt-get -y install binaryen` (taken from [here](https://installati.one/install-binaryen-ubuntu-22-04/))
- MacOS via Homebrew: `brew install binaryen` (see [Homebrew entry](https://formulae.brew.sh/formula/binaryen))

### 2. Install Dependencies

After installing `wasm-bindgen-cli`, you can install the necessary dependencies using the following command:
After installing local tooling, you can install the necessary dependencies using the following command:

```bash
npm install
Expand Down
Loading
Loading