Skip to content

Commit 802574a

Browse files
authored
fix: remove platformFee when no feeAccount (#441)
1 parent 1fcbafd commit 802574a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/ui/src/contexts/SwapProvider/providers/JupiterProvider.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,15 @@ export const JupiterProvider: SwapProvider = {
149149
throw swapError(CommonError.MismatchingProvider);
150150
}
151151

152+
// If no fee account is available, remove platformFee from quote to maintain consistency
153+
// Jupiter API expects either both platformFee + feeAccount or neither
154+
const cleanedQuote = feeAccount
155+
? quote
156+
: {
157+
...quote,
158+
platformFee: null,
159+
};
160+
152161
const [txResponse, buildTxError] = await resolve(
153162
fetchAndVerify(
154163
[
@@ -159,10 +168,10 @@ export const JupiterProvider: SwapProvider = {
159168
'Content-Type': 'application/json',
160169
},
161170
body: JSON.stringify({
162-
quoteResponse: quote,
171+
quoteResponse: cleanedQuote,
163172
userPublicKey: userAddress,
164173
dynamicComputeUnitLimit: true, // Gives us a higher chance of the transaction landing
165-
feeAccount,
174+
...(feeAccount && { feeAccount }),
166175
}),
167176
},
168177
],

0 commit comments

Comments
 (0)