Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,9 @@ html-report-multichain/

# UI Integration tests
test/integration/config/assets

# Claude AI development files
CLAUDE.md
/CLAUDE.md
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Tracked File Contradicts Gitignore

The CLAUDE.md file is committed in this change but also added to .gitignore. This creates a contradiction: the file is tracked now, but Git will ignore future changes. This suggests CLAUDE.md is intended to be a tracked file, like documentation.

Fix in Cursor Fix in Web

temp/
/temp/
108 changes: 108 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Common Development Commands

### Building

- `yarn start` - Start development build with file watching (MV3, no LavaMoat)
- `yarn start:mv2` - Start development build for Firefox (MV2)
- `yarn start:flask` - Start development build with Flask features (experimental)
- `yarn dist` - Production build for Chromium browsers (MV3)
- `yarn dist:mv2` - Production build for Firefox (MV2)
- `yarn build:test` - Create test build for e2e testing

### Testing

- `yarn test` - Run linting and unit tests
- `yarn test:unit` - Run Jest unit tests only
- `yarn test:e2e:chrome` - Run e2e tests in Chrome
- `yarn test:e2e:firefox` - Run e2e tests in Firefox
- `yarn test:e2e:single <test-file>` - Run single e2e test

### Linting & Code Quality

- `yarn lint` - Run all linting (ESLint, TypeScript, Stylelint, Prettier)
- `yarn lint:fix` - Auto-fix linting issues where possible
- `yarn lint:tsc` - TypeScript compiler checks
- `yarn lint:eslint` - ESLint checks only

### Development Tools

- `yarn storybook` - Start Storybook for component development
- `yarn dapp` - Start test dapp server for testing MetaMask integration

Comment on lines +9 to +35
Copy link

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These command lists duplicate package.json scripts and are likely to drift. Consider adding a brief note that the package.json scripts are the source of truth and keep only high-level examples here, or link to package.json. Alternatively, add a 'yarn run' tip or a small 'yarn help' script to enumerate available commands.

Copilot uses AI. Check for mistakes.
## High-Level Architecture

### Core Structure

- **`app/`** - Browser extension core functionality
- `scripts/background.js` - Main background script (service worker in MV3)
- `scripts/contentscript.js` - Content script injected into web pages
- `scripts/inpage.js` - Provider API injected into page context
- `scripts/metamask-controller.js` - Main controller orchestrating all functionality
- `scripts/controllers/` - Individual controllers (preferences, transactions, etc.)

- **`ui/`** - React-based user interface
- `pages/` - Main UI screens (home, settings, confirmations, etc.)
- `components/` - Reusable React components
- `hooks/` - Custom React hooks
- `ducks/` - Redux state management (actions, reducers, selectors)
- `selectors/` - Redux state selectors

- **`shared/`** - Code shared between background and UI
- `constants/` - Application constants and enums
- `lib/` - Utility libraries and helpers
- `modules/` - Business logic modules
- `types/` - TypeScript type definitions
Comment on lines +40 to +58
Copy link

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These hard-coded file paths/extensions can easily become outdated. To reduce confusion, consider linking to actual files/folders in this repo (relative links) or omitting file extensions where not essential so the section stays accurate if files are migrated or renamed.

Suggested change
- **`app/`** - Browser extension core functionality
- `scripts/background.js` - Main background script (service worker in MV3)
- `scripts/contentscript.js` - Content script injected into web pages
- `scripts/inpage.js` - Provider API injected into page context
- `scripts/metamask-controller.js` - Main controller orchestrating all functionality
- `scripts/controllers/` - Individual controllers (preferences, transactions, etc.)
- **`ui/`** - React-based user interface
- `pages/` - Main UI screens (home, settings, confirmations, etc.)
- `components/` - Reusable React components
- `hooks/` - Custom React hooks
- `ducks/` - Redux state management (actions, reducers, selectors)
- `selectors/` - Redux state selectors
- **`shared/`** - Code shared between background and UI
- `constants/` - Application constants and enums
- `lib/` - Utility libraries and helpers
- `modules/` - Business logic modules
- `types/` - TypeScript type definitions
- **[`app/`](./app/)** - Browser extension core functionality
- [`scripts/background.js`](./app/scripts/background.js) - Main background script (service worker in MV3)
- [`scripts/contentscript.js`](./app/scripts/contentscript.js) - Content script injected into web pages
- [`scripts/inpage.js`](./app/scripts/inpage.js) - Provider API injected into page context
- [`scripts/metamask-controller.js`](./app/scripts/metamask-controller.js) - Main controller orchestrating all functionality
- [`scripts/controllers/`](./app/scripts/controllers/) - Individual controllers (preferences, transactions, etc.)
- **[`ui/`](./ui/)** - React-based user interface
- [`pages/`](./ui/pages/) - Main UI screens (home, settings, confirmations, etc.)
- [`components/`](./ui/components/) - Reusable React components
- [`hooks/`](./ui/hooks/) - Custom React hooks
- [`ducks/`](./ui/ducks/) - Redux state management (actions, reducers, selectors)
- [`selectors/`](./ui/selectors/) - Redux state selectors
- **[`shared/`](./shared/)** - Code shared between background and UI
- [`constants/`](./shared/constants/) - Application constants and enums
- [`lib/`](./shared/lib/) - Utility libraries and helpers
- [`modules/`](./shared/modules/) - Business logic modules
- [`types/`](./shared/types/) - TypeScript type definitions

