Open yamen opened 7 months ago
Array-based query strings such as dexes and excludeDexes are serialised using repeating parameters (eg dexes=Openbook&dexes=Saber) instead of as comma separated strings as expected by the server.
dexes
excludeDexes
dexes=Openbook&dexes=Saber
Call with for eg:
{ inputMint: 'So11111111111111111111111111111111111111112', outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', amount: 100000000000, excludeDexes: [ 'Openbook', 'Whirlpool' ] }
The following will be used as the query parameter:
inputMint=So11111111111111111111111111111111111111112&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=100000000000&excludeDexes=Openbook&excludeDexes=Whirlpool
Which will result in the dexes not actually being exlcuded in the resulting quote.
Overriding the client can fix this as a hack:
const jupiterClient = createJupiterApiClient({ basePath: JUPITER_API_URL, queryParamsStringify: (params) => { if (params['excludeDexes']) { params['excludeDexes'] = (params['excludeDexes'] as string[]).join(','); } if (params['dexes']) { params['dexes'] = (params['dexes'] as string[]).join(','); } return querystring(params); } });
But this should ideally be fixed in the runtime where the query string generator can prefer concatenating arrays with commas.
Issue
Array-based query strings such as
dexes
andexcludeDexes
are serialised using repeating parameters (egdexes=Openbook&dexes=Saber
) instead of as comma separated strings as expected by the server.Reproduce
Call with for eg:
The following will be used as the query parameter:
Which will result in the dexes not actually being exlcuded in the resulting quote.
Fix
Overriding the client can fix this as a hack:
But this should ideally be fixed in the runtime where the query string generator can prefer concatenating arrays with commas.