hyperledger-labs / solang-playground

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Solang Playground - A Solidity web editor for Hyperledger Solang

Welcome to Solang Playground, a Solidity web editor for that enables editing, compiling, deploying and interacting with Solidity smart contracts on Solana or Polkadot.

Demo

You can experiment with a live demo of the example server integrated with an in-browser editor here:

http://labs.hyperledger.org/solang-playground/

Building

cargo install cargo-make
cargo make deps
cargo make build

Running

cargo make run

By default, the server will be available at http://localhost:9000.

Testing

Solang Playground test suite includes tests for the backend and the frontend. To run all available tests, you have to first start the server with cargo make run in a separate terminal, and then run the following command:

cargo make test

Project Structure

This repository has two main parts:

  • crates: Rust code, including:
    • backend: Actix Web server for the frontend.
    • generate_bindings: Generates TypeScript bindings for API endpoints.
    • solang: Contains the solang-parser
    • browser: Contains the monaco editor web server
  • packages: TypeScript project for the frontend app, served by the Rust backend.

Docker

Pre-requisites

The Dockerfile for Solang Playground relies on Nestybox's Sysbox runtime. This helps compile Solang Smart Contracts within a protected Docker environment. We also use a multi-stage build process to improve image size.

Here are the instructions to install Sysbox

Building the Docker Image Locally

docker build -t solang-playground .

You can then run the image with:

cargo make docker-run

The docker image is also available on Docker Hub:

docker pull tareknaser360/solang-playground-amd64

Roadmap and Status

V0.1

Milestone Related Feature Status
Compile Solang language server to WASM, and integrate it to a Monaco editor. Allow editing Solidity source files in the browser, with smarts provided from the server (Diagnostics, code completion, etc..) Completed
Host Solang on a backend service Allow compiling smart contracts on the web editor Completed
Support Polkadot API Allow the deployment and interaction with Solidity contracts on Polkadot In progress
IDE Improvements Improve developer experience when trying out the IDE, making it a more attractive option for Solidity devs Not started

Acknowledgments

  • This project started out as a fork of https://github.com/silvanshade/tower-lsp-web-demo. Darin Morrison created a demo project where an example tower-lsp language server was compiled to WASM and integrated in a Monaco web editor.
  • The structure of solang-playground is significantly inspired by ink-playground. This includes the implementation of running the Solang compiler functionality in a sandboxed environment.

About

License:Apache License 2.0


Languages

Language:Rust 97.5%Language:TypeScript 2.2%Language:CSS 0.1%Language:JavaScript 0.1%Language:Dockerfile 0.1%Language:HTML 0.0%Language:Solidity 0.0%Language:Shell 0.0%