Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/fix-gemini-wallet-icon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rainbow-me/rainbowkit": patch
---

Fix Gemini wallet connector to use `icon` instead of `icons` in `appMetadata`
5 changes: 5 additions & 0 deletions .changeset/fix-mobile-wallet-visibility.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rainbow-me/rainbowkit": patch
---

Fix mobile visibility for Coin98, CLV, SafePal, Frontier, and BeraSig wallets.
5 changes: 5 additions & 0 deletions .changeset/rename-argent-to-ready.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rainbow-me/rainbowkit': patch
---

Rename the Argent wallet connector to `readyWallet`
5 changes: 5 additions & 0 deletions .changeset/update-metamask-flags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rainbow-me/rainbowkit": patch
---

Add additional wallet flags to `isMetaMask()` to detect impersonating providers.
20 changes: 20 additions & 0 deletions .changeset/upgrade-wagmi-viem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
"@rainbow-me/create-rainbowkit": patch
"example": patch
"site": patch
"with-create-react-app": patch
"with-next": patch
"with-next-app": patch
"with-next-app-i18n": patch
"with-next-custom-button": patch
"with-next-mint-nft": patch
"with-next-rainbow-button": patch
"with-next-siwe-iron-session": patch
"with-next-siwe-next-auth": patch
"with-next-wallet-button": patch
"with-react-router": patch
"with-remix": patch
"with-vite": patch
---

Upgrade wagmi to ^2.19.3 and viem to 2.38.0.
5 changes: 5 additions & 0 deletions .changeset/xdefi-to-ctrl-rebrand.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rainbow-me/rainbowkit": patch
---

Add `ctrlWallet` wallet connector to replace `xdefiWallet`. XDEFI Wallet has been rebranded to CTRL Wallet.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Node.js & TypeScript",
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bookworm",
"postCreateCommand": "npm i -g pnpm@10.8.0 && pnpm install"
"postCreateCommand": "npm i -g pnpm@10.21.0 && pnpm install"
}
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ It's never a fun experience to have your pull request declined after investing a

## Prerequisites

