diff --git a/README.md b/README.md index 713c0e8..27b9bd7 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,16 @@ If you encounter ```ImportError: cannot import name 'sync_native' from 'spl.toke 1. Go to https://github.com/michaelhly/solana-py/tree/master/src/spl/token and download ```instructions.py``` 2. In your packages folder, replace ```spl/token/instructions.py``` with the one you just downloaded. +### Using custom URLs + +You can set custom URLs via environment variables for any self-hosted Jupiter APIs. Like the [V6 Swap API](https://station.jup.ag/docs/apis/self-hosted) or [QuickNode's Metis API](https://marketplace.quicknode.com/add-on/metis-jupiter-v6-swap-api). Here are the ENV vars: + +``` +QUOTE_API_URL=https://jupiter-swaps.quiknode.pro/D3ADB33F/quote? +SWAP_API_URL=https://jupiter-swaps.quiknode.pro/D3ADB33F/swap +``` + + ### Here is a code snippet on how to use the SDK ```py import base58 diff --git a/src/jupiter_python_sdk/jupiter.py b/src/jupiter_python_sdk/jupiter.py index 56e8600..4a78d37 100644 --- a/src/jupiter_python_sdk/jupiter.py +++ b/src/jupiter_python_sdk/jupiter.py @@ -1,3 +1,4 @@ +import os import base64 import json import time @@ -528,8 +529,8 @@ async def get_available_dca_tokens( class Jupiter(): ENDPOINT_APIS_URL = { - "QUOTE": "https://quote-api.jup.ag/v6/quote?", - "SWAP": "https://quote-api.jup.ag/v6/swap", + "QUOTE": os.getenv("QUOTE_API_URL") || "https://quote-api.jup.ag/v6/quote?", + "SWAP": os.getenv("SWAP_API_URL") || "https://quote-api.jup.ag/v6/swap", "OPEN_ORDER": "https://jup.ag/api/limit/v1/createOrder", "CANCEL_ORDERS": "https://jup.ag/api/limit/v1/cancelOrders", "QUERY_OPEN_ORDERS": "https://jup.ag/api/limit/v1/openOrders?wallet=",