Bump web3 and add bpf loaders to search results (#12066)
This commit is contained in:
@@ -3,7 +3,13 @@ import bs58 from "bs58";
|
||||
import { useHistory, useLocation } from "react-router-dom";
|
||||
import Select, { InputActionMeta, ActionMeta, ValueType } from "react-select";
|
||||
import StateManager from "react-select";
|
||||
import { PROGRAM_IDS, SYSVAR_IDS, ProgramName } from "utils/tx";
|
||||
import {
|
||||
LOADER_IDS,
|
||||
PROGRAM_IDS,
|
||||
SYSVAR_IDS,
|
||||
ProgramName,
|
||||
LoaderName,
|
||||
} from "utils/tx";
|
||||
import { TokenRegistry } from "tokenRegistry";
|
||||
import { Cluster, useCluster } from "providers/cluster";
|
||||
|
||||
@@ -87,6 +93,31 @@ function buildProgramOptions(search: string) {
|
||||
}
|
||||
}
|
||||
|
||||
const SEARCHABLE_LOADERS: LoaderName[] = ["BPF Loader", "BPF Loader 2"];
|
||||
|
||||
function buildLoaderOptions(search: string) {
|
||||
const matchedLoaders = Object.entries(LOADER_IDS).filter(
|
||||
([address, name]) => {
|
||||
return (
|
||||
SEARCHABLE_LOADERS.includes(name) &&
|
||||
(name.toLowerCase().includes(search.toLowerCase()) ||
|
||||
address.includes(search))
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
if (matchedLoaders.length > 0) {
|
||||
return {
|
||||
label: "Program Loaders",
|
||||
options: matchedLoaders.map(([id, name]) => ({
|
||||
label: name,
|
||||
value: [name, id],
|
||||
pathname: "/address/" + id,
|
||||
})),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function buildSysvarOptions(search: string) {
|
||||
const matchedSysvars = Object.entries(SYSVAR_IDS).filter(
|
||||
([address, name]) => {
|
||||
@@ -143,6 +174,11 @@ function buildOptions(search: string, cluster: Cluster) {
|
||||
options.push(programOptions);
|
||||
}
|
||||
|
||||
const loaderOptions = buildLoaderOptions(search);
|
||||
if (loaderOptions) {
|
||||
options.push(loaderOptions);
|
||||
}
|
||||
|
||||
const sysvarOptions = buildSysvarOptions(search);
|
||||
if (sysvarOptions) {
|
||||
options.push(sysvarOptions);
|
||||
|
@@ -3,7 +3,8 @@ import {
|
||||
SystemProgram,
|
||||
StakeProgram,
|
||||
VOTE_PROGRAM_ID,
|
||||
BpfLoader,
|
||||
BPF_LOADER_PROGRAM_ID,
|
||||
BPF_LOADER_DEPRECATED_PROGRAM_ID,
|
||||
SYSVAR_CLOCK_PUBKEY,
|
||||
SYSVAR_RENT_PUBKEY,
|
||||
SYSVAR_REWARDS_PUBKEY,
|
||||
@@ -15,19 +16,8 @@ import {
|
||||
import { TokenRegistry } from "tokenRegistry";
|
||||
import { Cluster } from "providers/cluster";
|
||||
|
||||
export type ProgramName =
|
||||
| "Break Solana Program"
|
||||
| "Budget Program"
|
||||
| "Config Program"
|
||||
| "Exchange Program"
|
||||
| "Stake Program"
|
||||
| "Storage Program"
|
||||
| "System Program"
|
||||
| "Vest Program"
|
||||
| "Vote Program"
|
||||
| "SPL Token Program";
|
||||
|
||||
export const PROGRAM_IDS: { [key: string]: ProgramName } = {
|
||||
export type ProgramName = typeof PROGRAM_IDS[keyof typeof PROGRAM_IDS];
|
||||
export const PROGRAM_IDS = {
|
||||
BrEAK7zGZ6dM71zUDACDqJnekihmwF15noTddWTsknjC: "Break Solana Program",
|
||||
Budget1111111111111111111111111111111111111: "Budget Program",
|
||||
Config1111111111111111111111111111111111111: "Config Program",
|
||||
@@ -38,14 +28,15 @@ export const PROGRAM_IDS: { [key: string]: ProgramName } = {
|
||||
Vest111111111111111111111111111111111111111: "Vest Program",
|
||||
[VOTE_PROGRAM_ID.toBase58()]: "Vote Program",
|
||||
TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA: "SPL Token Program",
|
||||
};
|
||||
} as const;
|
||||
|
||||
const LOADER_IDS = {
|
||||
export type LoaderName = typeof LOADER_IDS[keyof typeof LOADER_IDS];
|
||||
export const LOADER_IDS = {
|
||||
MoveLdr111111111111111111111111111111111111: "Move Loader",
|
||||
NativeLoader1111111111111111111111111111111: "Native Loader",
|
||||
[BpfLoader.programId(1).toBase58()]: "BPF Loader",
|
||||
[BpfLoader.programId(2).toBase58()]: "BPF Loader 2",
|
||||
};
|
||||
[BPF_LOADER_DEPRECATED_PROGRAM_ID.toBase58()]: "BPF Loader",
|
||||
[BPF_LOADER_PROGRAM_ID.toBase58()]: "BPF Loader 2",
|
||||
} as const;
|
||||
|
||||
const SYSVAR_ID: { [key: string]: string } = {
|
||||
Sysvar1111111111111111111111111111111111111: "SYSVAR",
|
||||
|
Reference in New Issue
Block a user