From 6c235ea6e55abf142eab9c1acf433be0e9fcb797 Mon Sep 17 00:00:00 2001 From: NeOMakinG <14963751+NeOMakinG@users.noreply.github.com> Date: Thu, 2 Jan 2025 05:35:15 +0800 Subject: [PATCH] fix: let jupiter decide if shared accounts should be used (#8445) * fix: let jupiter decide if shared accounts should be used * fix: remove useshaedaccount --------- Co-authored-by: woody <125113430+woodenfurniture@users.noreply.github.com> --- .../swapper/src/swappers/JupiterSwapper/utils/helpers.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/swapper/src/swappers/JupiterSwapper/utils/helpers.ts b/packages/swapper/src/swappers/JupiterSwapper/utils/helpers.ts index bfc0ecd8d44..0a861a56200 100644 --- a/packages/swapper/src/swappers/JupiterSwapper/utils/helpers.ts +++ b/packages/swapper/src/swappers/JupiterSwapper/utils/helpers.ts @@ -43,7 +43,6 @@ type GetJupiterSwapArgs = { fromAddress: string rawQuote: unknown toAddress?: string - useSharedAccounts: boolean feeAccount: string | undefined } @@ -81,7 +80,6 @@ export const getJupiterSwapInstructions = ({ fromAddress, toAddress, rawQuote, - useSharedAccounts, feeAccount, }: GetJupiterSwapArgs): Promise< Result, SwapErrorRight> @@ -89,7 +87,6 @@ export const getJupiterSwapInstructions = ({ jupiterService.post(`${apiUrl}/swap-instructions`, { userPublicKey: fromAddress, destinationTokenAccount: toAddress, - useSharedAccounts, quoteResponse: rawQuote, dynamicComputeUnitLimit: true, prioritizationFeeLamports: 'auto', @@ -274,10 +271,6 @@ export const createSwapInstructions = async ({ fromAddress: sendAddress, toAddress: isCrossAccountTrade ? destinationTokenAccount?.toString() : undefined, rawQuote: priceResponse, - // It would be better to use this only if routes number are > 1 and for cross account trades, - // but Jupiter has a bug under the hood when swapping SPL to Token2022 and taking referral fees - // Also it reduce sol numbers and compute units in the end, so TXs fees are smaller - useSharedAccounts: true, feeAccount: affiliateBps !== '0' && tokenAccount ? tokenAccount.toString() : undefined, })