To be specific I am using ethers version 6.2.3
Error is in this line
const deploymentReceipt = await contract.deployTransaction.wait(1);
Entire code I am using to deploy contract and wait
const { ethers, JsonRpcProvider } = require('ethers');
const fs = require('fs-extra');
async function main() {
const provider = new JsonRpcProvider('http://127.0.0.1:7545');
const wallet = new ethers.Wallet(
'private Key', //replace with ganache private key
provider
);
const abi = fs.readFileSync('./SimpleStorage_sol_SimpleStorage.abi', 'utf8');
const binary = fs.readFileSync(
'./SimpleStorage_sol_SimpleStorage.bin',
'utf8'
);
const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
console.log('Deploying, Please wait...');
const contract = await contractFactory.deploy();
const deploymentReceipt = await contract.deployTransaction.wait(1); // This line has the issue.
console.log(deploymentReceipt);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
Console
Deploying, Please wait...
TypeError: no matching function (argument="key", value="deployTransaction", code=INVALID_ARGUMENT, version=6.2.3)
code: 'INVALID_ARGUMENT',
argument: 'key',
value: 'deployTransaction'