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

The liquidityFile is too large. Is there a faster way to get the poolInfo from two tokens? #14

Closed
y0unghe opened this issue Jun 29, 2024 · 5 comments
Assignees

Comments

@y0unghe
Copy link

y0unghe commented Jun 29, 2024

Whenever the swap executes the program will call the following codes to get the poolInfo to load the liquidity file. The file is 467MB. Is there a better and faster way to get the poolInfo?

await raydiumSwap.loadPoolKeys(Raydium_Liquidity_File);

let poolInfo = raydiumSwap.findPoolInfoForTokens(sourceToken, destinationToken);
@mukul013
Copy link

You are right , did you find any other way to find be poolInfo faster ?

@akegaviar akegaviar self-assigned this Jul 27, 2024
@akegaviar
Copy link
Member

Hey guys, a valid point. I updated the project to only use the trimmed version. Check the TLDR quick run section as it has the details https://github.com/chainstacklabs/raydium-sdk-swap-example-typescript/blob/main/README.md#tldr-quick-run

@ultravigilante
Copy link

ultravigilante commented Nov 25, 2024

❯ ts-node ./trimMainnet.ts
Error: Cannot create a string longer than 0x1fffffe8 characters
    at Object.readFileSync (node:fs:441:20)
    at trimMainnetJson (/home/me/repos/work/raydium-sdk-swap-example-typescript/src/trimMainnet.ts:31:39)
    at Object.<anonymous> (/home/me/repos/work/raydium-sdk-swap-example-typescript/src/trimMainnet.ts:58:1)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module.m._compile (/home/me/.local/share/mise/installs/node/22.8.0/lib/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Object.require.extensions.<computed> [as .ts] (/home/me/.local/share/mise/installs/node/22.8.0/lib/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14) {
  code: 'ERR_STRING_TOO_LONG'
}

Unsure if this is OS specific or not, I'm using Arch Linux and Node v22.8.0. Looks like the file is just too big for Node.js at >512MiB.

In my main project I'm using JSONStream to load the JSON in chunks rather than loading the full file at once. Maybe something similar should be done for the trim script?

@kuchaguangjie
Copy link

kuchaguangjie commented Jan 20, 2025

❯ ts-node ./trimMainnet.ts
Error: Cannot create a string longer than 0x1fffffe8 characters
    at Object.readFileSync (node:fs:441:20)
    at trimMainnetJson (/home/me/repos/work/raydium-sdk-swap-example-typescript/src/trimMainnet.ts:31:39)
    at Object.<anonymous> (/home/me/repos/work/raydium-sdk-swap-example-typescript/src/trimMainnet.ts:58:1)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module.m._compile (/home/me/.local/share/mise/installs/node/22.8.0/lib/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Object.require.extensions.<computed> [as .ts] (/home/me/.local/share/mise/installs/node/22.8.0/lib/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14) {
  code: 'ERR_STRING_TOO_LONG'
}

Unsure if this is OS specific or not, I'm using Arch Linux and Node v22.8.0. Looks like the file is just too big for Node.js at >512MiB.

In my main project I'm using JSONStream to load the JSON in chunks rather than loading the full file at once. Maybe something similar should be done for the trim script?

same error on ubuntu 24.04

should re-open this

@cbeauch
Copy link

cbeauch commented Jan 26, 2025

Same error for me

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

6 participants