There's no specific error code to this problem other than just simple undefined. The problem could be generated from the Hardhat Local Node and Raffle Contract's ABI.
Hardhat Local Node's accounts are not precisely synchronised with the Metamask wallet in my browser the way I'd have wanted them to be. This is something I should get fixed asap, as it's sort of creating a backlog.
Current deploy scripts for generating abi.json from the Raffle.sol contract is sort of working and again not working as the generated abi format is slightly different.
02-updateUI.ts -
import * as fs from 'fs';
import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { stringify } from 'querystring';
import {
FRONT_END_ABI_FILE,
FRONT_END_ADDRESSES_FILE,
} from '../helper-hardhat-config';
const updateUI: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { ethers } = hre;
const chainId: string = '31337';
if (process.env.UPDATE_FRONT_END) {
console.log('Updating Front End...');
const raffle = await ethers.getContract('Raffle');
const contractAddresses = JSON.parse(
fs.readFileSync(FRONT_END_ADDRESSES_FILE, 'utf8')
);
if (chainId in contractAddresses) {
if (!contractAddresses[chainId].includes(raffle.address)) {
contractAddresses[chainId].push(raffle.address);
}
} else {
contractAddresses[chainId] = [raffle.address];
}
fs.writeFileSync(
FRONT_END_ABI_FILE,
JSON.stringify(raffle.interface)
// raffle.interface.format(ethers.utils.FormatTypes.json)
);
fs.writeFileSync(
FRONT_END_ADDRESSES_FILE,
JSON.stringify(contractAddresses)
);
}
};
export default updateUI;
updateUI.tags = ['all', 'frontend'];
There's no specific error code to this problem other than just simple
undefined
. The problem could be generated from the Hardhat Local Node andRaffle Contract's ABI
.Hardhat Local Node's accounts are not precisely synchronised with the Metamask wallet in my browser the way I'd have wanted them to be. This is something I should get fixed asap, as it's sort of creating a backlog.
Current deploy scripts for generating
abi.json
from theRaffle.sol
contract is sort of working and again not working as the generatedabi
format is slightly different.02-updateUI.ts
-