Skip to content

Commit

Permalink
fix: let jupiter decide if shared accounts should be used (#8445)
Browse files Browse the repository at this point in the history
* fix: let jupiter decide if shared accounts should be used

* fix: remove useshaedaccount

---------

Co-authored-by: woody <[email protected]>
  • Loading branch information
NeOMakinG and woodenfurniture authored Jan 1, 2025
1 parent 9169dec commit 6c235ea
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions packages/swapper/src/swappers/JupiterSwapper/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ type GetJupiterSwapArgs = {
fromAddress: string
rawQuote: unknown
toAddress?: string
useSharedAccounts: boolean
feeAccount: string | undefined
}

Expand Down Expand Up @@ -81,15 +80,13 @@ export const getJupiterSwapInstructions = ({
fromAddress,
toAddress,
rawQuote,
useSharedAccounts,
feeAccount,
}: GetJupiterSwapArgs): Promise<
Result<AxiosResponse<SwapInstructionsResponse, any>, SwapErrorRight>
> =>
jupiterService.post<SwapInstructionsResponse>(`${apiUrl}/swap-instructions`, {
userPublicKey: fromAddress,
destinationTokenAccount: toAddress,
useSharedAccounts,
quoteResponse: rawQuote,
dynamicComputeUnitLimit: true,
prioritizationFeeLamports: 'auto',
Expand Down Expand Up @@ -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,
})

Expand Down

0 comments on commit 6c235ea

Please sign in to comment.