This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
BlueWallet is a Bitcoin and Lightning wallet built with React Native. It's a cross-platform mobile application supporting iOS, Android, and macOS.
# Install dependencies
npm install
# iOS setup (required after npm install)
npx pod-install
# Start Metro bundler
npm start
# Run on platforms
npx react-native run-ios
npx react-native run-android
# Testing
npm run test # Run all tests
npm run unit # Unit tests only
npm run jest # Integration tests
npm run lint # ESLint
npm run tslint # TypeScript checking
# Run a single test file
npm run jest -- tests/unit/hd-segwit-bech32-wallet.test.js
# E2E Testing
npm run e2e:debug # Android debug build
npm run e2e:release # Android release build-
/class/- Core wallet logic and Bitcoin functionality. Key classes:wallets/- Wallet implementations (HDSegwitBech32Wallet, LegacyWallet, etc.)deeplinkSchemaMatch.ts- URL scheme handlingblue-electrum.ts- Electrum server connectivity
-
/screen/- Screen components organized by feature:wallets/- Wallet management screenssend/- Transaction creation screensreceive/- Address generation screenssettings/- App settings screens
-
/components/- Reusable UI components (migrating from BlueComponents.js to TypeScript) -
/blue_modules/- Core modules:BlueElectrum.ts- Electrum client wrapperencryption.ts- Storage encryptionanalytics.ts- Analytics wrapper
-
/navigation/- React Navigation stack definitions with lazy loading
- Uses React Context API with multiple providers:
StorageProvider- Wallet storage and managementSettingsProvider- App settings- Located in
/components/Context/
The app supports multiple wallet types, each with its own class in /class/wallets/:
- HD SegWit (BIP84) -
HDSegwitBech32Wallet - HD Legacy (BIP44) -
HDLegacyBreadwalletWallet - Lightning -
LightningCustodianWallet - Multisig -
MultisigHDWallet - Watch-only -
WatchOnlyWallet
bitcoinjs-libv7 - Core Bitcoin functionality- Custom Electrum client implementation
- PSBT support for advanced transactions
- Minimum iOS 15.1
- Uses CocoaPods (
npx pod-installafter npm install) - Includes Apple Watch app and widgets
- Xcode project at
/ios/BlueWallet.xcworkspace
- Gradle-based build at
/android/ - ProGuard rules for release builds
- Firebase integration
- Unit Tests (
/tests/unit/) - Test wallet classes and utilities - Integration Tests (
/tests/integration/) - Test wallet operations - E2E Tests (
/tests/e2e/) - Detox-based UI tests
# Run specific test file
npm run jest -- tests/unit/hd-segwit-bech32-wallet.test.js
# Run tests matching pattern
npm run jest -- --testNamePattern="HDSegwitBech32Wallet"
# Debug tests
npm run jest -- --detectOpenHandles tests/unit/currency.test.js- Project is migrating from JavaScript to TypeScript
- New files should be TypeScript
- Type definitions in
/typings/and*.d.tsfiles
- Use absolute imports:
import { BlueCard } from '../../BlueComponents'; - Lazy load screens:
const WalletsList = lazy(() => import('../screen/wallets/WalletsList'));
Use prefixes:
REL- Release-relatedFIX- Bug fixesADD- New featuresREF- RefactoringTST- TestsOPS- DevOps/buildDOC- Documentation
- Managed through
/blue_modules/BlueElectrum.ts - Automatic server selection and failover
- WebSocket and TCP support
- Fee estimation via Electrum
- UTXO selection algorithms
- RBF (Replace-By-Fee) support
- Batch transaction support
- Optional encryption for wallet storage
- Handled by
/blue_modules/encryption.ts - Biometric authentication integration
- Use Flipper for debugging
- React DevTools for component inspection
- Network inspection for Electrum calls
- iOS: Run
npx pod-installafter dependency changes - Android: Clean build with
cd android && ./gradlew clean - Metro cache:
npx react-native start --reset-cache