ethers-simple-storage-fcc
ethers-simple-storage-fcc copied to clipboard
"providers" property doesnt exist on type ethers (TypeScript)
import { ethers } from "ethers";
async function main() {
// http://127.0.0.1:7545
let provider = new ethers.providers.JsonRpcProvider("http://127.0.0.1:7545");
}
Underlines "providers"-keyword with the following error:
Property 'providers' does not exist on type 'typeof import("/Users/danielmielke/Code/hh-fcc/ethers-simple-storage/node_modules/ethers/types/ethers")'.
Any idea why? Buggy ethers version? Im using ^6.1.0
Could you see this?
https://github.com/PatrickAlphaC/ethers-simple-storage-fcc/pull/67
const ether = require("ethers");
async function main() {
const provider = new ether.JsonRpcProvider("http://127.0.0.1:7545");
}
"dependencies": {
"ethers": "^6.1.0",
"solc": "^0.8.19"
},
@Mielke
- Make sure to always check the current docs to stay at their pace! it's not buggy, they change the functions.
cit. all the ethers.providers.* are being moved to ethers.*
This works for ethers v 6.2.0:
let provider = new ethers.getDefaultProvider("http://127.0.0.1:7545")
- There are other issues that arise with ethers 6.2.0:
const deploymentReceipt = await contract.deployTransaction.wait(1)
should be changed into
const txResponse = await contract.deploymentTransaction().wait()
Also console.log(`Contract deployed to ${contract.address}`)
changed toconsole.log(`Contract deployed to ${await contract.getAddress()}`)