Skip to content

Commit

Permalink
fix(swap): disable eth flow selling on buy orders (#3574)
Browse files Browse the repository at this point in the history
* fix(swap): disable eth flow selling on buy orders

* refactor: rename probableTypedValue
  • Loading branch information
alfetopito authored Jan 9, 2024
1 parent 102a2c4 commit 17f484b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions apps/cowswap-frontend/src/legacy/state/swap/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,19 @@ export default createReducer<SwapState>(initialState, (builder) =>
const { chainId, recipient, inputCurrencyId, outputCurrencyId, inputCurrencyAmount, outputCurrencyAmount } =
payload

const typedValue = state.independentField === Field.INPUT ? inputCurrencyAmount : outputCurrencyAmount
const defaultTypedValue = state.independentField === Field.INPUT ? inputCurrencyAmount : outputCurrencyAmount

const { independentField, typedValue } = getEthFlowOverridesOnSelect(
inputCurrencyId,
state.independentField,
defaultTypedValue || state.typedValue,
state
)

return {
...state,
typedValue: typedValue ?? state.typedValue,
typedValue,
independentField,
chainId,
[Field.INPUT]: {
currencyId: inputCurrencyId ?? null,
Expand Down

0 comments on commit 17f484b

Please sign in to comment.