You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Try to setup hardhat project with viem, typescript, ignition. When i compile the smart contract viem helpers work great, type inference for deploy and contract call, but for ignition it does not work. I just can put anything as arguments of deploy, and same with calls. But in document i can see that everything should work
import{buildModule}from"@nomicfoundation/hardhat-ignition/modules";import{parseEther}from"viem";constJAN_1ST_2030=1893456000;constONE_GWEI: bigint=parseEther("0.001");constLockModule=buildModule("LockModule",(m)=>{constunlockTime=m.getParameter("unlockTime",JAN_1ST_2030);constlockedAmount=m.getParameter("lockedAmount",ONE_GWEI);constlock=m.contract("anything",[unlockTime],{// no errors and completionvalue: lockedAmount,});return{ lock };});exportdefaultLockModule;
Minimal reproduction steps
Initialize project with npx hardhat init
Choose: "Create a TypeScript project (with Viem)"
After run npx hardhat compile
Go to ignition/modules/Lock.ts file
No type inference for m.contract()
Try to install @nomicfoundation/hardhat-ignition-viem
Import @nomicfoundation/hardhat-ignition-viem in hardhat.config.ts
Recomile contracts
Go to ignition/modules/Lock.ts file
No type inference for m.contract()
Search terms
viem type inference, ignition type inference
The text was updated successfully, but these errors were encountered:
This is a great feature suggestion. I think we want to support it but I can't give a timeline.
We are looking at enhancing the our viem type inference in Hardhat 3 generally, that might provide an opportunity to look at adding refined types within an Ignition module.
Version of Hardhat
2.22.4
Docs reference
https://github.com/NomicFoundation/hardhat/blame/dfd91d254362a3f5a0a2c940398e8af7d677f876/docs/src/content/ignition/docs/guides/viem.md#L102
What happened?
Try to setup hardhat project with viem, typescript, ignition. When i compile the smart contract viem helpers work great, type inference for deploy and contract call, but for ignition it does not work. I just can put anything as arguments of deploy, and same with calls. But in document i can see that everything should work
Node: v20.13.1
NPM: v10.5.2
package.json
hardhat.config.ts
ignition/module/Lock.ts
Minimal reproduction steps
npx hardhat init
npx hardhat compile
ignition/modules/Lock.ts
filem.contract()
@nomicfoundation/hardhat-ignition-viem
@nomicfoundation/hardhat-ignition-viem
inhardhat.config.ts
ignition/modules/Lock.ts
filem.contract()
Search terms
viem type inference, ignition type inference
The text was updated successfully, but these errors were encountered: