bridge_ui: tokens on multiple chains warning
Change-Id: I80f08abff68ba918c3cedf76c2c08b2c32bebd4e
This commit is contained in:
parent
59b490e13a
commit
caa5507f68
|
@ -3,6 +3,7 @@ import { Restore } from "@material-ui/icons";
|
||||||
import { useCallback } from "react";
|
import { useCallback } from "react";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import useIsWalletReady from "../../hooks/useIsWalletReady";
|
import useIsWalletReady from "../../hooks/useIsWalletReady";
|
||||||
|
import useTokenBlacklistWarning from "../../hooks/useTokenBlacklistWarning";
|
||||||
import {
|
import {
|
||||||
selectTransferAmount,
|
selectTransferAmount,
|
||||||
selectTransferIsSourceComplete,
|
selectTransferIsSourceComplete,
|
||||||
|
@ -47,6 +48,10 @@ function Source({
|
||||||
const isSourceComplete = useSelector(selectTransferIsSourceComplete);
|
const isSourceComplete = useSelector(selectTransferIsSourceComplete);
|
||||||
const shouldLockFields = useSelector(selectTransferShouldLockFields);
|
const shouldLockFields = useSelector(selectTransferShouldLockFields);
|
||||||
const { isReady, statusMessage } = useIsWalletReady(sourceChain);
|
const { isReady, statusMessage } = useIsWalletReady(sourceChain);
|
||||||
|
const tokenBlacklistWarning = useTokenBlacklistWarning(
|
||||||
|
sourceChain,
|
||||||
|
parsedTokenAccount?.mintKey
|
||||||
|
);
|
||||||
const handleSourceChange = useCallback(
|
const handleSourceChange = useCallback(
|
||||||
(event) => {
|
(event) => {
|
||||||
dispatch(setSourceChain(event.target.value));
|
dispatch(setSourceChain(event.target.value));
|
||||||
|
@ -112,7 +117,7 @@ function Source({
|
||||||
disabled={!isSourceComplete}
|
disabled={!isSourceComplete}
|
||||||
onClick={handleNextClick}
|
onClick={handleNextClick}
|
||||||
showLoader={false}
|
showLoader={false}
|
||||||
error={statusMessage || error}
|
error={statusMessage || error || tokenBlacklistWarning}
|
||||||
>
|
>
|
||||||
Next
|
Next
|
||||||
</ButtonWithLoader>
|
</ButtonWithLoader>
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
import {
|
||||||
|
ChainId,
|
||||||
|
CHAIN_ID_ETH,
|
||||||
|
CHAIN_ID_SOLANA,
|
||||||
|
} from "@certusone/wormhole-sdk";
|
||||||
|
import { useMemo } from "react";
|
||||||
|
import {
|
||||||
|
ETH_TOKENS_THAT_EXIST_ELSEWHERE,
|
||||||
|
SOLANA_TOKENS_THAT_EXIST_ELSEWHERE,
|
||||||
|
} from "../utils/consts";
|
||||||
|
|
||||||
|
export default function useTokenBlacklistWarning(
|
||||||
|
chainId: ChainId,
|
||||||
|
tokenAddress: string | undefined
|
||||||
|
) {
|
||||||
|
return useMemo(
|
||||||
|
() =>
|
||||||
|
tokenAddress &&
|
||||||
|
((chainId === CHAIN_ID_SOLANA &&
|
||||||
|
SOLANA_TOKENS_THAT_EXIST_ELSEWHERE.includes(tokenAddress)) ||
|
||||||
|
(chainId === CHAIN_ID_ETH &&
|
||||||
|
ETH_TOKENS_THAT_EXIST_ELSEWHERE.includes(tokenAddress)))
|
||||||
|
? "This token exists on multiple chains! Bridging the token via Wormhole will produce a wrapped version which might have no liquidity on the target chain."
|
||||||
|
: undefined,
|
||||||
|
[chainId, tokenAddress]
|
||||||
|
);
|
||||||
|
}
|
|
@ -163,3 +163,29 @@ export const WORMHOLE_V1_MINT_AUTHORITY =
|
||||||
: CLUSTER === "testnet"
|
: CLUSTER === "testnet"
|
||||||
? "BJa7dq3bRP216zaTdw4cdcV71WkPc1HXvmnGeFVDi5DC"
|
? "BJa7dq3bRP216zaTdw4cdcV71WkPc1HXvmnGeFVDi5DC"
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
|
// hardcoded addresses for warnings
|
||||||
|
export const SOLANA_TOKENS_THAT_EXIST_ELSEWHERE = [
|
||||||
|
"SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt", // SRM
|
||||||
|
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
|
||||||
|
"kinXdEcpDQeHPEuQnqmUgtYykqKGVFq6CeVX5iAHJq6", // KIN
|
||||||
|
"CDJWUqTcYTVAKXAVXoQZFes5JUFc7owSeq7eMQcDSbo5", // renBTC
|
||||||
|
"8wv2KAykQstNAj2oW6AHANGBiFKVFhvMiyyzzjhkmGvE", // renLUNA
|
||||||
|
"G1a6jxYz3m8DVyMqYnuV7s86wD4fvuXYneWSpLJkmsXj", // renBCH
|
||||||
|
"FKJvvVJ242tX7zFtzTmzqoA631LqHh4CdgcN8dcfFSju", // renDGB
|
||||||
|
"ArUkYE2XDKzqy77PRRGjo4wREWwqk6RXTfM9NeqzPvjU", // renDOGE
|
||||||
|
"E99CQ2gFMmbiyK2bwiaFNWUUmwz4r8k2CVEFxwuvQ7ue", // renZEC
|
||||||
|
"De2bU64vsXKU9jq4bCjeDxNRGPn8nr3euaTK8jBYmD3J", // renFIL
|
||||||
|
];
|
||||||
|
export const ETH_TOKENS_THAT_EXIST_ELSEWHERE = [
|
||||||
|
getAddress("0x476c5E26a75bd202a9683ffD34359C0CC15be0fF"), // SRM
|
||||||
|
getAddress("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"), // USDC
|
||||||
|
getAddress("0x818fc6c2ec5986bc6e2cbf00939d90556ab12ce5"), // KIN
|
||||||
|
getAddress("0xeb4c2781e4eba804ce9a9803c67d0893436bb27d"), // renBTC
|
||||||
|
getAddress("0x52d87F22192131636F93c5AB18d0127Ea52CB641"), // renLUNA
|
||||||
|
getAddress("0x459086f2376525bdceba5bdda135e4e9d3fef5bf"), // renBCH
|
||||||
|
getAddress("0xe3cb486f3f5c639e98ccbaf57d95369375687f80"), // renDGB
|
||||||
|
getAddress("0x3832d2F059E55934220881F831bE501D180671A7"), // renDOGE
|
||||||
|
getAddress("0x1c5db575e2ff833e46a2e9864c22f4b22e0b37c2"), // renZEC
|
||||||
|
getAddress("0xD5147bc8e386d91Cc5DBE72099DAC6C9b99276F5"), // renFIL
|
||||||
|
];
|
||||||
|
|
Loading…
Reference in New Issue