Commit 3fe0a5a9 authored by Noah Zinsmeister's avatar Noah Zinsmeister Committed by GitHub

catch possible errors when constructing v1 route (#794)

parent f0e1e921
...@@ -75,10 +75,13 @@ export function useV1TradeLinkIfBetter( ...@@ -75,10 +75,13 @@ export function useV1TradeLinkIfBetter(
} }
const route = pairs && new Route(pairs, input) const route = pairs && new Route(pairs, input)
const v1Trade = let v1Trade: Trade
try {
v1Trade =
route && exactAmount route && exactAmount
? new Trade(route, exactAmount, isExactIn ? TradeType.EXACT_INPUT : TradeType.EXACT_OUTPUT) ? new Trade(route, exactAmount, isExactIn ? TradeType.EXACT_INPUT : TradeType.EXACT_OUTPUT)
: undefined : undefined
} catch {}
let v1HasBetterTrade = false let v1HasBetterTrade = false
if (v1Trade) { if (v1Trade) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment