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

DLMM.create is not a function #125

Open
keyboard-warlord opened this issue Dec 11, 2024 · 5 comments
Open

DLMM.create is not a function #125

keyboard-warlord opened this issue Dec 11, 2024 · 5 comments

Comments

@keyboard-warlord
Copy link

Hello!

I recently installed this library as a dependency for my project, but I encountered an issue right at the start. I'm trying to connect to a specific pool following the steps outlined in the documentation: DLMM SDK Integration Guide.

Here is my code:

import DLMM, { StrategyType } from "@meteora-ag/dlmm";

const dlmmPool = await DLMM.create(alchemyApi, details.poolAddress);

However, when I start the project, I get the following error:

const dlmmPool = await DLMM.create(alchemyApi, details.poolAddress);
                                ^

TypeError: DLMM.create is not a function

Could you please clarify how I can resolve this issue?

For context:

Type definitions are being imported and recognized correctly.
If you need any additional information, feel free to let me know.
Thank you!

@professorr-x
Copy link

this works for me:
const dlmmPool = await DLMM.default.create(alchemyApi, details.poolAddress);

@Magnuskeel
Copy link

I have exactly the same issue unfortunately. I think it might have to do with the tsconfig(module, target settings), but honestly tried everything at this point.... like the OP I am able to import and enter to debug the code but the static create method returns as undefined.

@keyboard-warlord
Copy link
Author

I have exactly the same issue unfortunately. I think it might have to do with the tsconfig(module, target settings), but honestly tried everything at this point.... like the OP I am able to import and enter to debug the code but the static create method returns as undefined.

Yes, I also concluded that the issue is likely with my environment setup. However, I'm using meteora-sdk in only a very small part of my project. So, I decided to work around it by simply copying the repository and using DLMM directly from the source files, without building it.

@Magnuskeel
Copy link

After some trial and error I came up with a small casting hack given our environments ;)

The import statement remains as documented but you need to access the "default" property of what seems to the the DLMM object even though the compiler wont let you.

const dlmm = ((DLMM)as any).default;
const dlmmPool = await dlmm.create(connection, new PublicKey(METEORA_POOL));

This should work.

@fantarics
Copy link

After some trial and error I came up with a small casting hack given our environments ;)

The import statement remains as documented but you need to access the "default" property of what seems to the the DLMM object even though the compiler wont let you.

const dlmm = ((DLMM)as any).default; const dlmmPool = await dlmm.create(connection, new PublicKey(METEORA_POOL));

This should work.

Thank you for your input! solved my issues too

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