0

Here is the exact path of the error:

(C:\Users\HP FOLIO\.vscode\hardhat-fund-me-fcc\node_modules\@nomiclabs\hardhat-ethers\src\internal\ethers-provider-wrapper.ts:4:61)

Here's the definition of the EthersProviderWrapper class inside the above mentioned ethers-provider-wrapper.ts file:

import { ethers } from "ethers";
import { EthereumProvider } from "hardhat/types";

export class EthersProviderWrapper extends ethers.providers.JsonRpcProvider {
  private readonly _hardhatProvider: EthereumProvider;
      emit: any;

  constructor(hardhatProvider: EthereumProvider) {
    super();
    this._hardhatProvider = hardhatProvider;
  }

  public async send(method: string, params: any): Promise<any> {
    const result = await this._hardhatProvider.send(method, params);

    // We replicate ethers' behavior.
    this.emit("debug", {
      action: "send",
      request: {
        id: 42,
        jsonrpc: "2.0",
        method,
        params,
      },
      response: result,
      provider: this,
    });

    return result;
  }

  public toJSON() {
    return "<WrappedHardhatProvider>";
  }
}

Here is my package.json file:

{
    "name": "hardhat-fund-me-fcc",
    "author": "EddiePumpin",
    "version": "1.0.0",
    "devDependencies": {
        "@chainlink/contracts": "v0.8",
        "@nomiclabs/hardhat-ethers": "^2.2.3",
        "@nomiclabs/hardhat-etherscan": "^3.0.0",
        "@nomiclabs/hardhat-waffle": "^2.0.2",
        "chai": "^4.3.4",
        "dotenv": "^14.2.0",
        "ethereum-waffle": "^3.4.0",
        "ethers": "^6.13.1",
        "hardhat": "^2.22.9",
        "hardhat-deploy": "^0.12.4",
        "hardhat-deploy-ethers": "^0.4.2",
        "hardhat-gas-reporter": "^1.0.7",
        "http-server": "^14.1.1",
        "prettier": "^3.3.3",
        "prettier-plugin-solidity": "^1.0.0-beta.19",
        "solhint": "^3.3.7",
        "solidity-coverage": "^0.7.18"
    },
    "scripts": {
        "test": "yarn hardhat test",
        "test:staging": "yarn hardhat test --network sepolia",
        "lint": "solhint 'contracts/**/*.sol'",
        "lint:fix": "solhint 'contracts/**/*.sol' --fix",
        "format": "prettier --write .",
        "coverage": "hardhat coverage",
        "license": "ISC"
    }
}

2 Answers 2

0

Since, the version of your @nomiclabs/hardhat-ethers package is older and referencing the ethers.js v5. So, instead of ethers.js v6, you've to install ethers.js v5.

For doing that, you can just execute either of these commands, depending on whether you're using yarn or npm:

Using yarn:

yarn add [email protected]

Using npm:

npm install [email protected]
0

With the latest Ethers.js v6.13.2

const infuraApiKey = "1234...";
const blockchainStr = "sepolia"; // or "base-sepolia", "mainnet", ...
const provider = new InfuraProvider(blockchainStr, infuraApiKey);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.