deploymentReceipt Error #5093
Answered
by
alymurtazamemon
thegreatfeez
asked this question in
Q&A
-
trying to deploy my contract after adding the deploymentReceipt and i keep getting TypeError: no matching function (argument="key", value="deployTransaction", code=INVALID_ARGUMENT, version=6.1.0) |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Mar 15, 2023
Replies: 3 comments 4 replies
-
const ethers = require("ethers");
const fs = require("fs-extra");
async function main(){
const provider = new ethers.JsonRpcProvider("http://127.0.0.1:7545");
const wallet = new ethers.Wallet("0xc51b47890bbebea304606ee399ddae1d7f9ae78f8642695f946bc917723fc605",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);
console.log(deploymentReceipt);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit();
}); |
Beta Was this translation helpful? Give feedback.
0 replies
-
@thegreatfeez Please use the old version of |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
alymurtazamemon
-
To use wait in ethers version 6 const contract = await contractFactory.deploy();
const deploymentReceipt = await contract.deploymentTransaction().wait(2); // change the number here Complete Code: 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("0xc51b47890bbebea304606ee399ddae1d7f9ae78f8642695f946bc917723fc605",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);
const contract = await contractFactory.deploy();
console.log("Deploying please wait....");
const deploymentReceipt = await contract.deploymentTransaction().wait(2); // change the number here
console.log(deploymentReceipt);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit();
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@thegreatfeez Please use the old version of
ethers
for now. Run this commandnpm i ethers@^5.5.3