Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support viem and Hardhat toolbox #193

Open
robercano opened this issue Feb 8, 2024 · 3 comments
Open

Support viem and Hardhat toolbox #193

robercano opened this issue Feb 8, 2024 · 3 comments

Comments

@robercano
Copy link

Is your feature request related to a problem? Please describe.
We've decided to switch to viem for our project, and we were previously using Smock for our tests. Unfortunately Smock does not support viem so we will need to drop it for now.

Describe the solution you'd like
Having viem support in Smock

Describe alternatives you've considered
There are no other libraries out there with the same functionality, so there aren't really any alternatives

Additional context
If you'd be open to collaboration I could have a look to understand how much work it would involve, or at least help with the effort. I'm really interested in having this :)

@coreyar
Copy link

coreyar commented Mar 4, 2024

I'm curious what dependency you have between viem and smock. My assumption is there is no dependency that you would be able to use smock to mock/ fake contracts and still query them with viem.

@robercano
Copy link
Author

Hi @coreyar,

As far as I understood Smock uses Ethers.js Contract type for instantiating the mocks/fakes. I couldn't manage to use viem Contracts with Smock, but perhaps I was doing it wrong. Have you tried this combination of Hardhat Toolbox for viem and Smock?

@coreyar
Copy link

coreyar commented Mar 7, 2024

I haven't but I played around with it but I dug in a bit today and I was able to get it to work here - https://github.com/coreyar/smock-viem-example/blob/main/test/SmockLock.ts#L152

I need to learn more about how smock works but it is at the evm layer hence the dependency on hardhat but not viem or ethers.

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

No branches or pull requests

2 participants