Skip to content

Add wagmi CLI contract bridge with fork-first dev workflow#3

Draft
gskril wants to merge 3 commits into
mainfrom
cursor/wagmi-cli-bridge-35e2
Draft

Add wagmi CLI contract bridge with fork-first dev workflow#3
gskril wants to merge 3 commits into
mainfrom
cursor/wagmi-cli-bridge-35e2

Conversation

@gskril

@gskril gskril commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Summary

Sets up the contract ↔ frontend bridge using @wagmi/cli with the Foundry plugin. ABIs and deployment addresses are generated into src/generated/contracts.ts — no custom helpers, no sample contract UI.

Also expands env gitignore, adds fork-first development docs, and defaults the frontend to Anvil + Sepolia.

Changes

  • wagmi.config.ts — Foundry plugin with includeBroadcasts: true (picks up addresses from contracts/broadcast/ after deploy)
  • pnpm generate — runs automatically before dev and build
  • .env.example + .gitignore — ignore all .env* except .env.example
  • foundry.toml — RPC aliases for anvil, fork, sepolia
  • src/wagmi.ts — Anvil (31337) + Sepolia, env-based RPC URLs
  • docs/development.md — fork workflow, generate, env vars
  • CI — frontend build job (needs Foundry for wagmi generate)

Workflow

anvil --fork-url $FORK_RPC_URL
pnpm contracts:deploy   # deploy to fork
pnpm dev                # generate + run app

Import generated exports in your own components:

import { counterAbi, counterAddress } from '@/generated/contracts'

When contracts change, re-run pnpm generate (or pnpm dev) — no wagmi config edits needed.

Test plan

  • pnpm wagmi generate produces ABIs without forge-std noise
  • Deploy to Anvil → regenerate → counterAddress[31337] populated
  • pnpm build passes with and without broadcast data
  • forge test, forge fmt --check pass
Open in Web Open in Cursor 

cursoragent and others added 3 commits June 30, 2026 17:45
- Generate typed ABIs and addresses from Foundry artifacts and broadcasts
- Expand gitignore for .env* (keep .env.example) and src/generated/
- Default wagmi to Anvil + Sepolia with env-based RPC URLs
- Add fork workflow docs, .env.example, and frontend CI job

Co-authored-by: Greg <gskril@users.noreply.github.com>
Run pnpm generate explicitly after contract changes or deploys.
CI runs generate before build.

Co-authored-by: Greg <gskril@users.noreply.github.com>
Remove src/generated/ from gitignore. CI verifies the committed
file stays in sync with contract ABIs via generate + git diff.

Co-authored-by: Greg <gskril@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants