protocol-v2 icon indicating copy to clipboard operation
protocol-v2 copied to clipboard

Outdated jupiterClient endpoints

Open smartpunter opened this issue 1 year ago • 1 comments

jupiterClient from SDK internally uses 2 endpoints: /quote to retrieve swap route and /swap to retrieve transaction data.

Recently jupiter have updated their API and now this functionality is provided by different endpoints: /quote and /transaction.

While SDK allows to specify custom URL for jupiter swap api, at the moment it is impossible to use actual endpoint "https://api.jup.ag/swap/v6"

I would suggest to implement new optional configuration object JupiterURLs with 'quote' and 'transaction' fields. If this fields exists - then use them for requests.

This is much more elegant solution, comparent to current code with hardcoded default routes and api version:

const apiVersionParam =
	this.url === 'https://quote-api.jup.ag' ? '/v6' : '';
const quote = await (
	await fetch(`${this.url}${apiVersionParam}/quote?${params.toString()}`)
).json();

This change would allow users to use current version of JUP API now and in the future.

smartpunter avatar Oct 12 '24 10:10 smartpunter

hey can i work on this?

Freakycoder avatar Oct 22 '25 20:10 Freakycoder