fix(cli): support named Foundry deployments sharing one artifact ABI - #5231
Open
TLSRUF wants to merge 1 commit into
Open
fix(cli): support named Foundry deployments sharing one artifact ABI#5231TLSRUF wants to merge 1 commit into
TLSRUF wants to merge 1 commit into
Conversation
Fixes wevm#4396. The foundry plugin's `deployments` map is keyed by artifact name, so it can't express two named contracts (e.g. DAI and WETH) that share one artifact's ABI with different addresses — one entry silently overwrites the other. Add a second deployment shape, `{ artifact, address }`, that generates an additional named contract reusing another artifact's ABI: deployments: { DAI: { artifact: 'ERC20', address: { 1: '0x...' } }, WETH: { artifact: 'ERC20', address: { 1: '0x...' } }, } The existing plain-address shape is unchanged and still works. Alias contracts are resolved by contracts() (a full `wagmi generate` run); onAdd/onChange in --watch mode can only return one ContractConfig per changed file, so alias contracts need a rerun to pick up, which is now documented. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: fc23b29 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@TLSRUF is attempting to deploy a commit to the Wevm Team on Vercel. A member of the Team first needs to authorize it. |
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.
Closes #4396
The
foundryplugin'sdeploymentsmap is keyed by artifact name, so it can't express two named contracts (e.g.DAIandWETH) that share one artifact's ABI with different addresses — one entry silently overwrites the other, and only one of the two ends up generated.What changed
Added a second
deploymentsvalue shape,{ artifact, address }, that generates an additional named contract reusing another artifact's ABI:The existing plain-address shape (
deployments: { ERC20: { 1: '0x...' } }) is unchanged and fully backward compatible — covered by a new regression test.Scope / limitation
Alias contracts are resolved by
contracts()(i.e. a fullwagmi generaterun).watch.onAdd/watch.onChangecan only return a singleContractConfigper changed file (per the existingWatchtype), so duringwagmi generate --watcha changed artifact only re-emits its own artifact-named contract — picking up alias contracts needs a rerun ofwagmi generate. This is called out in the docs. Happy to extendonAdd/onChangeto return multiple contracts in a follow-up if that's preferred, but wanted to keep this PR's surface area (and the sharedWatchtype used by every plugin) small.Prior attempt
#5011 attempted this earlier but grew into a larger watch-mode rework across several follow-up commits and was closed without a merge or review comment. This PR re-approaches the same issue with a smaller, additive change to keep it easy to review.
Testing
deployments support multiple named contracts sharing one artifact ABIanddeployments still support a plain address for the artifact itselftofoundry.test.tspnpm --filter @wagmi/cli check:typespassesbiome checkpasses on changed filesout/artifacts locally withforge: { build: false }(this dev environment doesn't have Foundry installed, so I couldn't exercise the existingforge build-dependent tests locally, only my scoped verification — CI has Foundry installed and should run the full suite)🤖 Generated with Claude Code