(
args:
| {
contractAddress: string;
contractName: string;
apiName: ApiName;
}
| {}
)
| 4 | import { ApiName, explorerApiUrls } from "./explorer/networks"; |
| 5 | |
| 6 | export 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 | |
| 39 | const _renderedItems = new Map<string, StatusBarItem>(); |
| 40 |
no test coverage detected