Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jorbuedo committed Jan 16, 2025
1 parent a0c329a commit 405009a
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions apps/wallet-mobile/src/features/Swap/common/SwapProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,21 @@ const swapReducer = (state: SwapState, action: SwapAction) => {

break
case SwapAction.TokenInAmountChanged:
draft.tokenInInput.value = action.value
try {
draft.tokenInInput.value = String(Number(action.value))
} catch {
break
}
if (action.value === '' || action.value === '0') draft.tokenOutInput.value = '0'

break
case SwapAction.TokenOutAmountChanged:
draft.tokenOutInput.value = action.value
draft.lastInputTouched = 'out'
try {
draft.lastInputTouched = 'out'
draft.tokenOutInput.value = String(Number(action.value))
} catch {
break
}
if (action.value === '' || action.value === '0') draft.tokenInInput.value = '0'

break
Expand All @@ -264,7 +272,11 @@ const swapReducer = (state: SwapState, action: SwapAction) => {

break
case SwapAction.WantedPriceInputChanged:
draft.wantedPrice = action.value
try {
draft.wantedPrice = String(Number(action.value))
} catch {
break
}

break
case SwapAction.SwitchTouched:
Expand Down

0 comments on commit 405009a

Please sign in to comment.