Skip to content
Merged

v2 #224

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
62201de
updated interfaces, abi, bytecode
Jun 18, 2022
74d5dcb
Create constructor issue solved
Jun 20, 2022
a8769c0
Updated structure for remix
Jun 20, 2022
3dcd74a
Added loading multiple json files functinality
Jun 23, 2022
0dc7928
commit
Aniket6990 Jun 23, 2022
d43f493
fixed network and account selection,check balance bug
Aniket6990 Jun 23, 2022
6665bf6
Added select one contract function
Jun 23, 2022
ecbd4f5
Merged and need to add package.json
Jun 24, 2022
54fea89
Compilation issue fixed after yarn
Jun 24, 2022
5690a5f
Removed src, optimized the code
Jun 25, 2022
ea274c9
Updated version
Jun 25, 2022
04b054a
clean up react
0mkara Jun 26, 2022
80fb2cc
Merge pull request #222 from ethential/dev/clean-up
domin191013 Jun 26, 2022
ccccbcc
Added list, select function
Jun 27, 2022
d04169e
Merge pull request #220 from ethential/dev/compiled-json-load
0mkara Jun 27, 2022
d32fbbb
Changed rpc format
Jun 28, 2022
e90d95c
updated functions incuding getbalance function
Jun 28, 2022
bdff610
Add http url validator and other things
Jun 29, 2022
da9fa99
Merged feat/v2
Jun 29, 2022
1585504
Merge pull request #223 from ethential/dev/networkprovider
0mkara Jun 30, 2022
bf5770e
Added deploy and call function
Jun 30, 2022
6dbd6a0
Changed structure and saved files to same directory as compiled jsons
Jul 2, 2022
ef286eb
Saved function inputs to same directory
Jul 2, 2022
582b790
Saved the constructor input automatically when selecting the network
Jul 4, 2022
f139618
Deploy the contract, create input constructor
Jul 5, 2022
c45b8c2
Added function call of select smart contract
Jul 7, 2022
71cbf30
Added testing contracts
Jul 7, 2022
eb5d663
Added hardhat testing project
Jul 7, 2022
6d7bd31
Removed contracts folder and put into remix folder
Jul 7, 2022
1e82a87
Improved funciton call ui
Jul 8, 2022
8ecb4c2
Added ganache network deploy and function call
Jul 11, 2022
8af8189
Added hardhat features
Jul 11, 2022
a83cd94
Changed function name, worked on PR reviews
Jul 13, 2022
a577cf6
fix text and misc
0mkara Jul 13, 2022
4133542
Merge pull request #229 from ethential/fix/dev/conract-functions
0mkara Jul 13, 2022
44f655c
Merge pull request #226 from ethential/dev/conract-functions
0mkara Jul 13, 2022
e20c37c
Update Readme.md
Aniket6990 Jul 15, 2022
8496f9a
update README.MD
Aniket6990 Jul 15, 2022
7d1be35
update README
0mkara Jul 15, 2022
2f4b67a
update README discord link
0mkara Jul 15, 2022
3c54d95
update README
0mkara Jul 15, 2022
a721e94
update README
0mkara Jul 17, 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: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/build/ext-src"],
"outFiles": ["${workspaceRoot}/build/src"],
"preLaunchTask": "npm: watch"
},
{
Expand Down
2 changes: 1 addition & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tsconfig.json
tsconfig.extension.json
webpack.config.js
yarn.lock
ext-src/**
src/**
*.ts
*.sol
.gitignore
Expand Down
185 changes: 112 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,134 +1,170 @@
# [Ethereum](https://ethereum.org/) plugin for [VSCode](https://code.visualstudio.com/)
[![Join the chat at https://gitter.im/Ethential/ethcode](https://badges.gitter.im/Ethential/ethcode.svg)](https://gitter.im/Ethential/ethcode?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Discord chat](https://img.shields.io/discord/722971683388129290?color=7389D8&logo=discord&logoColor=ffffff)](https://discord.gg/87sE7Bm)
# Ethcode - Smart Contract Development & Execution Interface

Ethcode is a vscode extension 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.
[![Discord chat](https://img.shields.io/discord/722971683388129290?color=7389D8&logo=discord&logoColor=ffffff)](https://discord.gg/yBBmtqGvxK)

Ethcode is a vscode extension that helps deploy and execute solidity smart contracts in EVM based blockchians. It supports multiple test networks.

## Website

https://ethcode.dev/

## Docs

https://docs.ethcode.dev/

## Installation

VisualStudio Marketplace - https://marketplace.visualstudio.com/items?itemName=ethential.ethcode

## System support
* Linux, Mac, Windows

- Linux, Mac, Windows

## Usage instructions
### Activate plugin with activation command
* Command: `ethcode.activate`
* Description: Activates Ethcode extension.

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

### Load compiled JSON
* Command: `ethcode.combined-json.load`, `ethcode.standard-json.load`
* Description: Generate constructor inputs.
- Keyboard shortcut: `ctrl + alt + e`
- Command: `ethcode.activate`
(`ctrl + shift + P` to open command palette)

![Screenshot from 2021-07-01 19-41-30](https://user-images.githubusercontent.com/13261372/124138953-c7697100-daa4-11eb-9064-5756dba06606.png)
![Untitled](https://user-images.githubusercontent.com/87822922/179242559-30be9e9a-b961-4bb7-8879-d2fc3842d154.png)

![Screenshot from 2021-07-01 19-41-44](https://user-images.githubusercontent.com/13261372/124138945-c59fad80-daa4-11eb-954a-f47bbf0d0fec.png)
---

### Create constructor inputs
* Command: `ethcode.contract.input.create`
* Description: Generate constructor inputs.
### Select Ethereum Network

![Screenshot from 2021-07-01 19-55-50](https://user-images.githubusercontent.com/13261372/124141448-10bac000-daa7-11eb-978e-0746a51b4a08.png)
- Open command palette `ctrl + shift + P`
- `Select ethereum network` > Select your preferred network

This will create a `constructor-input.json` file inside your workspace.
![Untitled](https://user-images.githubusercontent.com/87822922/179243285-ac50d6f1-3f21-4f84-b0d4-3f00bd8c1011.png)

```
[
{
"internalType": "string",
"name": "_greeting",
"type": "string",
"value": "Hello World!"
}
]
```
As the JSON suggests the value for the input is provided with the `value` field.
![Untitled](https://user-images.githubusercontent.com/87822922/179243288-791e14fd-4336-4ddc-b49e-08418359392e.png)

---

### Select Ethereum Account

- Open command palette `ctrl + shift + P`
- `Select ethereum account` > Select your preferred account

![Untitled](https://user-images.githubusercontent.com/87822922/179243280-36a605e1-9702-4e48-b65d-e62f584ed4ce.png)

![Untitled](https://user-images.githubusercontent.com/87822922/179243282-7f867605-ce7d-484f-96d2-a0b6ad5a3021.png)

---

### Fetch Account Balance

- Open command palette `ctrl + shift + P`
- `Get account balance`

![Untitled](https://user-images.githubusercontent.com/87822922/179243306-0f0b6476-8dd3-4506-8737-f9995798d933.png)

![Untitled](https://user-images.githubusercontent.com/87822922/179243267-02a57374-7d01-40fb-b0a2-55c2cc830c40.png)

---

### Load constructor inpusts
* Command: `ethcode.contract.input.load`
* Description: Load constructor inputs.
### Load All Compiled JSON Output

![Screenshot from 2021-07-01 20-48-35](https://user-images.githubusercontent.com/13261372/124149165-f506e800-daad-11eb-9753-eb1ff58d6ef1.png)
- Open command palette `ctrl + shift + P`
- `Load all compiled JSON output`

### Build transaction
* Command: `ethcode.transaction.build`
* Description: Build raw transaction.
![Untitled](https://user-images.githubusercontent.com/87822922/179243274-a266417b-ad25-483b-83cb-0ed9a83d1c09.png)

![Screenshot from 2021-07-01 20-06-58](https://user-images.githubusercontent.com/13261372/124142793-2bd9ff80-daa8-11eb-8a72-31e6bde86d79.png)
---

### Select one compiled json output

### Deploy contracts.
* Command: `ethcode.account.sign-deploy`
* Description: Deploy transaction to network.
- Open command palette `ctrl + shift + P`
- `Select one compiled JSON output`

![Screenshot from 2021-07-01 20-29-01](https://user-images.githubusercontent.com/13261372/124146369-52e60080-daab-11eb-99ff-acd46cf0d43d.png)
![Untitled](https://user-images.githubusercontent.com/87822922/179243295-cf801c31-bff0-4e8b-9d9f-e01078a7ad86.png)

### Create account
* Command: `ethcode.account.create`
* Description: Create ethereum account. You will be prompted for password. Accounts are created inside ethcode extension directory.
![Untitled](https://user-images.githubusercontent.com/87822922/179243298-595ddcaa-86e9-42d8-9a19-d8c0b8d90e5b.png)

![Screenshot from 2021-07-01 21-00-45](https://user-images.githubusercontent.com/13261372/124150942-aa866b00-daaf-11eb-9d31-db538c140d23.png)
- After selecting compiled `JSON` output

![Screenshot from 2021-07-01 21-00-54](https://user-images.githubusercontent.com/13261372/124150937-a9553e00-daaf-11eb-84ab-51a546ad3742.png)
1. If the contract requires any constructor parameter to be passed then extra 3 files will be created in your `artifacts → contracts → <contract name>` folder

### List accounts
* Command: `ethcode.account.list`
* Description: List ethereum accounts.
`<contract name>_constructor-input.json`

![Screenshot from 2021-07-01 21-21-22](https://user-images.githubusercontent.com/13261372/124153761-66489a00-dab2-11eb-9d17-a8b97468a556.png)
`<contract name>_deployed-address.json`

### Use account
* Command: `ethcode.account.set`
* Description: Choose ethereum account for use.
`<contract name>_functions_input.json`

![Screenshot from 2021-07-01 21-23-05](https://user-images.githubusercontent.com/13261372/124153955-a0b23700-dab2-11eb-955a-9fca6c640a0b.png)
1. If the contract does not require any constructor parameter to be passed extra then 2 files will be created in your `artifacts → contracts → <contract name>` folder.

### Use network
* Command: `ethcode.network.set`
* Description: Choose ethereum network for use.
`<contract name>_deployed-address.json`

![Screenshot from 2021-07-01 21-26-05](https://user-images.githubusercontent.com/13261372/124154347-09011880-dab3-11eb-9e54-eb2952894ef8.png)
`<contract name>_functions_input.json`

----------------------------------------------------------------------------
---

### Deploy a smart contract

- Open command palette `ctrl + shift + P`
- `Deploy a Contract`
- Enter password
- After successful contract deployment, you will get deployed contract address

![contract address.png](https://user-images.githubusercontent.com/87822922/179243300-29128fb5-2c5d-4898-843b-280a942d08a2.png)

- paste this address in `artifacts → contracts → <contract name> → <contract name>_deployed-address.json` file.

---

### Contract call

- Open command palette `ctrl + shift + P`
- `Contract call` All Functions or methods of the contract will be shown in the list
- select preferred method

![call.png](https://user-images.githubusercontent.com/87822922/179247368-0ea2fb12-fcfa-41f3-bfe8-834144648421.png)

#### Note: Before selecting methods you should fill required values of that method in `artifacts → contracts → <contract name> → <contract name>_functions_input.json` file.

## [Vyper](https://vyper.readthedocs.io/) 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

## Help

Please help ethcode developers continue their work.

Ethereum donation address: [0xd22fE4aEFed0A984B1165dc24095728EE7005a36](https://etherscan.io/address/0xd22fE4aEFed0A984B1165dc24095728EE7005a36)

## Development

### Run following commands in the terminal

```shell
yarn install
yarn run build
```

And then press F5, in Extension Development Host session, run `Ethereum: Solidity compile` command from command palette.

### Generate Typescript types for protobuf

```shell
PROTOC_GEN_TS_PATH="./node_modules/.bin/protoc-gen-ts"
OUT_DIR="./ext-src/"
OUT_DIR="./src/"
protoc --plugin="protoc-gen-ts=${PROTOC_GEN_TS_PATH}" --js_out="import_style=commonjs,binary:${OUT_DIR}" --ts_out="${OUT_DIR}" services/ethereum.proto
```

## Packaging

```shell
vsce package --yarn
```

## Publishing
Step 1: Login to https://dev.azure.com/0mkar/ and generate PAT

Step 1: Login to https://dev.azure.com/ and generate PAT for your user or organization

Step 2:

```
vsce login ethential
vsce publish 0.1.4 -p <access token> --yarn
Expand All @@ -139,24 +175,27 @@ git push origin v0.1.4

Things we did on top of Create React App TypeScript template

* We inline `index.html` content in `ext-src/extension.ts` when creating the webview
* We set strict security policy for accessing resources in the webview.
* Only resources in `/build` can be accessed
* Only resources whose scheme is `vscode-resource` can be accessed.
* For all resources we are going to use in the webview, we change their schemes to `vscode-resource`
* Since we only allow local resources, absolute path for styles/images (e.g., `/static/media/logo.svg`) will not work. We add a `.env` file which sets `PUBLIC_URL` to `./` and after bundling, resource urls will be relative.
* We add baseUrl `<base href="${vscode.Uri.file(path.join(this._extensionPath, 'build')).with({ scheme: 'vscode-resource' })}/">` and then all relative paths work.
- We inline `index.html` content in `src/extension.ts` when creating the webview
- We set strict security policy for accessing resources in the webview.
- Only resources in `/build` can be accessed
- Only resources whose scheme is `vscode-resource` can be accessed.
- For all resources we are going to use in the webview, we change their schemes to `vscode-resource`
- Since we only allow local resources, absolute path for styles/images (e.g., `/static/media/logo.svg`) will not work. We add a `.env` file which sets `PUBLIC_URL` to `./` and after bundling, resource urls will be relative.
- We add baseUrl `<base href="${vscode.Uri.file(path.join(this._extensionPath, 'build')).with({ scheme: 'vscode-resource' })}/">` and then all relative paths work.

## Code formatting

Add following lines in vscode `settings.json`

```
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true,
"typescript.format.semicolons": "insert"
```

## References
* 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://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
93 changes: 0 additions & 93 deletions config/env.js

This file was deleted.

14 changes: 0 additions & 14 deletions config/jest/cssTransform.js

This file was deleted.

Loading