bridge_ui: eth token picker refreshes, & exclude 0 balance tokens

Change-Id: I0518106640e42dcd4aa1690f5855bd124043cbb1
This commit is contained in:
Chase Moran 2021-09-15 16:00:41 -04:00
parent af893c7266
commit de257bc22c
2 changed files with 7 additions and 2 deletions

View File

@ -233,6 +233,10 @@ export default function SolanaSourceTokenSelector(
const filteredOptions = useMemo(() => {
return props.accounts.filter((x) => {
//TODO, do a better check which likely involves supply or checking masterEdition.
const zeroBalance = x.amount === "0";
if (zeroBalance) {
return false;
}
const isNFT =
x.decimals === 0 && metaplex.data?.get(x.mintKey)?.data?.uri;
return nft ? isNFT : !isNFT;

View File

@ -214,6 +214,7 @@ const getEthereumAccountsCovalent = async (
item.contract_ticker_symbol &&
item.contract_address &&
item.balance &&
item.balance !== "0" &&
(nft
? item.supports_erc?.includes("erc721")
: item.supports_erc?.includes("erc20"))
@ -416,7 +417,7 @@ function useGetAvailableTokens(nft: boolean = false) {
// const nftTestWallet2 = "0x98ed231428088eb440e8edb5cc8d66dcf913b86e";
let cancelled = false;
const walletAddress = signerAddress;
if (walletAddress && lookupChain === CHAIN_ID_ETH && !tokenAccounts.data) {
if (walletAddress && lookupChain === CHAIN_ID_ETH && !covalent) {
//TODO less cancel
!cancelled && setCovalentLoading(true);
!cancelled &&
@ -477,7 +478,7 @@ function useGetAvailableTokens(nft: boolean = false) {
cancelled = true;
};
}
}, [lookupChain, provider, signerAddress, dispatch, nft, tokenAccounts.data]);
}, [lookupChain, provider, signerAddress, dispatch, nft, covalent]);
//Terra accounts load
//At present, we don't have any mechanism for doing this.