Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move ethers from devDependencies to dependencies #560

Closed
ocozalp opened this issue Jan 16, 2024 · 7 comments
Closed

Move ethers from devDependencies to dependencies #560

ocozalp opened this issue Jan 16, 2024 · 7 comments

Comments

@ocozalp
Copy link

ocozalp commented Jan 16, 2024

Hello,

I'm trying to make balancer-sdk work in a project that uses ethers v6 and I'm having issues with it because balancer-sdk uses ethers v5 (and it uses Interface class under ethers.util, in the latest versions it's ethers.Interface).

Can you consider moving ethers to dependencies so balancer-sdk uses its own ethers version?

@ocozalp
Copy link
Author

ocozalp commented Jan 16, 2024

Created a PR here: #561

@Pedrojok01
Copy link

Got the same problem in a node.js project using ethers v6. For now, I sorted out using package aliases:

"devDependencies": {
     "@balancer-labs/sdk": "^1.1.5",
     "ethers": "5.7.2",
     "ethers-v6": "npm:[email protected]",
}

Then, you can simply adjust your imports like this:

const { ethers } = require('ethers-v6');
// or in ES6 syntax
import { ethers } from 'ethers-v6';

@0xEzSwim
Copy link

0xEzSwim commented May 3, 2024

This issue is still relevant. I had to downgrade to ethers ^5.0.0 to use balancer-sdk

@johngrantuk
Copy link
Member

Trying to understand more about the issue here. Can anyone who has this issue confirm what version of the SDK is being used and even point me towards a repo where I can replicate?
The SDK has depenedcies on ethers sub packages but doesn't have a direct dep on "ethers" full package so I can't understand the issue atm. Thanks!

@ocozalp
Copy link
Author

ocozalp commented May 6, 2024

@johngrantuk For my case, I use "@balancer-labs/sdk": "^1.1.5" and "ethers": "^6.7.1".

When I have these two as dependencies and run tests I see this

  ● Test suite failed to run

    TypeError: Cannot read properties of undefined (reading 'Interface')

      5 | import { Injectable } from '@nestjs/common';
    > 6 | import { BalancerSDK, Network } from '@balancer-labs/sdk';
        | ^


      at Function.components [as createInterface] (../node_modules/@balancer-labs/src/contracts/factories/ComposableStablePool__factory.ts:16:9)
 

That fails because all interfaces in balancer-sdk extend ethers.utils.Interface but in later versions of ethers it's moved to ethers.Interface. It's tricky to override this (I manually change yarn.lock file :|) since ethers is a dev dependency for balancer-sdk. Moving it to dependencies will allow us to use whatever ethers version we need and also use balancer-sdk without an issue.

@johngrantuk
Copy link
Member

Thanks for patience here. Should be live on package: v1.1.6-beta.18 and please just let us know if there's any issue.

@ocozalp
Copy link
Author

ocozalp commented May 14, 2024

Thanks @johngrantuk !

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

No branches or pull requests

4 participants