Skip to content
This repository was archived by the owner on Mar 11, 2024. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
001c69d
feat: command provider poc
michaeljohnbennett Jul 20, 2022
0ed7d89
fix: adding in tests and typings to make chai/mocha work
michaeljohnbennett Jul 26, 2022
dabb72a
Merge remote-tracking branch 'origin/develop' into feature/command-pr…
michaeljohnbennett Aug 1, 2022
af4eaaa
fix: adjusting provider
michaeljohnbennett Aug 1, 2022
e8c58b6
fix: adjusting provider
michaeljohnbennett Aug 5, 2022
8126c63
Merge remote-tracking branch 'origin/develop' into feature/command-pr…
michaeljohnbennett Aug 11, 2022
2e804e2
fix: rework again after merging
michaeljohnbennett Aug 11, 2022
27f20a7
fix: added logging wrapper
michaeljohnbennett Aug 15, 2022
b13ae39
Merge remote-tracking branch 'origin/develop' into feature/command-pr…
michaeljohnbennett Aug 15, 2022
b8904b6
fix: added in compiler
michaeljohnbennett Aug 15, 2022
18b9882
fix: cleanup comments
michaeljohnbennett Aug 24, 2022
5d84c97
fix: merging in changes from develop
michaeljohnbennett Nov 1, 2022
ecd92be
fix: logging fixed
michaeljohnbennett Nov 1, 2022
e002cb6
fix: project based compilation working
michaeljohnbennett Nov 1, 2022
b8f3da9
fix: cleaning up code
michaeljohnbennett Nov 7, 2022
9ae11c7
fix: lots of refactoring
michaeljohnbennett Nov 9, 2022
2c0f847
fix: lots of refactoring
michaeljohnbennett Nov 14, 2022
3c01bfe
fix: tests
michaeljohnbennett Nov 16, 2022
90a7f12
Merge branch 'develop' into feature/command-provider-poc
michaeljohnbennett Nov 16, 2022
7bfb7fe
chore: removing copyright cleanup
michaeljohnbennett Nov 17, 2022
75e4935
chore: post merge refactor/cleanup
michaeljohnbennett Nov 18, 2022
19a3be6
fix: broken integration tests
michaeljohnbennett Nov 21, 2022
5ed78f4
fix: windows paths on CICD
michaeljohnbennett Nov 21, 2022
3addbe8
Merge branch 'develop' into feature/command-provider-poc
michaeljohnbennett Nov 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,3 @@ resources/drizzle/

ui-test/

