I have to update my front-end file with deployed latest ABI in json format. I am using following code in my deploy script (Run after the original smart contract is deployed)
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import fs from "fs";
const updateUI: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { network, ethers } = hre;
console.log("Writing to front end...");
//Updating ABI on front end JSON file
const frontEndAbiFile = "path/to/store/abi.json";
const fundme = await ethers.getContract("FundMe"); //already deployed contract on hardhat/rinkeby
//I want to get the ABI here so that I can write and save it to frontEndAbiFile location.
fs.writeFileSync(frontEndAbiFile, 'How shoud I get ABI in json?' );
};
export default updateUI;
How I can get ABI in json format FundMe
contract? Please read the comments in my above code.
Note:I am using TypeScript.