CetusProtocol / cetus-clmm-sui-sdk

The clmm sdk on Sui.
Apache License 2.0
28 stars 20 forks source link

RouterV2 - getBestRouter: From/To coin is undefined #4

Open magiclars-off opened 6 months ago

magiclars-off commented 6 months ago

Hi, I'm trying to utilize the SDK to make programmatic swaps on a website I build.

I'm keep running into the error: ClmmpoolsError: From/To coin is undefined when calling getBestRouter on RouterV2. https://github.com/CetusProtocol/cetus-clmm-sui-sdk/blob/6662cc1426bd7c93cfcc2479abd9859f4e3230b5/src/modules/routerModule.ts#L334

Sometimes I do get a result however most times I get the error.

Any idea how I can fix this?

code:

const res = await sdk.RouterV2.getBestRouter(
'0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX',
'0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN',
8358442,
false,
5,
'')

image