Skip to content
76 changes: 0 additions & 76 deletions .github/ISSUE_TEMPLATE/add-layerleap-request.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { gql } from '@apollo/client';
import { unstable_noStore } from 'next/cache';
import { NextRequest, NextResponse } from 'next/server';

import {
Expand Down Expand Up @@ -35,6 +36,7 @@ export async function GET(
request: NextRequest,
{ params }: { params: { chainId: string } },
): Promise<NextResponse<{ data: number; meta?: { source: string | null } } | { message: string }>> {
unstable_noStore();
const { chainId } = params;

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,27 @@ import { ERC20BridgeToken } from '../../hooks/arbTokenBridge.types';
import { useNetworks } from '../../hooks/useNetworks';
import { useNetworksRelationship } from '../../hooks/useNetworksRelationship';
import { useSelectedToken } from '../../hooks/useSelectedToken';
import { getL2ConfigForTeleport } from '../../token-bridge-sdk/teleport';
import { ChainId } from '../../types/ChainId';
import { addressesEqual } from '../../util/AddressUtils';
import { CommonAddress } from '../../util/CommonAddressUtils';
import { isTeleportEnabledToken } from '../../util/TokenTeleportEnabledUtils';
import { isTransferDisabledToken } from '../../util/TokenTransferDisabledUtils';
import { sanitizeTokenSymbol } from '../../util/TokenUtils';
import { withdrawOnlyTokens } from '../../util/WithdrawOnlyUtils';
import { isLifiEnabled } from '../../util/featureFlag';
import { getNetworkName } from '../../util/networks';
import { Dialog } from '../common/Dialog';
import { ExternalLink } from '../common/ExternalLink';
import { useSelectedTokenIsWithdrawOnly } from './hooks/useSelectedTokenIsWithdrawOnly';

export function isDisabledCanonicalTransfer({
selectedToken,
isDepositMode,
isTeleportMode,
parentChainId,
childChainId,
isSelectedTokenWithdrawOnly,
isSelectedTokenWithdrawOnlyLoading,
}: {
selectedToken: ERC20BridgeToken | null;
isDepositMode: boolean;
isTeleportMode: boolean;
parentChainId: ChainId;
childChainId: ChainId;
isSelectedTokenWithdrawOnly: boolean | undefined;
Expand All @@ -44,13 +39,6 @@ export function isDisabledCanonicalTransfer({
return true;
}

if (
isTeleportMode &&
!isTeleportEnabledToken(selectedToken.address, parentChainId, childChainId)
) {
return true;
}

if (parentChainId === ChainId.ArbitrumOne) {
if (
childChainId === ChainId.ApeChain &&
Expand All @@ -77,8 +65,7 @@ export function isDisabledCanonicalTransfer({

export function TransferDisabledDialog() {
const [networks] = useNetworks();
const { isDepositMode, isTeleportMode, parentChain, childChain } =
useNetworksRelationship(networks);
const { isDepositMode, parentChain, childChain } = useNetworksRelationship(networks);
const [selectedToken, setSelectedToken] = useSelectedToken();
// for tracking local state and prevent flickering with async URL params updating
const [selectedTokenAddressLocalValue, setSelectedTokenAddressLocalValue] = useState<
Expand All @@ -90,20 +77,6 @@ export function TransferDisabledDialog() {
erc20L1Address: selectedToken?.address,
chainId: networks.sourceChain.id,
});
const [l2ChainIdForTeleport, setL2ChainIdForTeleport] = useState<number | undefined>();

useEffect(() => {
const updateL2ChainIdForTeleport = async () => {
if (!isTeleportMode) {
return;
}
const { l2ChainId } = await getL2ConfigForTeleport({
destinationChainProvider: networks.destinationChainProvider,
});
setL2ChainIdForTeleport(l2ChainId);
};
updateL2ChainIdForTeleport();
}, [isTeleportMode, networks.destinationChainProvider]);

const shouldShowDialog = useMemo(() => {
if (
Expand All @@ -128,7 +101,6 @@ export function TransferDisabledDialog() {
return isDisabledCanonicalTransfer({
selectedToken,
isDepositMode,
isTeleportMode,
parentChainId: parentChain.id,
childChainId: childChain.id,
isSelectedTokenWithdrawOnly,
Expand All @@ -139,18 +111,13 @@ export function TransferDisabledDialog() {
isDepositMode,
isSelectedTokenWithdrawOnly,
isSelectedTokenWithdrawOnlyLoading,
isTeleportMode,
parentChain.id,
selectedToken,
selectedTokenAddressLocalValue,
networks.destinationChain.id,
networks.sourceChain.id,
]);

const sourceChainName = getNetworkName(networks.sourceChain.id);
const destinationChainName = getNetworkName(networks.destinationChain.id);
const l2ChainIdForTeleportName = l2ChainIdForTeleport
? getNetworkName(l2ChainIdForTeleport)
: null;

const isGHO =
selectedToken &&
networks.destinationChain.id === ChainId.ArbitrumOne &&
Expand Down Expand Up @@ -185,58 +152,27 @@ export function TransferDisabledDialog() {
onClose={onClose}
>
<div className="flex flex-col space-y-4 py-4">
{isTeleportMode ? (
// teleport transfer disabled content if token is not in the allowlist
<>
<p>
Unfortunately, <span className="font-medium">{unsupportedToken}</span> is not yet
supported for direct {sourceChainName} to {destinationChainName} transfers.
</p>
{l2ChainIdForTeleportName && (
<p>
To bridge <span className="font-medium">{unsupportedToken}</span>:
<li>
First bridge from {sourceChainName} to {l2ChainIdForTeleportName}.
</li>
<li>
Then bridge from {l2ChainIdForTeleportName} to {destinationChainName}.
</li>
</p>
)}
<p>
For more information please contact us on{' '}
<ExternalLink href="https://discord.com/invite/ZpZuw7p" className="underline">
Discord
</ExternalLink>{' '}
and reach out in #support for assistance.
</p>
</>
) : (
// canonical transfer disabled content for all other cases
<>
<p>
Unfortunately, <span className="font-medium">{unsupportedToken}</span> has a custom
bridge solution that is incompatible with the canonical Arbitrum bridge.
</p>
{isGHO && (
<p>
Please use the{' '}
<ExternalLink
className="underline hover:opacity-70"
href="https://app.transporter.io/?from=mainnet&tab=token&to=arbitrum&token=GHO"
>
CCIP bridge for GHO
</ExternalLink>{' '}
instead.
</p>
)}
<p>
For more information please contact{' '}
<span className="font-medium">{unsupportedToken}</span>
&apos;s developer team directly or explore their docs.
</p>
</>
<p>
Unfortunately, <span className="font-medium">{unsupportedToken}</span> has a custom bridge
solution that is incompatible with the canonical Arbitrum bridge.
</p>
{isGHO && (
<p>
Please use the{' '}
<ExternalLink
className="underline hover:opacity-70"
href="https://app.transporter.io/?from=mainnet&tab=token&to=arbitrum&token=GHO"
>
CCIP bridge for GHO
</ExternalLink>{' '}
instead.
</p>
)}
<p>
For more information please contact{' '}
<span className="font-medium">{unsupportedToken}</span>
&apos;s developer team directly or explore their docs.
</p>
</div>
</Dialog>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ import { useDestinationAddressError } from './hooks/useDestinationAddressError';
import { useIsTransferAllowed } from './hooks/useIsTransferAllowed';
import { isLifiRoute, useRouteStore } from './hooks/useRouteStore';
import { getAmountToPay } from './useTransferReadiness';
import { getSmartContractWalletTeleportTransfersNotSupportedErrorMessage } from './useTransferReadinessUtils';

const signerUndefinedError = 'Signer is undefined';
const transferNotAllowedError = 'Transfer not allowed';
Expand Down Expand Up @@ -134,14 +133,7 @@ export function TransferPanel() {
const tokensFromLists = useTokensFromLists();
const tokensFromUser = useTokensFromUser();
const {
current: {
childChain,
childChainProvider,
parentChain,
parentChainProvider,
isDepositMode,
isTeleportMode,
},
current: { childChain, childChainProvider, parentChain, parentChainProvider, isDepositMode },
} = useLatest(useNetworksRelationship(latestNetworks.current));
const { isLoading: isLoadingTokenLists } = useTokenLists(childChain.id);
const isBatchTransferSupported = useIsBatchTransferSupported();
Expand Down Expand Up @@ -849,12 +841,6 @@ export function TransferPanel() {
throw new Error(signerUndefinedError);
}

// SC Teleport transfers aren't enabled yet. Safety check, shouldn't be able to get here.
if (isSmartContractWallet && isTeleportMode) {
console.error(getSmartContractWalletTeleportTransfersNotSupportedErrorMessage());
return;
}

const childChainName = getNetworkName(childChain.id);

setTransferring(true);
Expand Down Expand Up @@ -1029,7 +1015,7 @@ export function TransferPanel() {
if (isSmartContractWallet) {
showDelayInSmartContractTransaction();

trackEvent(isTeleportMode ? 'Teleport' : isDepositMode ? 'Deposit' : 'Withdraw', {
trackEvent(isDepositMode ? 'Deposit' : 'Withdraw', {
tokenSymbol: selectedToken?.symbol,
assetType: 'ERC-20',
accountType: 'Smart Contract',
Expand Down Expand Up @@ -1094,7 +1080,7 @@ export function TransferPanel() {
const destinationAddress = latestDestinationAddress.current;

if (!isSmartContractWallet) {
trackEvent(isTeleportMode ? 'Teleport' : isDepositMode ? 'Deposit' : 'Withdraw', {
trackEvent(isDepositMode ? 'Deposit' : 'Withdraw', {
tokenSymbol: selectedToken?.symbol,
assetType: selectedToken ? 'ERC-20' : 'ETH',
accountType: 'EOA',
Expand Down Expand Up @@ -1181,7 +1167,7 @@ export function TransferPanel() {

const trackTransferButtonClick = useCallback(() => {
trackEvent('Transfer Button Click', {
type: isTeleportMode ? 'Teleport' : isDepositMode ? 'Deposit' : 'Withdrawal',
type: isDepositMode ? 'Deposit' : 'Withdrawal',
selectedRoute,
tokenSymbol: selectedToken?.symbol,
assetType: selectedToken ? 'ERC-20' : 'ETH',
Expand All @@ -1199,7 +1185,6 @@ export function TransferPanel() {
isBatchTransfer,
isDepositMode,
isSmartContractWallet,
isTeleportMode,
selectedToken,
isCustomDestinationTransfer,
selectedRoute,
Expand All @@ -1219,7 +1204,7 @@ export function TransferPanel() {
setTransferring(true);
if (isConnectedToTheWrongChain) {
trackEvent('Switch Network and Transfer', {
type: isTeleportMode ? 'Teleport' : isDepositMode ? 'Deposit' : 'Withdrawal',
type: isDepositMode ? 'Deposit' : 'Withdrawal',
tokenSymbol: selectedToken?.symbol,
assetType: selectedToken ? 'ERC-20' : 'ETH',
accountType: isSmartContractWallet ? 'Smart Contract' : 'EOA',
Expand Down
Loading
Loading