Add incinerator to explorer search results (#19125)
This commit is contained in:
parent
c7b986220e
commit
f5ce2c2d63
|
@ -6,6 +6,7 @@ import StateManager from "react-select";
|
||||||
import {
|
import {
|
||||||
LOADER_IDS,
|
LOADER_IDS,
|
||||||
PROGRAM_NAME_BY_ID,
|
PROGRAM_NAME_BY_ID,
|
||||||
|
SPECIAL_IDS,
|
||||||
SYSVAR_IDS,
|
SYSVAR_IDS,
|
||||||
LoaderName,
|
LoaderName,
|
||||||
programLabel,
|
programLabel,
|
||||||
|
@ -141,6 +142,28 @@ function buildSysvarOptions(search: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function buildSpecialOptions(search: string) {
|
||||||
|
const matchedSpecialIds = Object.entries(SPECIAL_IDS).filter(
|
||||||
|
([address, name]) => {
|
||||||
|
return (
|
||||||
|
name.toLowerCase().includes(search.toLowerCase()) ||
|
||||||
|
address.includes(search)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (matchedSpecialIds.length > 0) {
|
||||||
|
return {
|
||||||
|
label: "Accounts",
|
||||||
|
options: matchedSpecialIds.map(([id, name]) => ({
|
||||||
|
label: name,
|
||||||
|
value: [name, id],
|
||||||
|
pathname: "/address/" + id,
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function buildTokenOptions(
|
function buildTokenOptions(
|
||||||
search: string,
|
search: string,
|
||||||
cluster: Cluster,
|
cluster: Cluster,
|
||||||
|
@ -194,6 +217,11 @@ function buildOptions(
|
||||||
options.push(sysvarOptions);
|
options.push(sysvarOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const specialOptions = buildSpecialOptions(search);
|
||||||
|
if (specialOptions) {
|
||||||
|
options.push(specialOptions);
|
||||||
|
}
|
||||||
|
|
||||||
const tokenOptions = buildTokenOptions(search, cluster, tokenRegistry);
|
const tokenOptions = buildTokenOptions(search, cluster, tokenRegistry);
|
||||||
if (tokenOptions) {
|
if (tokenOptions) {
|
||||||
options.push(tokenOptions);
|
options.push(tokenOptions);
|
||||||
|
|
|
@ -132,7 +132,8 @@ export const LOADER_IDS = {
|
||||||
BPFLoaderUpgradeab1e11111111111111111111111: "BPF Upgradeable Loader",
|
BPFLoaderUpgradeab1e11111111111111111111111: "BPF Upgradeable Loader",
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
const SYSVAR_ID: { [key: string]: string } = {
|
export const SPECIAL_IDS: { [key: string]: string } = {
|
||||||
|
"1nc1nerator11111111111111111111111111111111": "Incinerator",
|
||||||
Sysvar1111111111111111111111111111111111111: "SYSVAR",
|
Sysvar1111111111111111111111111111111111111: "SYSVAR",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -182,7 +183,7 @@ export function addressLabel(
|
||||||
return (
|
return (
|
||||||
programLabel(address, cluster) ||
|
programLabel(address, cluster) ||
|
||||||
SYSVAR_IDS[address] ||
|
SYSVAR_IDS[address] ||
|
||||||
SYSVAR_ID[address] ||
|
SPECIAL_IDS[address] ||
|
||||||
tokenLabel(address, tokenRegistry) ||
|
tokenLabel(address, tokenRegistry) ||
|
||||||
SerumMarketRegistry.get(address, cluster)
|
SerumMarketRegistry.get(address, cluster)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue