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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
197 changes: 197 additions & 0 deletions .beads/pr-context.jsonl

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions .claude/commands/test-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ You have access to:
- **Browser MCP** (`mcp__browsermcp__*`): For UI interaction and validation
- **GitHub MCP**: For reading/writing test scenarios to the repository
- **File System**: For reading code and creating test documentation
- **Bash**: For running yarn commands, checking build status, etc.
- **Bash**: For running pnpm commands, checking build status, etc.

## Test Scenario Bank Location

Expand All @@ -198,7 +198,7 @@ When asked to run tests:
1. **Parse Full Scope**: Identify ALL sub-tasks in the user's request
2. **Load Test Scenarios**: Read from `.claude/test-scenarios/` or specify which scenario
3. **Plan Execution**: Use TodoWrite to track all tasks (mark in_progress/completed as you go)
4. **Start Dev Server**: Ensure `yarn dev` is running (check first, don't restart unnecessarily)
4. **Start Dev Server**: Ensure `pnpm run dev` is running (check first, don't restart unnecessarily)
5. **Execute ALL Tests**: Complete every requested test without stopping for permission
6. **Validate Results**: Check for expected outcomes (UI elements, state, console errors)
7. **Document Continuously**: Update test report/documentation as you execute
Expand Down Expand Up @@ -361,11 +361,11 @@ When completing test execution, provide:

## Commands You Should Know

- `yarn dev` - Start development server
- `yarn build` - Production build
- `yarn type-check` - TypeScript validation
- `yarn lint` - Lint check
- `yarn test` - Run unit tests (if they exist)
- `pnpm run dev` - Start development server
- `pnpm run build` - Production build
- `pnpm run type-check` - TypeScript validation
- `pnpm run lint` - Lint check
- `pnpm run test` - Run unit tests (if they exist)

## Continuous Improvement

Expand Down
8 changes: 4 additions & 4 deletions .claude/contracts/second-class-evm-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ All integration points required when adding a new second-class EVM chain to Shap
- Native asset included
- Registered in `scripts/generateAssetData/generateAssetData.ts`
- **Shared coingecko script** - `scripts/generateAssetData/coingecko.ts` must import and use the new chain's `chainId` constant
- **Per-chain generation**: after wiring, run `source ~/.zshrc && ZERION_API_KEY=$ZERION_API_KEY yarn generate:chain <chainId>` (e.g., `eip155:59144`) to regenerate only this chain's assets (~30s vs 30min for full `generate:all`). Also accepts directory name (e.g., `linea`).
- **Per-chain generation**: after wiring, run `source ~/.zshrc && ZERION_API_KEY=$ZERION_API_KEY pnpm run generate:chain <chainId>` (e.g., `eip155:59144`) to regenerate only this chain's assets (~30s vs 30min for full `generate:all`). Also accepts directory name (e.g., `linea`).

15. **Coingecko Integration** - `packages/caip/src/adapters/coingecko/`
- Enum value in `CoingeckoAssetPlatform`
Expand Down Expand Up @@ -197,15 +197,15 @@ Some chains have an ERC20 contract that represents the native token (e.g., Mantl
44. **Blacklist native ERC20 wrapper** - `scripts/generateAssetData/blacklist.json`
- If the chain has a special ERC20 contract representing the native token, add it to the blacklist
- Known patterns: Mantle `eip155:5000/erc20:0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000`, Polygon `eip155:137/erc20:0x0000000000000000000000000000000000001010`
- To detect: after `yarn generate:chain`, check if there are two entries with the same symbol as the native asset (one `slip44:60`, one `erc20:0x...`)
- After adding to blacklist, re-run `yarn generate:chain` to apply
- To detect: after `pnpm run generate:chain`, check if there are two entries with the same symbol as the native asset (one `slip44:60`, one `erc20:0x...`)
- After adding to blacklist, re-run `pnpm run generate:chain` to apply

## Phase 4: Consistency Checks

35. **Trailing slashes** on RPC URLs - all `*_NODE_URL` entries should be consistent (no trailing slash)
36. **Chain ID correctness** - verify against the chain's official docs
37. **Explorer URLs** - verify they're the official block explorer
38. **Asset icon URLs** - verify they resolve (HTTP 200, not 403/404). Prefer `assets.relay.link/icons/<chainId>/light.png` for networkIcon over CoinGecko URLs which often return 403. **After changing `networkIcon` in `baseAssets.ts`, you MUST re-run `yarn generate:chain` for that chain** - the generated JSON caches the old URL and won't pick up the fix until regenerated.
38. **Asset icon URLs** - verify they resolve (HTTP 200, not 403/404). Prefer `assets.relay.link/icons/<chainId>/light.png` for networkIcon over CoinGecko URLs which often return 403. **After changing `networkIcon` in `baseAssets.ts`, you MUST re-run `pnpm run generate:chain` for that chain** - the generated JSON caches the old URL and won't pick up the fix until regenerated.
39. **Generated data** - verify asset-manifest.json, generatedAssetData.json, relatedAssetIndex.json are regenerated

40. **Related Asset Index** - `public/generated/relatedAssetIndex.json` + `scripts/generateAssetData/generateRelatedAssetIndex/generateRelatedAssetIndex.ts`
Expand Down
6 changes: 3 additions & 3 deletions .claude/contracts/swapper-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ Every new swapper must be registered in all of the following locations:
## Testing Checklist

### Automated Checks (MUST pass)
- [ ] `yarn type-check` - All type checks pass
- [ ] `yarn lint` - All lint checks pass
- [ ] `yarn build:swapper` - Swapper package builds
- [ ] `pnpm run type-check` - All type checks pass
- [ ] `pnpm run lint` - All lint checks pass
- [ ] `pnpm run build:swapper` - Swapper package builds
- [ ] No `any` types used
- [ ] All errors handled monadically (`Result<T, SwapErrorRight>`)

Expand Down
42 changes: 21 additions & 21 deletions .claude/skills/chain-integration/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ For EVM-compatible chains (like Monad, HyperEVM, Base), you need **MINIMAL chang
- ✅ Wallet support flags (`_supportsChainName: boolean`)
- ✅ Support function (`supportsChainName()`)
- ✅ Set flags on all wallet implementations (~14 files)
- ✅ Build and verify with `yarn hdwallet:build`
- ✅ Build and verify with `pnpm run hdwallet:build`

**Why?** Each wallet type (Native, Ledger, MetaMask, etc.) needs to explicitly declare support for the chain, even though the crypto is identical. This enables wallet-specific gating in the UI.

Expand Down Expand Up @@ -564,10 +564,10 @@ export function supports[Chain](wallet: HDWallet): wallet is [Chain]Wallet {

```bash
# Build hdwallet packages to verify
yarn hdwallet:build
pnpm run hdwallet:build

# Run hdwallet tests
yarn hdwallet:test
pnpm run hdwallet:test
```

No version bumps or publishing needed — hdwallet packages are workspace packages (`workspace:^`).
Expand Down Expand Up @@ -1403,13 +1403,13 @@ case [chainLower]ChainId:
2. **Update viem if needed**: For new/recent chains, update viem to latest version first:
```bash
# Check current version
yarn why viem
pnpm why viem

# Update to latest pinned version
yarn up viem@latest
pnpm update viem@latest

# Rebuild packages
yarn build:packages
pnpm run build:packages
```

3. **Only define manually if unavailable**: If the chain doesn't exist in viem, use `defineChain()` pattern (see viem docs)
Expand Down Expand Up @@ -1488,17 +1488,17 @@ Claude running it is hands-off but you won't see detailed progress, and it may a

```bash
# Step 1: Generate CoinGecko CAIP adapters (JSON mappings from our code)
yarn generate:caip-adapters
pnpm run generate:caip-adapters
# ✓ Generates packages/caip/src/adapters/coingecko/generated/eip155_999/adapter.json
# ✓ Takes ~10 seconds

# Step 2: Generate color map (picks up new assets)
yarn generate:color-map
pnpm run generate:color-map
# ✓ Updates scripts/generateAssetData/color-map.json
# ✓ Takes ~5 seconds

# Step 3: Generate asset data (fetches tokens from CoinGecko)
ZERION_API_KEY=<user-provided-key> yarn generate:asset-data
ZERION_API_KEY=<user-provided-key> pnpm run generate:asset-data
# ✓ Fetches all HyperEVM ERC20 tokens from CoinGecko platform 'hyperevm'
# ✓ Updates src/assets/generated/
# ✓ Takes 2-5 minutes - YOU SHOULD SEE:
Expand All @@ -1509,12 +1509,12 @@ ZERION_API_KEY=<user-provided-key> yarn generate:asset-data
# - "Asset data generated successfully"

# Step 4: Generate tradable asset map (for swapper support)
yarn generate:tradable-asset-map
pnpm run generate:tradable-asset-map
# ✓ Generates src/lib/swapper/constants.ts mappings
# ✓ Takes ~10 seconds

# Step 5: Generate Thor longtail tokens (Thor-specific, optional for most chains)
yarn generate:thor-longtail-tokens
pnpm run generate:thor-longtail-tokens
# ✓ Updates Thor longtail token list
# ✓ Takes ~5 seconds
```
Expand Down Expand Up @@ -1745,7 +1745,7 @@ export const availableLedgerAppAssetIds = [

**CRITICAL**: After adding a new chain, TWO test files in `packages/caip/src/adapters/coingecko/` will almost always fail. Fix them BEFORE running the full test suite.

**IMPORTANT**: Always run `yarn build:packages` FIRST so TypeScript can resolve workspace package exports. Without this, type-check shows false errors like `'"@shapeshiftoss/caip"' has no exported member named '[chainLower]ChainId'`.
**IMPORTANT**: Always run `pnpm run build:packages` FIRST so TypeScript can resolve workspace package exports. Without this, type-check shows false errors like `'"@shapeshiftoss/caip"' has no exported member named '[chainLower]ChainId'`.

#### Test File 1: `packages/caip/src/adapters/coingecko/utils.test.ts`

Expand Down Expand Up @@ -1807,16 +1807,16 @@ error TS18048: 'targetNetwork' is possibly 'undefined'.

```bash
# 1. Build packages first (REQUIRED before type-check)
yarn build:packages
pnpm run build:packages

# 2. Run CAIP tests specifically
yarn vitest run packages/caip/ --reporter=verbose
pnpm exec vitest run packages/caip/ --reporter=verbose

# 3. Type-check
yarn type-check
pnpm run type-check

# 4. Lint
yarn lint --fix
pnpm run lint --fix
```

**Common patterns by chain native token**:
Expand All @@ -1828,21 +1828,21 @@ yarn lint --fix
### Step 7.1: Type Check

```bash
yarn type-check
pnpm run type-check

# Fix any TypeScript errors
```

### Step 7.2: Lint

```bash
yarn lint --fix
pnpm run lint --fix
```

### Step 7.3: Build

```bash
yarn build
pnpm run build

# Verify no build errors
# Check bundle size didn't explode
Expand Down Expand Up @@ -1996,7 +1996,7 @@ case [chainLower]ChainId:

### Gotcha 12: Missing CoinGecko Script Case

**Problem**: `yarn generate:asset-data` fails with "no coingecko token support for chainId"
**Problem**: `pnpm run generate:asset-data` fails with "no coingecko token support for chainId"
**Solution**: Add your chain case to `scripts/generateAssetData/coingecko.ts`
**Files to update**:
- Import `[chainLower]ChainId` from caip
Expand All @@ -2008,7 +2008,7 @@ case [chainLower]ChainId:

**Problem**: Asset generation fails with "Missing Zerion API key"
**Solution**: Get key from user via `AskUserQuestion`, pass as env var
**Command**: `ZERION_API_KEY=<key> yarn generate:all`
**Command**: `ZERION_API_KEY=<key> pnpm run generate:all`
**CRITICAL**: NEVER commit the Zerion API key to VCS!
**Example**: Always pass key via command line only

Expand Down
11 changes: 11 additions & 0 deletions .claude/skills/qabot/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,17 @@ The native wallet requires a password on each session start. The wallet-health f
- **THORChain swap timing**: SOL->RUNE completes in ~10s, RUNE->SOL can take ~90s. Always poll with 120s timeout.
- **Feedback dialog after swap**: A "How was your trade experience?" dialog appears after swaps complete. Dismiss with "Maybe Later" button.

#### Bug Investigation (CRITICAL)

When you encounter what looks like a bug, **don't just report it — investigate it**:

1. **Verify identity**: Is this the exact same yield ID, same account ID, same chain? Check the URL params (`yieldId`, `accountId`). A "discrepancy" between two different yields isn't a bug.
2. **Check network requests**: Open the browser's Network tab (or use JS eval to intercept fetch responses) to see what the API actually returned vs what the UI shows. Include the raw API response in your agentThought.
3. **Read the codebase**: You have access to `~/Sites/shapeshiftWeb`. `grep` for the relevant component, selector, or API call. Understand WHERE the bug likely originates (frontend rendering? stale cache? API response?).
4. **Cross-reference surfaces**: Check the same data across multiple views (yield detail page, My Positions list, DeFi drawer, wallet drawer). Note exactly which surfaces show correct vs incorrect data.
5. **Navigate freely**: You can explore the entire app to verify bugs — click around, check different pages, use filters. Just don't execute transactions outside fixture constraints.
6. **Write it up with confidence**: In agentThought, explain: what you expected, what you saw, what the API returned, what the code does, and your conclusion on where the bug is. Don't just say "possible bug" — say "confirmed bug in X component because Y".

#### Shell & Environment

- **zsh gotchas**: `$VAR` as command doesn't work in zsh. `!` negation in inline scripts causes "command not found: !". Use `grep -v` or numeric comparison instead. macOS `date` doesn't support `%3N` for milliseconds - use `python3 -c 'import time; print(int(time.time()*1000))'`. `status` is a read-only variable in zsh - use `result_status` instead.
Expand Down
12 changes: 6 additions & 6 deletions .claude/skills/swapper-integration/NEAR_INTENTS_RESEARCH.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ Authorization: Bearer YOUR_JWT_TOKEN

**Installation**:
```bash
yarn add @defuse-protocol/one-click-sdk-typescript
pnpm add @defuse-protocol/one-click-sdk-typescript
```

**Basic Usage**:
Expand Down Expand Up @@ -680,7 +680,7 @@ export const getTreasuryAddress = (chainId: ChainId): string => {
#### 1.2 Install TypeScript SDK
```bash
cd /Users/alexandre.gomes/Sites/shapeshiftWebClone
yarn add @defuse-protocol/one-click-sdk-typescript
pnpm add @defuse-protocol/one-click-sdk-typescript
```

#### 1.3 Verify Chain Support
Expand Down Expand Up @@ -1050,16 +1050,16 @@ export const getEnabledSwappers = (
#### 5.4 Build Validation
```bash
# Type checking
yarn type-check
pnpm run type-check

# Linting
yarn lint
pnpm run lint

# Build swapper package
yarn build:packages
pnpm run build:packages

# Build full app
yarn build:web
pnpm run build:web
```

---
Expand Down
16 changes: 8 additions & 8 deletions .claude/skills/swapper-integration/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: swapper-integration
description: Integrate new DEX aggregators, swappers, or bridge protocols (like Bebop, Portals, Jupiter, 0x, 1inch, etc.) into ShapeShift Web. Activates when user wants to add, integrate, or implement support for a new swapper. Guides through research, implementation, and testing following established patterns. (project)
allowed-tools: Read, Write, Edit, Grep, Glob, WebFetch, WebSearch, Bash(yarn test:*), Bash(yarn lint:*), Bash(yarn type-check), Bash(yarn build:*), Bash(gh pr:*), AskUserQuestion
allowed-tools: Read, Write, Edit, Grep, Glob, WebFetch, WebSearch, Bash(pnpm run test:*), Bash(pnpm run lint:*), Bash(pnpm run type-check), Bash(pnpm run build:*), Bash(gh pr:*), AskUserQuestion
---

# Swapper Integration Skill
Expand Down Expand Up @@ -1336,16 +1336,16 @@ export const getConfig = (): Config => ({

```bash
# Type checking (MUST pass)
yarn type-check
pnpm run type-check

# Linting (MUST pass)
yarn lint
pnpm run lint

# Build swapper package (MUST pass)
yarn build:swapper
pnpm run build:swapper

# Build web (SHOULD pass, may have unrelated errors)
yarn build:web
pnpm run build:web
```

Fix ALL type errors and lint errors before manual testing.
Expand Down Expand Up @@ -1463,9 +1463,9 @@ all pass before the integration is complete.
Before considering integration complete:

**Code Quality**:
- [ ] All type checks pass (`yarn type-check`)
- [ ] All lint checks pass (`yarn lint`)
- [ ] Build succeeds (`yarn build:swapper`)
- [ ] All type checks pass (`pnpm run type-check`)
- [ ] All lint checks pass (`pnpm run lint`)
- [ ] Build succeeds (`pnpm run build:swapper`)
- [ ] No `any` types used
- [ ] All errors handled monadically

Expand Down
6 changes: 3 additions & 3 deletions .claude/skills/swapper-integration/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,9 @@ Standard structure (most swappers):
Before considering integration complete:

**Automated checks**:
- [ ] `yarn type-check` passes
- [ ] `yarn lint` passes
- [ ] `yarn build:swapper` succeeds
- [ ] `pnpm run type-check` passes
- [ ] `pnpm run lint` passes
- [ ] `pnpm run build:swapper` succeeds

**Manual testing**:
- [ ] Can fetch quote for supported chain
Expand Down
12 changes: 6 additions & 6 deletions .claude/test-scenarios/QUICK-START.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Get started with automated testing for ShapeShift Web in 5 minutes!
## Prerequisites

1. **Browser MCP installed** - Follow setup in main README
2. **Dev server running** - `yarn dev` in terminal
2. **Dev server running** - `pnpm run dev` in terminal
3. **Claude Code** - Ready to accept slash commands

## Quick Commands
Expand Down Expand Up @@ -142,7 +142,7 @@ Each test scenario includes:
### "Dev server not running"
```bash
# Start dev server first
yarn dev
pnpm run dev

# Then run test
/test-agent run critical
Expand Down Expand Up @@ -176,7 +176,7 @@ You just modified the swap flow. Here's what to do:

```bash
# 1. Start dev server if not running
yarn dev
pnpm run dev

# 2. Run swap-related tests
/test-agent test asset-swap-flow
Expand Down Expand Up @@ -240,9 +240,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install deps
run: yarn install
run: pnpm install
- name: Start dev server
run: yarn dev &
run: pnpm run dev &
- name: Run critical tests
run: /test-agent run critical --ci
```
Expand Down Expand Up @@ -315,7 +315,7 @@ jobs:
║ ✅ Medium → Test bi-weekly ║
║ ║
║ WORKFLOW ║
║ 1. yarn dev → Start server ║
║ 1. pnpm run dev → Start server ║
║ 2. /test-agent test [name] → Run test ║
║ 3. Review results → Check pass/fail ║
║ 4. Fix issues → If any failures ║
Expand Down
Loading
Loading