Skip to content

feat: add support for Ethers with dynamic selection#29

Merged
Le-Caignec merged 5 commits into
mainfrom
feat/ethers-support
Jun 19, 2026
Merged

feat: add support for Ethers with dynamic selection#29
Le-Caignec merged 5 commits into
mainfrom
feat/ethers-support

Conversation

@Le-Caignec

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings June 18, 2026 10:32
@Le-Caignec Le-Caignec requested a review from zguesmi as a code owner June 18, 2026 10:32
@Le-Caignec Le-Caignec changed the title feat: add support for Hardhat Ethers with dynamic selection feat: add support for Ethers with dynamic selection Jun 18, 2026
@socket-security

socket-security Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​nomicfoundation/​hardhat-ethers@​4.0.1310010010096100

View full report

 * The `@iexec-nox/handle` client factories, injectable so the toolbox detection
 * can be unit-tested without a real chain.
 */

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 createHandleClient utility that detects whether viem or ethers is available on the Hardhat NetworkConnection.
  • 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.viem being present on NetworkConnection). If the toolbox modules are kept optional, the plugin source should not access connection.viem directly; instead, read the property via a narrow cast to a local ViemToolbox shape 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.ethers via a narrow cast to a local EthersToolbox shape rather than relying on external module augmentation to add the property to NetworkConnection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/plugin/src/utils/handle-client.ts Outdated
@Le-Caignec Le-Caignec merged commit ebac611 into main Jun 19, 2026
4 checks passed
@Le-Caignec Le-Caignec deleted the feat/ethers-support branch June 19, 2026 15:35
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.

3 participants