(context: vscode.ExtensionContext)
| 29 | export function deactivate() {} |
| 30 | |
| 31 | async function main(context: vscode.ExtensionContext) { |
| 32 | registerContributedCommands(context, fs); |
| 33 | |
| 34 | const apiName = await detectExplorerApiName(); |
| 35 | const network = networkNames[apiName]; |
| 36 | |
| 37 | vscode.workspace.updateWorkspaceFolders(0, 0, { |
| 38 | uri: vscode.Uri.parse("memfs:/"), |
| 39 | name: network, |
| 40 | }); |
| 41 | |
| 42 | let address: string | undefined; |
| 43 | |
| 44 | if (IN_DETH_HOST) address = await executeHostCommand("getContractAddress"); |
| 45 | |
| 46 | if (!address) { |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | renderStatusBarItems({ |
| 51 | contractAddress: address, |
| 52 | contractName: "contract", |
| 53 | apiName, |
| 54 | }); |
| 55 | |
| 56 | const contractName = await openContractSource(context, fs, apiName, address); |
| 57 | |
| 58 | renderStatusBarItems({ |
| 59 | contractAddress: address, |
| 60 | contractName, |
| 61 | apiName, |
| 62 | }); |
| 63 | } |
| 64 | |
| 65 | async function detectExplorerApiName(): Promise<explorer.ApiName> { |
| 66 | if (IN_DETH_HOST) { |
no test coverage detected