Relative Content

Tag Archive for javascriptblockchainsoliditypackage.jsonethers.js

TypeError: Cannot read properties of undefined (reading ‘readFileSync’)

const { ethers } = require(“ethers”); const { fs } = require(“fs-extra”); require(“dotenv”).config(); async function main() { const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_URL); const encryptedJson = fs.readFileSync(“./.encryptedKey.json”, “utf8”); let wallet = new ethers.Wallet.fromEncryptedJsonSync( encryptedJson, process.env.PRIVATE_KEY_PASSWORD ); wallet = await wallet.connect(provider); const abi = readFileSync( “./hh-fcc/ethers-simple-storage_SimpleStorage_sol_SimpleStorage.abi”, “utf8” ); const binary = readFileSync( “./hh-fcc/ethers-simple-storage_SimpleStorage_sol_SimpleStorage.bin”, “utf8” ); const contractFactory […]