fix(v1 swap): exact out swaps not working

This commit is contained in:
Moody Salem 2020-07-27 08:44:37 -05:00
parent e78b6d61f2
commit 6a311aa6d7
No known key found for this signature in database
GPG Key ID: 8CB5CD10385138DB

@ -123,14 +123,16 @@ export function useV1Trade(
pairs = [inputPair, outputPair]
}
const route = inputCurrency && pairs && pairs.length > 0 && new Route(pairs, inputCurrency)
const route = inputCurrency && pairs && pairs.length > 0 && new Route(pairs, inputCurrency, outputCurrency)
let v1Trade: Trade | undefined
try {
v1Trade =
route && exactAmount
? new Trade(route, exactAmount, isExactIn ? TradeType.EXACT_INPUT : TradeType.EXACT_OUTPUT)
: undefined
} catch {}
} catch (error) {
console.error('Failed to create V1 trade', error)
}
return v1Trade
}