0xtaodev / jupiter-python-sdk Goto Github PK
View Code? Open in Web Editor NEWJupiter Python SDK is a Python library that allows you to use most of Jupiter features.
Home Page: https://pypi.org/project/jupiter-python-sdk/
License: MIT License
Jupiter Python SDK is a Python library that allows you to use most of Jupiter features.
Home Page: https://pypi.org/project/jupiter-python-sdk/
License: MIT License
hello,
good repo and ty sir.
i only have oen probleme, every rtx have this error msg :Program Error: "Instruction #6 Failed - Slippage tolerance exceeded"
have a good day <3
I am very experienced with Python but fairly new to APIs:
result = await async_client.send_raw_transaction(txn=bytes(signed_txn), opts=opts)
returns an error:
UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.
but I am using all of the default urls here:
jupiter = Jupiter(
async_client=async_client,
keypair=private_key,
quote_api_url="https://quote-api.jup.ag/v6/quote?",
swap_api_url="https://quote-api.jup.ag/v6/swap",
open_order_api_url="https://jup.ag/api/limit/v1/createOrder",
cancel_orders_api_url="https://jup.ag/api/limit/v1/cancelOrders",
query_open_orders_api_url="https://jup.ag/api/limit/v1/openOrders?wallet=",
query_order_history_api_url="https://jup.ag/api/limit/v1/orderHistory",
query_trade_history_api_url="https://jup.ag/api/limit/v1/tradeHistory"
)
I am not sure if this is the right place for my question, but what exactly am I missing? Thank you so much for putting all of this together!
Can we add platform fees on the swap function? Or do I have to do this manually?
Also is the input amount in Lamport or sol?
system : macos latest
python: 3.11
pip : 23.1.2
when i run pip install jupiter-python-sdk
i got this error:
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting jupiter-python-sdk
Downloading https://mirrors.aliyun.com/pypi/packages/32/be/053abcdb337db09bce91c64ed82def74eac8306ef75d853fb98c1342f9ea/jupiter-python-sdk-0.0.1.1.tar.gz (19 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/5h/9tzfcvhs36d06wtlk00000gn/T/pip-install-pzjq8p3c/jupiter-python-sdk_30c0824dbb0e41cd9c3a956db90b7b5c/setup.py", line 7, in <module>
with codecs.open(os.path.join(here, "jupiter_python_sdk/README.md"), encoding="utf-8") as fh:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen codecs>", line 906, in open
FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/5h/9tzfcvhs36d06wtlk00000gn/T/pip-install-pzjq8p3c/jupiter-python-sdk_30c0824dbb0e41cd9c3a956db90b7b5c/jupiter_python_sdk/README.md'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Hi, I can fetch data without authentication, but have run into an issue when trying to execute a swap.
I’m getting these two problems:
import “solders.pubkey” could not be resolved from the source.
import “solders.keypair” could not be resolved from the source.
i’m running on Windows through VSCode. I’ve tried to resolve playing with python interpreter without success. Also pip list shows solders installed.
What’s the best way to troubleshoot this issue?
Hi,
I have a problem with priority fees; when I try to pass this argument, it returns an error:
async def safe_swap(input_mint: str, output_mint: str, amount: int, slippage_bps: int, prioritization_fee_lamports: int):
async_client = AsyncClient(rpc_url)
jupiter = Jupiter(
async_client=async_client,
keypair=KEYPAIR,
quote_api_url=quote_api_url,
swap_api_url=swap_api_url
)
try:
transaction_data = await jupiter.swap(
input_mint=input_mint,
output_mint=output_mint,
amount=amount,
slippage_bps=slippage_bps,
prioritization_fee_lamports=prioritization_fee_lamports
)
Action parsed: swap: An error occurred: Jupiter.swap() got an unexpected keyword argument 'prioritization_fee_lamports'
fyi callback for this arg
prioritization_fee_lamports = 1500000
Is it possible to correct?
Thanks a lot for your great work on this git
Hi!
just tried your wrapper it seems that there is circular import...
ImportError: cannot import name 'TypedDict' from partially initialized module 'typing_extensions' (most likely due to a circular import)
i'm running Python 3.12.2 on win10...
thanks
Hi, thank you for writing this python sdk for Jupiter! Are you able to append the execution swap code to the readme code example?
Thank you!
Hi. I get the following:::: .local/lib/python3.9/site-packages/jupiter_python_sdk/jupiter.py", line 676, in swap
transaction_data = httpx.post(url=self.ENDPOINT_APIS_URL['SWAP'], json=transaction_parameters).json()['swapTransaction']
KeyError: 'swapTransactio
Jupiter allows BETA TO routing which allows you to trade pairs that otherwise fail with a "not tradeable" or other error message. How can we add the beta routing to our routes for token swaps?
Anyone figured this out yet?
I just want to say thank you for sharing your code.
It's been very difficult trying to figure out how to deserialize, sign and serialize the Versioned Transactions.
1 million thank yous.
I need combine several transactions from Jupiter, so need this function. https://docs.jup.ag/docs/apis/swap-api#instructions-instead-of-transaction. Can you add? Thank you.
How do we add priority fees or compute units to this to ensure the transaction is successful?
I think this repo only works for tokens as supported by Jupiter token list. How to make it work for all tokens?
Hey, great work on SDK!
There is issue with exclude_dexes in jupiter swap function
quote_url += "&excludeDexes=" + ','.join(exclude_dexes).lower -> quote_url += "&excludeDexes=" + ','.join(exclude_dexes)
remove .lower because the query fails
also priority_fee needs to be added to swap Line:645
priority_fee: int=0
and here Line:690
transaction_parameters = {
"quoteResponse": quoteResponse,
"prioritizationFeeLamports":priority_fee,
"userPublicKey": user_public_key,
"wrapAndUnwrapSol": wrap_unwrap_sol
}
and again thanks for great job!
Hey! Thanks for the library. I found, that requirements.txt have outdated versions of solders, solana-py and anchorpy:
solders==0.18.1
solana==0.30.2
anchorpy==0.18.0
While latest versions are:
solders==0.21.0
solana==0.34.0
anchorpy==0.20.0
Is it possible to make these requirements less strict? I am struggling to add this lib as dependency with poetry because of this conflicts.
The transaction hash can be generated, but the transaction cannot be actually executed, and the mainnet cannot find the transaction.
How could I make swaps in devnet?
Ah, it's me again ;)
I'm currently facing the following issue: I know it's not the library's issue but the DEX jup aggregator. When I snap a newly created pools on Raydium, roughly within the first 10 to 20 seconds, and then execute the trade, it always returns the message 'The token whatever is not tradable :('.
However, when I search the token address on Dexscreener or Birdeye ... oh my, is already there and tradable 💯.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.