Skip to content
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
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ This repo is the home of BitGo's WASM libraries.

# Developer Setup

Enter the repository's Nix development shell to load the pinned toolchains:

```bash
nix develop
```

The shell provides Node.js 24.11.0 (matching `.nvmrc`), Rust nightly
2025-10-23 (matching CI), and the WASM build tools. Install the JavaScript
workspace dependencies from the repository root:

```bash
npm install
```
Expand All @@ -19,6 +29,26 @@ This will:
- Install all dependencies
- Set up pre-commit hooks via Husky

# wasm-ton Verification

The wasm-ton npm tests import generated WebAssembly bindings, so build them
before running the package tests:

```bash
npm run build:wasm --prefix packages/wasm-ton
npm test --prefix packages/wasm-ton
```

Run the Rust parser tests and TypeScript build with:

```bash
cargo test --manifest-path packages/wasm-ton/Cargo.toml parser_tests
npm run build:ts --prefix packages/wasm-ton
```

TypeScript and test tools are installed as npm workspace dependencies; no
global TypeScript compiler is required.

Pre-commit hooks automatically run on staged files:

- **JS/TS**: Prettier formatting + ESLint
Expand Down
65 changes: 65 additions & 0 deletions flake.lock

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

52 changes: 52 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
description = "Development environment for BitGoWASM";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-nodejs.url = "github:nixos/nixpkgs/1d4c88323ac36805d09657d13a5273aea1b34f0c";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = {
nixpkgs,
nixpkgs-nodejs,
rust-overlay,
...
}: let
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
forEachSystem = nixpkgs.lib.genAttrs systems;
in {
devShells = forEachSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [rust-overlay.overlays.default];
};
rustToolchain = pkgs.rust-bin.nightly."2025-10-23".default.override {
extensions = ["clippy" "rustfmt"];
targets = ["wasm32-unknown-unknown"];
};
in {
default = pkgs.mkShell {
packages = [
nixpkgs-nodejs.legacyPackages.${system}.nodejs_24
rustToolchain
pkgs.binaryen
pkgs.gnumake
pkgs.wasm-pack
];
Comment on lines +40 to +44

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Provide a WASM-capable compiler in the Darwin shells

On a clean aarch64-darwin system without Homebrew, this shell provides neither LLVM nor brew, so the package Makefiles fall back to Apple Clang, which they explicitly note lacks the wasm32-unknown-unknown target. Builds requiring C compilation, such as wasm-bip32 through secp256k1-sys, therefore fail despite Darwin being advertised as supported; include a WASM-capable Clang/LLVM toolchain and configure CC/AR from it.

Useful? React with 👍 / 👎.


shellHook = ''
export PATH="$(pwd)/node_modules/.bin:$PATH"
'';
};
});
};
}
Loading