-
Notifications
You must be signed in to change notification settings - Fork 208
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
EthersAdapter is not a constructor #287
Comments
I get a similar error |
I am also experiencing this error. I don't know enough about Typescript to know what's going on. Something seems to be wrong with the Typescript compilation and maybe default exports, as my compiler says this is fine, but it fails at runtime. This is what I did as a workaround: /* eslint-disable-next-line @typescript-eslint/ban-ts-comment */
// @ts-ignore
const ethAdapter = new EthersAdapter.default({
ethers,
signer
}); |
Yes seems default exports not working as expected. Would suggest to also export them as Named Exports. @codynhat that workaround works. Then I had similar issue with the rest of the Safe packages and had to do the same: import EthersAdapter from "@gnosis.pm/safe-ethers-lib";
import Safe from "@gnosis.pm/safe-core-sdk";
import SafeServiceClient from "@gnosis.pm/safe-service-client";
...
const ethAdapter = new EthersAdapter.default({ ethers, signer });
const safeSdk = await Safe.default.create({ ethAdapter, safeAddress });
const safeService = new SafeServiceClient.default({ txServiceUrl, ethAdapter }); |
import { ethers } from 'ethers';
import EthersAdapter from '@gnosis.pm/safe-ethers-lib';
const ethAdapter = new EthersAdapter({ ethers, signer }); These are the linting errors I get when I use the code above. When I do
|
What issues were you having with the rest of the Safe packages? When I wrote the code like on my answer above everything worked fine for me. |
Hi @xgambitox, @adriandelgg and @codynhat |
Hi @germartinez, created this minimal repo here so you are able to reproduce it. Thanks for looking into it. |
Hey @xgambitox. The issue is you are using node.js with ESM Modules and we are compiling the core as commonjs. This is a known issue and we opened a ticket to address this. The |
Description
Trying to instantiate a new
EthersAdapter
from@gnosis.pm/safe-ethers-lib
results in the following error:Environment
Steps to reproduce
index.js
package.json
Expected result
No error should be thrown
Additional context
Seems like a problem with module exports
The text was updated successfully, but these errors were encountered: