Solana.Unity-SDK icon indicating copy to clipboard operation
Solana.Unity-SDK copied to clipboard

Failed to deserialise Jupiter swap transaction

Open ElXanys opened this issue 5 months ago • 2 comments

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

ElXanys avatar Feb 20 '24 03:02 ElXanys