diff --git a/explorer/package-lock.json b/explorer/package-lock.json index d8afd45875..472c3adccf 100644 --- a/explorer/package-lock.json +++ b/explorer/package-lock.json @@ -2720,9 +2720,9 @@ } }, "@solana/web3.js": { - "version": "0.71.6", - "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-0.71.6.tgz", - "integrity": "sha512-mVCqVSEsBacL0xHHwuciHg8qJmFF7Yao9ItASLokYvUYfgwocNS0urnCytOqAFwfE27JRXLHOMOPq6mLbX/2Kg==", + "version": "0.71.11", + "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-0.71.11.tgz", + "integrity": "sha512-x8Hrk8pQuHicxJA5lTJEIsm7rTTorLQv01Wd7ge6CYKXxLQOwtTJV/fPlsAURtfYb92VtYgMbl9vvfXt9uXydw==", "requires": { "@babel/runtime": "^7.3.1", "bn.js": "^5.0.0", @@ -2735,7 +2735,7 @@ "mz": "^2.7.0", "node-fetch": "^2.2.0", "npm-run-all": "^4.1.5", - "rpc-websockets": "^5.0.8", + "rpc-websockets": "^7.1.0", "superstruct": "^0.8.3", "tweetnacl": "^1.0.0", "ws": "^7.0.0" @@ -3272,9 +3272,9 @@ "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==" }, "@types/express-serve-static-core": { - "version": "4.17.9", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.9.tgz", - "integrity": "sha512-DG0BYg6yO+ePW+XoDENYz8zhNGC3jDDEpComMYn7WJc4mY1Us8Rw9ax2YhJXxpyk2SF47PQAoQ0YyVT1a0bEkA==", + "version": "4.17.12", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.12.tgz", + "integrity": "sha512-EaEdY+Dty1jEU7U6J4CUWwxL+hyEGMkO5jan5gplfegUgCUsIUWqXxqw47uGjimeT4Qgkz/XUfwoau08+fgvKA==", "requires": { "@types/node": "*", "@types/qs": "*", @@ -3434,9 +3434,9 @@ "integrity": "sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ==" }, "@types/lodash": { - "version": "4.14.159", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.159.tgz", - "integrity": "sha512-gF7A72f7WQN33DpqOWw9geApQPh4M3PxluMtaHxWHXEGSN12/WbcEk/eNSqWNQcQhF66VSZ06vCF94CrHwXJDg==" + "version": "4.14.161", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.161.tgz", + "integrity": "sha512-EP6O3Jkr7bXvZZSZYlsgt5DIjiGr0dXP1/jVEwVLTFgg0d+3lWVQkRavYVQszV7dYUwvg0B8R0MBDpcmXg7XIA==" }, "@types/minimatch": { "version": "3.0.3", @@ -5322,6 +5322,15 @@ "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" }, + "bufferutil": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.1.tgz", + "integrity": "sha512-xowrxvpxojqkagPcWRQVXZl0YXhRhAtBEIq3VoER1NH5Mw1n1o0ojdspp+GS2J//2gCVyrzQDApQ4unGF+QOoA==", + "optional": true, + "requires": { + "node-gyp-build": "~3.7.0" + } + }, "builtin-status-codes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", @@ -9557,27 +9566,32 @@ } }, "jayson": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/jayson/-/jayson-3.3.3.tgz", - "integrity": "sha512-0bQ/vNvWyi+fzNoMvRK63m7BGU+PWwaJRVaGgJWZeAL5euOSqJtqzqyCrfiS3Sdw3OrvgKWF5f5N8ut87gxrng==", + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/jayson/-/jayson-3.3.4.tgz", + "integrity": "sha512-p2stl9m1C0vM8mdXM1m8shn0v5ECohD5gEDRzLD6CPv02pxRm1lv0jEz0HX6RvfJ/uO9z9Zzlzti7/uqq+Rh5g==", "requires": { - "@types/connect": "^3.4.32", - "@types/express-serve-static-core": "^4.16.9", - "@types/lodash": "^4.14.139", - "@types/node": "^12.7.7", - "JSONStream": "^1.3.1", - "commander": "^2.12.2", + "@types/connect": "^3.4.33", + "@types/express-serve-static-core": "^4.17.9", + "@types/lodash": "^4.14.159", + "@types/node": "^12.12.54", + "JSONStream": "^1.3.5", + "commander": "^2.20.3", "es6-promisify": "^5.0.0", "eyes": "^0.1.8", "json-stringify-safe": "^5.0.1", - "lodash": "^4.17.15", - "uuid": "^3.2.1" + "lodash": "^4.17.20", + "uuid": "^3.4.0" }, "dependencies": { "@types/node": { - "version": "12.12.54", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.54.tgz", - "integrity": "sha512-ge4xZ3vSBornVYlDnk7yZ0gK6ChHf/CHB7Gl1I0Jhah8DDnEQqBzgohYG4FX4p81TNirSETOiSyn+y1r9/IR6w==" + "version": "12.12.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.55.tgz", + "integrity": "sha512-Vd6xQUVvPCTm7Nx1N7XHcpX6t047ltm7TgcsOr4gFHjeYgwZevo+V7I1lfzHnj5BT5frztZ42+RTG4MwYw63dw==" + }, + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" } } }, @@ -11141,6 +11155,12 @@ } } }, + "node-gyp-build": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-3.7.0.tgz", + "integrity": "sha512-L/Eg02Epx6Si2NXmedx+Okg+4UHqmaf3TNcxd50SF9NQGcJaON3AtU++kax69XV7YWz4tUspqZSAsVofhFKG2w==", + "optional": true + }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -14349,23 +14369,48 @@ } }, "rpc-websockets": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-5.3.1.tgz", - "integrity": "sha512-rIxEl1BbXRlIA9ON7EmY/2GUM7RLMy8zrUPTiLPFiYnYOz0I3PXfCmDDrge5vt4pW4oIcAXBDvgZuJ1jlY5+VA==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-7.3.1.tgz", + "integrity": "sha512-7DhZirsTQv4UMS/9q9t3Urhb6kmh3iLyqIFeuhKmQtsmLP3fWrc2KyfoU5zuiBR7HP1IaNhEc3y8rL9SyCXqbw==", "requires": { - "@babel/runtime": "^7.8.7", + "@babel/runtime": "^7.11.2", "assert-args": "^1.2.1", - "babel-runtime": "^6.26.0", + "bufferutil": "^4.0.1", "circular-json": "^0.5.9", - "eventemitter3": "^3.1.2", - "uuid": "^3.4.0", - "ws": "^5.2.2" + "eventemitter3": "^4.0.6", + "next-tick": "^1.1.0", + "utf-8-validate": "^5.0.2", + "uuid": "^8.3.0", + "ws": "^7.3.1" }, "dependencies": { + "@babel/runtime": { + "version": "7.11.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.11.2.tgz", + "integrity": "sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "eventemitter3": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", - "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==" + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" + }, + "next-tick": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", + "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" + }, + "uuid": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz", + "integrity": "sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ==" + }, + "ws": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.1.tgz", + "integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==" } } }, @@ -16256,6 +16301,15 @@ "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" }, + "utf-8-validate": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.2.tgz", + "integrity": "sha512-SwV++i2gTD5qh2XqaPzBnNX88N6HdyhQrNNRykvcS0QKvItV9u3vPEJr+X5Hhfb1JC0r0e1alL0iB09rY8+nmw==", + "optional": true, + "requires": { + "node-gyp-build": "~3.7.0" + } + }, "util": { "version": "0.10.3", "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", diff --git a/explorer/package.json b/explorer/package.json index 15078152a0..84b1407b50 100644 --- a/explorer/package.json +++ b/explorer/package.json @@ -5,7 +5,7 @@ "dependencies": { "@react-hook/debounce": "^3.0.0", "@sentry/react": "^5.22.3", - "@solana/web3.js": "^0.71.6", + "@solana/web3.js": "^0.71.11", "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.0.2", "@testing-library/user-event": "^12.1.3", diff --git a/explorer/src/components/SearchBar.tsx b/explorer/src/components/SearchBar.tsx index 303426516c..229ba0d142 100644 --- a/explorer/src/components/SearchBar.tsx +++ b/explorer/src/components/SearchBar.tsx @@ -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); diff --git a/explorer/src/utils/tx.ts b/explorer/src/utils/tx.ts index bfc8c75c38..4698798212 100644 --- a/explorer/src/utils/tx.ts +++ b/explorer/src/utils/tx.ts @@ -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",