bridge_ui: fixed an errant error message

This commit is contained in:
Chase Moran 2021-12-27 21:57:33 -05:00 committed by Evan Gray
parent 7f74392a91
commit 0233f03a3c
1 changed files with 17 additions and 1 deletions

View File

@ -1,10 +1,13 @@
import { CHAIN_ID_SOLANA } from "@certusone/wormhole-sdk"; import { CHAIN_ID_SOLANA } from "@certusone/wormhole-sdk";
import { TokenInfo } from "@solana/spl-token-registry"; import { TokenInfo } from "@solana/spl-token-registry";
import React, { useCallback, useMemo } from "react"; import React, { useCallback, useMemo } from "react";
import { useSelector } from "react-redux";
import useMarketsMap from "../../hooks/useMarketsMap";
import useMetaplexData from "../../hooks/useMetaplexData"; import useMetaplexData from "../../hooks/useMetaplexData";
import useSolanaTokenMap from "../../hooks/useSolanaTokenMap"; import useSolanaTokenMap from "../../hooks/useSolanaTokenMap";
import { DataWrapper } from "../../store/helpers"; import { DataWrapper } from "../../store/helpers";
import { NFTParsedTokenAccount } from "../../store/nftSlice"; import { NFTParsedTokenAccount } from "../../store/nftSlice";
import { selectTransferTargetChain } from "../../store/selectors";
import { ParsedTokenAccount } from "../../store/transferSlice"; import { ParsedTokenAccount } from "../../store/transferSlice";
import { import {
MIGRATION_ASSET_MAP, MIGRATION_ASSET_MAP,
@ -51,6 +54,8 @@ export default function SolanaSourceTokenSelector(
return output; return output;
}, [mintAccounts?.data]); }, [mintAccounts?.data]);
const metaplex = useMetaplexData(mintAddresses); const metaplex = useMetaplexData(mintAddresses);
const markets = useMarketsMap(!nft);
const targetChain = useSelector(selectTransferTargetChain);
const memoizedTokenMap: Map<String, TokenInfo> = useMemo(() => { const memoizedTokenMap: Map<String, TokenInfo> = useMemo(() => {
const output = new Map<String, TokenInfo>(); const output = new Map<String, TokenInfo>();
@ -147,6 +152,17 @@ export default function SolanaSourceTokenSelector(
//This is a v1 wormhole token on testnet //This is a v1 wormhole token on testnet
//address = "4QixXecTZ4zdZGa39KH8gVND5NZ2xcaB12wiBhE4S7rn"; //address = "4QixXecTZ4zdZGa39KH8gVND5NZ2xcaB12wiBhE4S7rn";
//Anything we find in the features market map will be a non-v1 token. This has to short circuit the other checks
//As the featured market parsed token accounts are spoofed in by the token picker and lack valid metadata.
if (!nft) {
const marketsData = markets.data;
const featuredMarkets =
marketsData?.tokenMarkets?.[CHAIN_ID_SOLANA]?.[targetChain];
if (!!featuredMarkets?.[address]) {
return false;
}
}
if (!props.mintAccounts?.data) { if (!props.mintAccounts?.data) {
return true; //These should never be null by this point return true; //These should never be null by this point
} }
@ -162,7 +178,7 @@ export default function SolanaSourceTokenSelector(
return false; return false;
}, },
[props.mintAccounts] [props.mintAccounts, markets.data, nft, targetChain]
); );
const onChangeWrapper = useCallback( const onChangeWrapper = useCallback(