magicblock-labs / magicblock-labs/Solana.Unity-SDK
Failed to deserialise Jupiter swap transaction
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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