disable swap button if trade not populated (#3542)
This commit is contained in:
parent
a73f59b4ff
commit
cbc2ff668e
@ -94,13 +94,24 @@ export default memo(function SwapButton({ disabled }: SwapButtonProps) {
|
|||||||
const disableSwap = useMemo(
|
const disableSwap = useMemo(
|
||||||
() =>
|
() =>
|
||||||
disabled ||
|
disabled ||
|
||||||
|
!optimizedTrade ||
|
||||||
!chainId ||
|
!chainId ||
|
||||||
wrapLoading ||
|
wrapLoading ||
|
||||||
(wrapType !== WrapType.NOT_APPLICABLE && wrapError) ||
|
(wrapType !== WrapType.NOT_APPLICABLE && wrapError) ||
|
||||||
approvalState === ApproveOrPermitState.PENDING_SIGNATURE ||
|
approvalState === ApproveOrPermitState.PENDING_SIGNATURE ||
|
||||||
!(inputTradeCurrencyAmount && inputCurrencyBalance) ||
|
!(inputTradeCurrencyAmount && inputCurrencyBalance) ||
|
||||||
inputCurrencyBalance.lessThan(inputTradeCurrencyAmount),
|
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 => {
|
const actionProps = useMemo((): Partial<ActionButtonProps> | undefined => {
|
||||||
|
Loading…
Reference in New Issue
Block a user