defi-wonderland / smock

The Solidity mocking library
MIT License
321 stars 39 forks source link

Support Ethers v6 and Hardhat Toolbox 3.0.0 #187

Open mvillere opened 11 months ago

mvillere commented 11 months ago

Currently, if you would like to use Hardhat Toolbox 3.0.0, it requires dependencies on hardhat-ethers 3.0.4 and Ethers v6. This leads to an incompatibility with Smock, because smock requires hardhat-ethers v2 and Ethers v5.

It would be nice if Smock was updated to support Ethers v6. Unfortunately, I think this might require removing the hardhat-waffle dependency, as there is not a v3 of that since it is dead (Hardhat has moved on to using chai matchers and hardhat network helpers which they claim is an improvement over waffle).

Ethers v6 has substantial changes, specifically the elimination of BigNumber. Its probably better to deal with that big update sooner rather than later.

Can you please update to support Ethers v6 and also the hardhat 3/toolbox approach? If not, can you provide insight into if that update will ever occur?

Thank you.

developerasun commented 9 months ago

Upvoted this issue. I ran into the sample problem using current smock version.

Deps ```json "@defi-wonderland/smock": "^2.3.5", "hardhat": "^2.17.3", "@nomicfoundation/hardhat-toolbox": "^3.0.0", "@typechain/ethers-v6": "^0.5.0", "@typechain/hardhat": "^9.0.0", "ethers": "^6.7.1", ```

When running test like below,

import { FakeContract, smock } from '@defi-wonderland/smock';
it.only("some words" , async function TestMock() {
      const fakeCn = await smock.fake<Assembly>('Assembly')
      console.log({fakeCn})
})

Hardhat complains throw below logs.

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/utils' is not defined by "exports" in C:\Users\user\Desktop\code\web3-snippets\node_modules\.pnpm\@ethereum-waffle+provider@4.0.5_@ensdomains+ens@0.4.5_@ensdomains+resolver@0.2.4_ethers@6.7.1\node_modules\ethers\package.json
huseyindeniz commented 8 months ago

Hello, like @mvillere asked, do you have plans to support ethersV6? I love this package and I'd like to continue using it but upgrading to hardhat3 and ethersV6 is inevitable for most of us.

temporaryna commented 2 months ago

any news on that?

I found that one fork tried to update it to ethers-v6 (@puuuuh/smock), but I couldn't make it work.