Trying to use this but i'm getting NodeWallet not constructor
Closed this issue · 7 comments
smartydev42 commented
const wallet = new NodeWallet(Keypair.generate()); //note this is not used
this errors with
const wallet = new NodeWallet(Keypair.generate()); //note this is not used
^
TypeError: NodeWallet is not a constructor
unsure what i'm doing wrong.
newlgbtqdev commented
Dealing with same error
newlgbtqdev commented
did you figure any solutions?
rckprtr commented
Can you show me the contents of nodewallet.d.ts
? Do you just clone the project and npm i
it?
node -v
v20.10.0
Check the import also
import NodeWallet from "@coral-xyz/anchor/dist/cjs/nodewallet";
newlgbtqdev commented
smartydev42 commented
for me, i didnt use commonjs within my tsconfig, that fixed it.
rckprtr commented
So the fix for the library might be using es2022 for the module and the target, which ill make the change
rckprtr commented
This is now resolved with Common JS in the build