From 715465499dd9d1b57c7540d2dd985da19f55039e Mon Sep 17 00:00:00 2001 From: Javier Bueno Date: Fri, 20 Oct 2023 18:51:34 +0200 Subject: [PATCH] fix(swap): disable swap when limit 0 --- .../src/features/Swap/common/SwapFormProvider.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/wallet-mobile/src/features/Swap/common/SwapFormProvider.tsx b/apps/wallet-mobile/src/features/Swap/common/SwapFormProvider.tsx index 3a03068f58..c1ec1d45a0 100644 --- a/apps/wallet-mobile/src/features/Swap/common/SwapFormProvider.tsx +++ b/apps/wallet-mobile/src/features/Swap/common/SwapFormProvider.tsx @@ -39,8 +39,8 @@ export const SwapFormProvider = ({ const {tokenId: buyTokenId, quantity: buyQuantity} = orderData.amounts.buy const {tokenId: sellTokenId, quantity: sellQuantity} = orderData.amounts.sell - const buyTokenInfo = useTokenInfo({wallet, tokenId: orderData.amounts.buy.tokenId}) - const sellTokenInfo = useTokenInfo({wallet, tokenId: orderData.amounts.sell.tokenId}) + const buyTokenInfo = useTokenInfo({wallet, tokenId: buyTokenId}) + const sellTokenInfo = useTokenInfo({wallet, tokenId: sellTokenId}) const balances = useBalances(wallet) const sellbalance = Amounts.getAmount(balances, sellTokenId).quantity @@ -99,10 +99,11 @@ export const SwapFormProvider = ({ state.sellQuantity.isTouched && !Quantities.isZero(buyQuantity) && !Quantities.isZero(sellQuantity) && + !Quantities.isZero(sellQuantity) && state.buyQuantity.error === undefined && state.sellQuantity.error === undefined && ((orderData.type === 'limit' && orderData.limitPrice !== undefined && !Quantities.isZero(orderData.limitPrice)) || - orderData.selectedPoolCalculation !== undefined) + (orderData.type === 'market' && orderData.selectedPoolCalculation !== undefined)) const actions = React.useRef({ sellTouched: () => dispatch({type: SwapFormActionType.SellTouched}),