joshstevens19 / ethereum-abi-types-generator

Generate typings based on your ABIs, with provider wrappers exposed.
MIT License
162 stars 22 forks source link

Ethers version conflicts #41

Open jackmellis opened 2 years ago

jackmellis commented 2 years ago

Right now this is causing quite a lot of frustrating problems for us. Because this package has a dependency on ethers v4, and then an aliased dependency on ethers v5, sometimes an npm/yarn install will get completely confused about which version is which and our app (running on v5) will attempt to use the v4 version used by this package.

I'll paste a snippet from my yarn.lock where you can see that all other dependents of ethers are being redirected to your ethersv5 alias:

ethers@^4.0.47:
  version "4.0.49"
  resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.49.tgz#0eb0e9161a0c8b4761be547396bbe2fb121a8894"
  integrity sha512-kPltTvWiyu+OktYy1IStSO16i2e7cS9D9OxZ81q2UUaiNPVrm/RTcbxamCXF9VUSKzJIdJV68EAIhTEVBalRWg==
  dependencies:
    aes-js "3.0.0"
    bn.js "^4.11.9"
    elliptic "6.5.4"
    hash.js "1.1.3"
    js-sha3 "0.5.7"
    scrypt-js "2.0.4"
    setimmediate "1.0.4"
    uuid "2.0.1"
    xmlhttprequest "1.8.0"

ethers@^5.6.4, ethers@^5.6.7, "ethersv5@npm:ethers@^5.0.32":
  name ethersv5
  version "5.6.7"
  resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.6.7.tgz#3e6257b2a0fdd5fc93e68e141cf2b9761900f374"
  integrity sha512-Q8pmMraUENK0cY6cy6IvIe3e9xL/+4kBvxmUvLXg1O7Abob0c7XzWI76E29j5em/HxWMl5hYiSClmOMW3jJmdg==
  dependencies:
    "@ethersproject/abi" "5.6.2"
    "@ethersproject/abstract-provider" "5.6.0"
    "@ethersproject/abstract-signer" "5.6.1"
    "@ethersproject/address" "5.6.0"
    "@ethersproject/base64" "5.6.0"
    "@ethersproject/basex" "5.6.0"
    "@ethersproject/bignumber" "5.6.1"
    "@ethersproject/bytes" "5.6.1"
    "@ethersproject/constants" "5.6.0"
    "@ethersproject/contracts" "5.6.1"
    "@ethersproject/hash" "5.6.0"
    "@ethersproject/hdnode" "5.6.1"
    "@ethersproject/json-wallets" "5.6.0"
    "@ethersproject/keccak256" "5.6.0"
    "@ethersproject/logger" "5.6.0"
    "@ethersproject/networks" "5.6.3"
    "@ethersproject/pbkdf2" "5.6.0"
    "@ethersproject/properties" "5.6.0"
    "@ethersproject/providers" "5.6.7"
    "@ethersproject/random" "5.6.0"
    "@ethersproject/rlp" "5.6.0"
    "@ethersproject/sha2" "5.6.0"
    "@ethersproject/signing-key" "5.6.1"
    "@ethersproject/solidity" "5.6.0"
    "@ethersproject/strings" "5.6.0"
    "@ethersproject/transactions" "5.6.1"
    "@ethersproject/units" "5.6.0"
    "@ethersproject/wallet" "5.6.1"
    "@ethersproject/web" "5.6.0"
    "@ethersproject/wordlists" "5.6.0"

The problem is (I think) that webpack/next/etc. don't know to load ethers from the aliased folder, so they just pull the v4 version!

Is there a reason why v4 is still a dependency (and a top-level dependency) and you haven't upgraded?

joshstevens19 commented 2 years ago

Package supports both ethers v4 and v5.. will look into this more tomorrow thanks again for raising the issues