CardanoVSC is a powerful Visual Studio Code extension that provides seamless support for Haskell and Plutus development. It is designed to enhance developer productivity by offering:
- Advanced syntax highlighting for Haskell and Plutus code.
- Intelligent code completion to speed up development.
- Integration with the Cardano API for real-time blockchain interaction.
- An intuitive "Ctrl + Shift + P >> CardanoAPI" feature allowing developers to quickly access Cardano API options directly from the IDE.
This extension is perfect for developers building on the Cardano blockchain, enabling smooth and efficient smart contract development within the Visual Studio Code ecosystem.
- Clone the repository:
git clone https://github.com/AIQUANT-Tech/CardanoVSC.git cd CardanoVSC/cardanovsc/
- Install dependencies:
npm install
- Debug the extension by clicking the VS Code debug icon.
Before running the test command, ensure the required test file exists:
Create a folder out/test/
if it does not exist and add the following file sample.hs
:
module Sample where
import Data.List
factorial :: Integer -> Integer
factorial 0 = 1
factorial n = n * factorial (n - 1)
main :: IO ()
main = print (factorial 5)
Create a .env file on working directory and put your API key from cardanoscan
CARDANO_API_KEY=your_api_key_here
To run tests:
npm run test
πCardanoVSC
βββ πcardanovsc
βββ .gitignore
βββ π.vscode
βββ .vscode-test.mjs
βββ extensions.json
βββ haskell.code-snippets
βββ launch.json
βββ settings.json
βββ tasks.json
βββ .vscodeignore
βββ cabal-configuration.json
βββ cardanovsc-0.0.12.vsix
βββ CHANGELOG.md
βββ πdocs
βββ api_integration.png
βββ auto_completion.gif
βββ auto_completion.png
βββ cardanovsc_command.gif
βββ cardanovsc_command.png
βββ cardanovsc_create_wallet.gif
βββ cardanovsc_deployment.gif
βββ cardanovsc_node_connection.gif
βββ cardanovsc_restore_webview.png
βββ cardanovsc_sidebar_webview.png
βββ cardanovsc_wellet_webview.png
βββ cardanovsc01_sidebar_webview.png
βββ syntax_highlight.png
βββ eslint.config.mjs
βββ haskell-configuration.json
βββ License
βββ πmedia
βββ icon1.png
βββ icon1.svg
βββ package-lock.json
βββ package.json
βββ README.md
βββ πsnippets
βββ haskell.json
βββ πsrc
βββ completion.ts
βββ πconfig
βββ cardanoApiIntegration.ts
βββ cardanoNodeIntegration.ts
βββ extension.ts
βββ πimplementation
βββ deployment.ts
βββ implementation.ts
βββ registerCommand.ts
βββ πtest
βββ api_integration.test.ts
βββ extension.test.ts
βββ h_completion.test.ts
βββ s_highlight.test.ts
βββ πwebview_ui
βββ wallet_webview.ts
βββ webviewProvider.ts
βββ πsyntaxes
βββ alex.tmLanguage.json
βββ C2Hs.json
βββ cabal.tmLanguage.json
βββ happy.tmLanguage.json
βββ haskell.tmLanguage.json
βββ Hsc2Hs.json
βββ literateHaskell.tmLanguage.json
βββ plutus.tmLanguage.json
βββ tsconfig.json
βββ vsc-extension-quickstart.md
βββ πDesignDocs
βββ CardanoVSC-Scope_Design_Document.pdf
βββ Postman_CardanoVSC_CardanoscanAPI.json
βββ .gitignore
βββ LICENSE
βββ README.md
The Webview in CardanoVSC provides a dedicated sidebar interface within Visual Studio Code, offering a centralized hub for blockchain api interactions , development tools.
CardanoVSC provides several commands to interact with the Cardano blockchain:
cardanovsc.get_latest_block_details
- Get details of the latest block.cardanovsc.get_block_details
- Fetch details of a specific block.cardanovsc.get_address_balance
- Retrieve balance for a given address.cardanovsc.get_pool_details
- Fetch details about a stake pool.cardanovsc.get_transaction_details
- Retrieve information about a transaction.
To access these commands, open the Command Palette (Ctrl+Shift+P
), type CardanoVSC
, and select the desired command.
CardanoVSC integrates with Cardano APIs using cardanoscan API keys. CardanoVSC integrates with the Cardano API to provide real-time blockchain interaction directly within the IDE. Developers can fetch blockchain data, such as block details, transaction information, and wallet balances, without leaving Visual Studio Code. The API integration is powered by Cardanoscan API keys, ensuring secure and efficient access to Cardano blockchain data.
The Auto Completion feature in CardanoVSC enhances developer productivity by providing intelligent code suggestions as you type. It supports Haskell and Plutus syntax, offering context-aware recommendations for functions, variables, and modules. This feature reduces errors and speeds up coding by predicting and completing code snippets, making it easier to write complex smart contracts and blockchain-related logic.
The Syntax Highlighting feature improves code readability by visually distinguishing different elements of Haskell and Plutus code. Keywords, functions, variables, and operators are color-coded, making it easier to identify and debug code. This feature is particularly useful for developers working on complex smart contracts, as it helps maintain clarity and structure in the codebase.
Before using wallet management and smart contract deployment, you need to connect to a Cardano node on the Mainnet, Preprod, or Preview network.
- Open the CardanoVSC sidebar (click the Cardano icon in the Activity Bar).
- Click Cardano Node Connection.
- A prompt will appear to select the network (Mainnet, Preprod, or Preview).
- Another prompt will appear asking for the BlockFrost API key for the selected network.
- Enter the API key in the input box and press
Enter
. - The selected network will be reflected on the right side of the status bar, like this:
π Cardano Node: Preprod (or Mainnet/Preview) - After a successful connection, reload the VSCode window.
-
Ensure a Cardano network is configured:
- If no network is detected, the extension will prompt you to configure one.
- Follow the on-screen instructions to set up the network.
-
Select a Plutus Smart Contract file:
- Click on the Deploy Smart Contract option.
- A file selection dialog will open.
- Choose a
.plutus
file containing your contract. - example
.plutus
file content
{ "type": "PlutusScriptV2", "description": "", "cborHex": "49480100002221200101" } ```
-
Initialize Lucid with network configuration:
- The extension will retrieve network details from your configuration.
- Lucid (a JavaScript library for Cardano smart contract interactions) will be initialized.
-
Generate the script address:
- The extension extracts the CBOR hex from the Plutus script.
- It then computes the associated script address.
-
Confirm overwriting existing address files:
- If an address file already exists, the extension prompts you for confirmation before overwriting.
-
Save the generated address:
- The script address is saved to an
.addr
file in the same location as the.plutus
script. - A success message is displayed with the file location and script address .
- The script address is saved to an
- Open Folder: View the location of the saved
.addr
file. - Copy Address: Copy the generated script address to the clipboard for easy sharing.
- No network configured? Follow the prompt to set up a network connection.
- Invalid Plutus script? Ensure the
.plutus
file contains a validcborHex
field. - Address file already exists? Choose whether to overwrite the file or cancel the operation.
- Errors during deployment? Check the error messages and logs in the VSCode output panel.
CardanoVSC allows you to manage your Cardano wallets directly within VS Code. You can create, restore, and check balances securely while ensuring encrypted storage and password protection.
- Open the CardanoVSC sidebar (click the Cardano icon in the Activity Bar).
- Click Wallet Management
- Select your network from the dropdown (Mainnet/Testnet) and also from the status bar
[cardano:network-name]
button, which displays the selected network. - Click Create Wallet and before creating wallet must open any folder otherwise not create wallet.
- Set a strong password (minimum 12 characters recommended).
- Securely store your 24-word recovery phrase (displayed during setup).
- Click "I've Saved My Seed Phrase" to complete the setup.
- Wallet details are stored in the working directory inside the
wallet_details/
folder.
- Open Wallet Management from the sidebar.
- Select your network from the dropdown (Mainnet/Testnet) and also from the status bar
[cardano:network-name]
button, which displays the selected network. - Click Restore Wallet.
- Enter your 24-word seed phrase using one of the following methods:
- Paste the entire phrase (click "Paste Seed Phrase").
- copy seed phrase in the format --
word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12 word13 word14 word15 word16 word17 word18 word19 word20 word21 word22 word23 word24
- copy seed phrase in the format --
- Manually type each word in the numbered fields.
- Paste the entire phrase (click "Paste Seed Phrase").
- Click Restore Walletand before restoring wallet must open any folder otherwise not restoring wallet.
- Enter your wallet password when prompted.
- After successful, Wallet details are stored in the working directory inside the
wallet_details/
folder.
- Open Wallet Management.
- Select the correct network (Mainnet/Testnet).
- Click Check Balance.
- promt for asking address of wallet of that network in which you connected (network show at right corner in status bar of vscode)
- View your balance in the vscode Notification message.
β
AES-256 Encryption β Wallets are encrypted before storage.
β
Secure Storage β Wallets are saved under wallet_details/[network]/[wallet-address].json
.
Your wallet files are stored in vscode workspace after successful creating or restoring wallet
workspace/
βββ wallet_details/
βββ mainnet/
β βββ addr1q9...xyz.json
β βββ addr1q8...abc.json
βββ preview/
β βββ addr_test1...def.json
βββ preprod/
βββ addr_test1...def.json
Each .json
file contains:
{
"address": "addr1...",
"network": "mainnet",
"encryptedSeed": "salt:iv:encryptedData",
"createdAt": "2023-01-01T00:00:00.000Z"
}
π¨ Never share your recovery phrase β Anyone with these words can access your funds.
π¨ Backup your wallet files β Keep copies of .json
files in a secure location.
π¨ Use Testnet for development β Always test with Testnet ADA before using Mainnet.
If you encounter issues:
- Ensure you're on the correct network (Mainnet/Testnet).
- Double-check that all 24 words are entered correctly when restoring.
- Make sure your workspace folder has write permissions.
Contributions are welcome! Please open an issue or pull request on GitHub.
This project is licensed under the MIT License.
- Scope and Design Document: https://github.com/AIQUANT-Tech/CardanoVSC/blob/main/DesignDocs/CardanoVSC-Scope_Design_Document.pdf
- Figma Design: https://www.figma.com/design/MiVmXAtePUc3UndaGl7eGK