OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Legacy Jupiter Swap Python

  • Thread starter Thread starter Chester Reynolds
  • Start date Start date
C

Chester Reynolds

Guest
I am going to swap tokens on Jupiter as legacy transaction not versioned transaction in python. I used v4 jupiter api but after running below code I am not sure about the reason of error but decode json error caused.

Code:
`input_mint = "So11111111111111111111111111111111111111112"  # SOL
output_mint = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"  # USDC
amount = 100000000  # 0.1 SOL in lamports
slippage_bps = 50  # 0.5% slippage

quote_url = f"https://quote-api.jup.ag/v4/quote?inputMint={input_mint}&outputMint={output_mint}&amount={amount}&slippageBps={slippage_bps}"
requests.get(quote_url).json()`

If you have any idea or opinion for above code please let me know.

Also if you have source code to perform the legacy jupiter swap transaction in python, please share your experience with me. Thanks
<p>I am going to swap tokens on Jupiter as legacy transaction not versioned transaction in python.
I used v4 jupiter api but after running below code I am not sure about the reason of error but decode json error caused.</p>
<pre><code>`input_mint = "So11111111111111111111111111111111111111112" # SOL
output_mint = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" # USDC
amount = 100000000 # 0.1 SOL in lamports
slippage_bps = 50 # 0.5% slippage

quote_url = f"https://quote-api.jup.ag/v4/quote?inputMint={input_mint}&outputMint={output_mint}&amount={amount}&slippageBps={slippage_bps}"
requests.get(quote_url).json()`
</code></pre>
<p>If you have any idea or opinion for above code please let me know.</p>
<p>Also if you have source code to perform the legacy jupiter swap transaction in python, please share your experience with me.
Thanks</p>
 

Latest posts

S
Replies
0
Views
1
Safwan Aipuram
S
Top