Skip to content

Commit 9fd6bec

Browse files
authored
Merge pull request #118 from quantanet/prepare-release-v0.1.8
Prepare release v0.1.8
2 parents 2ce9534 + 45a76f1 commit 9fd6bec

File tree

13 files changed

+333
-251
lines changed

13 files changed

+333
-251
lines changed

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,38 @@
1-
# Ethereum IDE in VSCode
1+
# Ethereum plugin for VSCode
22
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/Ethereum-Devtools-Developers-Studio/ethcode)
33

4+
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.
5+
46
## System support
57
* Linux, Mac, Windows
68

79
## Usage instructions
810
`ctrl+alt+e` - activate the plugin.
9-
![Screenshot from 2019-09-28 23-04-40](https://user-images.githubusercontent.com/13261372/65820327-15ed3a00-e245-11e9-9836-606bb1a71de6.png)
11+
12+
![Screenshot from 2019-09-28 23-04-40](https://user-images.githubusercontent.com/13261372/78938476-e9f22180-7acf-11ea-8705-5a7f755a962a.png)
1013

1114
`ctrl+alt+c` - compile contracts.
15+
1216
![Screenshot from 2019-09-28 23-05-13](https://user-images.githubusercontent.com/13261372/71320562-e57b0c00-24d2-11ea-9b17-2629da608c6d.png)
1317

18+
Deploy contracts to test network.
19+
20+
![Screenshot from 2020-04-10 03-04-40](https://user-images.githubusercontent.com/13261372/78942930-5709b500-7ad8-11ea-8557-511fd4e537cc.png)
21+
1422
`ctrl+alt+t` - run unit testing.
15-
![Screenshot from 2019-10-30 20-00-05](https://user-images.githubusercontent.com/13261372/67867273-26e4e000-fb50-11e9-9956-5f06e27c5a29.png)
23+
24+
![Screenshot from 2019-10-30 20-00-05](https://user-images.githubusercontent.com/13261372/78938685-448b7d80-7ad0-11ea-8248-d2494269b52e.png)
1625

1726
**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.*
1827

1928
## Vyper support
2029
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
2130

31+
## Use locally generated key-pair to use with test networks
32+
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).
33+
34+
![Screenshot from 2020-04-11 01-02-38](https://user-images.githubusercontent.com/13261372/79018200-db1f7380-7b90-11ea-98f6-846f26405b35.png)
35+
2236
## Help
2337
Please help ethcode developers continue their work.
2438

@@ -73,4 +87,4 @@ Add following lines in vscode `settings.json`
7387
* https://github.com/Microsoft/vscode-go/wiki/Building,-Debugging-and-Sideloading-the-extension-in-Visual-Studio-Code
7488
* https://code.visualstudio.com/api/working-with-extensions/bundling-extension
7589
* https://stackoverflow.com/questions/50885128/how-can-i-debug-a-child-process-fork-process-from-visual-studio-code
76-
* https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_automatically-attach-debugger-to-nodejs-subprocesses
90+
* https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_automatically-attach-debugger-to-nodejs-subprocesses

ext-src/extension.ts

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class ReactPanel {
174174
this.version = message.version;
175175
} else if (message.command === 'run-deploy') {
176176
this.runDeploy(message.payload, message.testNetId);
177-
} else if (message.command === 'contract-method-call') {
177+
} else if (message.command.endsWith('contract-method-call')) {
178178
this.runContractCall(message.payload, message.testNetId);
179179
} else if (message.command === 'run-get-gas-estimate') {
180180
this.runGetGasEstimate(message.payload, message.testNetId);
@@ -310,7 +310,9 @@ class ReactPanel {
310310
version: this.version
311311
});
312312
solcWorker.on("message", (m: any) => {
313-
if (m.data && m.path) {
313+
if (m.error) {
314+
errorToast(m.error);
315+
} else if (m.data && m.path) {
314316
sources[m.path] = {
315317
content: m.data.content
316318
};
@@ -319,22 +321,22 @@ class ReactPanel {
319321
payload: input,
320322
version: this.version
321323
});
322-
}
323-
if (m.compiled) {
324+
} else if (m.compiled) {
324325
context.workspaceState.update("sources", JSON.stringify(sources));
325-
this._panel.webview.postMessage({ compiled: m.compiled, sources, newCompile: true, testPanel: 'main' });
326-
solcWorker.kill();
327-
}
328-
if (m.processMessage) {
326+
this._panel.webview.postMessage({ compiled: m.compiled, sources, testPanel: 'main' });
327+
} else if (m.processMessage) {
329328
this._panel.webview.postMessage({ processMessage: m.processMessage });
330329
}
331330
});
332331
solcWorker.on("error", (error: Error) => {
333332
console.log("%c Compile worker process exited with error" + `${error.message}`, "background: rgba(36, 194, 203, 0.3); color: #EF525B");
333+
solcWorker.kill();
334334
});
335335
solcWorker.on("exit", (code: number, signal: string) => {
336336
console.log("%c Compile worker process exited with " + `code ${code} and signal ${signal}`, "background: rgba(36, 194, 203, 0.3); color: #EF525B");
337-
this._panel.webview.postMessage({ message: `Error code ${code} : Error signal ${signal}` });
337+
this._panel.webview.postMessage({ processMessage: `Error code ${code} : Error signal ${signal}` });
338+
solcWorker.kill();
339+
// TODO: now if we kill process anywhere except here things fails randomly, (todo) properly exit process
338340
});
339341
}
340342
private invokeVyperCompiler(context: vscode.ExtensionContext, sources: ISources): void {
@@ -347,7 +349,7 @@ class ReactPanel {
347349
source: sources,
348350
version: this.version
349351
});
350-
vyperWorker.on('message', (m) => {
352+
vyperWorker.on('message', (m: any) => {
351353
if (m.error) {
352354
errorToast(m.error);
353355
}
@@ -488,15 +490,23 @@ class ReactPanel {
488490
}
489491
// call contract method
490492
private runContractCall(payload: any, testNetId: string) {
491-
var f: boolean = true;
493+
console.log("Running contract call");
492494
const callWorker = this.createWorker();
493495
callWorker.on("message", (m: any) => {
494-
this._panel.webview.postMessage({ callResult: m });
496+
if (m.error) {
497+
this._panel.webview.postMessage({ errors: m.error });
498+
} else if (m.unsignedTx) {
499+
this._panel.webview.postMessage({ unsignedTx: m.unsignedTx });
500+
} else {
501+
this._panel.webview.postMessage({ ganacheCallResult: m.callResult });
502+
}
495503
});
496-
if (f) {
497-
callWorker.send({ command: "contract-method-call", payload, jwtToken, testnetId: testNetId });
504+
if (testNetId === 'ganache') {
505+
console.log("testnet Id: " + testNetId);
506+
callWorker.send({ command: "ganache-contract-method-call", payload, jwtToken, testnetId: testNetId });
498507
} else {
499-
callWorker.send({ command: "custom-method-call", payload, jwtToken, testnetId: testNetId });
508+
console.log("testnet Id: " + testNetId);
509+
callWorker.send({ command: "contract-method-call", payload, jwtToken, testnetId: testNetId });
500510
}
501511
}
502512
// Get gas estimates
@@ -527,8 +537,8 @@ class ReactPanel {
527537
private sendEtherSigned(payload: any, testNetId: string) {
528538
const sendEtherWorker = this.createWorker();
529539
sendEtherWorker.on("message", (m: any) => {
530-
if (m.unsingedTx) {
531-
this._panel.webview.postMessage({ unsingedTx: m.unsingedTx });
540+
if (m.unsignedTx) {
541+
this._panel.webview.postMessage({ unsignedTx: m.unsignedTx });
532542
} else if (m.transactionResult) {
533543
this._panel.webview.postMessage({ transactionResult: m.transactionResult });
534544
success("Successfully sent Ether");

0 commit comments

Comments
 (0)