Merge pull request #297 from blockworks-foundation/lou/jup-max-accounts

Set maxAccounts on Jupiter swaps to limit txn size
This commit is contained in:
Lou-Kamades 2023-10-23 10:27:17 -05:00 committed by GitHub
commit 16e4e1e76c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -151,6 +151,7 @@ export const fetchJupiterTransaction = async (
// This is the ATA account for the output token where the fee will be sent to. If you are swapping from SOL->USDC then this would be the USDC ATA you want to collect the fee.
// feeAccount: 'fee_account_public_key',
slippageBps: Math.ceil(slippage * 100),
maxAccounts: 50
}),
})
).json()

View File

@ -30,6 +30,7 @@ const fetchJupiterRoute = async (
swapMode = 'ExactIn',
feeBps = 0,
onlyDirectRoutes = true,
maxAccounts = 50
) => {
{
const paramsString = new URLSearchParams({
@ -38,6 +39,7 @@ const fetchJupiterRoute = async (
amount: amount.toString(),
slippageBps: Math.ceil(slippage * 100).toString(),
pfeeBps: feeBps.toString(),
maxAccounts: maxAccounts.toString(),
swapMode,
onlyDirectRoutes: `${onlyDirectRoutes}`,
}).toString()