Skip to content

Commit

Permalink
Merge pull request #118 from quantanet/prepare-release-v0.1.8
Browse files Browse the repository at this point in the history
Prepare release v0.1.8
  • Loading branch information
0mkara authored Apr 10, 2020
2 parents 2ce9534 + 45a76f1 commit 9fd6bec
Show file tree
Hide file tree
Showing 13 changed files with 333 additions and 251 deletions.
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
# Ethereum IDE in VSCode
# Ethereum plugin for VSCode
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/Ethereum-Devtools-Developers-Studio/ethcode)

Ethcode is a vscode plugin for compiling, deploy, execute solidity and vyper smart contracts/programs in Ethereum blockchian. It supports multiple test networks. Ethcode has inbuilt support for Remix transaction debug and solidity unit testing.

## System support
* Linux, Mac, Windows

## Usage instructions
`ctrl+alt+e` - activate the plugin.
![Screenshot from 2019-09-28 23-04-40](https://user-images.githubusercontent.com/13261372/65820327-15ed3a00-e245-11e9-9836-606bb1a71de6.png)

![Screenshot from 2019-09-28 23-04-40](https://user-images.githubusercontent.com/13261372/78938476-e9f22180-7acf-11ea-8705-5a7f755a962a.png)

`ctrl+alt+c` - compile contracts.

![Screenshot from 2019-09-28 23-05-13](https://user-images.githubusercontent.com/13261372/71320562-e57b0c00-24d2-11ea-9b17-2629da608c6d.png)

Deploy contracts to test network.

![Screenshot from 2020-04-10 03-04-40](https://user-images.githubusercontent.com/13261372/78942930-5709b500-7ad8-11ea-8557-511fd4e537cc.png)

`ctrl+alt+t` - run unit testing.
![Screenshot from 2019-10-30 20-00-05](https://user-images.githubusercontent.com/13261372/67867273-26e4e000-fb50-11e9-9956-5f06e27c5a29.png)

![Screenshot from 2019-10-30 20-00-05](https://user-images.githubusercontent.com/13261372/78938685-448b7d80-7ad0-11ea-8248-d2494269b52e.png)

**Note:** *compilation with latest/default version is faster. compilation with any other selected version can be slower as it loads the compiler version from internet.*

## Vyper support
Please install vyper compiler for compiling vyper contracts in ethcode. Instructions for vyper compiler installation can be found on official vyper documentation - https://vyper.readthedocs.io/en/latest/installing-vyper.html

## Use locally generated key-pair to use with test networks
Ethcode signs all transactions using generated key-pair in your computer. Use `Generate key pair` button to generate one. Then go to respective test network faucet and get some testnet ether. For `Görli` use [goerli-faucet](https://goerli-faucet.slock.it).

![Screenshot from 2020-04-11 01-02-38](https://user-images.githubusercontent.com/13261372/79018200-db1f7380-7b90-11ea-98f6-846f26405b35.png)

## Help
Please help ethcode developers continue their work.

Expand Down Expand Up @@ -73,4 +87,4 @@ Add following lines in vscode `settings.json`
* https://github.com/Microsoft/vscode-go/wiki/Building,-Debugging-and-Sideloading-the-extension-in-Visual-Studio-Code
* https://code.visualstudio.com/api/working-with-extensions/bundling-extension
* https://stackoverflow.com/questions/50885128/how-can-i-debug-a-child-process-fork-process-from-visual-studio-code
* https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_automatically-attach-debugger-to-nodejs-subprocesses
* https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_automatically-attach-debugger-to-nodejs-subprocesses
44 changes: 27 additions & 17 deletions ext-src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class ReactPanel {
this.version = message.version;
} else if (message.command === 'run-deploy') {
this.runDeploy(message.payload, message.testNetId);
} else if (message.command === 'contract-method-call') {
} else if (message.command.endsWith('contract-method-call')) {
this.runContractCall(message.payload, message.testNetId);
} else if (message.command === 'run-get-gas-estimate') {
this.runGetGasEstimate(message.payload, message.testNetId);
Expand Down Expand Up @@ -310,7 +310,9 @@ class ReactPanel {
version: this.version
});
solcWorker.on("message", (m: any) => {
if (m.data && m.path) {
if (m.error) {
errorToast(m.error);
} else if (m.data && m.path) {
sources[m.path] = {
content: m.data.content
};
Expand All @@ -319,22 +321,22 @@ class ReactPanel {
payload: input,
version: this.version
});
}
if (m.compiled) {
} else if (m.compiled) {
context.workspaceState.update("sources", JSON.stringify(sources));
this._panel.webview.postMessage({ compiled: m.compiled, sources, newCompile: true, testPanel: 'main' });
solcWorker.kill();
}
if (m.processMessage) {
this._panel.webview.postMessage({ compiled: m.compiled, sources, testPanel: 'main' });
} else if (m.processMessage) {
this._panel.webview.postMessage({ processMessage: m.processMessage });
}
});
solcWorker.on("error", (error: Error) => {
console.log("%c Compile worker process exited with error" + `${error.message}`, "background: rgba(36, 194, 203, 0.3); color: #EF525B");
solcWorker.kill();
});
solcWorker.on("exit", (code: number, signal: string) => {
console.log("%c Compile worker process exited with " + `code ${code} and signal ${signal}`, "background: rgba(36, 194, 203, 0.3); color: #EF525B");
this._panel.webview.postMessage({ message: `Error code ${code} : Error signal ${signal}` });
this._panel.webview.postMessage({ processMessage: `Error code ${code} : Error signal ${signal}` });
solcWorker.kill();
// TODO: now if we kill process anywhere except here things fails randomly, (todo) properly exit process
});
}
private invokeVyperCompiler(context: vscode.ExtensionContext, sources: ISources): void {
Expand All @@ -347,7 +349,7 @@ class ReactPanel {
source: sources,
version: this.version
});
vyperWorker.on('message', (m) => {
vyperWorker.on('message', (m: any) => {
if (m.error) {
errorToast(m.error);
}
Expand Down Expand Up @@ -488,15 +490,23 @@ class ReactPanel {
}
// call contract method
private runContractCall(payload: any, testNetId: string) {
var f: boolean = true;
console.log("Running contract call");
const callWorker = this.createWorker();
callWorker.on("message", (m: any) => {
this._panel.webview.postMessage({ callResult: m });
if (m.error) {
this._panel.webview.postMessage({ errors: m.error });
} else if (m.unsignedTx) {
this._panel.webview.postMessage({ unsignedTx: m.unsignedTx });
} else {
this._panel.webview.postMessage({ ganacheCallResult: m.callResult });
}
});
if (f) {
callWorker.send({ command: "contract-method-call", payload, jwtToken, testnetId: testNetId });
if (testNetId === 'ganache') {
console.log("testnet Id: " + testNetId);
callWorker.send({ command: "ganache-contract-method-call", payload, jwtToken, testnetId: testNetId });
} else {
callWorker.send({ command: "custom-method-call", payload, jwtToken, testnetId: testNetId });
console.log("testnet Id: " + testNetId);
callWorker.send({ command: "contract-method-call", payload, jwtToken, testnetId: testNetId });
}
}
// Get gas estimates
Expand Down Expand Up @@ -527,8 +537,8 @@ class ReactPanel {
private sendEtherSigned(payload: any, testNetId: string) {
const sendEtherWorker = this.createWorker();
sendEtherWorker.on("message", (m: any) => {
if (m.unsingedTx) {
this._panel.webview.postMessage({ unsingedTx: m.unsingedTx });
if (m.unsignedTx) {
this._panel.webview.postMessage({ unsignedTx: m.unsignedTx });
} else if (m.transactionResult) {
this._panel.webview.postMessage({ transactionResult: m.transactionResult });
success("Successfully sent Ether");
Expand Down
Loading

0 comments on commit 9fd6bec

Please sign in to comment.