Skip to content

Commit

Permalink
refactor: remove wrong network toast code (#1907)
Browse files Browse the repository at this point in the history
  • Loading branch information
fionnachan committed Sep 19, 2024
1 parent 65ec220 commit c1893a6
Showing 1 changed file with 1 addition and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ import { useSwitchNetworkWithConfig } from '../../hooks/useSwitchNetworkWithConf
import { useIsConnectedToArbitrum } from '../../hooks/useIsConnectedToArbitrum'
import { useIsConnectedToOrbitChain } from '../../hooks/useIsConnectedToOrbitChain'
import { errorToast, warningToast } from '../common/atoms/Toast'
import { ExternalLink } from '../common/ExternalLink'
import { useAccountType } from '../../hooks/useAccountType'
import { DOCS_DOMAIN, GET_HELP_LINK } from '../../constants'
import { DOCS_DOMAIN } from '../../constants'
import {
AdvancedSettings,
useDestinationAddressStore
Expand Down Expand Up @@ -83,18 +82,6 @@ import { useIsBatchTransferSupported } from '../../hooks/TransferPanel/useIsBatc
import { normalizeTimestamp } from '../../state/app/utils'
import { getDestinationAddressError } from './hooks/useDestinationAddressError'

const networkConnectionWarningToast = () =>
warningToast(
<>
Network connection issue. Please contact{' '}
<ExternalLink href={GET_HELP_LINK} className="underline">
support
</ExternalLink>
.
</>,
{ autoClose: false }
)

export function TransferPanel() {
const { tokenFromSearchParams, setTokenQueryParam } =
useTokenFromSearchParams()
Expand Down Expand Up @@ -685,21 +672,6 @@ export function TransferPanel() {

const sourceChainId = latestNetworks.current.sourceChain.id
const destinationChainId = latestNetworks.current.destinationChain.id
const connectedChainId = networks.sourceChain.id
const sourceChainEqualsConnectedChain = sourceChainId === connectedChainId

// Transfer is invalid if the connected chain doesn't mismatches source-destination chain requirements
const depositNetworkConnectionWarning =
isDepositMode &&
(!sourceChainEqualsConnectedChain || isConnectedToOrbitChain.current)
const withdrawalNetworkConnectionWarning =
!isDepositMode && !sourceChainEqualsConnectedChain
if (
depositNetworkConnectionWarning ||
withdrawalNetworkConnectionWarning
) {
return networkConnectionWarningToast()
}

const sourceChainErc20Address = isDepositMode
? selectedToken?.address
Expand Down

0 comments on commit c1893a6

Please sign in to comment.