Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

"providers" property doesnt exist on type ethers (TypeScript) #68

Open
MielkeDaniel opened this issue Mar 15, 2023 · 4 comments
Open

"providers" property doesnt exist on type ethers (TypeScript) #68

MielkeDaniel opened this issue Mar 15, 2023 · 4 comments

Comments

@MielkeDaniel
Copy link

MielkeDaniel commented Mar 15, 2023

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

@PatrickAlphaC
Copy link
Owner

Could you see this?

#67

@dustinpor2626
Copy link

dustinpor2626 commented Mar 19, 2023

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"
  },

@sunnyStefi
Copy link

sunnyStefi commented Mar 21, 2023

@mielke

  1. 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")
  1. 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()

@RomanIvn
Copy link

RomanIvn commented Apr 11, 2023

Also console.log(`Contract deployed to ${contract.address}`)
changed toconsole.log(`Contract deployed to ${await contract.getAddress()}`)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants