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

Trying to use this but i'm getting NodeWallet not constructor #1

Closed
smartydev42 opened this issue Jun 12, 2024 · 7 comments
Closed

Comments

@smartydev42
Copy link

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
Copy link

Dealing with same error

@newlgbtqdev
Copy link

did you figure any solutions?

@rckprtr
Copy link
Owner

rckprtr commented Jun 13, 2024

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
Copy link

Capture

Yes followed all instructions, building custom script but running in to this issue.

Tried a workaround and ran into type error that Anchor_Wallet was missing.

@smartydev42
Copy link
Author

for me, i didnt use commonjs within my tsconfig, that fixed it.

@rckprtr
Copy link
Owner

rckprtr commented Jun 13, 2024

So the fix for the library might be using es2022 for the module and the target, which ill make the change

@rckprtr
Copy link
Owner

rckprtr commented Jul 9, 2024

This is now resolved with Common JS in the build

@rckprtr rckprtr closed this as completed Jul 9, 2024
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

3 participants