Note: This guide is for developers who want to contribute to Wallet Gateway. It is worth reading the entire doc first before starting setup.
- Node.js 24+ (see
.nvmrcfor exact version) - pnpm (version specified in
package.json#packageManager) - Java (for Canton) - sdkman is recommended for version management
An unofficial, community-contributed nix shell is available as well to provide these system dependencies.
-
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.7/install.sh | bash # or curl -fsSL https://fnm.vercel.app/install | bash
-
Restart your terminal
-
Run
nvm installorfnm installto install the Node.js version from.nvmrc -
Install pnpm
curl -fsSL https://get.pnpm.io/install.sh | sh - -
Run
pnpm installto install dependencies -
Run
pnpm postinstallto set up auto sign-off hooks
In order for Husky to use the correct node version (as part of our pre-commit), you might need to add an init file for certain IDEs.
Create the file ~/.config/husky/init.sh with the following content:
# ~/.config/husky/init.sh
# for nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# or
# for fnm
eval "$(fnm env)"As a requirement under the Hyperledger Foundation, all commits must be signed off. This can be done by adding the -s flag every time you commit.
In this repo, we use Husky to automatically configure a git hook to do this for you.
It is also recommended (but not required) to add a GPG key: https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account
We use conventional commits to track version changes for packages and create informative changelogs. Our linter automatically checks that the commit scope matches an nx project name. Some common commit types are:
feat-- results in a minor version bump for the scoped package (feat(pkg): ...)fix-- results in a patch version bump for the scoped package (fix(pkg): ...)build,chore,ci,docs,perf,refactor,revert,style,test
Major version bumps are triggered by adding an exclamation after the scope (feat(pkg)!: breaking change) or by including a BREAKING CHANGE: ... trailer at the end of the commit message.
Build all packages:
pnpm build:allThis uses nx to build all workspaces in parallel. After the initial build, you can selectively build each package by navigating into the corresponding directory and running pnpm build.
Other useful commands:
pnpm clean:all # Clean all build artifacts and reset nx cache
pnpm check:all # Build, typecheck, lint and test all packages
pnpm test:all # Run tests across all packages
pnpm test-coverage:all # Run tests with coverage across all packages
pnpm full:rebuild # Clean, regenerate, and rebuild everything
pnpm full:up # Start localnet and all dev servers
pnpm full:down # Stop localnet and all dev serversTests use Vitest and are exposed as the test Nx target, inferred by
@nx/vitest from each package's vitest.config.ts (which builds on the shared
vitest.base.ts). Extra arguments are forwarded to Vitest:
pnpm nx test <project> # e.g. pnpm nx test @canton-network/core-ledger-client
pnpm nx test <project> -c coverage # with coverage report in <project>/coverage
pnpm nx test <project> -- src/foo.test.ts # filter test filesRun pnpm generate:<api> from the root to regenerate RPC clients/servers. For example:
pnpm generate:dapp # Regenerate dApp API client
pnpm generate:all # Regenerate all API specsTo support fast iteration loops, the Wallet Gateway, the mock OAuth server and the example dApps run as dev servers that restart or reload on change. Start them with:
pnpm start:allThis uses pm2 to run each dev server as a background process with its own log, next to the UI
components watcher and their Storybook. The dev servers import the workspace libraries from their
src/ (the @canton-network/source export condition), so library changes reach them without a
build. Only the libraries bundling generated Daml bindings (core-token-standard,
core-token-standard-v2, core-splice-codegen) are used from dist/; pnpm generate:all builds them. See the pm2
cheatsheet for more commands
(preface them with pnpm pm2 when invoking).
pnpm pm2 list # Show running processes
pnpm pm2 logs remote # View the Wallet Gateway logs
pnpm stop:all # Stop all servicesNote: Codegenned artifacts are not regenerated automatically. Use
pnpm generate:allif updating the API specs.
After running pnpm start:all, you'll have services exposed on the following ports:
| Service | URL |
|---|---|
| Example Ping dApp | localhost:8080 |
| Example Portfolio | localhost:8081 |
| HTTP Wallet Gateway | localhost:3030 |
To run a local Splice network (includes Canton + Splice services):
pnpm script:fetch:localnet # Download localnet artifacts
pnpm start:localnet # Start the local network
pnpm stop:localnet # Stop the local networkIf you need to run Canton without the full Splice network (localnet already includes Canton):
- Ensure you have Java installed - sdkman is recommended for version management
- Run
pnpm script:fetch:cantonto download Canton to.canton/ - Run
pnpm start:cantonto start a participant & synchronizer
pnpm start:canton # Start Canton (mainnet config)
pnpm start:canton:tls # Start Canton with TLS enabled
pnpm start:canton:console # Start Canton with interactive consoleMany scripts support a --network flag to target different environments:
pnpm script:fetch:canton --network=devnet # Fetch devnet Canton version
pnpm script:fetch:canton --network=mainnet # Fetch mainnet Canton version (default)The e2e tests run against production builds, as in CI, not the dev servers of pnpm start:all. Dev builds behave differently (e.g. Lit dev mode), so a test passing against them can still fail in CI.
pnpm start:canton --network=devnet # ping and the extension
pnpm start:localnet --network=devnet # portfolio and the wallet SDK examples
pnpm start:e2e example-ping # builds and starts the Wallet Gateway, mock OAuth and ping (all dApps without arguments)
pnpm nx playwright:e2e @canton-network/example-ping
pnpm stop:allRebuild and run pnpm pm2 restart all after changing code, the e2e services do not watch for changes.
If you've cloned this repository when it was set up to use yarn, finalize the switch to pnpm:
- Pull latest main into your fork / branch
- Stop all running services:
yarn pm2 kill(andyarn stop:localnet, if applicable) - Delete any residual
yarndirectories:rm -rf .pnp.cjs .pnp.loader.mjs .yarn - Run
pnpm install - Done! For 99% of cases, you can now use
pnpmas a direct replacement foryarn, i.e.:yarn build:all-->pnpm build:allyarn start:all-->pnpm start:allyarn pm2 list-->pnpm pm2 list- ... etc
pnpm start:all used to start a tsdown --watch process per library, as the dev servers imported
the libraries from dist/. If your pm2 daemon still runs those, remove them once (this also stops
Canton started with pnpm start:canton):
pnpm pm2 delete all
pnpm start:allIf you've cloned this repository when it was set up to use corepack, finalize the switch to native pnpm:
- Pull latest main into your fork / branch
- Delete any residual
pnpm over corepackreferences:corepack disable pnpm(see pnpm troubleshooting) - Ensure you have at least pnpm 11 installed globally
- Use
pnpm