Skip to content

Commit

Permalink
fix: stop blocking swap on balance fetching (Uniswap#528)
Browse files Browse the repository at this point in the history
* fix: stop blocking swap on balance fetching

* fix: simplify bool logic
  • Loading branch information
just-toby authored Mar 3, 2023
1 parent e6c02a4 commit fa6a5d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/components/Swap/SwapActionButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ export default function SwapActionButton() {
(!permit2Enabled && approval.state !== SwapApprovalState.APPROVED) ||
error !== undefined ||
(!isWrap && !trade) ||
!(inputCurrencyAmount && inputCurrencyBalance) ||
inputCurrencyBalance.lessThan(inputCurrencyAmount),
!inputCurrencyAmount ||
// If there is no balance loaded, we should default to isDisabled=false
Boolean(inputCurrencyBalance?.lessThan(inputCurrencyAmount)),
[permit2Enabled, approval.state, error, isWrap, trade, inputCurrencyAmount, inputCurrencyBalance]
)

Expand Down
1 change: 0 additions & 1 deletion src/hooks/useCurrencyBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export function useCurrencyBalances(
const tokenBalances = useTokenBalances(account, tokens)
const containsETH: boolean = useMemo(() => currencies?.some((currency) => currency?.isNative) ?? false, [currencies])
const ethBalance = useNativeCurrencyBalances(useMemo(() => (containsETH ? [account] : []), [containsETH, account]))

return useMemo(
() =>
currencies?.map((currency) => {
Expand Down

0 comments on commit fa6a5d2

Please sign in to comment.