magicblock-labs / magicblock-labs/Solana.Unity-SDK

Failed to deserialise Jupiter swap transaction

Open
#212 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
199
Forks
128
PR merge metrics
No merged PRs in 30d

Description

Jupiter swap does not work for some reason :
`SwapQuoteAg swapQuote = await m_dexJupiter.GetSwapQuote(m_tokenSell.MintAddress, m_tokenBuy.MintAddress, DecimalUtil.ToUlong(m_amount, m_tokenSell.Decimals), SwapMode.ExactIn);
Transaction tx = await m_dexJupiter.Swap(swapQuote);
transaction.Sign(m_walletAccount);
var result = await m_clientRPC.SendTransactionAsync(Convert.ToBase64String(transaction.Serialize()));`

But Orca does :
`SwapQuote swapQuote = await m_dexOrca.GetSwapQuote(m_tokenSell.MintAddress, m_tokenBuy.MintAddress, DecimalUtil.ToUlong(m_amount, m_tokenSell.Decimals), 200);
var _whirlpool = await m_dexOrca.FindWhirlpoolAddress(m_tokenSell.MintAddress, m_tokenBuy.MintAddress);
Transaction tx = await m_dexOrca.SwapWithQuote(_whirlpool.Address, swapQuote);
transaction.Sign(m_walletAccount);
var result = await m_clientRPC.SendTransactionAsync(Convert.ToBase64String(transaction.Serialize()));`

And there's another small glitch : by default for Orca, slippageBPS unit is decimal (0.01), instead of real unit (1).

_Originally posted by @MoonNone in https://github.com/magicblock-labs/Solana.Unity-SDK/discussions/211#discussioncomment-8521557_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the Jupiter GetSwapQuote and Swap flow with the working Orca flow shown in the issue, focusing on Transaction deserialization and Serialize(). Then inspect the Orca slippageBPS handling. Done means Jupiter swap transactions serialize and submit successfully, and Orca uses the intended slippage unit.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
blockchain
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.