I'm migrating tests from Truffle to hardhat and waffle. How can I differentiate the abis here
import { abi } from "../build/BankFactory.json";
import { abi } from "../build/Bank.json";
Dec 11, 2021, 6:00 PM
Read about typescript and imports
Dec 11, 2021, 6:33 PM
I've been doing it the whole week. I just need some help.
I already added this line to the tsconfig.json
"resolveJsonModule": true
, but using that abi in web3 doesn't seem to work.
"resolveJsonModule": true
, but using that abi in web3 doesn't seem to work.
const bankFactoryInWeb3 = new web3.eth.Contract(abi, bankFactoryDeployed.address); The compiler complains about the type of abi
I mostly use ethers, but for some tests I need the openzeppelin-helper package, that's why I need web3js
Dec 11, 2021, 6:44 PM
Abi.Abi
You also named both imports the same
Dec 11, 2021, 6:47 PM
I didn't name them. They were generated by waffle.
Dec 11, 2021, 7:19 PM
Ahh okay, I haven’t used waffle
In my experience the json abis have the actual Abi def in an object called “Abi”, so when you reference the Abi it should be “obj.Abi”
Have you tried that?
Dec 11, 2021, 7:20 PM
I can chanfe those file names manually, but abi.abi gives a compiler error.
Let me see
Dec 11, 2021, 7:21 PM
If you can DM me and share your project GitHub or a zip file I can take a quick look later
(Remove all personal info first of course, make sure no private keys or anting in there)
Dec 11, 2021, 7:21 PM
🙏 DM you
Dec 11, 2021, 7:22 PM