This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
yarn install# Watch mode for development (compiles all TypeScript packages and watches for changes)
yarn dev
# Single build of all packages
yarn# Lint all packages
yarn lint
# Lint only changed files
yarn lint-changed
# Fix linting issues
yarn lint-fix
# Commit lint
yarn check-commits# Run all unit tests
yarn unit-test
# Run unit tests for a specific module
yarn run unit-test --scope bitgo
# Run unit tests for files containing specific string
yarn run unit-test -- -- --grep "keyword"
# Run unit tests only for changed modules since master
yarn unit-test-changed
# Run integration tests
yarn integration-test
# Generate test coverage
yarn coverage# Run browser tests
yarn browser-tests
# Build for production
yarn compile
# Build for development
yarn compile-dbgFor modules that need browser support (especially those using @bitgo/wasm-utxo), see docs/esm.md for the dual ESM/CJS build pattern.
BitGoJS uses conventional commits. All commits MUST pass the spec described in commitlint.config.js.
- Avoid
anytype: Use specific types, interfaces, or union types instead ofany. If absolutely necessary, preferunknownand use type guards for safety.
BitGoJS is a monorepo composed of multiple modules, each implementing specific functionality:
bitgo: Main module providing authentication, wallet management, cryptographic primitives, and coin interfaces@bitgo/sdk-core: Core SDK functionality, base classes, and interfaces@bitgo/sdk-api: API client utilities@bitgo/statics: Static configuration values used across the platform
@bitgo/sdk-coin-*: Individual cryptocurrency implementations (e.g., btc, eth, sol, etc.)@bitgo/abstract-eth,@bitgo/abstract-utxo, etc.: Abstract base classes for similar coin families
@bitgo/account-lib: Build and sign transactions for account-based coins@bitgo/utxo-lib: Build and sign transactions for UTXO-based coins
@bitgo/blockapis: Access public block explorer APIs for various coins@bitgo/express: Local BitGo transaction signing server and proxy@bitgo/unspents: Utilities for UTXO chains
The BitGoJS SDK follows a modular architecture:
-
Coin Factory Pattern: The
CoinFactoryallows dynamic registration and instantiation of different cryptocurrency implementations -
Multi-signature Wallets: Core functionality revolves around creating and managing multi-signature wallets across various blockchains
-
Transaction Building: Each coin type has builders for constructing, signing, and broadcasting transactions
-
Abstraction Layers: Common functionality shared across similar blockchains is abstracted into base classes (e.g.,
abstractEthLikeCoin,abstractUtxoCoin) -
TSS (Threshold Signature Scheme): Support for advanced cryptographic operations, including MPC (Multi-Party Computation) for secure key management
-
Module Independence: Each cryptocurrency module can be used independently, allowing users to include only the functionality they need
To implement a new coin:
yarn sdk-coin:newThis will generate the necessary boilerplate for a new coin implementation.
BitGoJS supports Node.js versions >=20 and <25, with NPM >=3.10.10.