Skip to content

Commit 3dd72c6

Browse files
authored
fix: mev protection (#2868)
* fix: mev protection * fix
1 parent 3651b4f commit 3dd72c6

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

apps/kyberswap-interface/src/components/SwapForm/AddMEVProtectionModal.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,10 @@ export default function AddMEVProtectionModal({ isOpen, onClose }: { isOpen: boo
131131
</Flex>
132132
<Text>
133133
<Trans>
134-
Note that adding the RPC endpoint automatically is only available via the MetaMask wallet. If you are
135-
using another wallet or would like to add the RPC endpoint to your wallet manually, please refer to this
136-
</Trans>{' '}
137-
<ExternalLink href="https://docs.kyberswap.com/getting-started/quickstart/faq#how-to-change-rpc-in-metamask">
138-
<Trans>guide</Trans>
139-
</ExternalLink>
140-
<Trans>. Please make sure you understand how it works and use at your own caution.</Trans>
134+
Note that adding the RPC endpoint automatically is only available via the MetaMask wallet. If you’re
135+
using another wallet please add the RPC endpoint manually in your wallet’s custom network settings.
136+
Please make sure you understand how it works and use it at your own caution.
137+
</Trans>
141138
</Text>
142139
</Flex>
143140
</Text>

apps/kyberswap-interface/src/components/SwapForm/SlippageSettingGroup.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import InfoHelper from 'components/InfoHelper'
1313
import AddMEVProtectionModal, { KYBER_SWAP_RPC } from 'components/SwapForm/AddMEVProtectionModal'
1414
import SlippageSetting from 'components/SwapForm/SlippageSetting'
1515
import { MouseoverTooltip, TextDashed } from 'components/Tooltip'
16-
import { CONNECTION } from 'components/Web3Provider'
1716
import { APP_PATHS } from 'constants/index'
1817
import { useActiveWeb3React, useWeb3React } from 'hooks'
1918
import useMixpanel, { MIXPANEL_TYPE } from 'hooks/useMixpanel'
@@ -43,7 +42,7 @@ export default function SlippageSettingGroup({
4342
}) {
4443
const upToXXSmall = useMedia(`(max-width: ${MEDIA_WIDTHS.upToXXSmall}px)`)
4544
const theme = useTheme()
46-
const { chainId, walletKey } = useActiveWeb3React()
45+
const { chainId } = useActiveWeb3React()
4746
const { active } = useWeb3React()
4847
const [showMevModal, setShowMevModal] = useState(false)
4948
const { mixpanelHandler } = useMixpanel()
@@ -60,9 +59,8 @@ export default function SlippageSettingGroup({
6059
const [paymentToken] = usePaymentToken()
6160
const { isSlippageControlPinned } = useSlippageSettingByPage()
6261
const isPartnerSwap = window.location.pathname.startsWith(APP_PATHS.PARTNER_SWAP)
63-
const isUsingMetamask = walletKey === CONNECTION.METAMASK_RDNS
6462
let rightButton =
65-
KYBER_SWAP_RPC[chainId] && isUsingMetamask && active && !isPartnerSwap && !isMobile && !isTablet ? (
63+
KYBER_SWAP_RPC[chainId] && active && !isPartnerSwap && !isMobile && !isTablet ? (
6664
<PriceAlertButton onClick={addMevProtectionHandler}>
6765
<Shield size={14} color={theme.subText} />
6866
<Text color={theme.subText} style={{ whiteSpace: 'nowrap' }}>

apps/kyberswap-interface/src/components/SwapForm/SwapModal/SwapDetails/index.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { useSwapFormContext } from 'components/SwapForm/SwapFormContext'
2020
import ValueWithLoadingSkeleton from 'components/SwapForm/SwapModal/SwapDetails/ValueWithLoadingSkeleton'
2121
import { TooltipTextOfSwapFee } from 'components/SwapForm/TradeSummary'
2222
import { MouseoverTooltip, TextDashed } from 'components/Tooltip'
23-
import { CONNECTION } from 'components/Web3Provider'
2423
import { APP_PATHS } from 'constants/index'
2524
import { useActiveWeb3React, useWeb3React } from 'hooks'
2625
import useENS from 'hooks/useENS'
@@ -46,7 +45,7 @@ export type Props = {
4645
} & Optional<Pick<DetailedRouteSummary, 'gasUsd' | 'executionPrice' | 'priceImpact'>>
4746

4847
export default function SwapDetails({ isLoading, gasUsd, minimumAmountOut, priceImpact, buildData }: Props) {
49-
const { chainId, networkInfo, account, walletKey } = useActiveWeb3React()
48+
const { chainId, networkInfo, account } = useActiveWeb3React()
5049
const { active } = useWeb3React()
5150
const [showMevModal, setShowMevModal] = useState(false)
5251
const theme = useTheme()
@@ -116,10 +115,8 @@ export default function SwapDetails({ isLoading, gasUsd, minimumAmountOut, price
116115
const slippageStatus = checkRangeSlippage(rawSlippage, cat)
117116
const upToXXSmall = useMedia(`(max-width: ${MEDIA_WIDTHS.upToXXSmall}px)`)
118117
const isPartnerSwap = window.location.pathname.startsWith(APP_PATHS.PARTNER_SWAP)
119-
const isUsingMetamask = walletKey === CONNECTION.METAMASK_RDNS
120118
const addMevButton =
121119
KYBER_SWAP_RPC[chainId] &&
122-
isUsingMetamask &&
123120
active &&
124121
!isPartnerSwap &&
125122
slippageStatus === SLIPPAGE_STATUS.HIGH &&

0 commit comments

Comments
 (0)