MCPcopy Create free account
hub / github.com/dethcrypto/dethcode / renderStatusBarItems

Function renderStatusBarItems

packages/ethereum-viewer/src/statusBar.ts:6–37  ·  view source on GitHub ↗
(
  args:
    | {
        contractAddress: string;
        contractName: string;
        apiName: ApiName;
      }
    | {}
)

Source from the content-addressed store, hash-verified

4import { ApiName, explorerApiUrls } from "./explorer/networks";
5
6export function renderStatusBarItems(
7 args:
8 | {
9 contractAddress: string;
10 contractName: string;
11 apiName: ApiName;
12 }
13 | {}
14) {
15 if ("contractAddress" in args) {
16 const { apiName, contractAddress, contractName } = args;
17 const website = apiUrlToWebsite(explorerApiUrls[apiName]);
18 const link = `${website}/address/${contractAddress}`;
19
20 const where = apiName.endsWith("etherscan")
21 ? "on Etherscan"
22 : "in the explorer";
23
24 const tooltip = `Open ${link}`;
25 renderStatusBarItem({
26 key: "ethereum-viewer.etherscan-link",
27 text: `$(eye) See ${contractName} ${where} (${contractAddress})`,
28 tooltip,
29 command: {
30 title: "Open on Etherscan",
31 command: "vscode.open",
32 arguments: [Uri.parse(link)],
33 },
34 priority: 0,
35 });
36 }
37}
38
39const _renderedItems = new Map<string, StatusBarItem>();
40

Callers 2

mainFunction · 0.90
openFunction · 0.90

Calls 2

apiUrlToWebsiteFunction · 0.90
renderStatusBarItemFunction · 0.85

Tested by

no test coverage detected