KleverChain IDE for Visual Studio Code
What is it?
KleverChain IDE is an extension for Visual Studio Code that offers development support for KleverChain Smart Contracts written in Rust.
Main features
- Build Smart Contracts to WASM
- Step-by-step debugging Rust smart contracts
- Automatically download tools and dependencies
How to get it
KleverChain IDE can be installed from the Visual Studio Code Marketplace.
Requirements and dependencies
Operating system
- Linux is supported
- MacOS is supported
- Windows not officially supported
Other dependencies
The main required dependency is the RUST
buildchain, which is essential for building and managing your smart contract projects. For the KleverChain IDE, it is required to have the RUST buildchain installed on the nightly version. The nightly version includes the latest features and improvements that are necessary for developing KleverChain Smart Contracts.
Installing the RUST buildchain
To install the RUST buildchain and set it up on the nightly version, follow these steps based on your operating system:
Windows:
- Download and run the installer from here to install
rustup
, which is the Rust toolchain installer.
- After installation, open a command prompt and execute the following command to switch to the nightly version:
rustup default nightly-2024-06-12
This command sets the Rust version to nightly globally on your system.
MacOS and Linux:
- Open a terminal and execute the command below to install
rustup
:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Once
rustup
is installed, switch to the nightly version of Rust by running:
rustup default nightly-2024-06-12
This will ensure you are using the nightly toolchain for all Rust projects unless specified otherwise.
Why the nightly version?
Using the nightly version of Rust allows access to the most current Rust features and optimizations. Some features required by KleverChain Smart Contracts are only available in the nightly Rust channel. It is crucial for developers to be on this version to ensure compatibility and leverage the latest advancements in the Rust ecosystem.
If you experience any issues during the installation or while setting Rust to the nightly version, please let us know on Github, on Slack, or on the Forum.
ksc is the backend of the Visual Studio Code extension. ksc is required by the KleverChain IDE. In order to install it, please follow these steps. The extension, via ksc
, will automatically download its external dependencies, so you do not have to worry much about setting up the development environment. These automatically installed dependencies include:
Klever Operator
buildchain
VM Tools
(e.g. tests / scenarios framework)
Extension Commands
This extension contributes the following commands (Ctrl+Shift+P
):
newFromTemplate
buildContract
deployContract
invokeContract
upgradeContract
cleanContract
runScenarios
Configuring VSCode Settings for KleverChain IDE
To tailor the KleverChain IDE extension to your development needs, you can configure several settings within your VSCode user settings. These settings allow you to specify paths to essential tools and resources, set the default KleverNode URL, and more. Below are the available settings along with their default values:
Available Settings
kleverchain.sdkPath
: Specifies the path to the Klever SDK. This is where your SDK tools and dependencies are located.
kleverchain.kleverNode
: Sets the URL of the KleverNode you wish to connect to. This is crucial for deploying and testing your smart contracts.
- Default:
https://node.devnet.klever.finance
kleverchain.keyFile
: Defines the path to your wallet key file. This file is necessary for signing transactions and deploying contracts.
- Default:
~/klever-sdk/walletKey.pem
kleverchain.address
: Your wallet address. This is used within the IDE to identify you and interact with the KleverChain network.
- Default:
""
(empty string, meaning you need to set this to your wallet address)
To customize these settings for your development environment, follow these steps:
- Open VSCode.
- Go to
File > Preferences > Settings
(or Code > Preferences > Settings
on Mac).
- In the search bar at the top, type
kleverchain
to filter out the settings related to the KleverChain IDE.
- You will see the settings listed above. Click on the edit icon next to each setting you wish to change and enter your desired value.
By configuring these settings, you can ensure that the KleverChain IDE extension works seamlessly with your development setup and preferences. If you need further assistance or have suggestions for additional settings, please reach out to us on Github, on Slack, or on the Forum.
Contributors
How to publish an update of the extension
- Within a PR, bump the version in
package.json
and package-lock.json
.
- Open and merge the PR against the
main
(master
) branch.
- Trigger the Github Workflow called
Release
. This will also publish the extension on the Visual Studio Marketplace.