Add wagmi CLI contract bridge with fork-first dev workflow#3
Draft
gskril wants to merge 3 commits into
Draft
Conversation
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sets up the contract ↔ frontend bridge using
@wagmi/cliwith the Foundry plugin. ABIs and deployment addresses are generated intosrc/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 withincludeBroadcasts: true(picks up addresses fromcontracts/broadcast/after deploy)pnpm generate— runs automatically beforedevandbuild.env.example+.gitignore— ignore all.env*except.env.examplefoundry.toml— RPC aliases foranvil,fork,sepoliasrc/wagmi.ts— Anvil (31337) + Sepolia, env-based RPC URLsdocs/development.md— fork workflow, generate, env varswagmi generate)Workflow
Import generated exports in your own components:
When contracts change, re-run
pnpm generate(orpnpm dev) — no wagmi config edits needed.Test plan
pnpm wagmi generateproduces ABIs without forge-std noisecounterAddress[31337]populatedpnpm buildpasses with and without broadcast dataforge test,forge fmt --checkpass