question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reopened: ethersproject 5.5.0 BaseProvider ovewrite Provider failed

See original GitHub issue

Previous issue: https://github.com/ethers-io/ethers.js/issues/2190

Issue above got closed while adding my comment lol.

Here is a copy of that comment, the issue seems to still exist:

It seems ethers@5.5.1 mostly pulls in @ethersproject dependencies at version 5.5.0:

{
  "author": "Richard Moore <me@ricmoo.com>",
  "browser-old": "./dist/ethers.umd.js",
  "dependencies": {
    "@ethersproject/abi": "5.5.0",
    "@ethersproject/abstract-provider": "5.5.1",
    "@ethersproject/abstract-signer": "5.5.0",
    "@ethersproject/address": "5.5.0",
    "@ethersproject/base64": "5.5.0",
    "@ethersproject/basex": "5.5.0",
    "@ethersproject/bignumber": "5.5.0",
    "@ethersproject/bytes": "5.5.0",
    "@ethersproject/constants": "5.5.0",
    "@ethersproject/contracts": "5.5.0",
    "@ethersproject/hash": "5.5.0",
    "@ethersproject/hdnode": "5.5.0",
    "@ethersproject/json-wallets": "5.5.0",
    "@ethersproject/keccak256": "5.5.0",
    "@ethersproject/logger": "5.5.0",
    "@ethersproject/networks": "5.5.0",
    "@ethersproject/pbkdf2": "5.5.0",
    "@ethersproject/properties": "5.5.0",
    "@ethersproject/providers": "5.5.0", // <--- πŸ˜…
    "@ethersproject/random": "5.5.0",
    ...
  },
  ...
  "version": "5.5.1"
}

Is this normal?

Anyway pulling in @ethersproject/providers@5.5.0 seems to suffer from the original issue:

Check file:///home/voltrevo/workspaces/ethf/bls-wallet/aggregator/deps.ts
error: TS2416 [ERROR]: Property 'resolveName' in type 'BaseProvider' is not assignable to the same property in base type 'Provider'.
  Type '(name: string | Promise<string>) => Promise<string | null>' is not assignable to type '(name: string | Promise<string>) => Promise<string>'.
    Type 'Promise<string | null>' is not assignable to type 'Promise<string>'.
      Type 'string | null' is not assignable to type 'string'.
        Type 'null' is not assignable to type 'string'.
    resolveName(name: string | Promise<string>): Promise<null | string>;
    ~~~~~~~~~~~
    at https://cdn.esm.sh/v54/@ethersproject/providers@5.5.0/lib/base-provider.d.ts:132:5

(Seeing this in deno trying to import https://esm.sh/ethers@5.5.1.)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
marcelomorgadocommented, Oct 21, 2021

Not sure if it can help but I’m also facing issues since the last upgrade:

  Type 'Provider' is not assignable to type 'Signer | Provider | undefined'.
    Type 'import("/.../node_modules/@ethersproject/abstract-provider/lib/index").Provider' is not assignable to type 'import("/.../node_modules/ethers/node_modules/@ethersproject/abstract-provider/lib/index").Provider'.
      The types returned by 'getBlock(...)' are incompatible between these types.
        Type 'Promise<import("/h.../node_modules/@ethersproject/abstract-provider/lib/index").Block>' is not assignable to type 'Promise<import("/.../node_modules/ethers/node_modules/@ethersproject/abstract-provider/lib/index").Block>'.
          Property '_difficulty' is missing in type 'import("/.../node_modules/@ethersproject/abstract-provider/lib/index").Block' but required in type 'import("/.../node_modules/ethers/node_modules/@ethersproject/abstract-provider/lib/index").Block'.
1reaction
jbargucommented, Oct 22, 2021

I think the problem would be resolved if all the subpackages, such as @ethersproject/abstract-provider would use ~ instead of ^ for the @ethersproject/* dependencies.

Right now you will almost always have 2 versions of @ethersproject/abstract-provider, which causes all these issues (I have been battling them for months now, the only solution is to use resolution field in the parent package). If I write my code for a fixed versionethers~5.4.0 (pulling in @ethersproject/abstract-provider@5.4.0 and as soon as the new version 5.5.0 is released for the package (@ethersproject/abstract-provider@5.5.0) my code will break if there was a change to the Provider class that I am inheriting from 5.4.0. Example:

"dependencies": {
    "@ethersproject/abstract-provider": "~5.4.0",
    "@ethersproject/abstract-signer": "~5.4.0",
    "ethers": "~5.4.0",
}

ethers dependencies:

$ yarn info -R ethers                                                       
└─ ethers@npm:5.4.7
   β”œβ”€ Version: 5.4.7
   β”‚
   └─ Dependencies
      β”œβ”€ @ethersproject/abi@npm:5.4.1 β†’ npm:5.4.1
      β”œβ”€ @ethersproject/abstract-provider@npm:5.4.1 β†’ npm:5.4.1
      β”œβ”€ @ethersproject/abstract-signer@npm:5.4.1 β†’ npm:5.4.1
      ...

@ethersproject/abstract-signer dependencies:

$ yarn info -R @ethersproject/abstract-signer                              
β”œβ”€ @ethersproject/abstract-signer@npm:5.4.1
β”‚  β”œβ”€ Version: 5.4.1
β”‚  β”‚
β”‚  └─ Dependencies
β”‚     β”œβ”€ @ethersproject/abstract-provider@npm:^5.4.0 β†’ npm:5.5.1
β”‚     β”œβ”€ @ethersproject/bignumber@npm:^5.4.0 β†’ npm:5.5.0
β”‚     β”œβ”€ @ethersproject/bytes@npm:^5.4.0 β†’ npm:5.5.0
β”‚     β”œβ”€ @ethersproject/logger@npm:^5.4.0 β†’ npm:5.5.0
β”‚     └─ @ethersproject/properties@npm:^5.4.0 β†’ npm:5.5.0
β”‚
└─ @ethersproject/abstract-signer@npm:5.5.0
   β”œβ”€ Version: 5.5.0
   β”‚
   └─ Dependencies
      β”œβ”€ @ethersproject/abstract-provider@npm:^5.5.0 β†’ npm:5.5.1
      β”œβ”€ @ethersproject/bignumber@npm:^5.5.0 β†’ npm:5.5.0
      β”œβ”€ @ethersproject/bytes@npm:^5.5.0 β†’ npm:5.5.0
      β”œβ”€ @ethersproject/logger@npm:^5.5.0 β†’ npm:5.5.0
      └─ @ethersproject/properties@npm:^5.5.0 β†’ npm:5.5.0

You cannot select a fixed version without the resolutions field.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ethersproject 5.5.0 BaseProvider ovewrite Provider failed #2190
BaseProvider => resolveName(name: string | Promise): Promise ; Provider => resolveName(name: string | Promise): Promise;
Read more >
@ethersproject/providers - npm
Start using @ethersproject/providers in your project by running `npm i ... other projects in the npm registry using @ethersproject/providers.
Read more >
unpredictable_gas_limit | The AI Search Engine You Control
Hi Pedro, when it comes to run the application and the profitable value is true I get the ERROR: reason: 'cannot estimate gas;...
Read more >
@ethersproject/constants - npm package | Snyk
Ensure you're using the healthiest npm packages. Snyk scans all the packages in your projects for vulnerabilities and provides automated fix advice.
Read more >
@ethersproject/providers | Yarn - Package Manager
@ethersproject/providers ... 0 vulnerabilities. Ethereum Providers for ethers. Ethereum, ethers ... (1392803); Added new error strings Pocket returns.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found