Skip to content

Conversation

@jamesmccomish
Copy link

Problem

The deployments mapping in FoundryConfig is useful for attaching contracts to addresses. But often when developing locally in a monorepo I run anvil (or a local fork) and deploy my contracts there. The addresses might change as the contracts change, and keeping the deployments mapping updated is awkward, it seems like a small addition to wagmi/cli could make this a lot easier.

### deployments
`{ [key: string]: address?: Address | Record<chainId, Address> | undefined } | undefined`
Mapping of addresses to attach to artifacts.

Update

This PR adds a flag includeBroadcasts which automatically populates the deployments mapping with any contracts deployed in a run-latest.json file in the /broadcasts/ folder.

/**
* Set contracts in `run-latest.json` files in the `broadcast/` directory as deployments.
*
* @dev broadcast deployments can be overridden by including the contract in the deployments mapping.
*
* @default false
*/
includeBroadcasts?: boolean | undefined

With that flag set, running wagmi generate in a local development script after deploying any test contracts locally will take the latest deployment addresses and generate files that can be read by the frontend.

Further Work

I think more info from these broadcast files could be useful to extract too. Things like blockNumber or deployment arguments might be useful for linking to indexers etc.

@changeset-bot
Copy link

changeset-bot bot commented Dec 22, 2025

⚠️ No Changeset found

Latest commit: 80c777f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Dec 22, 2025

@jamesmccomish is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@jamesmccomish jamesmccomish marked this pull request as draft December 23, 2025 10:29
@tmm tmm force-pushed the main branch 2 times, most recently from 002f089 to 058c8c1 Compare December 23, 2025 15:52
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.

1 participant