Code Monkey home page Code Monkey logo

Comments (4)

MehdiAbidri avatar MehdiAbidri commented on June 16, 2024 2

remove providers object from the line below

so instead of :

const provider = new ethers.providers.JsonRpcProvider(
    "HTTP://127.0.0.1:7545"
  );

write this :

const provider = new ethers.JsonRpcProvider(
    "HTTP://127.0.0.1:7545"
  );

this error maybe related to recent update which is not takken into account in this course.

from full-blockchain-solidity-course-js.

ShawnFromTexas avatar ShawnFromTexas commented on June 16, 2024

I do not see a deply.js here?

Sounds like you need to check JsonRpcProvidor.

'''TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')'''

from full-blockchain-solidity-course-js.

Akshat162001 avatar Akshat162001 commented on June 16, 2024

My freind is also having this mistake so he tried some code that might solve your problem here is the solve it :
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 privateKey = "0x558cc70107e27f955b18929f466564d6044269c09870c7e58ead521327ae0b12";
const Wallet = new ethers.Wallet(privateKey, provider);

const abi = JSON.parse(fs.readFileSync("SimpleStorage_sol_SimpleStorage.abi", "utf8"));
const bytecode = "0x" + fs.readFileSync("SimpleStorage_sol_SimpleStorage.bin", "utf8");

const contractFactory = new ethers.ContractFactory(abi, bytecode, Wallet);

console.log("Deploying, please wait...");
const contract = await contractFactory.deploy();
console.log("Contract address:", contract.address);
console.log("Transaction hash:", contract.deployTransaction.hash);

await contract.deployed();
console.log("Contract deployed successfully!");
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});

from full-blockchain-solidity-course-js.

Akshat162001 avatar Akshat162001 commented on June 16, 2024

Hopefully it might work..

from full-blockchain-solidity-course-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.