From 1b89f37aa58b2c2821e0c7424b7733d30e0bbe8b Mon Sep 17 00:00:00 2001 From: JayJay1024 Date: Fri, 15 Mar 2024 18:57:26 +0800 Subject: [PATCH] refactor: warning Darwinia<>Ethereum --- src/components/transfer-action.tsx | 5 ++-- src/components/transfer.tsx | 41 +++++++++++++++++++++++++----- src/config/chains/darwinia.ts | 2 -- src/config/chains/ethereum.ts | 2 -- 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/src/components/transfer-action.tsx b/src/components/transfer-action.tsx index 07e1505b5..8db5b2a69 100644 --- a/src/components/transfer-action.tsx +++ b/src/components/transfer-action.tsx @@ -7,13 +7,14 @@ import { Address, isAddress } from "viem"; import { useAccount, useNetwork, useSwitchNetwork } from "wagmi"; interface Props { + forceDisabled?: boolean; recipient: Address | undefined; transferable: bigint | undefined; transferAmount: InputValue; onTransfer: () => void; } -export default function TransferAction({ recipient, transferable, transferAmount, onTransfer }: Props) { +export default function TransferAction({ recipient, transferable, transferAmount, forceDisabled, onTransfer }: Props) { const { sourceAllowance, sourceChain, @@ -105,7 +106,7 @@ export default function TransferAction({ recipient, transferable, transferAmount ]); return ( - ); diff --git a/src/components/transfer.tsx b/src/components/transfer.tsx index 608e544a7..6c1569248 100644 --- a/src/components/transfer.tsx +++ b/src/components/transfer.tsx @@ -65,6 +65,32 @@ export default function Transfer() { const [balanceLoading, setBalanceLoading] = useState(false); const [indexerCategory, setIndexerCategory] = useState(); + const alert = useMemo(() => { + if ( + (sourceChain?.network === "darwinia-dvm" && targetChain?.network === "ethereum") || + (sourceChain?.network === "ethereum" && targetChain?.network === "darwinia-dvm") + ) { + return ( +
+ + {`Due to the Ethereum upgrade, the Darwinia<>Ethereum bridge is temporarily unavailable. Please use the official`} +   + + + Arbitrum bridge + +  {`to route to Darwinia or Ethereum instead.`} +
+ ); + } + return null; + }, [sourceChain?.network, targetChain?.network]); + const bridgeOptions = useMemo( () => getAvailableBridges(sourceChain, targetChain, sourceToken), [sourceChain, targetChain, sourceToken], @@ -349,16 +375,19 @@ export default function Transfer() { {/* Information */} {/* Action */}