TypeError: Cannot read properties of undefined(reading 'JsonRpcProvider') #6664
Unanswered
gopikantagarain
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
const ethers = require("ethers");
const fs = require("fs-extra");
async function main() {
const provider = new ethers.providers.JsonRpcProvider("http://127.0.0.1:7545");
const wallet = new ethers.Wallet(
"0x54817de31b061ee8620792c717eb07b7f6fa8377ee52ee49d1be64c0736c8cb4",
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();
console.log("Contract deployed at address:", contract.address);
}
main()

.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
Beta Was this translation helpful? Give feedback.
All reactions