This repository contains WASM and Node.js native bindings for various state channel utilities such as hashing states, signing states ad recovering signer addresses from signed states.
The repository contains one wasm-utils
directory at the root. This
generates a NPM package for the WASM utilities, which is written to
packages/wasm-utils
. This needs to be run before anything else.
After this, the package can be treated as a regular Lerna/Yarn monorepo.
The primary package in this repository is @statechannels/native-utils
in
packages/native-utils
. This package depends on Neon and
@statechannels/wasm-utils
. When it is installed, it will try to find
cargo
(the Rust package manager). If Rust is available, it will build
native Node.js bindings for the state channel utilities. If Rust is not
available, it will fall back to using the WASM package behind the scenes.
# This ensures that packages/wasm-utils/ is generated from wasm-utils/
yarn bootstrap
This will publish @statechannels/wasm-utils
and @statechannels/native-utils
.
yarn publish
This tests the native and WASM bindings.
yarn test
This compares the pre-existing utilities in Nitro Protocol / Server Wallet, the native bindings (if Rust is available) and the WASM bindings.
Copyright © 2020 State Channels contributors.
Licensed under the MIT License.