fix: token registry avoids custom slug (#16093)
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
||||
TokenInfo,
|
||||
TokenListContainer,
|
||||
} from "@solana/spl-token-registry";
|
||||
import { clusterSlug, useCluster } from "providers/cluster";
|
||||
import { Cluster, clusterSlug, useCluster } from "providers/cluster";
|
||||
|
||||
const TokenRegistryContext = React.createContext<TokenInfoMap>(new Map());
|
||||
|
||||
@@ -19,9 +19,10 @@ export function TokenRegistryProvider({ children }: ProviderProps) {
|
||||
|
||||
React.useEffect(() => {
|
||||
new TokenListProvider().resolve().then((tokens: TokenListContainer) => {
|
||||
const tokenList = tokens
|
||||
.filterByClusterSlug(clusterSlug(cluster))
|
||||
.getList();
|
||||
const tokenList =
|
||||
cluster === Cluster.Custom
|
||||
? []
|
||||
: tokens.filterByClusterSlug(clusterSlug(cluster)).getList();
|
||||
|
||||
setTokenRegistry(
|
||||
tokenList.reduce((map: TokenInfoMap, item: TokenInfo) => {
|
||||
|
Reference in New Issue
Block a user