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 {
|
||||
LOADER_IDS,
|
||||
PROGRAM_NAME_BY_ID,
|
||||
SPECIAL_IDS,
|
||||
SYSVAR_IDS,
|
||||
LoaderName,
|
||||
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(
|
||||
search: string,
|
||||
cluster: Cluster,
|
||||
|
@ -194,6 +217,11 @@ function buildOptions(
|
|||
options.push(sysvarOptions);
|
||||
}
|
||||
|
||||
const specialOptions = buildSpecialOptions(search);
|
||||
if (specialOptions) {
|
||||
options.push(specialOptions);
|
||||
}
|
||||
|
||||
const tokenOptions = buildTokenOptions(search, cluster, tokenRegistry);
|
||||
if (tokenOptions) {
|
||||
options.push(tokenOptions);
|
||||
|
|
|
@ -132,7 +132,8 @@ export const LOADER_IDS = {
|
|||
BPFLoaderUpgradeab1e11111111111111111111111: "BPF Upgradeable Loader",
|
||||
} as const;
|
||||
|
||||
const SYSVAR_ID: { [key: string]: string } = {
|
||||
export const SPECIAL_IDS: { [key: string]: string } = {
|
||||
"1nc1nerator11111111111111111111111111111111": "Incinerator",
|
||||
Sysvar1111111111111111111111111111111111111: "SYSVAR",
|
||||
};
|
||||
|
||||
|
@ -182,7 +183,7 @@ export function addressLabel(
|
|||
return (
|
||||
programLabel(address, cluster) ||
|
||||
SYSVAR_IDS[address] ||
|
||||
SYSVAR_ID[address] ||
|
||||
SPECIAL_IDS[address] ||
|
||||
tokenLabel(address, tokenRegistry) ||
|
||||
SerumMarketRegistry.get(address, cluster)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue