diff --git a/src/common/constants/settings.ts b/src/common/constants/settings.ts index 7ac5907bd..6e4fc49b0 100644 --- a/src/common/constants/settings.ts +++ b/src/common/constants/settings.ts @@ -10,9 +10,9 @@ export const MinerFeeDecimals = 2; export const defaultSlippage = 3; export const MIN_SLIPPAGE = 0.01; -export const MAX_SLIPPAGE = 1_000_000; +export const MAX_SLIPPAGE = 50; -export const INFINITY_SLIPPAGE = 1_000_000_000.5; +export const INFINITY_SLIPPAGE = 50; export const SlippageDecimals = 2; export const PoolFeeMax = 0.25; diff --git a/src/components/OperationSettings/OperationSettings.tsx b/src/components/OperationSettings/OperationSettings.tsx index 77677c235..f96aed0ef 100644 --- a/src/components/OperationSettings/OperationSettings.tsx +++ b/src/components/OperationSettings/OperationSettings.tsx @@ -17,7 +17,6 @@ import { filter, skip } from 'rxjs'; import { MIN_NITRO } from '../../common/constants/erg'; import { defaultSlippage, - INFINITY_SLIPPAGE, MAX_SLIPPAGE, MIN_SLIPPAGE, } from '../../common/constants/settings'; @@ -127,11 +126,7 @@ export const OperationSettings: FC = ({ filter((value) => !!value && value >= MIN_SLIPPAGE), ), (slippage) => { - if (slippage === INFINITY_SLIPPAGE) { - setSlippage(INFINITY_SLIPPAGE); - } else { - setSlippage(Math.min(slippage, MAX_SLIPPAGE)); - } + setSlippage(Math.min(slippage, MAX_SLIPPAGE)); }, [slippage, nitro], ); @@ -278,9 +273,7 @@ export const OperationSettings: FC = ({ size="large" style={{ backgroundColor: - slippage === INFINITY_SLIPPAGE - ? 'var(--spectrum-error-border-color)' - : slippageCheck(slippage) || slippageTxFailCheck(slippage) + slippageCheck(slippage) || slippageTxFailCheck(slippage) ? 'var(--spectrum-warning-border-color)' : 'var(--spectrum-btn-default-color)', }} @@ -288,8 +281,7 @@ export const OperationSettings: FC = ({ - {slippage === INFINITY_SLIPPAGE ? `∞ ` : `${slippage}% `} - slippage + {slippage}% slippage diff --git a/src/components/OperationSettings/SlippageInput/SlippageInput.tsx b/src/components/OperationSettings/SlippageInput/SlippageInput.tsx index 80c5c7bdd..e3cec7391 100644 --- a/src/components/OperationSettings/SlippageInput/SlippageInput.tsx +++ b/src/components/OperationSettings/SlippageInput/SlippageInput.tsx @@ -6,10 +6,7 @@ import { Control, Flex, Input, - Switch, - Typography, } from '@ergolabs/ui-kit'; -import { Trans } from '@lingui/macro'; import { ChangeEvent, FC } from 'react'; import styled from 'styled-components'; @@ -47,76 +44,70 @@ const _SlippageInput: FC = ({ return ( - {value !== INFINITY_SLIPPAGE && ( - - - - {SLIPPAGE_OPTIONS.sort().map((val, index) => ( - - - - ))} - - + + + {SLIPPAGE_OPTIONS.sort().map((val, index) => ( + + - - - - )} - - - - handleClickSlippage(e ? INFINITY_SLIPPAGE : defaultSlippage) - } - /> - - - Infinity slippage - + ))} + + + + + + {/**/} + {/* */} + {/* */} + {/* handleClickSlippage(e ? INFINITY_SLIPPAGE : defaultSlippage)*/} + {/* }*/} + {/* />*/} + {/* */} + {/* */} + {/* Infinity slippage*/} + {/* */} + {/**/} - - - Using infinity slippage may cause permanent loss of all your funds - in a order. Make sure you understand what you are doing. If not, - reduce the slippage tolerance. - - } - /> - + {/**/} + {/* */} + {/* Using infinity slippage may cause permanent loss of all your funds*/} + {/* in a order. Make sure you understand what you are doing. If not,*/} + {/* reduce the slippage tolerance.*/} + {/* */} + {/* }*/} + {/* />*/} + {/**/} ); };