Disable owned token request on mainnet explorer (#11343)
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Connection, PublicKey, TokenAccountInfo } from "@solana/web3.js";
|
import { Connection, PublicKey, TokenAccountInfo } from "@solana/web3.js";
|
||||||
import { FetchStatus, useAccounts } from "./index";
|
import { FetchStatus, useAccounts } from "./index";
|
||||||
import { useCluster } from "../cluster";
|
import { useCluster, Cluster } from "../cluster";
|
||||||
|
|
||||||
interface AccountTokens {
|
interface AccountTokens {
|
||||||
status: FetchStatus;
|
status: FetchStatus;
|
||||||
@ -49,7 +49,7 @@ const DispatchContext = React.createContext<Dispatch | undefined>(undefined);
|
|||||||
type ProviderProps = { children: React.ReactNode };
|
type ProviderProps = { children: React.ReactNode };
|
||||||
export function TokensProvider({ children }: ProviderProps) {
|
export function TokensProvider({ children }: ProviderProps) {
|
||||||
const [state, dispatch] = React.useReducer(reducer, {});
|
const [state, dispatch] = React.useReducer(reducer, {});
|
||||||
const { url } = useCluster();
|
const { cluster, url } = useCluster();
|
||||||
const { accounts, lastFetchedAddress } = useAccounts();
|
const { accounts, lastFetchedAddress } = useAccounts();
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
@ -58,7 +58,7 @@ export function TokensProvider({ children }: ProviderProps) {
|
|||||||
|
|
||||||
// Fetch history for new accounts
|
// Fetch history for new accounts
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (lastFetchedAddress) {
|
if (lastFetchedAddress && cluster !== Cluster.MainnetBeta) {
|
||||||
const infoFetched =
|
const infoFetched =
|
||||||
accounts[lastFetchedAddress] &&
|
accounts[lastFetchedAddress] &&
|
||||||
accounts[lastFetchedAddress].lamports !== undefined;
|
accounts[lastFetchedAddress].lamports !== undefined;
|
||||||
|
Reference in New Issue
Block a user