Solana.Unity-SDK
Solana.Unity-SDK copied to clipboard
Failed to deserialise Jupiter swap transaction
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