### We ignore the config file to stop issues.
# .eslintrc.js
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,13 @@
"default": false,
"description": "Disable notification on long running tasks."
},
"truffle-vscode.storageAccount.name": {
"type": "string",
"scope": "Storage Account name"
},
"truffle-vscode.coreSDK": {
"type": "string",
"scope": "Core SDK for extensions backend",
"default": "Truffle",
"enum": [
"Truffle"
"Truffle",
"Hardhat"
]
}
}
Expand Down Expand Up @@ -421,7 +418,7 @@
},
{
"command": "truffle-vscode.buildContracts",
"when": "view == truffle-vscode.views.explorer && viewItem == root",
"when": "view == truffle-vscode.views.explorer",
"group": "truffle-0@1"
},
{
Expand Down Expand Up @@ -752,6 +749,7 @@
"@commitlint/cli": "^17.0.3",
"@commitlint/config-conventional": "^17.0.3",
"@types/big.js": "^6.1.2",
"@types/chai": "^4.3.1",
"@types/copy-webpack-plugin": "^8.0.1",
"@types/download": "^6.2.4",
"@types/estree": "^0.0.52",
Expand All @@ -768,7 +766,7 @@
"@types/rewire": "^2.5.28",
"@types/rimraf": "^3.0.2",
"@types/semver": "^6.0.0",
"@types/sinon": "^7.0.11",
"@types/sinon": "^10.0.13",
"@types/source-map": "^0.5.2",
"@types/uuid": "^3.4.4",
"@types/vscode": "1.66.0",
Expand All @@ -777,6 +775,7 @@
"@vscode/debugadapter": "^1.55.1",
"@vscode/debugprotocol": "^1.55.1",
"@vscode/test-electron": "^2.1.3",
"chai": "^4.3.6",
"copy-webpack-plugin": "^10.0.0",
"copyfiles": "^2.4.1",
"decache": "^4.5.1",
Expand All @@ -785,13 +784,13 @@
"husky": "^8.0.1",
"istanbul": "^0.4.5",
"lint-staged": "^8.2.0",
"mocha": "^6.2.3",
"mocha": "^10.0.0",
"mockery": "^2.1.0",
"prettier": "2.7.1",
"pretty-quick": "^3.1.3",
"remap-istanbul": "^0.13.0",
"rewire": "^4.0.1",
"sinon": "^7.3.2",
"sinon": "^14.0.2",
"truffle": "^5.5.30",
"ts-loader": "9.3.1",
"ts-node": "^10.8.1",
Expand Down
3 changes: 3 additions & 0 deletions polyfills/original-require.js
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
// Copyright (c) 2022. Consensys Software Inc. All rights reserved.
// Licensed under the MIT license.

module.exports = eval('require');
3 changes: 3 additions & 0 deletions resources/ganache/assets/icons/account.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions resources/ganache/assets/icons/blocks.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion resources/ganache/assets/icons/contract.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion resources/ganache/assets/icons/events.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions resources/ganache/assets/icons/transactions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions resources/ganache/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<!-- Copyright (c) 2022. Consensys Software Inc. All rights reserved. -->
<!-- Licensed under the MIT license. -->

<!DOCTYPE html>
<html lang="en">
<head>
Expand Down
3 changes: 3 additions & 0 deletions resources/ganache/main.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* Copyright (c) 2022. Consensys Software Inc. All rights reserved. */
/* Licensed under the MIT license. */

:root {
--primary-color: rgba(235, 182, 126, 1);
--text-color: rgba(54, 65, 83, 1);
Expand Down
3 changes: 3 additions & 0 deletions resources/ganache/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2022. Consensys Software Inc. All rights reserved.
// Licensed under the MIT license.

const ganacheDetails = {
config: {
vscode: acquireVsCodeApi(),
Expand Down
3 changes: 3 additions & 0 deletions resources/logPanel/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<!-- Copyright (c) 2022. Consensys Software Inc. All rights reserved. -->
<!-- Licensed under the MIT license. -->

<!DOCTYPE html>
<html lang="en">
<head>
Expand Down
3 changes: 3 additions & 0 deletions resources/logPanel/main.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* Copyright (c) 2022. Consensys Software Inc. All rights reserved. */
/* Licensed under the MIT license. */

body,
html {
width: 100% !important;
Expand Down
3 changes: 3 additions & 0 deletions resources/logPanel/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2022. Consensys Software Inc. All rights reserved.
// Licensed under the MIT license.

const logView = {
config: {
state: acquireVsCodeApi(),
Expand Down
13 changes: 12 additions & 1 deletion src/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export enum RequiredApps {
dashboard = 'dashboard',
}

export enum OptionalApps {
hardhat = 'hardhat',
}
export type AppTypes = RequiredApps | OptionalApps;

export enum NotificationOptions {
error = 'error',
info = 'info',
Expand Down Expand Up @@ -120,6 +125,10 @@ export class Constants {
max: '',
min: '5.5.0',
},
[OptionalApps.hardhat]: {
max: '',
min: '2.9.0',
},
};

public static telemetryEvents = {
Expand Down Expand Up @@ -606,6 +615,8 @@ export class Constants {
WorkspaceShouldBeOpened: 'Workspace should be opened',
DashboardVersionError: 'Please upgrade to the latest version of Truffle to use this feature',
FetchingBoxesHasFailed: 'An error occurred while fetching boxes',
HHNoDefaultDeploy:
'Hardhat has no default deploy command. Consider using the HardHat Deploy Plugin: [hardhat-deploy](https://github.com/wighawag/hardhat-deploy)',
};

public static informationMessage = {
Expand Down Expand Up @@ -677,11 +688,11 @@ export class Constants {
};
public static userSettings = {
coreSdkSettingsKey: 'truffle-vscode.coreSDK',
storageAccountUserSettingsKey: 'truffle-vscode.storageAccount.name',
};

public static coreSdk = {
truffle: 'Truffle',
hardhat: 'Hardhat',
};

public static initialize(context: ExtensionContext) {
Expand Down
3 changes: 3 additions & 0 deletions src/Models/StatusBarItems/Contract.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2022. Consensys Software Inc. All rights reserved.
// Licensed under the MIT license.

import {Constants} from '@/Constants';
import {Memento, StatusBarAlignment, StatusBarItem, window} from 'vscode';

Expand Down
4 changes: 3 additions & 1 deletion src/Output.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Consensys Software Inc. All rights reserved.
// Copyright (c) 2022. Consensys Software Inc. All rights reserved.
// Licensed under the MIT license.

import {commands, ExtensionContext, window} from 'vscode';
Expand All @@ -13,6 +13,8 @@ export enum OutputLabel {
requirements = 'Truffle: Requirements',
telemetryClient = 'Truffle: Telemetry Client',
treeManager = 'Truffle: Service Tree Manager',
sdkCoreCommands = 'Truffle: SDK Commands',
hardhatCommands = 'Truffle: Hardhat Commands',
}

export class Output {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/ContractCommands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Consensys Software Inc. All rights reserved.
// Copyright (c) 2022. Consensys Software Inc. All rights reserved.
// Licensed under the MIT license.

import {StatusBarItems} from '@/Models/StatusBarItems/Contract';
Expand Down
12 changes: 6 additions & 6 deletions src/commands/DebuggerCommands.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
// Copyright (c) Consensys Software Inc. All rights reserved.
// Copyright (c) 2022. Consensys Software Inc. All rights reserved.
// Licensed under the MIT license.

import path from 'path';
import {debug, DebugConfiguration, QuickPickItem, workspace} from 'vscode';

import {DEBUG_TYPE} from '@/debugAdapter/constants/debugAdapter';
import {DebugNetwork} from '@/debugAdapter/debugNetwork';
import {shortenHash} from '@/debugAdapter/functions';
import {TransactionProvider} from '@/debugAdapter/transaction/transactionProvider';
import {Web3Wrapper} from '@/debugAdapter/web3Wrapper';
import {getTruffleWorkspace, getPathByPlatform} from '@/helpers/workspace';
import {getWorkspaceForUri} from '@/helpers/AbstractWorkspace';
import {showInputBox, showQuickPick} from '@/helpers/userInteraction';
import {getPathByPlatform} from '@/helpers/WorkspaceHelpers';
import {Telemetry} from '@/TelemetryClient';
import path from 'path';
import {debug, DebugConfiguration, QuickPickItem, workspace} from 'vscode';

export namespace DebuggerCommands {
export async function startSolidityDebugger() {
Telemetry.sendEvent('DebuggerCommands.startSolidityDebugger.commandStarted');

const workspaceUri = (await getTruffleWorkspace()).workspace;
const workspaceUri = (await getWorkspaceForUri()).workspace;
const workingDirectory = getPathByPlatform(workspaceUri);
const debugNetwork = new DebugNetwork(workingDirectory);
await debugNetwork.load();
Expand Down
44 changes: 44 additions & 0 deletions src/commands/HardhatCommands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright (c) 2022. Consensys Software Inc. All rights reserved.
// Licensed under the MIT license.

import {Constants, NotificationOptions, OptionalApps} from '@/Constants';

import {outputCommandHelper} from '@/helpers';
import {required} from '@/helpers/required';
import {showIgnorableNotification, showNotification} from '@/helpers/userInteraction';
import {AbstractWorkspace} from '@/helpers/AbstractWorkspace';
import {Output, OutputLabel} from '@/Output';
import {Telemetry} from '@/TelemetryClient';
import {commands, Uri} from 'vscode';

export async function buildContracts(ws: AbstractWorkspace, uri?: Uri): Promise<void> {
Telemetry.sendEvent('HardhatCommands.buildContracts.commandStarted');
if (!(await required.checkAppsSilentForUri(ws.workspace, OptionalApps.hardhat))) {
Telemetry.sendEvent('HardhatCommands.buildContracts.hardhatInstallationMissing');
await showNotification({
message: 'Hardhat is not installed, please install to continue...',
type: NotificationOptions.error,
});
// await required.installHardhat(required.Scope.locally);
return;
}

const workspaceDir = ws.workspace.fsPath;

Output.outputLine(OutputLabel.hardhatCommands, `compiling: ${JSON.stringify(uri)} : ${workspaceDir}`);
const args: string[] = [OptionalApps.hardhat, 'compile'];

// hardhat will compile all contracts, not one specifically.
Output.outputLine(
OutputLabel.hardhatCommands,
`Building: ${args} DIR: ${workspaceDir} Workspace: ${JSON.stringify(ws)} `
);

await showIgnorableNotification(Constants.statusBarMessages.buildingContracts, async () => {
Output.show();
await outputCommandHelper.executeCommand(workspaceDir, 'npx', args.join(' '));
commands.executeCommand('truffle-vscode.views.deployments.refresh');

Telemetry.sendEvent('HardhatCommands.buildContracts.commandFinished');
});
}
2 changes: 1 addition & 1 deletion src/commands/ProjectCommands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Consensys Software Inc. All rights reserved.
// Copyright (c) 2022. Consensys Software Inc. All rights reserved.
// Licensed under the MIT license.

import {Constants, RequiredApps} from '@/Constants';
Expand Down
Loading