VS Code Ethers Mode
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.
It uses VS CodeLens to display contextual information about Contracts, Externally Owned Accounts and networks.
- Call Smart Contract method by writing its Human-Readable ABI Signature
- 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 <network name | RPC URL>)
- Error reporting as you type
- Alias definitions with
- Send and sign transactions using private keys
- Ether CashFlow report for block ranges and block contextual information
Ethers language support
.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
- Code snippets for several ERCs
- TODO Support navigate to symbol definitions(request and file level custom variable) in open
- CodeLens support to add an actionable link to call method
- CHECK Fold/Unfold for request block
- Auto detect language mode using
In a new editor, select a network, followed by a contract address and a method call
name() view returns (string)
Once you prepared a Smart Contract method call,
Call Smart Contract Method link above the call
(this will appear if the file's language is
Ethers, by default
.web3 files are like this).
You can define aliases using the
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.
- as a block number separator to denote a block range.
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.
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
net <provider> at the beginning of the file and select
Change Language Mode -> Auto Detect.
yarn install in terminal to install dependencies
- Execute the
Run Extension target in the Debug View.
- 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
To build and package the extension we use the
To bundle the extension into
Unit tests can be found under the
Our test suite uses
mocha to run the tests.
VS Code Testing
VS Code API Overview
The extension uses
to register the