fix: token registry avoids custom slug (#16093)
This commit is contained in:
parent
570fd3f810
commit
7aa65831bc
26
explorer/package-lock.json
generated
26
explorer/package-lock.json
generated
@ -2419,6 +2419,14 @@
|
||||
"buffer-layout": "^1.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": {
|
||||
"version": "7.13.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.13.10.tgz",
|
||||
"integrity": "sha512-4QPkjJq6Ns3V/RgpEahRk+AGfL0eO6RHHtTWoNNr5mO49G6B5+X6d6THgWEAvTrznU5xYpbAlVKRYcsCgh/Akw==",
|
||||
"requires": {
|
||||
"regenerator-runtime": "^0.13.4"
|
||||
}
|
||||
},
|
||||
"@solana/web3.js": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.0.0.tgz",
|
||||
@ -2446,6 +2454,15 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"buffer": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.1.tgz",
|
||||
"integrity": "sha512-rVAXBwEcEoYtxnHSO5iWyhzV/O1WMtkUYWlfdLS7FjU4PnSJJHEfHXi/uHPI5EwltmOA794gN3bm3/pzuctWjQ==",
|
||||
"requires": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.2.1"
|
||||
}
|
||||
},
|
||||
"superstruct": {
|
||||
"version": "0.14.2",
|
||||
"resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz",
|
||||
@ -4937,15 +4954,6 @@
|
||||
"node-int64": "^0.4.0"
|
||||
}
|
||||
},
|
||||
"buffer": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
|
||||
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
|
||||
"requires": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.2.1"
|
||||
}
|
||||
},
|
||||
"buffer-from": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
|
||||
|
@ -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) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user