From 2961462ebea367583978a6f31c91634697c28fa1 Mon Sep 17 00:00:00 2001 From: Kevin Peters Date: Mon, 7 Mar 2022 01:53:28 +0000 Subject: [PATCH] bridge_ui: Disable transfers to and from polygon, display network upgrade warning --- bridge_ui/src/components/NFT/Source.tsx | 10 +++++-- bridge_ui/src/components/NFT/Target.tsx | 5 +++- .../components/PolygonNetworkDownWarning.tsx | 30 +++++++++++++++++++ bridge_ui/src/components/Transfer/Source.tsx | 13 ++++++-- 4 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 bridge_ui/src/components/PolygonNetworkDownWarning.tsx diff --git a/bridge_ui/src/components/NFT/Source.tsx b/bridge_ui/src/components/NFT/Source.tsx index da8d6ad9c..cff35235b 100644 --- a/bridge_ui/src/components/NFT/Source.tsx +++ b/bridge_ui/src/components/NFT/Source.tsx @@ -1,4 +1,8 @@ -import { CHAIN_ID_SOLANA, isEVMChain } from "@certusone/wormhole-sdk"; +import { + CHAIN_ID_POLYGON, + CHAIN_ID_SOLANA, + isEVMChain, +} from "@certusone/wormhole-sdk"; import { Button, makeStyles } from "@material-ui/core"; import { VerifiedUser } from "@material-ui/icons"; import { Alert } from "@material-ui/lab"; @@ -19,6 +23,7 @@ import ButtonWithLoader from "../ButtonWithLoader"; import ChainSelect from "../ChainSelect"; import KeyAndBalance from "../KeyAndBalance"; import LowBalanceWarning from "../LowBalanceWarning"; +import PolygonNetworkDownWarning from "../PolygonNetworkDownWarning"; import SolanaTPSWarning from "../SolanaTPSWarning"; import StepDescription from "../StepDescription"; import { TokenSelector } from "../TokenSelectors/SourceTokenSelector"; @@ -92,9 +97,10 @@ function Source() { ) : null} + {sourceChain === CHAIN_ID_POLYGON && } {sourceChain === CHAIN_ID_SOLANA && } {targetChain === CHAIN_ID_SOLANA && } + {targetChain === CHAIN_ID_POLYGON && } ({ + alert: { + marginTop: theme.spacing(1), + marginBottom: theme.spacing(1), + }, +})); + +export default function PolygonNetworkDownWarning() { + const classes = useStyles(); + + return ( + + Polygon is experiencing downtime. As a precautionary measure, Wormhole + network and portal have temporarily paused Polygon support until the issue + is resolved. + + + Link to @0xPolygonDevs tweet + + + + ); +} diff --git a/bridge_ui/src/components/Transfer/Source.tsx b/bridge_ui/src/components/Transfer/Source.tsx index 74d5ac89d..08e1dc668 100644 --- a/bridge_ui/src/components/Transfer/Source.tsx +++ b/bridge_ui/src/components/Transfer/Source.tsx @@ -1,6 +1,7 @@ import { CHAIN_ID_BSC, CHAIN_ID_ETH, + CHAIN_ID_POLYGON, CHAIN_ID_SOLANA, } from "@certusone/wormhole-sdk"; import { getAddress } from "@ethersproject/address"; @@ -39,6 +40,7 @@ import ChainSelectArrow from "../ChainSelectArrow"; import KeyAndBalance from "../KeyAndBalance"; import LowBalanceWarning from "../LowBalanceWarning"; import NumberTextField from "../NumberTextField"; +import PolygonNetworkDownWarning from "../PolygonNetworkDownWarning"; import SolanaTPSWarning from "../SolanaTPSWarning"; import StepDescription from "../StepDescription"; import { TokenSelector } from "../TokenSelectors/SourceTokenSelector"; @@ -140,6 +142,9 @@ function Source() { dispatch(incrementStep()); }, [dispatch]); + const isPolygonTransfer = + sourceChain === CHAIN_ID_POLYGON || targetChain === CHAIN_ID_POLYGON; + return ( <> @@ -159,7 +164,10 @@ function Source() { -
+
Source {sourceChain === CHAIN_ID_SOLANA && } + {isPolygonTransfer && } ) : null}