This file provides guidance to LLMs when working with code in this repository.
The Nado TypeScript SDK is a monorepo containing utilities for interacting with the Nado Protocol API and contracts. The project uses Lerna for workspace management and provides a comprehensive SDK for trading on Nado.
bun run build- Build all packages in the monorepo using Lernabun run clean- Clean all packagesbun run dev- Run development mode for all packagesbun run test:unit- Run Jest unit tests (packages only)bun run test:e2e- Build and run all E2E tests (node:test in apps/e2e)bun run lint- Run ESLint with auto-fix and Prettier formattingbun run typecheck- Run TypeScript type checking for all packagesbun run gen-typedoc- Generate TypeDoc documentation for all packages
- Unit tests (Jest):
bun run test:unit - E2E tests (node:test in apps/e2e) — each command runs
bun run buildfirst:bun run test:e2e- Run all E2E testsbun run test:e2e:client- Client E2E testsbun run test:e2e:engine- Engine-client E2E testsbun run test:e2e:indexer- Indexer-client E2E testsbun run test:e2e:nuanze- Nuanze-client E2E testsbun run test:e2e:trigger- Trigger-client E2E testsbun run test:e2e:mobile- Mobile-client E2E tests
- Without building first (if already built):
bun --cwd apps/e2e e2eande2e:client,e2e:engine,e2e:indexer,e2e:nuanze,e2e:trigger,e2e:mobile
bun run publish-all- Clean, build, and publish all packages via Lernabun run depcruise:all- Analyze package dependencies and detect circular dependencies
Each package in packages/ has these common scripts:
bun run build- Build the specific packagebun run clean- Clean build artifactsbun run dev- Watch mode for developmentbun run lint- Check linting rules onlybun run lint:fix- Fix linting issues automaticallybun run typecheck- Type check without emitting files
The project follows a monorepo pattern with these core packages:
@nadohq/client- Main entry point that composes all other packages into a unifiedNadoClient@nadohq/engine-client- Handles off-chain matching engine communication@nadohq/indexer-client- Provides indexer queries for historical data@nadohq/trigger-client- Manages trigger service for stop orders@nadohq/mobile-client- Client for the mobile service API (usernames, profiles, private mode, push notification devices & preferences)@nadohq/nuanze-client- Read-only client for the public Nuanze analytics API@nadohq/shared- Contract utilities, ABIs, and on-chain interactions. Also includes common utilities, such as bignumber.js for mathematical operations.
NadoClientis the main class that orchestrates all API interactions- Uses
viemfor Ethereum wallet/provider functionality - Supports both chain signers and linked signers for trading
- Modular API design with separate classes for Market, Spot, Perp, Subaccount, and WebSocket operations
- All packages use TypeScript with strict type checking
- Use bignumber.js for precise decimal calculations (the SDK exports
BigNumber/toBigNumber/BigNumberish) - EIP-712 signing for off-chain order execution
- Comprehensive type definitions for all API responses
- Consistent error handling with custom error classes
- Viem as the primary Ethereum library dependency
After making edits, ALWAYS run the following verification sequence:
- Type Check
- Run
bun run typecheckto verify all TypeScript types are correct across all packages
- Run
- Lint Check
- Run
bun run lintto run ESLint with auto-fix and Prettier formatting
- Run
- Build
- Run
bun run buildto build all packages before running any tests
- Run
- Tests
- Run
bun run test:unitfor Jest unit tests; runbun run test:e2efor E2E tests (builds first)
- Run
- All commands must pass before considering a task complete
- Fix errors immediately - If any command fails, address issues and re-run the full sequence
- Build before adding E2E tests - Always run
bun run buildbefore E2E testing to ensure packages are properly built - Add basic sanity E2E tests - Never skip writing E2E tests for new features, client APIs, or user flows
For detailed coding standards and conventions, see Style Guide.
- JSDoc documentation standards
- TypeScript conventions and type safety
- Client class patterns and architecture
- Error handling and custom exceptions
- Naming conventions and file structure
- Constants and configuration management
- Utility function patterns and validation