Disable owned token request on mainnet explorer (#11343)

This commit is contained in:
Justin Starry 2020-08-03 12:51:47 +08:00 committed by GitHub
parent 8bcc8edf47
commit 1fe762cc79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
import React from "react";
import { Connection, PublicKey, TokenAccountInfo } from "@solana/web3.js";
import { FetchStatus, useAccounts } from "./index";
import { useCluster } from "../cluster";
import { useCluster, Cluster } from "../cluster";
interface AccountTokens {
status: FetchStatus;
@ -49,7 +49,7 @@ const DispatchContext = React.createContext<Dispatch | undefined>(undefined);
type ProviderProps = { children: React.ReactNode };
export function TokensProvider({ children }: ProviderProps) {
const [state, dispatch] = React.useReducer(reducer, {});
const { url } = useCluster();
const { cluster, url } = useCluster();
const { accounts, lastFetchedAddress } = useAccounts();
React.useEffect(() => {
@ -58,7 +58,7 @@ export function TokensProvider({ children }: ProviderProps) {
// Fetch history for new accounts
React.useEffect(() => {
if (lastFetchedAddress) {
if (lastFetchedAddress && cluster !== Cluster.MainnetBeta) {
const infoFetched =
accounts[lastFetchedAddress] &&
accounts[lastFetchedAddress].lamports !== undefined;