How-to guide

Set up Trading development

Use this guide to get the Trading contracts, SDK, and UI compiled and running on your machine.

Build and run

  1. From the repository root, confirm dependencies with test -d node_modules. If they are missing, run bun install --frozen-lockfile && bun run setup; setup installs every project from its lockfile, compiles the contracts, and builds the UI apps and UI tests.
  2. Run bun run trading:compile. It compiles the contracts, builds the shared packages, and runs the Trading vendor build, which generates ui/trading/ts/generated/contractArtifact.ts. Never edit generated files.
  3. Run bun run trading:test, which runs the SDK, contract-facing, and UI Trading tests, and bun run trading:ui:build.
  4. Start bun run app:serve:trading, then open http://localhost:4163/?simulate=1&genesis=yes for the browser-local simulator. Configure the Trading UI lists the Trading scenarios. The setup works when the tests pass and the simulator page loads.

To run the standalone UI in Docker instead, complete the repository-root setup first, then from ui/trading:

docker network inspect zoltar >/dev/null 2>&1 \
  || docker network create zoltar
docker compose up --build --force-recreate

Then open http://localhost:4163/#/market. On Windows, ui/trading/start.bat runs the same Compose command. The final image runs as an unprivileged user and exposes a health check at /. The Docker image copies the core deployment addresses from docs/mainnet-deployment-addresses.json and docs/sepolia-deployment-addresses.json.

Test transactions against an external node

To exercise the contracts on a local Anvil node, follow Use local Anvil; for script and integration tests, Deploy for script and integration tests covers bun run trading:deploy:local.

Other commands

After a change that alters what the UI shows, run bun run docs:screenshots -- --app trading to recapture the documentation screenshots.