From ad05ded1501bacd76d507fa88ab49c50aac1297c Mon Sep 17 00:00:00 2001 From: jorbuedo Date: Wed, 27 Sep 2023 17:14:18 +0200 Subject: [PATCH] Update limit price on refresh --- .../CreateOrder/ShowTokenActions/TopTokenActions.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/ShowTokenActions/TopTokenActions.tsx b/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/ShowTokenActions/TopTokenActions.tsx index 69207b17f3..56eed94449 100644 --- a/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/ShowTokenActions/TopTokenActions.tsx +++ b/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/ShowTokenActions/TopTokenActions.tsx @@ -13,7 +13,7 @@ import {useSwapTouched} from '../../../../common/SwapFormProvider' export const TopTokenActions = () => { const strings = useStrings() const orderTypeLabels = [strings.marketButton, strings.limitButton] - const {createOrder, orderTypeChanged} = useSwap() + const {createOrder, limitPriceChanged, orderTypeChanged} = useSwap() const {isBuyTouched, isSellTouched} = useSwapTouched() const isDisabled = !isBuyTouched || !isSellTouched || createOrder.selectedPool === undefined const orderTypeIndex = createOrder.type === 'market' ? 0 : 1 @@ -32,6 +32,11 @@ export const TopTokenActions = () => { } } + const refresh = () => { + refetch() + limitPriceChanged(createOrder.marketPrice) + } + return ( { selected={orderTypeIndex} /> - refetch()} disabled={isDisabled}> +