Skip to main content

Develop with soroban more efficiently

Project description

About

Sorodev is a CLI tool and Python package which allows to develop with Soroban more efficiently.

It is designed for Linux systems (Debian, WSL, ...)

Why?

While soroban-cli is like a Swiss knife to interact with Soroban, it also requires many arguments and parameters to specify the context, such as the current network being used, the last deployment addresses, ...

Similarly, Rust is a generic and customizable language, which requires to replicate the same patterns for each contract.

The idea behind sorodev is to provide the setup to get started with a development on Soroban and to bring some tools on top of soroban-cli.

For example:

  • create new Soroban projects and contracts (create default Cargo.toml, lib.rs, test.rs)
  • use a sorodev.json to configure the current parameters
  • build, test, deploy, invoke contracts, or make contract bindings with simple commands

To sum up, Sorodev indends to make it easier for anyone to start developping on Soroban and to enable a more efficient development experience.

However, it's recommended to understand both the Soroban development setup and how Sorodev works.

Getting started

Installation

Install Soroban

Install Rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Install the WebAssembly compilation target

rustup target add wasm32-unknown-unknown

Install soroban-cli

cargo install soroban-cli

Install Sorodev

pip install sorodev

Standalone project

mkdir example
cd example

sorodev install
sorodev add-contract hello_soroban
sorodev add-account alice
sorodev build
sorodev test
sorodev deploy hello_soroban
sorodev invoke hello_soroban hello --args "--to Sorodev"

Create an Astro project

npm create astro@4.0.1 example_astro --\
	--template basics\
	--install\
	--no-git\
	--typescript strictest

cd example_astro

sorodev install
sorodev add-contract hello_soroban
sorodev add-account alice
sorodev build
sorodev deploy hello_soroban
sorodev make-binding hello_soroban

In pages/index.astro, add the following lines:

---
import Layout from "../layouts/Layout.astro";
import Card from "../components/Card.astro";

+ import { Contract, networks } from "hello_soroban-client";

+ const greeter = new Contract({
+   ...networks.testnet,
+   rpcUrl: "https://soroban-testnet.stellar.org",
+ });
+ 
+ const { result } = await greeter.hello({ to: "Sorodev" });
---
- <h1>Welcome to <span class="text-gradient">Astro</span></h1>
+ <h1><span class="text-gradient">{result.join(" ")}</span></h1>

In the package.json, add the following script:

"scripts": {
    ...
    "postinstall": "sorodev build && sorodev deploy hello_soroban && sorodev make-binding hello_soroban"
}

Then run:

npm i
npm run dev

Then open http://localhost:4321/, you should see Hello Sorodev.

Create a Next.js project

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sorodev-0.0.2.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

sorodev-0.0.2-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file sorodev-0.0.2.tar.gz.

File metadata

  • Download URL: sorodev-0.0.2.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for sorodev-0.0.2.tar.gz
Algorithm Hash digest
SHA256 68a67a6037e2374f1c9f9412bcfc32f0178207e0cb74795f4fa190a70deba315
MD5 6da31ac66d847a0f1222547dde605e05
BLAKE2b-256 c9742a516a862506ca6cf8914ab3b78a02a8dc3acb9116e6fc54dc833afac006

See more details on using hashes here.

File details

Details for the file sorodev-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: sorodev-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for sorodev-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5a72cc423589265564df82b031c106b7b1694e31175f5b2afb705e011bd06374
MD5 7677c666abd831357690ac30713f9880
BLAKE2b-256 cb6324aaf0f04406a22da032eb0e2bf582d88df9c4f2fd55a010c17493a42dce

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page