Open ACHENAQ opened 1 year ago
const provider = new ethers.JsonRpcProvider("http://127.0.0.1:7545"); const wallet = ethers.Wallet( "0x6bfb6ad9cfe40cdf914020b4128c51be0bf0f73284f42c83ec2d3121e1ab1582", provider );
@ACHENAQ This might help
I run in the same problem as ACHENAQ above.
I checked online and people were saying I should change my file path; I did. Now I'm running into another error :D Which is:
Error: ENOENT: no such file or directory, open './SimpleStorage.sol_SimpleStorage.abi'
at Object.openSync (node:fs:590:3)
at Object.readFileSync (node:fs:458:35)
at main (/Users/maximelalonde/Desktop/hh-fcc/deploy.js:11:18)
at Object.
I don't know what to do exactly. I'm coding on a Mac 2015 with High Sierra as the most up to date patch. Could it be that? Sometimes I have to use previous version so that extensions are compatible with my Mac. Let me know. GOOD DAY PEOPLE!
Hey ACHENAQ, I finally succeed. Took a whiiiillllleeee!
const { ethers } = require("ethers"); const fs = require("fs");
async function main() { const provider = new ethers.providers.JsonRpcProvider( "http://127.0.0.1:7545" ); const wallet = new ethers.Wallet( "0xb357c12e59c02b0b6bde61434adda8ab38a29f2db7bb109ec360955b55404677", provider ); const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8"); const bin = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.bin", "utf8"); const contractFactory = new ethers.ContractFactory(abi, bin, wallet); console.log("Deploying, please wait..."); const contract = await contractFactory.deploy(); // Stop here and wait for the contract to deploy const deploymentReceipt = await contract.deployTransaction.wait(1); console.log(deploymentReceipt); }
main() .then(() => process.exit(0)) .catch((error) => { console.error(error); process.exit(1); });
I unistalled the node_modules and reinstalled it. Also I'm using Ethers 5.6.2 and modify a little bit of the code listening to some this and input from ChatGPT. Good luck bro!
I had earlier used the solution provided to someone who asked question here but still not working, please help this is the code snipet
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 = ethers.wallet( "0x6bfb6ad9cfe40cdf914020b4128c51be0bf0f73284f42c83ec2d3121e1ab1582", provider ); const abi = fs.readFileSync("./simpleStorage_sol_simpleStorage.abi", "utf8"); const binary = fs.readFileSync( "./simpleStorage_sol_simpleStorage.binary", "utf8" ); const contractfactory = new ethers.contractfactory(abi, binary, wallet); console.log("deploying, please wait..."); const contract = await contractfactory.deploy(); console.log(contract); } main() .then(() => process.exit(0)) .catch((error) => { console.error(error); process.exit(1); });