Copilot uses AI. Check for mistakes.

### Build System

- Uses Gulp + Browserify build system (not Webpack by default)
- Support for multiple build types: main, beta, flask (experimental features)
- LavaMoat security for production builds (disabled in development for speed)
- Supports both Manifest V2 (Firefox) and V3 (Chromium) extension formats

### Key Controllers

- **MetaMaskController** - Main orchestrator controller
- **PreferencesController** - User preferences and settings
- **TransactionController** - Transaction lifecycle and history
- **NetworkController** - Network/chain management
- **AssetsController** - Token and NFT management
- **PermissionController** - dApp permissions and connections
- **SnapController** - MetaMask Snaps (plugins) management

### Testing Strategy

- **Unit tests**: Jest for individual component/function testing
- **Integration tests**: Testing controller interactions
- **E2E tests**: Selenium WebDriver tests simulating user workflows
- **Storybook**: Component documentation and visual testing

### Configuration

- **`.metamaskrc`** - Local development configuration (copy from `.metamaskrc.dist`)
- **`builds.yml`** - Build configuration for different build types and features
- **Environment variables** required: `INFURA_PROJECT_ID` for blockchain RPC access

### Extension Architecture Flow

1. **Inpage Script** - Provides `window.ethereum` API to web pages
2. **Content Script** - Bridges communication between page and extension
3. **Background Script** - Handles blockchain interactions, state management
4. **UI Scripts** - React interface for user interactions (popup, full screen)

### MetaMask Snaps Integration

- Supports extending MetaMask functionality via Snaps (plugins)
- Snaps run in isolated execution environments
- Account management snaps, signing snaps, and notification snaps supported

### Multi-chain Support

- Built-in support for Ethereum and EVM-compatible networks
- Bitcoin wallet snap integration
- Solana wallet snap integration
- Account abstraction and delegation features
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Contradictory File Tracking and Redundant .gitignore Entries

The commit adds CLAUDE.md to the repository but also adds it to .gitignore. This creates a contradiction where the file is tracked now, but future changes won't be, which goes against the PR's stated intent to prevent accidental commits of these files. Additionally, the .gitignore entries for CLAUDE.md and temp/ are redundant.

Additional Locations (1)

Fix in Cursor Fix in Web

Comment on lines +105 to +108
Copy link

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section implies Bitcoin and Solana support as general integrations and that account abstraction is a core feature. To avoid misleading readers, clarify that non-EVM chains and AA are available via optional Snaps or specific features, not built-in by default. Suggested wording:

  • Built-in support for Ethereum and other EVM-compatible networks
  • Optional Bitcoin support via Snaps (not enabled by default)
  • Optional Solana support via Snaps (not enabled by default)
  • Account abstraction and delegation may be available via specific snaps/features; see project docs for current scope.
Suggested change
- Built-in support for Ethereum and EVM-compatible networks
- Bitcoin wallet snap integration
- Solana wallet snap integration
- Account abstraction and delegation features
- Built-in support for Ethereum and other EVM-compatible networks
- Optional Bitcoin support via Snaps (not enabled by default)
- Optional Solana support via Snaps (not enabled by default)
- Account abstraction and delegation may be available via specific snaps/features; see project docs for current scope.

Copilot uses AI. Check for mistakes.
Loading