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

Function detectExplorerApiName

packages/ethereum-viewer/src/extension.ts:65–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63}
64
65async function detectExplorerApiName(): Promise<explorer.ApiName> {
66 if (IN_DETH_HOST) {
67 const detectedName = await executeHostCommand("getApiName");
68
69 if (!detectedName) return "etherscan";
70
71 if (!(detectedName in explorerApiUrls)) {
72 if (detectedName !== "code") {
73 await vscode.window.showErrorMessage(
74 `"${detectedName}" is not a valid network. Using mainnet etherscan instead.`
75 );
76 }
77
78 return "etherscan";
79 }
80
81 return detectedName as explorer.ApiName;
82 } else {
83 return "etherscan";
84 }
85}

Callers 1

mainFunction · 0.85

Calls 1

executeHostCommandFunction · 0.90

Tested by

no test coverage detected