balancer-sdk
balancer-sdk copied to clipboard
Move ethers from devDependencies to dependencies
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?
Created a PR here: https://github.com/balancer/balancer-sdk/pull/561
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';
This issue is still relevant. I had to downgrade to ethers ^5.0.0 to use balancer-sdk
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!
@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.
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.
Thanks @johngrantuk !