Commit 5817d3bb authored by Vignesh Mohankumar's avatar Vignesh Mohankumar Committed by GitHub

style: simplify otherAmount calculation (#3880)

* simplify otherAmount calculation

* possibly not needed, but adding to keep logic the same
parent bdeb62ad
......@@ -78,14 +78,16 @@ export function useRoutingAPITrade<TTradeType extends TradeType>(
}
}
const otherAmount =
tradeType === TradeType.EXACT_INPUT
? currencyOut && quoteResult
? CurrencyAmount.fromRawAmount(currencyOut, quoteResult.quote)
: undefined
: currencyIn && quoteResult
? CurrencyAmount.fromRawAmount(currencyIn, quoteResult.quote)
: undefined
let otherAmount = undefined
if (quoteResult) {
if (tradeType === TradeType.EXACT_INPUT && currencyOut) {
otherAmount = CurrencyAmount.fromRawAmount(currencyOut, quoteResult.quote)
}
if (tradeType === TradeType.EXACT_OUTPUT && currencyIn) {
otherAmount = CurrencyAmount.fromRawAmount(currencyIn, quoteResult.quote)
}
}
if (isError || !otherAmount || !route || route.length === 0 || !queryArgs) {
return {
......
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