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>( ...@@ -78,14 +78,16 @@ export function useRoutingAPITrade<TTradeType extends TradeType>(
} }
} }
const otherAmount = let otherAmount = undefined
tradeType === TradeType.EXACT_INPUT if (quoteResult) {
? currencyOut && quoteResult if (tradeType === TradeType.EXACT_INPUT && currencyOut) {
? CurrencyAmount.fromRawAmount(currencyOut, quoteResult.quote) otherAmount = CurrencyAmount.fromRawAmount(currencyOut, quoteResult.quote)
: undefined }
: currencyIn && quoteResult
? CurrencyAmount.fromRawAmount(currencyIn, quoteResult.quote) if (tradeType === TradeType.EXACT_OUTPUT && currencyIn) {
: undefined otherAmount = CurrencyAmount.fromRawAmount(currencyIn, quoteResult.quote)
}
}
if (isError || !otherAmount || !route || route.length === 0 || !queryArgs) { if (isError || !otherAmount || !route || route.length === 0 || !queryArgs) {
return { 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