We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef2f414 commit b07e0ceCopy full SHA for b07e0ce
src/swapService/strategies/strategyBalmySDK.ts
@@ -19,7 +19,6 @@ import {
19
getAddress,
20
isAddress,
21
isAddressEqual,
22
- maxUint256,
23
parseAbiParameters,
24
parseUnits,
25
} from "viem"
@@ -368,7 +367,12 @@ export class StrategyBalmySDK {
368
367
369
if (bestQuotes.length === 0) throw new Error("Quotes not found")
370
371
- return bestQuotes
+ return bestQuotes.sort((qa: SwapQuote, qb: SwapQuote) => {
+ // sort by lowest price out/in
372
+ const a = (qa.amountIn * 10n ** 18n) / qa.amountOut
373
+ const b = (qb.amountIn * 10n ** 18n) / qb.amountOut
374
+ return Number(a > b) || -(a < b)
375
+ })
376
}
377
378
// async #binarySearchOverswapQuote(swapParams: SwapParams) {
0 commit comments