()
| 12 | ) { |
| 13 | const contributedCommands = { |
| 14 | async open() { |
| 15 | const address = await window.showInputBox({ |
| 16 | title: "contract address", |
| 17 | placeHolder: "0x0000000000000000000000000000000000000000", |
| 18 | }); |
| 19 | |
| 20 | if (!address) { |
| 21 | // cancelling is not an error |
| 22 | return; |
| 23 | } |
| 24 | |
| 25 | const networks = unsafeEntries(networkNames); |
| 26 | |
| 27 | interface Item extends QuickPickItem { |
| 28 | apiName: ApiName; |
| 29 | } |
| 30 | |
| 31 | const picked = await window.showQuickPick( |
| 32 | networks.map( |
| 33 | ([apiName, networkName]): Item => ({ |
| 34 | label: networkName, |
| 35 | detail: explorerApiUrls[apiName as ApiName], |
| 36 | apiName, |
| 37 | }) |
| 38 | ), |
| 39 | { |
| 40 | canPickMany: false, |
| 41 | title: "network", |
| 42 | matchOnDetail: true, |
| 43 | } |
| 44 | ); |
| 45 | |
| 46 | if (!picked) { |
| 47 | await window.showWarningMessage("Sorry, we need to pick a network."); |
| 48 | return; |
| 49 | } |
| 50 | |
| 51 | const { apiName } = picked; |
| 52 | |
| 53 | const contractName = await openContractSource( |
| 54 | context, |
| 55 | fs, |
| 56 | apiName, |
| 57 | address |
| 58 | ); |
| 59 | |
| 60 | renderStatusBarItems({ |
| 61 | contractAddress: address, |
| 62 | contractName, |
| 63 | apiName, |
| 64 | }); |
| 65 | }, |
| 66 | }; |
| 67 | |
| 68 | for (const [key, value] of Object.entries(contributedCommands)) { |
nothing calls this directly
no test coverage detected