Replies: 2 comments
-
You can use the wagmi CLI with the hardhat plugin to generate ABIs cast to Another note: you can still import ABIs as JSON like in wagmi 0.12 and ethers.js, however, the caveat is that you won’t get all the nice features of type safety & inference. In other words, casting to Hopefully importing JSON as const will be supported natively in TypeScript one day: microsoft/TypeScript#32063 |
Beta Was this translation helpful? Give feedback.
-
i was able to generate
|
Beta Was this translation helpful? Give feedback.
-
I have upgraded recently to 1.3.x, over 0.12.x, and I have to say I am quite perplexed by the way ABIs are handled by the library.
Hardhat produces artificats that contain ABIs and bytecodes under a JSON, I would think that viem would handle them directly, but the type inferrence you do ask that I make my ABI look a certain way, and that would involve taking the data from each of the artifacts I create with HardHat and put them in a file as const for viem to be able to handle them without sending out typescript errors.
Instead of being powerful and preventing errors, all it does is make me waste copious amounts of time, where with ethers.js, I could just import the json artificat, feed the Contract interface with the abi object and the bytecode object, and done.
Any possibilities to make the Contract Interfacing less strict? People like me use those frameworks to save time and build fast.
Beta Was this translation helpful? Give feedback.
All reactions