fix: update balance check in derived swap state (#2054)

* update balance check in derived swap state

* replace balance check with correct version of trade
This commit is contained in:
Ian Lapham 2021-07-14 19:23:46 -04:00 committed by GitHub
parent c63bb84f09
commit 631052e6a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -202,7 +202,7 @@ export function useDerivedSwapInfo(toggledVersion: Version): {
const allowedSlippage = useSwapSlippageTolerance(toggledTrade)
// compare input balance to max input based on version
const [balanceIn, amountIn] = [currencyBalances[Field.INPUT], v2Trade?.maximumAmountIn(allowedSlippage)]
const [balanceIn, amountIn] = [currencyBalances[Field.INPUT], toggledTrade?.maximumAmountIn(allowedSlippage)]
if (balanceIn && amountIn && balanceIn.lessThan(amountIn)) {
inputError = t`Insufficient ${amountIn.currency.symbol} balance`