This project uses [`pnpm`](https://pnpm.io) as a package manager. The required `pnpm` version to get started is `^10.8.0`.
This project uses [`pnpm`](https://pnpm.io) as a package manager. The required `pnpm` version to get started is `^10.21.0`.

## Development environment

Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ name: CI
on: [pull_request, push]

env:
pnpm: 10.8.0
RAINBOW_PROVIDER_API_KEY: ${{ secrets.RAINBOW_PROVIDER_API_KEY }}
WALLETCONNECT_PROJECT_ID: ${{ secrets.WALLETCONNECT_PROJECT_ID }}
pnpm: 10.21.0

jobs:
tests:
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/claude.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Claude Code

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]

jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
actions: read # Required for Claude to read CI results on PRs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}

# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
# prompt: 'Update the pull request description to include a summary of changes.'

# Optional: Add claude_args to customize behavior and configuration
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://docs.anthropic.com/en/docs/claude-code/sdk#command-line for available options
# claude_args: '--model claude-opus-4-1-20250805 --allowed-tools Bash(gh pr:*)'

8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

env:
pnpm: 10.8.0
pnpm: 10.21.0
HUSKY: 0 # Avoid pre-commit hook tests
RAINBOW_PROVIDER_API_KEY: RAINBOW_PROVIDER_API_KEY

Expand Down Expand Up @@ -49,9 +49,9 @@ jobs:
- name: Create Release Pull Request
uses: changesets/action@v1
with:
title: 'chore: version packages'
commit: 'chore: version packages'
title: "chore: version packages"
commit: "chore: version packages"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RAINBOW_PROVIDER_API_KEY: ${{ secrets.RAINBOW_PROVIDER_API_KEY }}
WALLETCONNECT_PROJECT_ID: ${{ secrets.WALLETCONNECT_PROJECT_ID }}
WALLETCONNECT_PROJECT_ID: ${{ secrets.WALLETCONNECT_PROJECT_ID }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,4 @@ dist

# Others
.DS_Store

node-compile-cache/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
183 changes: 163 additions & 20 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,163 @@
# Contributor Guide

## Dev Environment Tips
- Run `pnpm install` from the repository root to install all dependencies and generate type definitions.
- Before committing, execute `pnpm format:fix` to automatically correct formatting issues.

## Testing Instructions
- Check the CI configuration under `.github/workflows` to understand the automated plan.
- Use `pnpm test` at the monorepo root to run the full test suite. Your commit must pass these tests before merging.
- To focus on a specific test, run `pnpm test:unit run -t "<test name>"`.
- Keep fixing test or type errors until everything passes.
- After moving files or adjusting imports, run `pnpm lint` to ensure ESLint and TypeScript still succeed.
- Whenever you change code, add or update tests even if not explicitly requested.

## PR Instructions
- Follow the commit style defined in `commitlint.config.js`. Prefix commits and PR titles with a type such as `fix`, `feat`, or `chore`, for example: `fix: resolve login bug`.
- Always run `pnpm changeset` to create a changeset for every affected package. Patch versions are typically preferred unless the change warrants a minor or major bump.
- Never modify any CHANGELOG.md files. These are managed automatically.
- Patch bump `@rainbow-me/create-rainbowkit` whenever template dependencies change.
- Only modify `en-US.json` locale files; never adjust other locale JSON files.
# AGENTS.md

This file provides guidance to Codex (openai.com/codex) when working with code in this repository.

## Monorepo Structure

RainbowKit is a pnpm monorepo containing multiple packages:

- **`packages/rainbowkit`** - Core library: React components and hooks for wallet connection UI
- **`packages/rainbow-button`** - Standalone rainbow button component
- **`packages/rainbowkit-siwe-next-auth`** - Sign-In with Ethereum integration with NextAuth.js
- **`packages/create-rainbowkit`** - CLI tool for scaffolding new RainbowKit projects
- **`packages/example`** - Development example app (runs on localhost:3000)
- **`site`** - Documentation site (runs on localhost:3001)
- **`examples/`** - Additional example integrations (Next.js, Vite, Remix, etc.)

## Development Commands

### Setup
```bash
pnpm install # Install dependencies and generate type definitions from root
```

### Development
```bash
pnpm dev # Run example app + site (localhost:3000 and :3001)
pnpm dev:lib # Watch and rebuild library packages only
pnpm dev:example # Run lib + example app only
pnpm dev:site # Run lib + docs site only
pnpm dev:cli # Watch mode for create-rainbowkit CLI
pnpm dev:template:next-app # Run Next.js app template directly
```

### Building
```bash
pnpm build # Build all packages (excludes template apps)
```

### Testing
```bash
pnpm test # Run all unit tests (uses Vitest)
pnpm test:unit run -t "<name>" # Run specific test by name
pnpm test:update # Update test snapshots
pnpm test:watch # Watch mode for tests
pnpm test:cli # Test CLI scaffolding (builds template)
pnpm test:cli:dev # Scaffold template + start dev server
pnpm test:cli:clean # Remove generated test app
```

### Linting & Formatting
```bash
pnpm lint # Check formatting + typecheck all packages
pnpm lint:fix # Auto-fix formatting issues
pnpm format:check # Check Biome formatting only
pnpm format:fix # Auto-fix Biome formatting (run before commits)
```

## Architecture

### Core Library (`packages/rainbowkit`)

Built with:
- **Styling**: Vanilla Extract for type-safe CSS-in-JS with CSS modules
- **Build**: Custom esbuild setup (`build.js`) with watch mode
- **Bundling**: ESM format with code splitting for tree shaking

Key directories:
- `src/components/` - UI components (ConnectButton, modals, etc.)
- `src/wallets/` - Wallet connector definitions and registry
- `src/themes/` - Theme system (light, dark, midnight)
- `src/locales/` - Internationalization files
- `src/hooks/` - React hooks for wallet interactions
- `src/css/` - Vanilla Extract styles

Build process:
1. TypeScript type generation runs first (`typegen`)
2. esbuild compiles main entry + wallets separately
3. Vanilla Extract processes CSS with autoprefixer and selector prefixing (`[data-rk]`)
4. SVGs are inlined as data URLs, PNGs as base64

Environment variables required (`.env.local`):
- `RAINBOW_PROVIDER_API_KEY` - For enhanced provider features
- `WALLETCONNECT_PROJECT_ID` - For WalletConnect integration

### Testing

- Framework: Vitest with jsdom environment
- Setup: `packages/rainbowkit/test/setup.ts`
- Config: Root `vitest.config.ts` with Vanilla Extract plugin
- Tests located alongside source files (`.test.ts` / `.test.tsx`)

## Commit & Release Workflow

### Commit Format
Follow conventional commits as defined in `commitlint.config.js`:
- Types: `fix`, `feat`, `test`, `tooling`, `refactor`, `revert`, `example`, `docs`, `format`, `chore`
- Example: `fix: resolve wallet disconnect issue`

### Changesets
Always create a changeset for user-facing changes:
```bash
pnpm changeset # Creates markdown file in .changeset/
```
- Prefer patch versions unless change warrants minor/major
- Never edit CHANGELOG.md files directly (auto-generated)
- Update existing changesets in same area rather than creating duplicates
- Patch bump `@rainbow-me/create-rainbowkit` when template dependencies change

### Git Workflow Tools
Use the following tools for git operations:
- **Graphite (`gt`)** - Preferred tool for all git interactions:
- **Creating commits**: `gt create -m "commit message"`
- **Modifying existing commits**: `gt modify`
- **Prefer this over adding new commits unless explicitly asked**
- **Need to stage changes with git add or use --all to stage all changes**
- **Always resubmit after running gt modify** using `gt submit --stack`
- **Creating branches**: `gt branch create <branch-name>`
- **Tracking branches**: `gt track` - Always track branches if they aren't already tracked
- **Moving branches in stack**: `gt move --onto <target-branch>` - Use when repositioning commits/branches
- **Submitting/updating pull requests**: `gt submit --stack`
- **Checking out PRs**: `gt checkout <pr-number>`
- **Resubmitting after changes**: Always run `gt submit --stack` after making changes or commits
- **Always ask before committing changes or manipulating/resubmitting branches or opening PRs**
- **Always use gt modify by default when asked to make a commit**
- **GitHub CLI (`gh`)** - For viewing CI/CD status:
- Use `gh run list` to view workflow runs
- Use `gh run view` to investigate specific CI failures

### Locale Files
Only modify `en-US.json` locale files. Other language files are managed separately.

## CI Pipeline

See `.github/workflows/ci.yml` for full test plan:
1. Install dependencies
2. Build all packages
3. Run linting and formatting checks
4. Run unit tests (`pnpm test`)
5. Run CLI tests (`pnpm test:cli`)

All checks must pass before merging.

## Working with create-rainbowkit CLI

Template location: `packages/create-rainbowkit/templates/next-app/`

After template changes:
```bash
pnpm test:cli:dev # Scaffold and test template (updates lockfile)
```
Commit the generated lockfile to keep monorepo in sync.

Link CLI globally for testing:
```bash
pnpm link:cli # Makes `create-rainbowkit` available system-wide
```

## Additional Notes

- Uses Biome for formatting/linting (replaces ESLint + Prettier)
- React 19 and Next.js 15 compatible
- Built on wagmi v2 and viem 2.x
- Node.js >= 20 required
Loading
Loading