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

Convert JSBI instances to native numbers using toNumber #55

Open
adrien-flowdesk opened this issue Jul 4, 2024 · 0 comments
Open

Convert JSBI instances to native numbers using toNumber #55

adrien-flowdesk opened this issue Jul 4, 2024 · 0 comments

Comments

@adrien-flowdesk
Copy link

adrien-flowdesk commented Jul 4, 2024

Hello Traderjoe team,

I'm following the guide to perform a trade from the doc but I'm stuck at the step 6. When I execute :

// generates all possible TradeV2 instances
const trades = await TradeV2.getTradesExactIn(
  allRoutes,
  amountIn,
  outputToken,
  isNativeIn,
  isNativeOut,
  publicClient,
  CHAIN_ID
);

It returns every time an empty array because an error is caught.

Once we received results, some TradeV2 instances are created and it looks like the error is thrown when the TradeV2 constructor is executed.

Here is the stack error of the compiled files:

Error: Convert JSBI instances to native numbers using `toNumber`.
    at JSBI.call [as valueOf] (node_modules/@traderjoe-xyz/sdk-v2/node_modules/jsbi/tsc-out/jsbi.mjs:81:15)
    at Function.__toPrimitive (node_modules/@traderjoe-xyz/sdk-core/node_modules/jsbi/tsc-out/jsbi.mjs:1887:39)
    at Function.BigInt (node_modules/@traderjoe-xyz/sdk-core/node_modules/jsbi/tsc-out/jsbi.mjs:56:36)
    at parseBigintIsh (node_modules/@traderjoe-xyz/sdk-core/dist/index.js:147:171)
    at new _CurrencyAmount (node_modules/@traderjoe-xyz/sdk-core/dist/index.js:484:26)
    at new _TokenAmount (node_modules/@traderjoe-xyz/sdk-core/dist/index.js:527:5)
    at new _TradeV2 (node_modules/@traderjoe-xyz/sdk-v2/dist/index.js:31221:25)
    at node_modules/@traderjoe-xyz/sdk-v2/dist/index.js:31464:16

Thanks for your help,
Cheers

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

1 participant