https://github.com/acuarica/vscode-ethers
Ethers Mode allows you to explore and call Smart Contracts methods using Ethers.js and view the response directly in VS Code. It interacts with any EVM-compatible blockchain, e.g., Ethereum, Polygon, Avalanche, etc.
https://github.com/acuarica/vscode-ethers
address avalanche blockchain bytecode ethereum ethers evm polygon repl smart-contracts solidity web3
Last synced: 6 months ago
JSON representation
Ethers Mode allows you to explore and call Smart Contracts methods using Ethers.js and view the response directly in VS Code. It interacts with any EVM-compatible blockchain, e.g., Ethereum, Polygon, Avalanche, etc.
- Host: GitHub
- URL: https://github.com/acuarica/vscode-ethers
- Owner: acuarica
- License: mit
- Created: 2022-04-13T10:49:27.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-18T02:58:16.000Z (over 2 years ago)
- Last Synced: 2024-04-29T01:16:14.620Z (about 2 years ago)
- Topics: address, avalanche, blockchain, bytecode, ethereum, ethers, evm, polygon, repl, smart-contracts, solidity, web3
- Language: TypeScript
- Homepage: https://marketplace.visualstudio.com/items?itemName=acuarica.ethers-mode
- Size: 14.5 MB
- Stars: 14
- Watchers: 5
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# VS Code Ethers Mode
[](https://marketplace.visualstudio.com/items?itemName=acuarica.ethers-mode)
[](https://marketplace.visualstudio.com/items?itemName=acuarica.ethers-mode)
[](https://marketplace.visualstudio.com/items?itemName=acuarica.ethers-mode)
[](https://marketplace.visualstudio.com/items?itemName=acuarica.ethers-mode)
[](https://github.com/acuarica/vscode-ethers/actions)
Ethers Mode allows you to explore and call Smart Contracts methods using [Ethers.js](https://docs.ethers.io/v5/) and view the response directly in VS Code.
It interacts with any EVM-compatible blockchain, _e.g._, Ethereum, Polygon, Avalanche, _etc_.
It uses VS CodeLens to display contextual information about Contracts, Externally Owned Accounts and networks.

## Main Features
- Call Smart Contract method by writing its [Human-Readable ABI Signature](https://blog.ricmoo.com/human-readable-contract-abis-in-ethers-js-141902f4d917)
- Detect contract or EOA address and provide its balance
- Call multiple Smart Contract methods in a single file
- Send method arguments and autodetect argument types
- View return value as a notification (**CHANGE**)
- Provide network info
- Select multiple network in a single file networks (using `net `)
- Error reporting as you type
- Alias definitions with `as` and `this`
- Send and sign transactions using private keys
- Ether CashFlow report for block ranges and block contextual information
- `Ethers` language support
- `.ethers` and `.web3` file extensions
- Syntax highlight of Human-Readable ABI Signatures if Solidity extension is installed
- TODO Auto completion for method, url, header, custom/system variables, mime types and so on
- Comments (line starts with `#`) support
- Code snippets for several ERCs
- TODO Support navigate to symbol definitions(request and file level custom variable) in open `http` file
- CodeLens support to add an actionable link to call method
- CHECK Fold/Unfold for request block
And more
- Auto detect language mode using `net` declaration
## Usage
In a new editor, select a network, followed by a contract address and a method call
```ethers
net fuji
0x5425890298aed601595a70AB815c96711a31Bc65
name() view returns (string)
```
Once you prepared a Smart Contract method call,
click the `Call Smart Contract Method` link above the call
(this will appear if the file's language is `Ethers`, by default `.ethers` and `.web3` files are like this).
## Features
### Aliases
You can define aliases using the `as` keyword.
These aliases can be used to reference the aliased address within another address.
Moreover, you can use the `this` reference to use the address in the current scope.

### Hovers & Decompile
Provide connection info and decompilation of smart contracts.

### Sending and Signing Transactions
To send and sign transactions,
you can provide a private key for an account.
The address will be displayed as a code lens.

### Display inferred types
When you omit the type of an argument, it will display an inlay with the inferred type.

### Blocks and Ether CashFlow
Allows you display single block or block range information by proving a contextual hover.
Moreover, you can calculate the Ether CashFlow of the entire block range.
Use `-` as a block number separator to denote a block range.

### Snippets
When you know that a contract implements a specific ERC,
you can use snippets to insert its methods.
The errors are caused because on methods that require sending a transaction without specifying a signer.

### Error Reporting
Whenever there is a syntax error or the method call is inconsistent, _e.g._, trying to send a transaction without a signer, the extension will show provide diagnostics about them.

### Language Auto Detection
Just write `net ` at the beginning of the file and select
`Change Language Mode -> Auto Detect`.

### a
```ethers
sdsd
net sdsd
net
```
## Contributing
- Execute `yarn install` in terminal to install dependencies
- Execute the `Run Extension` target in the Debug View.
This will:
- Start a task `npm: watch` to compile the code
- Run the extension in a new VS Code window
### Typechecking and Building
To typecheck the extension using `tsc`, run
```sh
yarn compile
```
To build and package the extension we use the `esbuild` bundler.
To bundle the extension into `dist/main.js`, run
```sh
yarn build
```
### Unit Testing
Unit tests can be found under the `test` folder.
Our test suite uses `mocha` to run the tests.
```sh
yarn test
```
### VS Code Testing
**TODO!**
### VS Code API Overview
### `languages` module
The extension uses [`languages.registerCodeLensProvider`](https://code.visualstudio.com/api/references/vscode-api#languages.registerCodeLensProvider)
to register the `CodeLensProvider`.