feat: add support for Ethers with dynamic selection#29
Merged
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds dynamic Hardhat toolbox support so the plugin can build a Handle client using either the Viem toolbox (connection.viem) or the Ethers toolbox (connection.ethers), depending on what the consuming project enables.
Changes:
- Add a new
createHandleClientutility that detects whetherviemorethersis available on the HardhatNetworkConnection. - Update
nox.connect()to use the new toolbox-agnostic handle-client creation. - Add unit tests for toolbox detection logic and update dependencies to include Ethers + hardhat-ethers.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds lockfile entries for @nomicfoundation/hardhat-ethers and ethers. |
| packages/plugin/test/handle-client.ts | Adds unit tests covering viem/ethers detection and error behavior. |
| packages/plugin/src/utils/handle-client.ts | Introduces createHandleClient with runtime detection between viem and ethers toolboxes. |
| packages/plugin/src/nox.ts | Switches from viem-only client creation to dynamic toolbox selection. |
| packages/plugin/package.json | Adds dev deps for hardhat-ethers and ethers, and introduces optional peer deps metadata for both toolboxes. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (2)
packages/plugin/src/utils/handle-client.ts:44
- This branch relies on toolbox-provided type augmentation (
connection.viembeing present onNetworkConnection). If the toolbox modules are kept optional, the plugin source should not accessconnection.viemdirectly; instead, read the property via a narrow cast to a localViemToolboxshape so the code type-checks without importing the toolbox packages.
"`@nomicfoundation/hardhat-ethers` in your Hardhat config.",
);
}
packages/plugin/src/utils/handle-client.ts:49
- Same as the viem branch: if toolbox packages are optional peers, access
connection.ethersvia a narrow cast to a localEthersToolboxshape rather than relying on external module augmentation to add the property toNetworkConnection.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
zguesmi
approved these changes
Jun 19, 2026
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.
No description provided.