allbridge-io / allbridge-core-js-sdk

21 stars 12 forks source link

Use higher rate limit Jupiter URL #88

Open abunsen opened 1 month ago

abunsen commented 1 month ago

This PR adjusts the API provided for the jupiter package. The default API was updated for swap/quote to leverage jupiterapi.com. The API offers higher rate limits (up to 10 rps) along with a faster updated market cache. The jupiterapi.com market cache surfaces newly launched tokens faster since it doesn't require a certain volume/liquidity threshold to be met, along with an improved cadence of it being updated. _With that said, the API does take a small platform fee (0.2%) on swaps given the stability/rate limits/new markets it provides.

More details can be found on the site.

opanasiuk-oleksii commented 1 month ago

Hi, @abunsen!

Thank you for your pull request! Have you considered overriding the jupiterUrl property during the SDK initialization? This could help resolve the issue you're addressing.

Here's an example of how to do it:

import { AllbridgeCoreSdk, nodeRpcUrlsDefault, mainnet } from "@allbridge/bridge-core-sdk";
const sdk = new AllbridgeCoreSdk(
  nodeRpcUrlsDefault,
  {
    ...mainnet,
    jupiterUrl: "https://public.jupiterapi.com"
  });

You can also review all available configuration options here.

Once again, thank you for contributing!

gholam-deblan commented 1 month ago

0.2% fee is not small