disable swap button if trade not populated (#3542)

This commit is contained in:
Ian Lapham 2022-03-17 16:26:37 -07:00 committed by GitHub
parent a73f59b4ff
commit cbc2ff668e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -94,13 +94,24 @@ export default memo(function SwapButton({ disabled }: SwapButtonProps) {
const disableSwap = useMemo(
() =>
disabled ||
!optimizedTrade ||
!chainId ||
wrapLoading ||
(wrapType !== WrapType.NOT_APPLICABLE && wrapError) ||
approvalState === ApproveOrPermitState.PENDING_SIGNATURE ||
!(inputTradeCurrencyAmount && inputCurrencyBalance) ||
inputCurrencyBalance.lessThan(inputTradeCurrencyAmount),
[disabled, chainId, wrapLoading, wrapType, wrapError, approvalState, inputTradeCurrencyAmount, inputCurrencyBalance]
[
disabled,
optimizedTrade,
chainId,
wrapLoading,
wrapType,
wrapError,
approvalState,
inputTradeCurrencyAmount,
inputCurrencyBalance,
]
)
const actionProps = useMemo((): Partial<ActionButtonProps> | undefined => {