order exactout swap amounts correctly
This commit is contained in:
parent
920a901a66
commit
94b8aec4d9
|
@ -160,8 +160,10 @@ export const handleGetRoutes = async (
|
||||||
routes: RouteInfo[]
|
routes: RouteInfo[]
|
||||||
bestRoute: RouteInfo
|
bestRoute: RouteInfo
|
||||||
}[]
|
}[]
|
||||||
).sort(
|
).sort((a, b) =>
|
||||||
(a, b) => Number(b.bestRoute.outAmount) - Number(a.bestRoute.outAmount)
|
swapMode === 'ExactIn'
|
||||||
|
? Number(b.bestRoute.outAmount) - Number(a.bestRoute.outAmount)
|
||||||
|
: Number(a.bestRoute.inAmount) - Number(b.bestRoute.inAmount)
|
||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
routes: sortedByBiggestOutAmount[0].routes,
|
routes: sortedByBiggestOutAmount[0].routes,
|
||||||
|
|
Loading…
Reference in New Issue